From fb5feb075971a16aa34489c7895525e6273688fa Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Thu, 15 Jun 2023 11:32:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Logic/Notice/External/AccountLogin.php | 13 ++----------- .../Logic/Notice/External/ConsultReply.php | 13 +++---------- .../Logic/Notice/External/LiveBegin.php | 16 +++------------- .../Logic/Notice/External/OrderFinish.php | 13 +++---------- .../Logic/Notice/External/PointGoodsDeliver.php | 17 +++++------------ .../Logic/Notice/External/RefundFinish.php | 13 +++---------- .../Logic/Notice/External/Sms/ConsultReply.php | 6 ++---- .../Logic/Notice/External/Sms/GoodsDeliver.php | 10 ++++------ .../Logic/Notice/External/Sms/LiveBegin.php | 10 ++++------ .../Logic/Notice/External/Sms/OrderFinish.php | 6 ++---- .../Logic/Notice/External/Sms/RefundFinish.php | 6 ++---- .../Notice/External/WeChat/AccountLogin.php | 13 +++++++++---- .../Notice/External/WeChat/ConsultReply.php | 13 +++++++++---- .../Notice/External/WeChat/GoodsDeliver.php | 12 ++++++++---- .../Logic/Notice/External/WeChat/LiveBegin.php | 13 +++++++++---- .../Notice/External/WeChat/OrderFinish.php | 12 ++++++++---- .../Notice/External/WeChat/RefundFinish.php | 11 ++++++++--- 17 files changed, 84 insertions(+), 113 deletions(-) diff --git a/app/Services/Logic/Notice/External/AccountLogin.php b/app/Services/Logic/Notice/External/AccountLogin.php index 3b146df7..9d63913d 100644 --- a/app/Services/Logic/Notice/External/AccountLogin.php +++ b/app/Services/Logic/Notice/External/AccountLogin.php @@ -9,7 +9,6 @@ namespace App\Services\Logic\Notice\External; use App\Models\Task as TaskModel; use App\Models\User as UserModel; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\WeChat\AccountLogin as WeChatAccountLoginNotice; use App\Services\Logic\Service as LogicService; use App\Traits\Client as ClientTrait; @@ -23,19 +22,11 @@ class AccountLogin extends LogicService { $wechatNoticeEnabled = $this->wechatNoticeEnabled(); - if (!$wechatNoticeEnabled) return; - $params = $task->item_info; - $userId = $task->item_info['user']['id']; - - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($userId); - - if ($subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatAccountLoginNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } } diff --git a/app/Services/Logic/Notice/External/ConsultReply.php b/app/Services/Logic/Notice/External/ConsultReply.php index a5d7a35a..991d4920 100644 --- a/app/Services/Logic/Notice/External/ConsultReply.php +++ b/app/Services/Logic/Notice/External/ConsultReply.php @@ -12,7 +12,6 @@ use App\Models\Task as TaskModel; use App\Repos\Consult as ConsultRepo; use App\Repos\Course as CourseRepo; use App\Repos\User as UserRepo; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\Sms\ConsultReply as SmsConsultReplyNotice; use App\Services\Logic\Notice\External\WeChat\ConsultReply as WeChatConsultReplyNotice; use App\Services\Logic\Service as LogicService; @@ -25,8 +24,6 @@ class ConsultReply extends LogicService $wechatNoticeEnabled = $this->wechatNoticeEnabled(); $smsNoticeEnabled = $this->smsNoticeEnabled(); - if (!$wechatNoticeEnabled && !$smsNoticeEnabled) return; - $consultId = $task->item_info['consult']['id']; $consultRepo = new ConsultRepo(); @@ -65,18 +62,14 @@ class ConsultReply extends LogicService ], ]; - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($consult->owner_id); - - if ($wechatNoticeEnabled && $subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatConsultReplyNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } if ($smsNoticeEnabled) { $notice = new SmsConsultReplyNotice(); - $notice->handle($user, $params); + $notice->handle($params); } } diff --git a/app/Services/Logic/Notice/External/LiveBegin.php b/app/Services/Logic/Notice/External/LiveBegin.php index 84633e69..0461736c 100644 --- a/app/Services/Logic/Notice/External/LiveBegin.php +++ b/app/Services/Logic/Notice/External/LiveBegin.php @@ -13,7 +13,6 @@ use App\Models\Task as TaskModel; use App\Repos\Chapter as ChapterRepo; use App\Repos\Course as CourseRepo; use App\Repos\User as UserRepo; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\Sms\LiveBegin as SmsLiveBeginNotice; use App\Services\Logic\Notice\External\WeChat\LiveBegin as WeChatLiveBeginNotice; use App\Services\Logic\Service as LogicService; @@ -26,8 +25,6 @@ class LiveBegin extends LogicService $wechatNoticeEnabled = $this->wechatNoticeEnabled(); $smsNoticeEnabled = $this->smsNoticeEnabled(); - if (!$wechatNoticeEnabled && !$smsNoticeEnabled) return; - $courseUser = $task->item_info['course_user']; $chapterId = $task->item_info['chapter']['id']; @@ -60,21 +57,16 @@ class LiveBegin extends LogicService 'start_time' => $chapter->attrs['start_time'], 'end_time' => $chapter->attrs['end_time'], ], - 'course_user' => $courseUser, ]; - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($user->id); - - if ($wechatNoticeEnabled && $subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatLiveBeginNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } if ($smsNoticeEnabled) { $notice = new SmsLiveBeginNotice(); - $notice->handle($user, $params); + $notice->handle($params); } } @@ -91,8 +83,6 @@ class LiveBegin extends LogicService 'course_user' => [ 'course_id' => $courseUser->course_id, 'user_id' => $courseUser->user_id, - 'role_type' => $courseUser->role_type, - 'source_type' => $courseUser->role_type, ], 'chapter' => [ 'id' => $chapter->id, diff --git a/app/Services/Logic/Notice/External/OrderFinish.php b/app/Services/Logic/Notice/External/OrderFinish.php index 05ffd272..789138d0 100644 --- a/app/Services/Logic/Notice/External/OrderFinish.php +++ b/app/Services/Logic/Notice/External/OrderFinish.php @@ -11,7 +11,6 @@ use App\Models\Order as OrderModel; use App\Models\Task as TaskModel; use App\Repos\Order as OrderRepo; use App\Repos\User as UserRepo; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\Sms\OrderFinish as SmsOrderFinishNotice; use App\Services\Logic\Notice\External\WeChat\OrderFinish as WeChatOrderFinishNotice; use App\Services\Logic\Service as LogicService; @@ -24,8 +23,6 @@ class OrderFinish extends LogicService $wechatNoticeEnabled = $this->wechatNoticeEnabled(); $smsNoticeEnabled = $this->smsNoticeEnabled(); - if (!$wechatNoticeEnabled && !$smsNoticeEnabled) return; - $orderId = $task->item_info['order']['id']; $orderRepo = new OrderRepo(); @@ -50,18 +47,14 @@ class OrderFinish extends LogicService ], ]; - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($order->owner_id); - - if ($wechatNoticeEnabled && $subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatOrderFinishNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } if ($smsNoticeEnabled) { $notice = new SmsOrderFinishNotice(); - $notice->handle($user, $params); + $notice->handle($params); } } diff --git a/app/Services/Logic/Notice/External/PointGoodsDeliver.php b/app/Services/Logic/Notice/External/PointGoodsDeliver.php index ab886944..f299cd21 100644 --- a/app/Services/Logic/Notice/External/PointGoodsDeliver.php +++ b/app/Services/Logic/Notice/External/PointGoodsDeliver.php @@ -11,7 +11,6 @@ use App\Models\PointGiftRedeem as PointGiftRedeemModel; use App\Models\Task as TaskModel; use App\Repos\PointGiftRedeem as PointGiftRedeemRepo; use App\Repos\User as UserRepo; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\Sms\GoodsDeliver as SmsGoodsDeliverNotice; use App\Services\Logic\Notice\External\WeChat\GoodsDeliver as WeChatGoodsDeliverNotice; use App\Services\Logic\Service as LogicService; @@ -24,9 +23,7 @@ class PointGoodsDeliver extends LogicService $wechatNoticeEnabled = $this->wechatNoticeEnabled(); $smsNoticeEnabled = $this->smsNoticeEnabled(); - if (!$wechatNoticeEnabled && !$smsNoticeEnabled) return; - - $redeemId = $task->item_info['point_redeem']['id']; + $redeemId = $task->item_info['redeem']['id']; $redeemRepo = new PointGiftRedeemRepo(); @@ -46,18 +43,14 @@ class PointGoodsDeliver extends LogicService 'deliver_time' => time(), ]; - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($user->id); - - if ($wechatNoticeEnabled && $subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatGoodsDeliverNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } if ($smsNoticeEnabled) { $notice = new SmsGoodsDeliverNotice(); - $notice->handle($user, $params); + $notice->handle($params); } } @@ -71,7 +64,7 @@ class PointGoodsDeliver extends LogicService $task = new TaskModel(); $itemInfo = [ - 'point_gift_redeem' => ['id' => $redeem->id], + 'redeem' => ['id' => $redeem->id], ]; $task->item_id = $redeem->id; diff --git a/app/Services/Logic/Notice/External/RefundFinish.php b/app/Services/Logic/Notice/External/RefundFinish.php index baaefe5f..104c4720 100644 --- a/app/Services/Logic/Notice/External/RefundFinish.php +++ b/app/Services/Logic/Notice/External/RefundFinish.php @@ -11,7 +11,6 @@ use App\Models\Refund as RefundModel; use App\Models\Task as TaskModel; use App\Repos\Refund as RefundRepo; use App\Repos\User as UserRepo; -use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\Logic\Notice\External\Sms\RefundFinish as SmsRefundFinishNotice; use App\Services\Logic\Notice\External\WeChat\RefundFinish as WeChatRefundFinishNotice; use App\Services\Logic\Service as LogicService; @@ -24,8 +23,6 @@ class RefundFinish extends LogicService $wechatNoticeEnabled = $this->wechatNoticeEnabled(); $smsNoticeEnabled = $this->smsNoticeEnabled(); - if (!$wechatNoticeEnabled && !$smsNoticeEnabled) return; - $refundId = $task->item_info['refund']['id']; $refundRepo = new RefundRepo(); @@ -50,18 +47,14 @@ class RefundFinish extends LogicService ], ]; - $subscribeRepo = new WeChatSubscribeRepo(); - - $subscribe = $subscribeRepo->findByUserId($refund->owner_id); - - if ($wechatNoticeEnabled && $subscribe) { + if ($wechatNoticeEnabled) { $notice = new WeChatRefundFinishNotice(); - $notice->handle($subscribe, $params); + $notice->handle($params); } if ($smsNoticeEnabled) { $notice = new SmsRefundFinishNotice(); - $notice->handle($user, $params); + $notice->handle($params); } } diff --git a/app/Services/Logic/Notice/External/Sms/ConsultReply.php b/app/Services/Logic/Notice/External/Sms/ConsultReply.php index 74ee6a63..ab75219c 100644 --- a/app/Services/Logic/Notice/External/Sms/ConsultReply.php +++ b/app/Services/Logic/Notice/External/Sms/ConsultReply.php @@ -7,7 +7,6 @@ namespace App\Services\Logic\Notice\External\Sms; -use App\Models\User as UserModel; use App\Repos\Account as AccountRepo; use App\Services\Smser; @@ -17,15 +16,14 @@ class ConsultReply extends Smser protected $templateCode = 'consult_reply'; /** - * @param UserModel $user * @param array $params * @return bool|null */ - public function handle(UserModel $user, array $params) + public function handle(array $params) { $accountRepo = new AccountRepo(); - $account = $accountRepo->findById($user->id); + $account = $accountRepo->findById($params['user']['id']); if (!$account->phone) return null; diff --git a/app/Services/Logic/Notice/External/Sms/GoodsDeliver.php b/app/Services/Logic/Notice/External/Sms/GoodsDeliver.php index 69324c56..a83e9fc8 100644 --- a/app/Services/Logic/Notice/External/Sms/GoodsDeliver.php +++ b/app/Services/Logic/Notice/External/Sms/GoodsDeliver.php @@ -7,7 +7,6 @@ namespace App\Services\Logic\Notice\External\Sms; -use App\Models\User as UserModel; use App\Repos\Account as AccountRepo; use App\Services\Smser; @@ -17,22 +16,21 @@ class GoodsDeliver extends Smser protected $templateCode = 'goods_deliver'; /** - * @param UserModel $user * @param array $params * @return bool|null */ - public function handle(UserModel $user, array $params) + public function handle(array $params) { - $params['deliver_time'] = date('Y-m-d H:i', $params['deliver_time']); - $accountRepo = new AccountRepo(); - $account = $accountRepo->findById($user->id); + $account = $accountRepo->findById($params['user']['id']); if (!$account->phone) return null; $templateId = $this->getTemplateId($this->templateCode); + $params['deliver_time'] = date('Y-m-d H:i', $params['deliver_time']); + $params = [ $params['goods_name'], $params['order_sn'], diff --git a/app/Services/Logic/Notice/External/Sms/LiveBegin.php b/app/Services/Logic/Notice/External/Sms/LiveBegin.php index 0ee9bf9f..fef22b23 100644 --- a/app/Services/Logic/Notice/External/Sms/LiveBegin.php +++ b/app/Services/Logic/Notice/External/Sms/LiveBegin.php @@ -7,7 +7,6 @@ namespace App\Services\Logic\Notice\External\Sms; -use App\Models\User as UserModel; use App\Repos\Account as AccountRepo; use App\Services\Smser; @@ -17,20 +16,19 @@ class LiveBegin extends Smser protected $templateCode = 'live_begin'; /** - * @param UserModel $user * @param array $params * @return bool|null */ - public function handle(UserModel $user, array $params) + public function handle(array $params) { - $params['live']['start_time'] = date('H:i', $params['live']['start_time']); - $accountRepo = new AccountRepo(); - $account = $accountRepo->findById($user->id); + $account = $accountRepo->findById($params['user']['id']); if (!$account->phone) return null; + $params['live']['start_time'] = date('H:i', $params['live']['start_time']); + $params = [ $params['course']['title'], $params['chapter']['title'], diff --git a/app/Services/Logic/Notice/External/Sms/OrderFinish.php b/app/Services/Logic/Notice/External/Sms/OrderFinish.php index 8ae436f6..881e1c76 100644 --- a/app/Services/Logic/Notice/External/Sms/OrderFinish.php +++ b/app/Services/Logic/Notice/External/Sms/OrderFinish.php @@ -7,7 +7,6 @@ namespace App\Services\Logic\Notice\External\Sms; -use App\Models\User as UserModel; use App\Repos\Account as AccountRepo; use App\Services\Smser; @@ -17,15 +16,14 @@ class OrderFinish extends Smser protected $templateCode = 'order_finish'; /** - * @param UserModel $user * @param array $params * @return bool|null */ - public function handle(UserModel $user, array $params) + public function handle(array $params) { $accountRepo = new AccountRepo(); - $account = $accountRepo->findById($user->id); + $account = $accountRepo->findById($params['user']['id']); if (!$account->phone) return null; diff --git a/app/Services/Logic/Notice/External/Sms/RefundFinish.php b/app/Services/Logic/Notice/External/Sms/RefundFinish.php index 2d7c59b3..a059a623 100644 --- a/app/Services/Logic/Notice/External/Sms/RefundFinish.php +++ b/app/Services/Logic/Notice/External/Sms/RefundFinish.php @@ -7,7 +7,6 @@ namespace App\Services\Logic\Notice\External\Sms; -use App\Models\User as UserModel; use App\Repos\Account as AccountRepo; use App\Services\Smser; @@ -17,15 +16,14 @@ class RefundFinish extends Smser protected $templateCode = 'refund_finish'; /** - * @param UserModel $user * @param array $params * @return bool|null */ - public function handle(UserModel $user, array $params) + public function handle(array $params) { $accountRepo = new AccountRepo(); - $account = $accountRepo->findById($user->id); + $account = $accountRepo->findById($params['user']['id']); if (!$account->phone) return null; diff --git a/app/Services/Logic/Notice/External/WeChat/AccountLogin.php b/app/Services/Logic/Notice/External/WeChat/AccountLogin.php index 09410124..36208a08 100644 --- a/app/Services/Logic/Notice/External/WeChat/AccountLogin.php +++ b/app/Services/Logic/Notice/External/WeChat/AccountLogin.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class AccountLogin extends WeChatNotice @@ -16,12 +16,17 @@ class AccountLogin extends WeChatNotice protected $templateCode = 'account_login'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params - * @return bool + * @return bool|null */ - public function handle(WeChatSubscribeModel $subscribe, array $params) + public function handle(array $params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; + $first = '你好,登录系统成功!'; $remark = '如果非本人操作,请立即修改密码哦!'; diff --git a/app/Services/Logic/Notice/External/WeChat/ConsultReply.php b/app/Services/Logic/Notice/External/WeChat/ConsultReply.php index ad13f2c3..330dfbc2 100644 --- a/app/Services/Logic/Notice/External/WeChat/ConsultReply.php +++ b/app/Services/Logic/Notice/External/WeChat/ConsultReply.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class ConsultReply extends WeChatNotice @@ -16,12 +16,17 @@ class ConsultReply extends WeChatNotice protected $templateCode = 'consult_reply'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params - * @return bool + * @return bool|null */ - public function handle(WeChatSubscribeModel $subscribe, array $params) + public function handle(array $params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; + $first = sprintf('%s 回复了你的咨询!', $params['replier']['name']); $remark = '如果还有其它疑问,请和我们保持联系哦!'; diff --git a/app/Services/Logic/Notice/External/WeChat/GoodsDeliver.php b/app/Services/Logic/Notice/External/WeChat/GoodsDeliver.php index 7d61787d..70304e3b 100644 --- a/app/Services/Logic/Notice/External/WeChat/GoodsDeliver.php +++ b/app/Services/Logic/Notice/External/WeChat/GoodsDeliver.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class GoodsDeliver extends WeChatNotice @@ -16,12 +16,16 @@ class GoodsDeliver extends WeChatNotice protected $templateCode = 'goods_deliver'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params - * @return bool + * @return bool|null */ - public function handle(WeChatSubscribeModel $subscribe, $params) + public function handle($params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; $first = '发货已处理完成!'; $remark = '感谢您的支持,有疑问请联系客服哦!'; diff --git a/app/Services/Logic/Notice/External/WeChat/LiveBegin.php b/app/Services/Logic/Notice/External/WeChat/LiveBegin.php index 228e9d2d..3db3d77f 100644 --- a/app/Services/Logic/Notice/External/WeChat/LiveBegin.php +++ b/app/Services/Logic/Notice/External/WeChat/LiveBegin.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class LiveBegin extends WeChatNotice @@ -16,12 +16,17 @@ class LiveBegin extends WeChatNotice protected $templateCode = 'live_begin'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params - * @return bool + * @return bool|null */ - public function handle(WeChatSubscribeModel $subscribe, array $params) + public function handle(array $params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; + $first = '你参与的课程直播就要开始了!'; $startTime = date('H:i', $params['live']['start_time']); diff --git a/app/Services/Logic/Notice/External/WeChat/OrderFinish.php b/app/Services/Logic/Notice/External/WeChat/OrderFinish.php index a8927dcc..b242b881 100644 --- a/app/Services/Logic/Notice/External/WeChat/OrderFinish.php +++ b/app/Services/Logic/Notice/External/WeChat/OrderFinish.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class OrderFinish extends WeChatNotice @@ -16,12 +16,16 @@ class OrderFinish extends WeChatNotice protected $templateCode = 'order_finish'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params - * @return bool + * @return bool|null */ - public function handle(WeChatSubscribeModel $subscribe, $params) + public function handle($params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; $first = '订单已处理完成!'; $remark = '感谢您的支持,有疑问请联系客服哦!'; diff --git a/app/Services/Logic/Notice/External/WeChat/RefundFinish.php b/app/Services/Logic/Notice/External/WeChat/RefundFinish.php index 11d4e91c..da710593 100644 --- a/app/Services/Logic/Notice/External/WeChat/RefundFinish.php +++ b/app/Services/Logic/Notice/External/WeChat/RefundFinish.php @@ -7,7 +7,7 @@ namespace App\Services\Logic\Notice\External\WeChat; -use App\Models\WeChatSubscribe as WeChatSubscribeModel; +use App\Repos\WeChatSubscribe as WeChatSubscribeRepo; use App\Services\WeChatNotice; class RefundFinish extends WeChatNotice @@ -16,12 +16,17 @@ class RefundFinish extends WeChatNotice protected $templateCode = 'refund_finish'; /** - * @param WeChatSubscribeModel $subscribe * @param array $params * @return bool */ - public function handle(WeChatSubscribeModel $subscribe, array $params) + public function handle(array $params) { + $subscribeRepo = new WeChatSubscribeRepo(); + + $subscribe = $subscribeRepo->findByUserId($params['user']['id']); + + if (!$subscribe) return null; + $first = '退款已处理完成!'; $remark = '感谢您的支持,有疑问请联系客服哦!';