合并分支 'workorder' 到 'master'
ok 查看合并请求 !2291
正在显示
4 个修改的文件
包含
46 行增加
和
33 行删除
| @@ -158,26 +158,29 @@ class TicketController extends BaseController | @@ -158,26 +158,29 @@ class TicketController extends BaseController | ||
| 158 | * 企微群里@小超或艾丝,触发推送工单 | 158 | * 企微群里@小超或艾丝,触发推送工单 |
| 159 | * 接收群ID | 159 | * 接收群ID |
| 160 | */ | 160 | */ |
| 161 | - public function pushNotifyByBot($friend_id) | 161 | + public function pushTicketByBot($friend_id) |
| 162 | { | 162 | { |
| 163 | $project = TicketProject::where('wechat_group_id', $friend_id)->where('is_del', 0)->first(); | 163 | $project = TicketProject::where('wechat_group_id', $friend_id)->where('is_del', 0)->first(); |
| 164 | if (!$project) | 164 | if (!$project) |
| 165 | return response()->json(['message' => '未找到对应的工单项目'], 404); | 165 | return response()->json(['message' => '未找到对应的工单项目'], 404); |
| 166 | 166 | ||
| 167 | - $url = in_array($project->project_cate, [3,4]) ? 'https://hub.ai.cc/api/fob_ai_customer_service/push_message' : 'https://hub.ai.cc/api/globalso_ai_customer_service/send_msg'; | ||
| 168 | - $response = Http::post($url, [ | ||
| 169 | - 'type' => 'Link', | ||
| 170 | - 'friend_id' => $friend_id, | ||
| 171 | - 'content' => json_encode([ | ||
| 172 | - 'title' => 'AI协同工单 - ' . $project->company_name, | ||
| 173 | - 'desc' => "您好,我们同事没有及时回复,你可以查看工单进度!", | ||
| 174 | - 'size' => 0, | ||
| 175 | - 'thumbSize' => 0, | ||
| 176 | - 'thumbUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 177 | - 'url' => 'https://oa.quanqiusou.cn/afterorder?project_id='.$project->uuid | ||
| 178 | - ], JSON_UNESCAPED_UNICODE) | ||
| 179 | - ]); | ||
| 180 | - // 返回 $response 的相应内容以及网络状态码 | ||
| 181 | - return response($response->body(), $response->status()); | 167 | +// $url = in_array($project->project_cate, [3,4]) ? 'https://hub.ai.cc/api/fob_ai_customer_service/push_message' : 'https://hub.ai.cc/api/globalso_ai_customer_service/send_msg'; |
| 168 | +// $response = Http::post($url, [ | ||
| 169 | +// 'type' => 'Link', | ||
| 170 | +// 'friend_id' => $friend_id, | ||
| 171 | +// 'content' => json_encode([ | ||
| 172 | +// 'title' => 'AI协同工单 - ' . $project->company_name, | ||
| 173 | +// 'desc' => "您好,我们同事没有及时回复,你可以查看工单进度!", | ||
| 174 | +// 'size' => 0, | ||
| 175 | +// 'thumbSize' => 0, | ||
| 176 | +// 'thumbUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 177 | +// 'url' => 'https://oa.quanqiusou.cn/afterorder?project_id='.$project->uuid | ||
| 178 | +// ], JSON_UNESCAPED_UNICODE) | ||
| 179 | +// ]); | ||
| 180 | +// // 返回 $response 的相应内容以及网络状态码 | ||
| 181 | +// return response($response->body(), $response->status()); | ||
| 182 | + | ||
| 183 | + $project->pushWechatGroupMsg("您好,我们同事没有及时回复,你可以查看工单进度!"); | ||
| 184 | + return response()->json(['message' => '工单推送成功']); | ||
| 182 | } | 185 | } |
| 183 | } | 186 | } |
| @@ -240,22 +240,7 @@ class AsideTicketController extends BaseController | @@ -240,22 +240,7 @@ class AsideTicketController extends BaseController | ||
| 240 | if (empty($project->wechat_group_id)) { | 240 | if (empty($project->wechat_group_id)) { |
| 241 | $this->response('该工单没有绑定的企微群', Code::USER_MODEL_NOTFOUND_ERROE); | 241 | $this->response('该工单没有绑定的企微群', Code::USER_MODEL_NOTFOUND_ERROE); |
| 242 | } | 242 | } |
| 243 | - | ||
| 244 | - $message_push = new MessagePush(); | ||
| 245 | - $message_push->project_id = $project->table_id; | ||
| 246 | - $message_push->friend_id = $project->wechat_group_id; | ||
| 247 | - $message_push->content_type = 'Link'; | ||
| 248 | - $message_push->content = json_encode([ | ||
| 249 | - 'title' => "AI协同工单 - " . $project->company_name, | ||
| 250 | - 'desc' => "可提交新的工单、查询工单进度、AI会同步通知售后人员!", | ||
| 251 | - 'size' => 0, | ||
| 252 | - 'thumbSize' => 0, | ||
| 253 | - 'thumbUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 254 | - 'url' => 'https://oa.quanqiusou.cn/afterorder?project_id='.$project->uuid | ||
| 255 | - ], JSON_UNESCAPED_UNICODE); | ||
| 256 | - $message_push->send_time = now(); | ||
| 257 | - $message_push->type = MessagePush::TYPE_TICKET; | ||
| 258 | - $message_push->save(); | 243 | + $project->pushWechatGroupMsg(); |
| 259 | $this->response('success', Code::SUCCESS); | 244 | $this->response('success', Code::SUCCESS); |
| 260 | } | 245 | } |
| 261 | 246 |
| @@ -6,6 +6,7 @@ use App\Models\Base; | @@ -6,6 +6,7 @@ use App\Models\Base; | ||
| 6 | use App\Models\Manage\Manage; | 6 | use App\Models\Manage\Manage; |
| 7 | use App\Models\Project\Project; | 7 | use App\Models\Project\Project; |
| 8 | use App\Models\ProjectAssociation\ProjectAssociation; | 8 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 9 | +use App\Models\Workchat\MessagePush; | ||
| 9 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 10 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 10 | 11 | ||
| 11 | class TicketProject extends Base | 12 | class TicketProject extends Base |
| @@ -53,4 +54,28 @@ class TicketProject extends Base | @@ -53,4 +54,28 @@ class TicketProject extends Base | ||
| 53 | ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT) | 54 | ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT) |
| 54 | ->select(['id', 'project_id', 'friend_id', 'binding_app']); | 55 | ->select(['id', 'project_id', 'friend_id', 'binding_app']); |
| 55 | } | 56 | } |
| 57 | + | ||
| 58 | + | ||
| 59 | + /** | ||
| 60 | + * @return void | ||
| 61 | + * 企微群推送工单消息 | ||
| 62 | + */ | ||
| 63 | + public function pushWechatGroupMsg($desc="可提交新的工单、查询工单进度、AI会同步通知售后人员!") | ||
| 64 | + { | ||
| 65 | + $message_push = new MessagePush(); | ||
| 66 | + $message_push->project_id = $this->table_id; | ||
| 67 | + $message_push->friend_id = $this->wechat_group_id; | ||
| 68 | + $message_push->content_type = 'Link'; | ||
| 69 | + $message_push->content = json_encode([ | ||
| 70 | + 'title' => "AI协同工单 - " . $this->company_name, | ||
| 71 | + 'desc' => $desc, | ||
| 72 | + 'size' => 0, | ||
| 73 | + 'thumbSize' => 0, | ||
| 74 | + 'thumbUrl' => 'https://hub.globalso.com/logocm.png', | ||
| 75 | + 'url' => 'https://oa.quanqiusou.cn/afterorder?project_id='.$this->uuid | ||
| 76 | + ], JSON_UNESCAPED_UNICODE); | ||
| 77 | + $message_push->send_time = now(); | ||
| 78 | + $message_push->type = MessagePush::TYPE_TICKET; | ||
| 79 | + $message_push->save(); | ||
| 80 | + } | ||
| 56 | } | 81 | } |
| @@ -85,5 +85,5 @@ Route::prefix('tickets')->group(function () { | @@ -85,5 +85,5 @@ Route::prefix('tickets')->group(function () { | ||
| 85 | Route::get('/{project_id}/{id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'show'])->summary('B端,渠道-工单详情')->name('tickets.show'); | 85 | Route::get('/{project_id}/{id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'show'])->summary('B端,渠道-工单详情')->name('tickets.show'); |
| 86 | Route::get('/chat/{project_id}/{ticket_id}', [\App\Http\Controllers\Api\WorkOrder\TicketChatController::class, 'index'])->summary('B端,渠道-工单聊天记录')->name('tickets.chat.index'); | 86 | Route::get('/chat/{project_id}/{ticket_id}', [\App\Http\Controllers\Api\WorkOrder\TicketChatController::class, 'index'])->summary('B端,渠道-工单聊天记录')->name('tickets.chat.index'); |
| 87 | Route::post('/chat/{project_id}/{ticket_id}', [\App\Http\Controllers\Api\WorkOrder\TicketChatController::class, 'store'])->summary('B端,渠道-工单聊天记录提交')->name('tickets.chat.store'); | 87 | Route::post('/chat/{project_id}/{ticket_id}', [\App\Http\Controllers\Api\WorkOrder\TicketChatController::class, 'store'])->summary('B端,渠道-工单聊天记录提交')->name('tickets.chat.store'); |
| 88 | - Route::get('/pushNotify_ByBot/{friend_id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'pushNotifyByBot'])->summary('企微群@机器人触发工单推送')->name('tickets.pushNotifyByBot'); | ||
| 89 | }); | 88 | }); |
| 89 | +Route::get('/pushTicketByBot/{friend_id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'pushTicketByBot'])->summary('企微群@机器人触发工单推送')->name('tickets.pushTicketByBot'); |
-
请 注册 或 登录 后发表评论