Merge pull request #15 from a54552239/dev

2.8.13
This commit is contained in:
vilson 2020-03-06 12:09:51 +08:00 committed by GitHub
commit 82c57c119c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 63 additions and 14 deletions

View File

@ -146,6 +146,12 @@ class DepartmentMember extends CommonModel
}
} else {
$memberAccount = MemberAccount::where(['member_code' => $member['code'], 'organization_code' => $organizationCode])->find();
if (!$memberAccount) {
$memberAccount = MemberAccount::inviteMember($member['code'], $organizationCode, $position, $mobile, '', $description);
if (!isError($memberAccount)) {
$count++;
}
}
}
if ($departments) {
$departmentList = explode(';', $departments);
@ -168,6 +174,8 @@ class DepartmentMember extends CommonModel
} catch (Exception $e) {
return error(2, $e->getMessage());
}
}else{
}
}
}

View File

@ -19,7 +19,7 @@ use think\facade\Hook;
*/
class Task extends CommonModel
{
protected $append = ['priText', 'liked', 'stared', 'tags', 'childCount', 'hasUnDone', 'parentDone', 'hasComment', 'hasSource', 'canRead'];
protected $append = ['priText','statusText', 'liked', 'stared', 'tags', 'childCount', 'hasUnDone', 'parentDone', 'hasComment', 'hasSource', 'canRead'];
public function read($code)
{
@ -112,6 +112,9 @@ class Task extends CommonModel
if (isset($data['pri'])) {
$type = 'pri';
}
if (isset($data['status'])) {
$type = 'status';
}
if (isset($data['begin_time'])) {
$type = 'setBeginTime';
if (!$data['begin_time']) {
@ -481,7 +484,16 @@ class Task extends CommonModel
return false;
}
public function getMemberTasks($memberCode = '', $done = 0, $page = 1, $pageSize = 10)
/**
* 成员任务
* @param string $memberCode
* @param int $done
* @param int $taskType 搜索类型 1-我执行的 2-我参与的 3-我创建的
* @param int $page
* @param int $pageSize
* @return array
*/
public function getMemberTasks($memberCode = '', $done = 0, $taskType = 1, $page = 1, $pageSize = 10)
{
if (!$memberCode) {
$memberCode = getCurrentMember()['code'];
@ -489,14 +501,25 @@ class Task extends CommonModel
if ($page < 1) {
$page = 1;
}
$offset = ($page - 1) * $page;
$offset = ($page - 1) * $pageSize;
$limit = $pageSize;
$prefix = config('database.prefix');
$doneSql = '';
if ($done != -1) {
$doneSql = " and t.done = {$done}";
}
$sql = "select *,t.id as id,t.name as name,t.code as code,t.create_time as create_time,t.end_time,t.begin_time from {$prefix}task as t join {$prefix}project as p on t.project_code = p.code where t.deleted = 0 {$doneSql} and t.assign_to = '{$memberCode}' and p.deleted = 0 order by t.id desc";
//我执行的
if ($taskType == 1) {
$sql = "select *,t.id as id,t.name as name,t.code as code,t.create_time as create_time,t.end_time,t.begin_time from {$prefix}task as t join {$prefix}project as p on t.project_code = p.code where t.deleted = 0 {$doneSql} and t.assign_to = '{$memberCode}' and p.deleted = 0 order by t.id desc";
}
//我参与的
if ($taskType == 2) {
$sql = "select *,t.id as id,t.name as name,t.code as code,t.create_time as create_time,t.end_time,t.begin_time from {$prefix}task as t join {$prefix}project as p on t.project_code = p.code left join {$prefix}task_member as tm on tm.task_code = t.code where t.deleted = 0 {$doneSql} and tm.member_code = '{$memberCode}' and p.deleted = 0 order by t.id desc";
}
//我创建的
if ($taskType == 3) {
$sql = "select *,t.id as id,t.name as name,t.code as code,t.create_time as create_time,t.end_time,t.begin_time from {$prefix}task as t join {$prefix}project as p on t.project_code = p.code where t.deleted = 0 {$doneSql} and t.create_by = '{$memberCode}' and p.deleted = 0 order by t.id desc";
}
$total = Db::query($sql);
$total = count($total);
$sql .= " limit {$offset},{$limit}";
@ -700,6 +723,14 @@ class Task extends CommonModel
$status = [0 => '普通', 1 => '紧急', 2 => '非常紧急'];
return $status[$data['pri']];
}
public function getStatusTextAttr($value, $data)
{
if (!isset($data['status'])) {
$data['status'] = 0;
}
$status = [0 => '未开始', 1 => '已完成', 2 => '进行中', 3 => '挂起', 4 => '测试中'];
return $status[$data['status']];
}
/**
* 标签

View File

@ -34,7 +34,7 @@ class TaskStages extends CommonModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function tasks($stageCode, $deleted = 0, $done = -1, $title = '', $pri = [], $executor = [], $creator = [], $joiner = [], $endTime = [], $beginTime = [], $createTime = [], $doneTime = [])
public function tasks($stageCode, $deleted = 0, $done = -1, $title = '', $pri = [], $executor = [], $creator = [], $joiner = [], $status = [], $endTime = [], $beginTime = [], $createTime = [], $doneTime = [])
{
$where = ['pcode' => '', 'deleted' => $deleted];
if ($done != -1) {
@ -43,7 +43,7 @@ class TaskStages extends CommonModel
$taskModel = Task::alias('t')->where($where);
if (is_array($stageCode)) {
$taskModel = $taskModel->whereIn('t.stage_code', $stageCode);
}else{
} else {
$taskModel = $taskModel->where('t.stage_code', $stageCode);
}
if ($title) {
@ -52,6 +52,9 @@ class TaskStages extends CommonModel
if ($pri) {
$taskModel = $taskModel->whereIn('t.pri', $pri);
}
if ($status) {
$taskModel = $taskModel->whereIn('t.status', $status);
}
if ($endTime) {
$taskModel = $taskModel->whereBetween('t.end_time', implode(',', $endTime));
}
@ -62,7 +65,7 @@ class TaskStages extends CommonModel
$taskModel = $taskModel->whereBetween('t.create_time', implode(',', $createTime));
}
if ($doneTime) {
$taskModel = $taskModel->leftJoin('project_log pl', 't.code = pl.source_code')->where(['pl.action_type'=> 'task', 'pl.type' => 'done'])->whereBetween('pl.create_time', $doneTime);
$taskModel = $taskModel->leftJoin('project_log pl', 't.code = pl.source_code')->where(['pl.action_type' => 'task', 'pl.type' => 'done'])->whereBetween('pl.create_time', $doneTime);
}
//todo 查询范围问题
$joinTaskMember = false;

View File

@ -16,7 +16,6 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\exception\DbException;
use think\facade\Log;
use think\facade\Request;
use think\response\Redirect;

View File

@ -118,6 +118,10 @@ class Task
$icon = 'user';
$remark = '更新任务优先级为 ' . $task['priText'];
break;
case 'status':
$icon = 'deployment-unit';
$remark = '修改执行状态为 ' . $task['statusText'];
break;
case 'removeExecutor':
$icon = 'user-delete';
$remark = '移除了执行者 ';

View File

@ -77,6 +77,7 @@ class Task extends BasicApi
*/
public function selfList()
{
$taskType = Request::post('taskType', 1);
$type = Request::post('type', 0);
$memberCode = Request::post('memberCode', '');
if (!$memberCode) {
@ -89,9 +90,11 @@ class Task extends BasicApi
$done = 0;
}
$type == -1 && $done = $type;
$list = $this->model->getMemberTasks($member['code'], $done, Request::post('page'), Request::post('pageSize'));
$list = $this->model->getMemberTasks($member['code'], $done, $taskType, Request::post('page'), Request::post('pageSize'));
$status = [0 => '普通', 1 => '紧急', 2 => '非常紧急'];
if ($list['list']) {
foreach ($list['list'] as &$task) {
$task['priText'] = $status[$task['pri']];
$task['executor'] = Member::where(['code' => $task['assign_to']])->field('name,avatar')->find();
$task['projectInfo'] = \app\common\Model\Project::where(['code' => $task['project_code']])->field('name,code')->find();
}
@ -291,7 +294,7 @@ class Task extends BasicApi
*/
public function edit(Request $request)
{
$data = $request::only('name,sort,end_time,begin_time,pri,description,work_time');
$data = $request::only('name,sort,end_time,begin_time,pri,description,work_time,status');
$code = $request::post('taskCode');
if (!$code) {
$this->error("请选择一个任务");

View File

@ -69,6 +69,7 @@ class TaskStages extends BasicApi
$done = Request::param('done', -1);
$title = Request::param('title', '');
$pri = json_decode(Request::post('pri', ''));
$status = json_decode(Request::post('status', ''));
$stage = json_decode(Request::post('stage', ''));
$executor = json_decode(Request::post('executor', ''));
$creator = json_decode(Request::post('creator', ''));
@ -81,7 +82,7 @@ class TaskStages extends BasicApi
$this->error("数据解析异常");
}
$where[] = ['stage_code', '=', $code];
$list = $this->model->tasks($code, 0, $done, $title, $pri, $executor, $creator, $joiner, $endTime, $beginTime, $createTime, $doneTime);
$list = $this->model->tasks($code, 0, $done, $title, $pri, $executor, $creator, $joiner, $status, $endTime, $beginTime, $createTime, $doneTime);
// $list = \app\common\Model\Task::alias('t')->join('member m','t.assign_to = m.code')->field()->where(['stage_code'=>$code])->select();
$this->success('', $list);

View File

@ -28,7 +28,7 @@
"phpoffice/phpspreadsheet": "^1.5",
"firebase/php-jwt": "^5.0",
"phpmailer/phpmailer": "^6.0",
"mingyoung/dingtalk": "2.0",
"mingyoung/dingtalk": "^2.3.0",
"zoujingli/ip2region": "^1.0"
},
"autoload": {

View File

@ -6,7 +6,7 @@ return [
// 应用名称
'app_name' => 'pearProject',
// 应用版本
'app_version' => '2.8.12',
'app_version' => '2.8.13',
// 应用地址
'app_host' => '',
// 应用调试模式

View File

@ -124,7 +124,7 @@ class Redis implements SessionHandlerInterface
*/
public function destroy($sessID)
{
return $this->handler->delete($this->config['session_name'] . $sessID) > 0;
return $this->handler->del($this->config['session_name'] . $sessID) > 0;
}
/**