1
0
Эх сурвалжийг харах

提交自动外呼开启和停止任务。故障分类编辑

dongxiaoqin 11 сар өмнө
parent
commit
9842bd183d

+ 6 - 0
app/adminapi/controller/fault_type/FaultTypeController.php

@@ -121,4 +121,10 @@ class FaultTypeController extends BaseAdminController
         $result = FaultTypeLogic::getAllData();
         return $this->data($result);
     }
+
+    public function goodsCategory()
+    {
+        $result = FaultTypeLogic::getGoodsCategoryData();
+        return $this->data($result);
+    }
 }

+ 2 - 7
app/adminapi/lists/fault_code/FaultCodeLists.php

@@ -39,7 +39,7 @@ class FaultCodeLists extends BaseAdminDataLists implements ListsSearchInterface
     public function setSearch(): array
     {
         return [
-            '=' => ['status'],
+            '=' => ['status','type'],
             '%like%' => ['codes', 'name', 'detail'],
         ];
     }
@@ -48,12 +48,7 @@ class FaultCodeLists extends BaseAdminDataLists implements ListsSearchInterface
     {
         $where = [];
         if (isset($this->params['type_id']) && $this->params['type_id'] !== '') {
-            $pid = FaultType::where('id', $this->params['type_id'])->value('pid');
-            if ($pid == 0) {
-                $where[] = ['type_id', 'in', FaultType::where('pid', $this->params['type_id'])->column('id')];
-            } else {
-                $where[] = ['type_id', '=', $this->params['type_id']];
-            }
+            $where[] = ['type_id', '=', $this->params['type_id']];
         }
         return $where;
     }

+ 16 - 2
app/adminapi/logic/fault_type/FaultTypeLogic.php

@@ -15,9 +15,10 @@
 namespace app\adminapi\logic\fault_type;
 
 
-use app\common\model\fault_type\FaultType;
-use app\common\logic\BaseLogic;
 use think\facade\Db;
+use app\common\logic\BaseLogic;
+use app\common\model\fault_type\FaultType;
+use app\common\model\goods_category\GoodsCategory;
 
 
 /**
@@ -72,6 +73,7 @@ class FaultTypeLogic extends BaseLogic
                 'name' => $params['name'],
                 'pid' => $params['pid'],
                 'sort' => $params['sort']?:0,
+                'goods_category_id' => $params['goods_category_id'],
                 //'level' => $params['level'],
                 'status' => $params['status'],
             ]);
@@ -106,6 +108,7 @@ class FaultTypeLogic extends BaseLogic
                 'pid' => $pid,
                 'name' => $params['name'],
                 'sort' => $params['sort'],
+                'goods_category_id' => $params['goods_category_id'],
                 //'level' => $params['level'],
                 'status' => $params['status'],
             ]);
@@ -167,4 +170,15 @@ class FaultTypeLogic extends BaseLogic
         }
         return [];
     }
+
+    public static function getGoodsCategoryData()
+    {
+        $data = GoodsCategory::where('status',1)
+            ->whereRaw('pid in (select id from la_goods_category where pid in (6,62))')
+            ->field('id,pid,name,category_type')
+            ->order(['weigh'=> 'desc'])
+            ->select()
+            ->toArray();
+        return $data;
+    }
 }

+ 1 - 0
app/adminapi/service/WeCallService.php

@@ -158,6 +158,7 @@ class WeCallService
 
     private function taskStatusChange($data)
     {
+        return true;
         $taskId = $data['taskId'];
         $status = $data['status'];
         if ($taskId == $this->taskId && $status == 'COMPLETE') {

+ 4 - 4
app/adminapi/validate/fault_type/FaultTypeValidate.php

@@ -33,7 +33,7 @@ class FaultTypeValidate extends BaseValidate
     protected $rule = [
         'id' => 'require',
         'name' => 'require',
-        'pid' => 'require',
+        //'pid' => 'require',
         'sort' => 'require',
         'status' => 'require',
 
@@ -47,7 +47,7 @@ class FaultTypeValidate extends BaseValidate
     protected $field = [
         'id' => 'id',
         'name' => '分类名称',
-        'pid' => '上级id',
+        //'pid' => '上级id',
         'sort' => '排序',
         'status' => '部门状态(0停用 1正常)',
 
@@ -62,7 +62,7 @@ class FaultTypeValidate extends BaseValidate
      */
     public function sceneAdd()
     {
-        return $this->only(['name','pid','sort','status']);
+        return $this->only(['name','sort','status']);
     }
 
 
@@ -74,7 +74,7 @@ class FaultTypeValidate extends BaseValidate
      */
     public function sceneEdit()
     {
-        return $this->only(['id','name','pid','sort','status']);
+        return $this->only(['id','name','sort','status']);
     }
 
 

+ 4 - 4
app/common/command/AutomaticDispatch.php

@@ -120,9 +120,9 @@ class AutomaticDispatch extends Command
         if ($this->customerList) {
             $weCallService = new WeCallService();
             $res = $weCallService->importUser($this->customerList);
-            if (isset($res['code']) && $res['code'] == 200) {
-                $res = $weCallService->startTask();
-            }
+            // if (isset($res['code']) && $res['code'] == 200) {
+            //     $res = $weCallService->startTask();
+            // }
         }
         $this->customerList = [];
     }
@@ -239,8 +239,8 @@ class AutomaticDispatch extends Command
                             // '客户手机号'=>$item['mobile']
                         ]
                     ];
-                    return true;
                 }
+                return $res;
             }
         } 
         return false;