diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index 3ba08cc..a872a6e 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -233,16 +233,9 @@ class Common extends ApiController if (empty($param['check'])) { $this->apiError("审批状态不能为空"); } - if ($param['check'] != 3) { - if (empty($param['content'])) { - $this->apiError("审批内容不能为空"); - } - //1审核结束 2下一审批人 - if (empty($param['check_node'])) { - $this->apiError("审批节点不能为空"); - } - } - + if (!in_array($param['check'], [1, 2, 3])) { + $this->apiError("审批状态参数错误"); + } $id = $param['id']; $type = $param['type']; $detail = []; @@ -250,6 +243,9 @@ class Common extends ApiController if($type==1){ //日常审核 $detail = Db::name('Approve')->where(['id' => $id])->find(); + if (empty($detail)){ + $this->apiError("审批数据错误"); + } $subject = '一个日常审批'; $msg_title_type = $detail['type'] ?? 0; } @@ -406,7 +402,7 @@ class Common extends ApiController 'type' => $type, 'check_time' => time(), 'status' => $param['check'], - 'content' => $param['content'], + 'content' => $param['content'] ?? '', 'create_time' => time() ); $aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData); @@ -482,7 +478,7 @@ class Common extends ApiController 'type' => $type, 'check_time' => time(), 'status' => $param['check'], - 'content' => $param['content'], + 'content' => $param['content'] ?? '', 'create_time' => time() ); $aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData); @@ -534,7 +530,7 @@ class Common extends ApiController 'type' => $type, 'check_time' => time(), 'status' => $param['check'], - 'content' => $param['content'], + 'content' => $param['content'] ?? '', 'create_time' => time() ); $aid = Db::name('FlowRecord')->strict(false)->field(true)->insertGetId($checkData);