Commit 0707d8ea authored by hujun's avatar hujun

图片

parent c88ec277
...@@ -223,24 +223,28 @@ class Cost extends Basic ...@@ -223,24 +223,28 @@ class Cost extends Basic
public function checkCost() public function checkCost()
{ {
$code = 101; $code = 101;
if (empty($this->params['id'])) {
$params = $this->params;
if (empty($params['id'])) {
return $this->response($code, '参数错误'); return $this->response($code, '参数错误');
} }
switch($this->params['check_status']) {
switch($params['check_status']) {
case 1 : case 1 :
$this->params['status'] = 1;break; $params['status'] = 1;break;
case 2 : case 2 :
$this->params['status'] = 2;break; $params['status'] = 2;break;
case 3 : case 3 :
$this->params['status'] = 3;break; $params['status'] = 3;break;
case 4 : case 4 :
$this->params['status'] = 4;break; $params['img_name'] = json_decode($params['img_name'], true);
$params['status'] = 4;break;
default : default :
return $this->response($code, '请求链接参数错误'); return $this->response($code, '请求链接参数错误');
} }
$service = new CostService(); $service = new CostService();
$result = $service->check($this->params, $this->userId); $result = $service->check($params, $this->userId);
if ($result['status'] != 'fail') { if ($result['status'] != 'fail') {
$code = 200; $code = 200;
} }
......
...@@ -34,7 +34,7 @@ class CostService ...@@ -34,7 +34,7 @@ class CostService
$result['status'] = 'fail'; $result['status'] = 'fail';
$result['msg'] = ''; $result['msg'] = '';
$where['id'] = $params['id']; $where['id'] = $params['id'];
$where['is_del'] = $id = 0; $where['is_del'] = $is_update_apply = 0;
$cost_data = $this->apply_model->findByOne('id,status', $where); $cost_data = $this->apply_model->findByOne('id,status', $where);
if (empty($cost_data)) { if (empty($cost_data)) {
$result['msg'] = '无该记录'; $result['msg'] = '无该记录';
...@@ -66,13 +66,13 @@ class CostService ...@@ -66,13 +66,13 @@ class CostService
$num = $this->check_model->saveData($save_check); $num = $this->check_model->saveData($save_check);
if ($num) { if ($num) {
try { try {
$id = $this->apply_model->updateData(['status'=>$params['status']], ['id'=>$cost_data['id']]); $is_update_apply = $this->apply_model->updateData(['status'=>$params['status']], ['id'=>$cost_data['id']]);
if ($params['status'] == 4) { if ($params['status'] == 4) {
foreach($params['img_name'] as $v) { foreach($params['img_name'] as $v) {
$img_arr = [ $img_arr[] = [
'img_id' => $id, 'img_id' => $cost_data['id'],
'img_type' => 2, 'img_type' => 2,
'img_name' => $v['img_name'] 'img_name' => $v
]; ];
} }
...@@ -85,7 +85,7 @@ class CostService ...@@ -85,7 +85,7 @@ class CostService
return $result; return $result;
} }
} }
if ($id) { if ($is_update_apply) {
$result['status'] = 'successful'; $result['status'] = 'successful';
$result['msg'] = '审核成功'; $result['msg'] = '审核成功';
} else { } else {
......
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