Răsfoiți Sursa

add - 工单第三方手动下单、用户端加单强转当前工程师

liugc 1 an în urmă
părinte
comite
a34b1e9896

+ 13 - 1
app/adminapi/controller/works/ServiceWorkController.php

@@ -216,5 +216,17 @@ class ServiceWorkController extends BaseAdminController
         }
         return $this->fail(ServiceWorkLogic::getError());
     }
-
+    /**
+     * 手动添加工单到第三方平台 (暂时只有美团)
+     * @return \think\response\Json
+     */
+    public function addThirdPlatformsOrders()
+    {
+        $params = request()->post();
+        $result = ServiceWorkLogic::addThirdPlatformsOrders($params);
+        if (false === $result) {
+            return $this->fail(ServiceWorkLogic::getError());
+        }
+        return $this->success('添加成功', [], 1, 1);
+    }
 }

+ 3 - 0
app/adminapi/lists/goods/GoodsLists.php

@@ -78,6 +78,9 @@ class GoodsLists extends BaseAdminDataLists implements ListsSearchInterface
             // 筛选已选过的
             $where[] = ['is_activity','=' ,1];//100000
         }
+        if (isset($this->params['platforms']) && !empty($this->params['platforms'])) {
+            $where[] = [ 'platform_value','>',0];
+        }
         return $where;
     }
 

+ 14 - 0
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -14,6 +14,7 @@
 
 namespace app\adminapi\logic\works;
 
+use app\api\logic\ThirdOrderLogic;
 use think\Exception;
 use think\db\Query;
 use think\facade\Db;
@@ -973,4 +974,17 @@ class ServiceWorkLogic extends BaseLogic
         }
     }
 
+    /**
+     * 添加第三方平台订单
+     * @return false|void
+     */
+    public static function addThirdPlatformsOrders($params)
+    {
+        try {
+            return ThirdOrderLogic::submitOrders($params);
+        }catch  (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
 }

+ 5 - 1
app/api/logic/ServiceOrderLogic.php

@@ -1236,7 +1236,11 @@ class ServiceOrderLogic extends BaseLogic
             if($work->isEmpty()){
                 throw new Exception('工单不存在');
             }
-            if($work['work_status']!=WorkEnum::WORK_STATUS_WAIT_SERVICE){
+            /*if($work['work_status']!=WorkEnum::WORK_STATUS_WAIT_SERVICE){
+                throw new Exception('工单状态不正确,无法绑定');
+            }*/
+            // 20250310 未上门状态强转新工程师
+            if((int)$work['work_status'] > 3){
                 throw new Exception('工单状态不正确,无法绑定');
             }
             $worker = MasterWorker::where('id',$params['worker_id'])->findOrEmpty();