From cf0520f1e69a35ac11a4207d545a460df1c9cc2d Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 13 Jun 2024 09:35:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=92=8C=E6=94=AF=E4=BB=98=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=B9=B6=E6=9B=B4=E6=96=B0=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E5=8F=91=E9=80=81=E4=B8=AD=E7=9A=84=E5=95=86=E5=93=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/order/OrderLogic.php | 45 ++-------------------------- app/common/logic/PayNotifyLogic.php | 4 +-- app/queue/redis/StoreStorageSend.php | 4 ++- 3 files changed, 7 insertions(+), 46 deletions(-) diff --git a/app/api/logic/order/OrderLogic.php b/app/api/logic/order/OrderLogic.php index d7e64fbc..9713a59a 100644 --- a/app/api/logic/order/OrderLogic.php +++ b/app/api/logic/order/OrderLogic.php @@ -97,14 +97,11 @@ class OrderLogic extends BaseLogic $cart_select[$k]['old_cart_id'] = $v['id']; $cart_select[$k]['cart_num'] = $v['cart_num']; $cart_select[$k]['verify_code'] = $params['verify_code'] ?? ''; + $cartInfo = $cart_select[$k]; $cartInfo['name'] = $find['store_name']; $cartInfo['image'] = $find['image']; - //计算好vip价格 - // $vipPrice = self::dealVip($find['price']); - // if ($vipPrice) { - // $cartInfo['price'] = $vipPrice; - // } + $cartInfo['vip_price'] = 0; //$cart_select[$k]['total'] - $vipPrice ?? 0; $cart_select[$k]['cart_info'] = json_encode($cartInfo); $cart_select[$k]['branch_product_id'] = $find['branch_product_id']; @@ -120,45 +117,7 @@ class OrderLogic extends BaseLogic } //TODO 收单打9.9折 会员按照比例打折 等级按照充值去升级 $pay_price = self::$pay_price; - // $check = StoreOrder::where('uid',\request()->userId)->count();//首单逻辑 $vipPrice = 0; - // if (isset($check) && $check['status'] == 1) { - // $discountRate = '0.99';//首单逻辑 - // $pay_price 是价格 - // $discountRate = $check['remark'];//折扣 - // $discountRate = bcdiv($discountRate, '10', 2); - // $pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2); - // } else { - /* $userVip = User::where('id', \request()->userId)->value('user_ship'); - if ($userVip) { - switch ($userVip) { - case UserShipEnum::VIP1: - $discountRate = UserShip::where('id', UserShipEnum::VIP1)->value('discount'); - break; - case UserShipEnum::VIP2: - $discountRate = UserShip::where('id', UserShipEnum::VIP2)->value('discount'); - break; - case UserShipEnum::VIP3: - $discountRate = UserShip::where('id', UserShipEnum::VIP3)->value('discount'); - break; - case UserShipEnum::VIP4: - $discountRate = UserShip::where('id', UserShipEnum::VIP4)->value('discount'); - break; - case UserShipEnum::VIP5: - $discountRate = UserShip::where('id', UserShipEnum::VIP5)->value('discount'); - break; - default: - $discountRate = 1; - } - $discountRate = bcdiv($discountRate, '100', 2); - $pay_price = bcdiv(bcmul($pay_price, $discountRate, 4), '1', 2); - }*/ - // } - // if (!empty(self::$total) && !empty($pay_price)) { - // bcscale(2); - // $vipPrice = bcsub(self::$total, $pay_price, 2); - // } - //成本价 收益 $order = [ 'create_time' => time(), diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 5dbdc490..49338f54 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -125,9 +125,9 @@ class PayNotifyLogic extends BaseLogic PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); } else { PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); - Redis::send('push-platform-print', ['id' => $order['id']], 60); // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); } + Redis::send('push-platform-print', ['id' => $order['id']], 60); if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5); } @@ -241,8 +241,8 @@ class PayNotifyLogic extends BaseLogic PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); } else { PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); - Redis::send('push-platform-print', ['id' => $order['id']], 60); } + Redis::send('push-platform-print', ['id' => $order['id']], 60); return true; } diff --git a/app/queue/redis/StoreStorageSend.php b/app/queue/redis/StoreStorageSend.php index 6d58da70..7ceab499 100644 --- a/app/queue/redis/StoreStorageSend.php +++ b/app/queue/redis/StoreStorageSend.php @@ -45,8 +45,10 @@ class StoreStorageSend implements Consumer 'bar_code' => $find['bar_code'], 'cate_id' => $find['cate_id'], 'price' => $find['price'], - 'unit' => $find['unit'], 'cost' => $find['cost'], + 'vip_price' => $find['vip_price'], + 'vip_ot_price' => $find['vip_ot_price'], + 'unit' => $find['unit'], 'store_id' => $store_id, 'sales' => 0, 'stock' => 0,