diff --git a/application/common/Model/Task.php b/application/common/Model/Task.php index a392c37..24d7f30 100644 --- a/application/common/Model/Task.php +++ b/application/common/Model/Task.php @@ -238,7 +238,7 @@ class Task extends CommonModel if ($parentCode) { $parentTask = self::where(['code' => $parentCode])->find(); if (!$parentTask) { - return error(5, '父任务无效'); + return error(8, '父任务无效'); } if ($parentTask['deleted']) { return error(6, '父任务在回收站中无法编辑'); diff --git a/application/common/Model/TaskWorkTime.php b/application/common/Model/TaskWorkTime.php index b2c2ca0..83bfbce 100644 --- a/application/common/Model/TaskWorkTime.php +++ b/application/common/Model/TaskWorkTime.php @@ -42,8 +42,8 @@ class TaskWorkTime extends CommonModel if (!$beginTime) { return error(4, '请选择开始时间'); } - if (!$num || !is_numeric($num)) { - return error(5, '请输入有效工时'); + if (!$num || $num < 0 || !is_numeric($num)) { + return error(6, '请输入有效工时'); } $data = [ 'create_time' => nowTime(), diff --git a/application/project/controller/Task.php b/application/project/controller/Task.php index 1347c99..0885db4 100644 --- a/application/project/controller/Task.php +++ b/application/project/controller/Task.php @@ -464,6 +464,12 @@ class Task extends BasicApi $this->success('', $list); } + /** + * 工时间录 + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ public function _taskWorkTimeList() { $taskCode = Request::param('taskCode'); @@ -477,6 +483,12 @@ class Task extends BasicApi $this->success('', $workTimeList); } + /** + * 记录工时 + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ public function saveTaskWorkTime() { $param = Request::only('beginTime,num,content,taskCode'); @@ -487,6 +499,13 @@ class Task extends BasicApi $this->success(); } + /** + * 修改工时 + * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ public function editTaskWorkTime() { $param = Request::only('beginTime,num,content'); @@ -505,6 +524,13 @@ class Task extends BasicApi $this->success(); } + /** + * 删除工时 + * @return array + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException + */ public function delTaskWorkTime() { $code = Request::param('code');