增加成员任务、项目查看

Signed-off-by: vilson <545522390@qq.com>
This commit is contained in:
vilson 2019-01-24 10:44:49 +08:00
parent 5c1ead0291
commit 62b4ab889d
3 changed files with 20 additions and 5 deletions

View File

@ -397,7 +397,11 @@ class Task extends CommonModel
$offset = ($page - 1) * $page;
$limit = $pageSize;
$prefix = config('database.prefix');
$sql = "select *,t.id as id,t.name as name,t.code as code from {$prefix}task as t join {$prefix}project as p on t.project_code = p.code where t.done = {$done} and t.deleted = 0 and t.assign_to = '{$memberCode}' and p.deleted = 0 order by t.id desc";
$doneSql = '';
if ($done != -1) {
$doneSql = " and t.done = {$done}";
}
$sql = "select *,t.id as id,t.name as name,t.code as code 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";
$total = Db::query($sql);
$total = count($total);
$sql .= " limit {$offset},{$limit}";

View File

@ -103,7 +103,7 @@ class Project extends BasicApi
}
/**
* 获取自己的任务
* 获取自己的项目
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
@ -111,7 +111,12 @@ class Project extends BasicApi
public function selfList()
{
$type = Request::post('type');
$member = getCurrentMember();
$memberCode = Request::post('memberCode', '');
if (!$memberCode) {
$member = getCurrentMember();
} else {
$member = Member::where(['code' => $memberCode])->find();
}
$deleted = 1;
if (!$type) {
$deleted = 0;

View File

@ -81,12 +81,18 @@ class Task extends BasicApi
*/
public function selfList()
{
$type = Request::post('type');
$member = getCurrentMember();
$type = Request::post('type', 0);
$memberCode = Request::post('memberCode', '');
if (!$memberCode) {
$member = getCurrentMember();
} else {
$member = Member::where(['code' => $memberCode])->find();
}
$done = 1;
if (!$type) {
$done = 0;
}
$type == -1 && $done = $type;
$list = $this->model->getMemberTasks($member['code'], $done, Request::post('page'), Request::post('pageSize'));
if ($list['list']) {
foreach ($list['list'] as &$task) {