Browse Source

优化接口

huangsanjia 1 year ago
parent
commit
625f4a09d0
1 changed files with 7 additions and 7 deletions
  1. 7 7
      application/api/controller/ReportingWork.php

+ 7 - 7
application/api/controller/ReportingWork.php

@@ -92,10 +92,10 @@ class ReportingWork extends Api
 //        $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
         $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
         $res = Db::query($sql);
-        if ($res !== false){
-            $this->success('设置成功');
-        }else{
+        if ($res === false){
             $this->error('设置失败');
+        }else{
+            $this->success('设置成功');
         }
     }
     /**
@@ -124,10 +124,10 @@ class ReportingWork extends Api
         $where['Gy0_gxh'] = $params['gxh'];
         $date = date('Y-m-d H:i:s');
         $res = \db('工单_工艺资料')->where($where)->setField('PD_WG',$date);
-        if ($res !== false){
-            $this->success('设置成功');
-        }else{
+        if ($res === false){
             $this->error('设置失败');
+        }else{
+            $this->success('设置成功');
         }
     }
     /**
@@ -418,7 +418,7 @@ class ReportingWork extends Api
             $this->error('非法请求');
         }
         $params = Request::instance()->get();
-        $data = \db('设备_基本资料')->where('sys_sbID',$params['addr'])->field('设备编号')->find();
+        $data = \db('设备_基本资料')->where('sys_sbID',$params['addr'])->field('设备编号,rtrim(使用部门) as 使用部门')->find();
         $this->success('请求成功',$data);
     }
 }