From f6444a5b86b6ffa6fd10f45f0b87ac22c1e32bb1 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 11 Jun 2024 14:21:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=85=85=E5=80=BC?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=92=8C=E4=BC=98=E5=8C=96=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E8=B4=A7=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/logic/PayNotifyLogic.php | 6 ++++++ app/common/service/wechat/WeChatMnpService.php | 4 ++-- app/queue/redis/PushDeliverySend.php | 2 +- app/queue/redis/PushPlatformPrintSend.php | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 8f3bbbde8..1566bd94a 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -150,6 +150,9 @@ class PayNotifyLogic extends BaseLogic // self::afterPay($order,$extra['transaction_id']); } + /** + * 充值 + */ public static function recharge($orderSn, $extra = []) { $order = UserRecharge::where('order_id', $orderSn)->findOrEmpty(); @@ -177,6 +180,9 @@ class PayNotifyLogic extends BaseLogic //更新等级 self::dealLevel($uid, $user->total_recharge_amount); + if (!empty($extra['payer']['openid']) ) { + Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid'],'logistics_type'=>3], 5); + } return true; } diff --git a/app/common/service/wechat/WeChatMnpService.php b/app/common/service/wechat/WeChatMnpService.php index 360fd8249..6711cce72 100644 --- a/app/common/service/wechat/WeChatMnpService.php +++ b/app/common/service/wechat/WeChatMnpService.php @@ -100,7 +100,7 @@ class WeChatMnpService /** * @notes 发货 */ - public function delivery($order_id,$openid) + public function delivery($order_id,$openid,$logistics_type=3) { $token=Cache::get('mmp_access_token'); if(!$token){ @@ -114,7 +114,7 @@ class WeChatMnpService 'out_trade_no'=>$order_id, 'mchid'=>config('payment.wechat.default.mch_id') ], - 'logistics_type'=>2, + 'logistics_type'=>$logistics_type,//1、快递物流 2、同城配送 3、虚拟商品,例如话费充值,点卡等4、用户自提 'delivery_mode'=>'UNIFIED_DELIVERY', 'shipping_list'=>[ ['item_desc'=>'商品'] diff --git a/app/queue/redis/PushDeliverySend.php b/app/queue/redis/PushDeliverySend.php index 49dec1300..1509b1f9d 100644 --- a/app/queue/redis/PushDeliverySend.php +++ b/app/queue/redis/PushDeliverySend.php @@ -19,7 +19,7 @@ class PushDeliverySend implements Consumer // 消费 public function consume($data) { - (new WeChatMnpService)->delivery($data['order_id'], $data['openid']); + (new WeChatMnpService)->delivery($data['order_id'], $data['openid'],$data['logistics_type']??3); } public function onConsumeFailure(\Throwable $e, $package) diff --git a/app/queue/redis/PushPlatformPrintSend.php b/app/queue/redis/PushPlatformPrintSend.php index 3f3227728..43b28e447 100644 --- a/app/queue/redis/PushPlatformPrintSend.php +++ b/app/queue/redis/PushPlatformPrintSend.php @@ -3,6 +3,7 @@ namespace app\queue\redis; use app\admin\logic\operation\OpurchaseclassLogic; +use app\common\enum\PayEnum; use app\common\model\goods\Goods; use app\common\model\goods\Unit; use app\common\model\merchant\Merchant; @@ -46,6 +47,7 @@ class PushPlatformPrintSend implements Consumer $mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin',1)->field('staff_name,phone')->find(); $user = User::where('id', $find['uid'])->field('nickname,mobile')->find(); $find['system_store_name'] = $merchant['name']; + $find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']); $find['system_store_phone'] = $merchant['phone']; $find['staff_name'] = $mer_user_info['staff_name']; $find['staff_phone'] = $mer_user_info['phone'];