Commit c9e6154e authored by wangzhengwen's avatar wangzhengwen

update

parent c3b1b8e1
......@@ -92,7 +92,21 @@ class Index extends BaseController
// 1. 查询项目列表
$projects = \app\model\Project::where('user_id', $userId)
->where('status', 'in', [0, 1, 3])
->field(['id', 'title', 'status', 'tag_ids'])
->withCount(['put'])
->field([
'id',
'title',
'status',
'tag_ids',
'sh_status_time',
'zhouqi',
// 当 status=3 时,计算截止日期(sh_status_time + zhouqi * 86400)
'IF(
status=3 AND sh_status_time IS NOT NULL AND zhouqi IS NOT NULL,
FROM_UNIXTIME(sh_status_time + zhouqi * 86460),
NULL
) as deadline_date',
])
->paginate([
'page' => $page, // 当前页数
'list_rows' => $pageSize, // 每页数量
......
......@@ -127,13 +127,22 @@ class Project extends BaseController
$pageSize = $request->param('pageSize/d', 10);
$where = ['project_id' => $data['project_id']];
//如果当前项目已确定接单人 只查询接单人的申请记录
$put_user = ProjectPut::where('project_id', $request->param('project_id'))
->where('status',2)
->value('user_id');
if ($put_user)
{
$where['user_id'] = $put_user;
}
$query = ProjectPut::with(['getuserdata'])
->where($where);
$order_status = ProjectModel::where('id', $request->param('project_id'))->value('status');
if ($order_status >= 2) {
$query->where(['status' => 2]);
}
if (!empty($data['search_str'])) {
......
......@@ -47,6 +47,9 @@ class ProjectPut extends BaseController
(new ProjectPutModel())->putProject($data,$request->userId);
//将项目状态改为3 待验收
ProjectModel::where(['id'=>$data['project_id']])->update(['status' => 3]);
return $this->returnMsg('success',1);
}
......
......@@ -252,5 +252,10 @@ class Project extends Model
->field('fileid,filename,filesize,fileurl,filetype,storage');
}
public function put()
{
return $this->hasMany(ProjectPut::class, 'project_id', 'id');
}
}
\ No newline at end of file
......@@ -24,6 +24,7 @@ class ProjectPut extends Model
protected $type = [
'complete_time' => 'timestamp:Y-m-d H:i:s',
'complete_post_time' => 'timestamp:Y-m-d H:i:s',
'put_time' => 'timestamp:Y-m-d H:i:s',
];
public function getCreatetimeAttr($value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment