|
|
@@ -22,6 +22,9 @@ class ExternalPlatformLogic extends BaseLogic
|
|
|
case 'confirm_price':
|
|
|
self::confirmPrice($params['params']);
|
|
|
break;
|
|
|
+ case 'service_finish':
|
|
|
+ self::serviceFinish($params['params']);
|
|
|
+ break;
|
|
|
default:
|
|
|
throw new \Exception('场景不存在');
|
|
|
}
|
|
|
@@ -34,7 +37,7 @@ class ExternalPlatformLogic extends BaseLogic
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ // 工程师报价通知
|
|
|
private static function confirmPrice($params)
|
|
|
{
|
|
|
try {
|
|
|
@@ -75,6 +78,39 @@ class ExternalPlatformLogic extends BaseLogic
|
|
|
throw new \Exception($e->getMessage());
|
|
|
}
|
|
|
}
|
|
|
+ // 工程师服务完成通知
|
|
|
+ private static function serviceFinish($params)
|
|
|
+ {
|
|
|
+ try {
|
|
|
+
|
|
|
+ $work = ServiceWork::where(['id'=>$params['work_id']])->findOrEmpty();
|
|
|
+ if($work->isEmpty()){
|
|
|
+ throw new \Exception('工单不存在');
|
|
|
+ }
|
|
|
+ if($work->external_platform_id > 0){
|
|
|
+ $externalPlatform = ExternalPlatform::find($work->external_platform_id);
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'timestamp'=>time(),
|
|
|
+ 'scene'=>'service_finish',
|
|
|
+ 'version'=>'1',
|
|
|
+ 'notice_data'=>json_encode([
|
|
|
+ 'work_sn'=>$work->work_sn
|
|
|
+ ],JSON_UNESCAPED_UNICODE)
|
|
|
+ ];
|
|
|
+ $data['sign'] = ExternalPlatform::getSign($externalPlatform['appkey'],$data);
|
|
|
+ $res = http_request($externalPlatform['send_url'],http_build_query($data));
|
|
|
+ Log::info('ExternalPlatform-serviceFinish:'
|
|
|
+ .'url:'.$externalPlatform['send_url']
|
|
|
+ .'|data:'.json_encode($data,JSON_UNESCAPED_UNICODE)
|
|
|
+ .'|res:'.json_encode([$res],JSON_UNESCAPED_UNICODE)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ throw new \Exception($e->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|