From 38be24aaa267951cfca84927e216a205b412f783 Mon Sep 17 00:00:00 2001 From: limu Date: Mon, 18 Dec 2023 16:36:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=B4=A1=E7=8C=AE=E5=80=BC?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/order/StoreOrderCreateRepository.php | 3 ++- .../store/order/StoreOrderRepository.php | 2 +- crmeb/jobs/OrderPartnerJob.php | 13 +++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index c70250f..315fbd5 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -1058,6 +1058,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $rate = bcmul($merchantCart['merchantCategory']['commission_rate'], 100, 4); } $user_address = isset($address) ? ($address['province'] . $address['city'] . $address['district'] . $address['street'] . $address['detail']) : ''; + //整理订单数据 $_order = [ 'cartInfo' => $merchantCart, @@ -1093,7 +1094,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository 'coupon_price' => bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2), 'platform_coupon_price' => $merchantCart['order']['platform_coupon_price'], 'pay_type' => $pay_type, - 'user_address_id' => $user_address['address_id'] ?? 0, + 'user_address_id' => $address['address_id'] ?? 0, ]; $allUseCoupon = array_merge($allUseCoupon, $merchantCart['order']['useCouponIds']); $orderList[] = $_order; diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index a847aa9..949b02e 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -745,7 +745,7 @@ class StoreOrderRepository extends BaseRepository $storeOrderStatusRepository->{$func}($orderStatus); }); //推送到贡献值结算队列 - Queue::push(OrderPartnerJob::class, compact('order')); + Queue::push(OrderPartnerJob::class, $order->toArray()); event('order.take', compact('order')); diff --git a/crmeb/jobs/OrderPartnerJob.php b/crmeb/jobs/OrderPartnerJob.php index 57ffe17..da90160 100644 --- a/crmeb/jobs/OrderPartnerJob.php +++ b/crmeb/jobs/OrderPartnerJob.php @@ -32,8 +32,9 @@ use app\common\repositories\user\UserAddressRepository; class OrderPartnerJob implements JobInterface { - public function fire($job,$data) + public function fire($job, $data) { + file_put_contents('/tmp/debug_partner', '开始处理贡献值订单:'.var_export($data, 1), 8); try { //初始化贡献值 $bao_price = $mian_price = $ping_price = $total_price = 0; @@ -201,7 +202,7 @@ class OrderPartnerJob implements JobInterface ->select()->toArray(); $role_ids = array_column($trade_roles, 'id'); - $trade_trade_data = array_column($trade_roles,null, 'id'); + $trade_trade_data = array_column($trade_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->whereIn('p.partner_id', $role_ids) @@ -244,8 +245,8 @@ class OrderPartnerJob implements JobInterface ->whereIn('area_id', $area_ids) ->select()->toArray(); - $role_ids = array_column($area_roles, 'id'); - $trade_trade_data = array_column($area_roles, null,'id'); + $role_ids = array_column($area_roles, 'id'); + $trade_trade_data = array_column($area_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->whereIn('p.partner_id', $role_ids) @@ -280,7 +281,7 @@ class OrderPartnerJob implements JobInterface ->where('status', 1) ->select()->toArray(); $role_ids = array_column($common_roles, 'id'); - $common_trade_data = array_column($common_roles, null,'id'); + $common_trade_data = array_column($common_roles, null, 'id'); $user_list = User::getDB()->alias('u') ->leftJoin('UserPartner p', 'u.uid = p.uid') ->field('u.*,p.partner_id') @@ -288,7 +289,7 @@ class OrderPartnerJob implements JobInterface ->where('u.uid', '<>', $data['uid']) ->select(); - if(!empty($user_list)){ + if (!empty($user_list)) { $user_list = $user_list->toArray(); $user_count = count($user_list); foreach ($user_list as $cuk => $cuv) {