Jelajahi Sumber

Merge branch 'master' of e.coding.net:zdap/weixiu/weixiu_api into data_rules-m

liugc 1 tahun lalu
induk
melakukan
93a1ef9d05

+ 26 - 25
app/api/controller/ServiceOrderController.php

@@ -244,31 +244,32 @@ class ServiceOrderController extends BaseApiController
         if (false === $result) {
         if (false === $result) {
             return $this->fail(ServiceOrderLogic::getError());
             return $this->fail(ServiceOrderLogic::getError());
         }
         }
-        $order = ServiceOrderLogic::orderPayInfo($params);
-        $workDetail = ServiceWorkAppointmentLog::where(['work_id'=>$order['work_id']])->order('id desc')->findOrEmpty();
-        $masterDetail = MasterWorkerLogic::detail(['id'=>$result['master_worker_id']]);
-        // 修改预约时间通知【给用户的通知】
-        $res = event('Notice',  [
-            'scene_id' => 117,
-            'params' => [
-                'user_id' => $result['user_id'],
-                'date' => $params['appointment_time'],
-                'tel' => asteriskString($masterDetail['mobile']),
-            ]
-        ]);
-        // 修改预约时间通知【给工程师的通知,仅限公众号】
-        $res = event('Notice',  [
-            'scene_id' => 118,
-            'params' => [
-                'user_id' => $result['master_worker_id'],
-                'order_id' => $order['work_id'],
-                'thing4' => $result['title'],
-                'time5' => date('Y-m-d H:i:s',$workDetail['last_appointment_time']),
-                'time6' => date('Y-m-d H:i:s',$workDetail['this_appointment_time']),
-                'thing11' => (iconv_strlen($result['address'])>15)?(mb_substr($result['address'],0,15,'UTF-8').'...'):$result['address'],
-                'phone_number8' => asteriskString($result['mobile']),
-            ]
-        ]);
+        if($result->master_worker_id!=0){
+            $workDetail = ServiceWorkAppointmentLog::where(['work_id'=>$result['id']])->order('id desc')->findOrEmpty();
+            $masterDetail = MasterWorkerLogic::detail(['id'=>$result['master_worker_id']]);
+            // 修改预约时间通知【给用户的通知】
+            $res = event('Notice',  [
+                'scene_id' => 117,
+                'params' => [
+                    'user_id' => $result['user_id'],
+                    'date' => $params['appointment_time'],
+                    'tel' => asteriskString($masterDetail['mobile']),
+                ]
+            ]);
+            // 修改预约时间通知【给工程师的通知,仅限公众号】
+            $res = event('Notice',  [
+                'scene_id' => 118,
+                'params' => [
+                    'user_id' => $result['master_worker_id'],
+                    'order_id' => $result['id'],
+                    'thing4' => $result['title'],
+                    'time5' => date('Y-m-d H:i:s',$workDetail['last_appointment_time']),
+                    'time6' => date('Y-m-d H:i:s',$workDetail['this_appointment_time']),
+                    'thing11' => (iconv_strlen($result['address'])>15)?(mb_substr($result['address'],0,15,'UTF-8').'...'):$result['address'],
+                    'phone_number8' => asteriskString($result['mobile']),
+                ]
+            ]);
+        }
 
 
         return $this->success('已提交改约', [], 1, 1);
         return $this->success('已提交改约', [], 1, 1);
     }
     }

+ 3 - 1
app/api/logic/IssueWorkLogic.php

@@ -89,7 +89,9 @@ class IssueWorkLogic extends BaseLogic
                 throw new Exception('订单暂未结束,不允许投诉,请直接联系客服');
                 throw new Exception('订单暂未结束,不允许投诉,请直接联系客服');
             }
             }
             // 判断是否投诉时效过期
             // 判断是否投诉时效过期
-            if(strtotime($work['finished_time']) < (time()-86400*5)){
+            // 设定固定的工单允许投诉
+            $iss_work_ids = [160];
+            if(strtotime($work['finished_time']) < (time()-86400*5) && !in_array($work['id'],$iss_work_ids)){
                 throw new Exception('投诉时效已过');
                 throw new Exception('投诉时效已过');
             }
             }
             $IssueWork = new IssueWork();
             $IssueWork = new IssueWork();

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

@@ -575,7 +575,7 @@ class ServiceOrderLogic extends BaseLogic
 
 
 
 
     /**
     /**
-     * 获取订单支付详情
+     * 获取订单支付详情--这个用于尾款支付的时候,自动使用了优惠券,不要随便调用
      * @param $params
      * @param $params
      * @return array|false
      * @return array|false
      */
      */
@@ -902,9 +902,12 @@ class ServiceOrderLogic extends BaseLogic
                 throw new Exception('工单不存在');
                 throw new Exception('工单不存在');
             }
             }
 
 
-            //更新工单未确认上门的状态
-            $work->work_status = 3;
-            $work->user_confirm_status = 0;
+            if($work->master_worker_id!=0){
+                //更新工单未确认上门的状态
+                $work->work_status = 3;
+                $work->user_confirm_status = 0;
+                $work->appoint_approval = 1;
+            }
 
 
             ServiceWorkAppointmentLog::create([
             ServiceWorkAppointmentLog::create([
                 'work_id'=>$work->id,
                 'work_id'=>$work->id,
@@ -913,7 +916,6 @@ class ServiceOrderLogic extends BaseLogic
             ]);
             ]);
 
 
             $work->appointment_time = strtotime($params['appointment_time']);
             $work->appointment_time = strtotime($params['appointment_time']);
-            $work->appoint_approval = 1;
             $work->save();
             $work->save();
 
 
             Db::commit();
             Db::commit();