From a4d21adea51cb10457434f30ad8b972d16709966 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 8 Oct 2024 20:32:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=9A=E7=9F=A5=E9=80=BB=E8=BE=91=E4=B8=AD=E7=9A=84?= =?UTF-8?q?openid=E8=8E=B7=E5=8F=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改了获取openid的方式,从用户认证表中查询openid,而不是直接使用订单信息中的openid - 增加了对openid的判断,只有在openid存在时才发送物流通知 - 优化了代码结构,提高了代码的可读性和维护性 --- app/common/logic/PayNotifyLogic.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index f744c12df..ebee3d311 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -25,6 +25,7 @@ use app\common\model\store_product_log\StoreProductLog; use app\common\model\system_store\SystemStore; use app\common\model\user\User; use app\common\model\user\UserAddress; +use app\common\model\user\UserAuth; use app\common\model\user\UserRecharge; use app\common\model\user_ship\UserShip; use app\common\model\user_sign\UserSign; @@ -273,8 +274,11 @@ class PayNotifyLogic extends BaseLogic // self::addUserSing($order); // self::dealProductLog($order); - if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { - Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'], 'logistics_type' => 4]); + if ($order->pay_type == 7) { + $openid=UserAuth::where('user_id',$order['uid'])->value('openid'); + if($openid){ + Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $openid, 'logistics_type' => 4]); + } } if ($order['pay_type'] == 9) { Db::name('wechat_micropay')->where(['order_id' => $order['order_id']])->delete();