From c95f8cca8abeb825c0a7ad05c064baf6fc3d48ad Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Mon, 29 Jul 2024 17:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Login.php | 14 +++++++++++--- app/api/controller/AfterSale.php | 2 +- app/api/logic/AfterSaleLogic.php | 15 ++++++++++++++- app/common/server/SmsMessageServer.php | 3 +-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index e8dd9d9c..29992473 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -50,11 +50,19 @@ class Login extends AdminBase // 'mobile' => 15005837859, // 'params' => [ // 'user_id' => 979, -// 'after_sale_sn' => '测试单号' +// 'after_sale_sn' => '202306071624224802' // ] // ]); -// dump(123); -// die; + event('Notice', [ + 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP_REFUND, + 'mobile' => 15005837859, + 'params' => [ + 'user_id' => 979, + 'after_sale_sn' => '202306071624224802' + ] + ]); + dump(123); + die; if ($this->request->isAjax()) { $post = request()->post(); (new LoginValidate())->goCheck(); diff --git a/app/api/controller/AfterSale.php b/app/api/controller/AfterSale.php index 79e43e30..31a2a606 100644 --- a/app/api/controller/AfterSale.php +++ b/app/api/controller/AfterSale.php @@ -43,7 +43,7 @@ class AfterSale extends Api $post = $this->request->post(); $post['user_id'] = $this->user_id; $post['reason'] = ""; - (new AfterSaleValidate())->goCheck('add', $post); + // (new AfterSaleValidate())->goCheck('add', $post); $result = AfterSaleLogic::add($post, $this->user_id); if (false === $result) { return JsonServer::error('该订单已超过售后时间'); diff --git a/app/api/logic/AfterSaleLogic.php b/app/api/logic/AfterSaleLogic.php index 0cd0e62d..4c3c56e9 100644 --- a/app/api/logic/AfterSaleLogic.php +++ b/app/api/logic/AfterSaleLogic.php @@ -277,7 +277,7 @@ class AfterSaleLogic extends Logic if (!empty($order['shop']['mobile'])) { //通知商家 event('Notice', [ - 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP, + 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP_REFUND, 'mobile' => $order['shop']['mobile'], 'params' => [ 'user_id' => $user_id, @@ -500,6 +500,19 @@ class AfterSaleLogic extends Logic $user_id, AfterSaleLog::USER_AGAIN_REFUND ); + + $order = Order::with('shop')->where(['id' => $after_sale['order_id']])->find(); + if (!empty($order['shop']['mobile'])) { + //通知商家 + event('Notice', [ + 'scene' => NoticeEnum::AFTER_SALE_NOTICE_SHOP, + 'mobile' => $order['shop']['mobile'], + 'params' => [ + 'user_id' => $user_id, + 'after_sale_sn' => $after_sale['sn'] + ] + ]); + } Db::commit(); return ['after_sale_id' => $id]; } catch (Exception $e) { diff --git a/app/common/server/SmsMessageServer.php b/app/common/server/SmsMessageServer.php index 2a400e66..62ffaea4 100644 --- a/app/common/server/SmsMessageServer.php +++ b/app/common/server/SmsMessageServer.php @@ -38,7 +38,6 @@ class SmsMessageServer try{ //场景对应短信模板信息 $scene_config = NoticeSetting::where(['scene' => $params['scene']])->findOrEmpty(); - //增加短信记录 $content = $this->getContentInfo($scene_config, $params); $code = $this->getCodeInfo($params['scene'], $scene_config, $params['params']); @@ -46,13 +45,13 @@ class SmsMessageServer //增加通知记录 $this->notice = MessageNoticeLogic::addNoticeLog($params, $scene_config['sms_notice'], NoticeEnum::SMS_NOTICE, $content); - //发送短信 $SmsDriver = new Driver(); $res = $SmsDriver->send($params['mobile'], [ 'template_id' => $scene_config['sms_notice']['template_code'], 'param' => $this->setSmsParams($scene_config, $params), ]); + if (false === $res) { $this->updateSmsLog($this->sms_log['id'], SmsEnum::SEND_FAIL, $SmsDriver->getError()); throw new \Exception($SmsDriver->getError());