tongshanglei 2 년 전
부모
커밋
b71bbda40e

+ 1 - 1
catch/hydraulic/controller/Hydraulic.php

@@ -37,7 +37,7 @@ class Hydraulic extends CatchController
         if(isset($data['out_date']) && is_int($data['out_date'])){
             $data['out_date'] = date('Y-m-d',$data['out_date']);
         }
-        if(!$data['out_date']){
+        if(isset($data['out_date']) && !$data['out_date']){
             $data['out_date'] = null;
         }
         return CatchResponse::success($this->hydraulicModel->storeBy($data));

+ 2 - 2
catch/hydraulic/controller/Wrench.php

@@ -37,7 +37,7 @@ class Wrench extends CatchController
         if(isset($data['out_date'])  && is_int($data['out_date'])){
             $data['out_date'] = date('Y-m-d',$data['out_date']);
         }
-        if(!$data['out_date']){
+        if(isset($data['out_date']) && !$data['out_date']){
             $data['out_date'] = null;
         }
         return CatchResponse::success($this->wrenchModel->storeBy($data));
@@ -78,6 +78,6 @@ class Wrench extends CatchController
      */
     public function delete($id) : \think\Response
     {
-        return CatchResponse::success($this->wrenchModel->deleteBy($id));
+        return CatchResponse::success($this->wrenchModel->deleteBy($id,true));
     }
 }

+ 5 - 1
catch/hydraulic/database/migrations/20220506141132_wrench.php

@@ -43,7 +43,11 @@ class Wrench extends Migrator
 			->addColumn('net_state', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '网络状态',])
 			->addColumn('online_time', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '在线时间',])
 			->addColumn('max_pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最大压力',])
-			->addColumn('min_pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最小压力',])
+            ->addColumn('min_pressure', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '最小压力',])
+            ->addColumn('angle_sensor', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '角度传感器',])
+            
+
+
 			->addColumn('checked_at', 'integer', ['limit' => MysqlAdapter::INT_REGULAR,'null' => true,'signed' => true,'comment' => '校验时间',])
 			->addColumn('checked_no', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '校验台编号',])
 			->addColumn('checked_res', 'string', ['limit' => 32,'null' => true,'signed' => true,'comment' => '校验结果',])

+ 12 - 0
catch/hydraulic/model/Wrench.php

@@ -42,6 +42,7 @@ class Wrench extends Model
         'max_pressure',
         // 最小压力
         'min_pressure',
+        'angle_sensor',
         // 校验时间
         'checked_at',
         // 校验台编号
@@ -107,6 +108,17 @@ class Wrench extends Model
         $id = $this->getData('model');
         return Db::table('device_mold')->where('id', $id)->value('name');
     }
+     /**
+     * 获取角度传感器
+     */
+    public function getAngleSensorAttr($value)
+    {
+        if($value==1){
+            return true;
+        }else{
+            return false;
+        }
+    }
     /**
      * 获取部门名称(文本)
      */