Pārlūkot izejas kodu

当日上报产量修改

qiuenguang 1 gadu atpakaļ
vecāks
revīzija
1f22ef3f2b
1 mainītis faili ar 35 papildinājumiem un 0 dzēšanām
  1. 35 0
      application/api/controller/Facility.php

+ 35 - 0
application/api/controller/Facility.php

@@ -1810,4 +1810,39 @@ class Facility extends Api
             $this->success('退还成功');
         }
     }
+
+    /**
+     * 当日上报产量修改
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function chanliangEdit()
+    {
+        if (Request::instance()->isPost() === false){
+            $this->error('请求错误');
+        }
+        $param = Request::instance()->post();
+        if (empty($param[0]['UniqId'])){
+            $this->error('参数错误');
+        }
+        $i = 0;
+        foreach ($param as $key=>$value){
+            unset($param['UniqId']);
+            $sql = \db('设备_产量计酬')
+                ->where('UniqId',$param[$key]['UniqId'])
+                ->fetchSql(true)
+                ->update($value);
+            $res = \db()->query($sql);
+            if ($res === false){
+                $i++;
+            }
+        }
+        if ($i !== 0){
+            $this->error('修改失败');
+        }else{
+            $this->success('修改成功');
+        }
+    }
 }