post()->goCheck('confirmDoor'); try { $work_sn = decrypt($params['code'], \think\facade\Config::get('project.work_sn_key')); $work = ServiceWork::where(['work_sn'=>$work_sn,'mobile'=>$params['phone']])->findOrEmpty(); if($work->isEmpty()){ throw new Exception('工单不存在'); } $params['user_id'] = $work['master_worker_id'];//工程师信息 $params['user_info'] = MasterWorker::where('id',$work['master_worker_id'])->field('worker_number,real_name')->findOrEmpty();//工程师信息 $params['work_sn'] = $work_sn; $result = ServiceWorkLogic::confirmDoor($params); if($work->third_type == 1 || ($work->external_platform_id > 0)){ http_request('https://developer.kyjlkj.com/platf/performanceNotice', http_build_query([ 'external_platform_id'=> $work->external_platform_id, 'send_code'=>1003, 'work_sn'=>$work['work_sn'], ])); $meituan_result = ThirdOrderLogic::updateorderfulfillinfo($work,ThirdTypeEnum::MEITUAN_ARRIVED); Log::write('美团确认上门'.json_encode($meituan_result)); } if (false === $result) { throw new Exception(ServiceWorkLogic::getError()); } }catch (\Exception $e){ return $this->fail($e->getMessage()); } return $this->success('已确认上门'); } public function confirmPriceDetail() { $params = (new UserConfirmValidate())->post()->goCheck('confirmDoor'); try { $work_sn = decrypt($params['code'], \think\facade\Config::get('project.work_sn_key')); $work = ServiceWork::where(['work_sn'=>$work_sn,'mobile'=>$params['phone']])->findOrEmpty(); if($work->isEmpty()){ throw new Exception('工单不存在'); } // 先登录得到用户信息 $userInfo = LoginLogic::login(['account'=>$params['phone'],'scene'=>2,'terminal'=>2]); $userId = User::where('mobile',$params['phone'])->value('id'); $sn = RechargeOrder::where('work_id',$work->id)->where('user_id',$work->user_id)->value('sn'); $result = ServiceOrderLogic::detail([ 'sn' => $sn, 'user_id' => $userId, 'user_info' => $userInfo, 'domain'=>$this->request->domain() ]); if (false === $result) { throw new Exception(ServiceOrderLogic::getError()); } $result['user_info'] = $userInfo; return $this->data($result); }catch (\Exception $e){ return $this->fail($e->getMessage()); } } }