From f548a20da762ea535608c98d64287278a4cb5639 Mon Sep 17 00:00:00 2001 From: "WIN-C27C5MSVTPO\\16961" <1696136552@qq.com> Date: Mon, 5 Jan 2026 17:18:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E8=B0=83=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/controller/NotifyController.php | 66 +--------------------- 1 file changed, 3 insertions(+), 63 deletions(-) diff --git a/app/common/controller/NotifyController.php b/app/common/controller/NotifyController.php index 9e4fffb..6a45dbe 100644 --- a/app/common/controller/NotifyController.php +++ b/app/common/controller/NotifyController.php @@ -2,6 +2,7 @@ namespace app\common\controller; +use support\Log; use support\Request; use support\Response; use app\common\utils\FeishuMessage; @@ -36,70 +37,9 @@ class NotifyController try { $param = $request->post(); - // 解析数据 - // $param = json_decode($param['event'], true); - $orderSn = $param['event']['action']['value']; - if (strpos($orderSn, '"') !== false) { - $orderSn = str_replace('"', '', $orderSn); - } - - // 处理询单&客户线索信息 - $openId = $param['event']['operator']['open_id']; - - // 获取询单 - $order = InquiryLog::with(['channelInfo', 'countryInfo', 'enter'])->where('order_no', $orderSn)->first(); - if (!$order) { - return $this->error('未找到询单记录'); - } - - // 获取客户xians - $customer = CrmCustomer::where('sn', $orderSn)->first(); - if (!$customer) { - return $this->error('未找到客户线索'); - } - - // 获取用户 - $uinfo = User::where('open_id', $openId)->first(); - - // 更新客户线索 - $customer->user_id = $uinfo->id; - - // 更新询单数据 - $order->recipient = $uinfo->id; - $order->status = 2; - $order->t_time = time(); - - // 保存 - if (!$order->save() || !$customer->save()) { - return $this->error('跟踪失败'); - } - - // 获取飞书消息模板 - $feishuMessage = new FeishuMessage(); - $content = $feishuMessage->groupUpdateTemplates( - (new InquiryLogService())->qualityName($order->quality), - $order->order_no, - $order->channelInfo ? $order->channelInfo->name : '', - $order->countryInfo ? $order->countryInfo->cn_addr : '', - $order->enter ? $order->enter->name : '', - $order->r_time ? date('Y-m-d H:i:s', $order->r_time) : '', - $order->t_time ? date('Y-m-d H:i:s', $order->t_time) : '' - ); - - // 组装飞书消息模板 - $data = '{ - "toast": { - "type": "success", - "content": "操作成功" - }, - "card": { - "type": "raw", - "data": '.$content.' - } - }'; - + Log::info('feishuCallback',[$param]); // 响应消息 - return new Response(200, ['Content-Type' => 'application/json'], $data); + return new Response(200, ['Content-Type' => 'application/json'], $param); } catch (\Throwable $e) { return $this->error($e->getMessage()); }