Ver código fonte

预约时间提交

WHITEFANG 1 ano atrás
pai
commit
8e318f86a3

+ 9 - 8
app/api/controller/ServiceOrderController.php

@@ -6,6 +6,7 @@ use app\adminapi\logic\works\ServiceWorkLogic;
 use app\api\lists\recharge\ServiceOrderLists;
 use app\api\logic\ServiceOrderLogic;
 use app\api\validate\ServiceOrderValidate;
+use app\common\model\works\ServiceWorkAppointmentLog;
 use think\facade\Log;
 
 /**
@@ -238,13 +239,13 @@ class ServiceOrderController extends BaseApiController
             return $this->fail(ServiceOrderLogic::getError());
         }
         $order = ServiceOrderLogic::orderPayInfo($params);
-        $workDetail = ServiceWorkLogic::detail(['id'=>$order['work_id']]);
+        $workDetail = ServiceWorkAppointmentLog::where(['work_id'=>$order['work_id']])->order('id desc')->findOrEmpty();
         $masterDetail = MasterWorkerLogic::detail(['id'=>$workDetail['master_worker_id']]);
         // 修改预约时间通知【给用户的通知】
         $res = event('Notice',  [
             'scene_id' => 117,
             'params' => [
-                'user_id' => $workDetail['user_id'],
+                'user_id' => $result['user_id'],
                 'date' => $params['appointment_time'],
                 'tel' => $masterDetail['mobile'],
             ]
@@ -253,12 +254,12 @@ class ServiceOrderController extends BaseApiController
         $res = event('Notice',  [
             'scene_id' => 118,
             'params' => [
-                'user_id' => $workDetail['master_worker_id'],
-                'thing4' => $workDetail['title'],
-                'time5' => $workDetail['appointment_time'],
-                'time6' => $params['appointment_time'],
-                'thing11' => (iconv_strlen($workDetail['address'])>15)?(mb_substr($workDetail['address'],0,15,'UTF-8').'...'):$workDetail['address'],
-                'phone_number8' => $workDetail['mobile'],
+                'user_id' => $result['master_worker_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' => $result['mobile'],
             ]
         ]);
         return $this->success('已提交改约', [], 1, 1);

+ 3 - 0
app/api/logic/ServiceOrderLogic.php

@@ -806,12 +806,15 @@ class ServiceOrderLogic extends BaseLogic
 
             $work->appointment_time = strtotime($params['appointment_time']);
             $work->save();
+
             Db::commit();
         }
         catch (\Exception $e) {
             self::setError($e->getMessage());
             return false;
         }
+
+        return  $work;
     }
 
     public static function approvalRefund($params)