|
@@ -26,29 +26,19 @@ class Ccjc extends model{
|
|
|
return $this->hasOne('orgs', 'task_id', 'id');
|
|
|
}
|
|
|
|
|
|
- public function selectCcjcAndOrgsData($task_uid,$task_class='例行监测',$pageNum=1,$pageSize=10)
|
|
|
+ public function selectUndertakeData($where_undertake,$where,$pageNum,$pageSize)
|
|
|
{
|
|
|
- $ccjc = new Ccjc();
|
|
|
- return $ccjc->where([['task_class', '=', $task_class],])->with([
|
|
|
- 'orgs'=>function ($query) use ($task_uid){
|
|
|
- $query->where('unit_id',$task_uid);
|
|
|
- }
|
|
|
- ])->page((int)$pageNum,(int)$pageSize)->select();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function selectUndertakeData($task_class,$where, $pageNum, $pageSize)
|
|
|
- {
|
|
|
- $result = Ccjc::hasWhere('undertake', function ($query) use ($where){
|
|
|
- $query->where($where);
|
|
|
- })->where('task_class','=',$task_class)->page($pageNum,$pageSize)->select();
|
|
|
+ $result = Ccjc::hasWhere('undertake', function ($query) use ($where_undertake) {
|
|
|
+ $query->where($where_undertake);
|
|
|
+ })->where($where)->page((int)$pageNum,(int)$pageSize)->select();
|
|
|
return $result;
|
|
|
}
|
|
|
- public function countUndertakeData($task_class,$where)
|
|
|
+
|
|
|
+ public function countUndertakeData($where_undertake,$where)
|
|
|
{
|
|
|
- $result = Ccjc::hasWhere('undertake', function ($query) use ($where){
|
|
|
- $query->where($where);
|
|
|
- })->where('task_class','=',$task_class)->count();
|
|
|
+ $result = Ccjc::hasWhere('undertake', function ($query) use ($where_undertake) {
|
|
|
+ $query->where($where_undertake);
|
|
|
+ })->where($where)->count();
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
@@ -63,21 +53,16 @@ class Ccjc extends model{
|
|
|
return $this->where($where)->select()->count();
|
|
|
}
|
|
|
|
|
|
+ public function updateInfoByTaskID($task_id,$data)
|
|
|
+ {
|
|
|
+ return $this->where('id','=',$task_id)->save($data);
|
|
|
+ }
|
|
|
|
|
|
//删除任务
|
|
|
public function deleteItemById($task_id)
|
|
|
{
|
|
|
return $this->where('id', '=', $task_id)->delete();
|
|
|
}
|
|
|
- public function deleteTaskByID($id)
|
|
|
- {
|
|
|
- if (empty($id)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- return $this->select($id)->delete();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
|
|
|
//添加任务 返回添加数据的主键id
|
|
|
public function createTask($data)
|
|
@@ -89,29 +74,11 @@ class Ccjc extends model{
|
|
|
return $this->where('id','=',$task_id)->find();
|
|
|
}
|
|
|
|
|
|
- public function selectInfoByTaskId($task_id_arr)
|
|
|
- {
|
|
|
- return $this->select($task_id_arr);
|
|
|
- }
|
|
|
-
|
|
|
- //根据id查询任务发布者releaser
|
|
|
- public function getCreaterById($id)
|
|
|
- {
|
|
|
- return $this->select($id)->column('releaser');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public function updateInfoByTaskID($task_id, $data)
|
|
|
+ public function getTaskInfoByModelId($model_id)
|
|
|
{
|
|
|
- return $this->where('id', '=', $task_id)->save($data);
|
|
|
+ return $this->where('test_model_id', '=', $model_id)->find();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 更新任务状态
|
|
|
- * @param $arr_condition:['id'=>1,'task_name'=>'更改的名称','isPublish'=>'2']
|
|
|
- * @return false|\think\Collection
|
|
|
- * @throws \Exception
|
|
|
- */
|
|
|
public function updateTaskByArrCondition($arr_condition)
|
|
|
{
|
|
|
if (empty($arr_condition)) {
|