From 764173a22d39fae53b80fcfc31286255d84e4351 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Fri, 7 Jun 2024 15:41:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E5=95=86=E6=88=B7?= =?UTF-8?q?=E8=BF=9B=E8=B4=A7=20=E6=94=AF=E6=8C=81=E4=BD=BF=E7=94=A8=20?= =?UTF-8?q?=E5=86=A0=E5=90=8D=E5=93=81=E7=89=8C=E9=A2=9D=E5=BA=A6=E5=92=8C?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E5=93=81=E7=89=8C=E9=A2=9D=E5=BA=A6=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=8A=B5=E6=89=A3=EF=BC=8C=E4=BD=86=E6=98=AF=E6=AF=8F?= =?UTF-8?q?=E7=A7=8D=E5=93=81=E7=89=8C=E9=A2=9D=E5=BA=A6=E4=BB=85=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E6=8A=B5=E6=89=A3=E5=90=8C=E5=93=81=E7=89=8C=E7=9A=84?= =?UTF-8?q?=E5=95=86=E5=93=81=EF=BC=8C=E9=A2=9D=E5=BA=A6=E4=B8=8D=E8=B6=B3?= =?UTF-8?q?=E6=97=B6=E9=9C=80=E8=A6=81=E8=BF=9B=E8=A1=8C=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/dao/store/order/StoreCartDao.php | 12 +- app/common/dao/store/product/ProductDao.php | 9 +- .../order/StoreOrderCreateRepository.php | 124 ++++++++++++++---- .../product/SupplierProductRepository.php | 6 +- .../merchant/MerchantQuotaRepository.php | 40 +++++- app/controller/api/Supplier.php | 7 +- .../api/store/merchant/Merchant.php | 25 +++- .../exchangeQuota/OrderPaySuccessEvent.php | 17 +-- route/api.php | 3 +- 9 files changed, 192 insertions(+), 51 deletions(-) diff --git a/app/common/dao/store/order/StoreCartDao.php b/app/common/dao/store/order/StoreCartDao.php index 19dab48..554f011 100644 --- a/app/common/dao/store/order/StoreCartDao.php +++ b/app/common/dao/store/order/StoreCartDao.php @@ -92,7 +92,12 @@ class StoreCartDao extends BaseDao }) ->with([ 'product' => function(Relation $query) use ($address){ - $query->field('product_id,cate_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,temp_id,give_coupon_ids,is_gift_bag,is_used,product_type,old_product_id,integral_rate,delivery_way,delivery_free,type,extend,pay_limit,once_max_count,once_min_count,mer_svip_status,svip_price_type,refund_switch,integral_give_switch,integral_give_set,integral_give_type,integral_give_rate,integral_give_money,integral_deduction_type,integral_deduction_money'); + $query->field('brand_id,product_id,cate_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,temp_id,give_coupon_ids,is_gift_bag,is_used,product_type,old_product_id,integral_rate,delivery_way,delivery_free,type,extend,pay_limit,once_max_count,once_min_count,mer_svip_status,svip_price_type,refund_switch,integral_give_switch,integral_give_set,integral_give_type,integral_give_rate,integral_give_money,integral_deduction_type,integral_deduction_money') + ->with([ + 'brand'=>function($query){ + $query->bind(['brand_name']); + } + ]); if($address){ $cityIds = array_filter([$address->province_id,$address->city_id,$address->district_id,$address->street_id]); $query->with([ @@ -119,7 +124,10 @@ class StoreCartDao extends BaseDao $query->order('shipping_template_free_id DESC') ->withLimit(1); } - ] + ], + 'brand'=>function($query){ + $query->bind(['brand_name']); + } ]); } }, diff --git a/app/common/dao/store/product/ProductDao.php b/app/common/dao/store/product/ProductDao.php index acf0a07..fb302ad 100644 --- a/app/common/dao/store/product/ProductDao.php +++ b/app/common/dao/store/product/ProductDao.php @@ -482,7 +482,14 @@ class ProductDao extends BaseDao public function getFailProduct(int $productId) { - return $this->getModel()::withTrashed()->field('product_type,product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used')->find($productId); + return $this->getModel()::withTrashed() + ->field('product_type,product_id,image,store_name,is_show,status,is_del,unit_name,price,mer_status,is_used,brand_id') + ->with([ + 'brand'=>function($query){ + $query->bind(['brand_name']); + } + ]) + ->find($productId); } public function geTrashedtProduct(int $id) diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index ebc440b..50df4f9 100644 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -7,6 +7,8 @@ use app\common\model\user\ExchangeIntegralRecord; use app\common\model\user\ExchangeQuotaRecord; use app\common\model\user\User; use app\common\repositories\system\config\ConfigValueRepository; +use app\common\repositories\system\merchant\MerchantQuotaRecordRepository; +use app\common\repositories\system\merchant\MerchantQuotaRepository; use crmeb\jobs\SendSmsJob; use crmeb\services\SwooleTaskService; use think\exception\ValidateException; @@ -732,9 +734,15 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ $orderTotalWineDiffMoney = 0;// 订单总差价 $orderTotalWineDiffMoneyPrice = 0;// 订单总补差价支付金额 $orderTotalRandomReduction = 0;// 订单总随机立减金额 - $orderTotalMerQuota = 0;// 进货订单-补货额度抵扣金额 + $orderTotalMerTitleQuota = 0;// 进货订单 - 补货额度 - 冠名品牌抵扣额度(总) + $orderTotalMerOtherQuota = 0;// 进货订单 - 补货额度 - 其他品牌抵扣额度(总) + // 获取当前进货商户的补货额度 - $merQuotaSurplus = app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$with_goods_mer_id])->value('quota_surplus'); + $merQuotaInfo = app()->make(MerchantQuotaRepository::class)->getMerQuotaAndBrandInfo((int)$with_goods_mer_id); + $titleSurplusQuota = $merQuotaInfo['title_surplus_quota'] ?? 0; + $otherSurplusQuota = $merQuotaInfo['other_surplus_quota'] ?? 0; + $merBrandName = $merQuotaInfo['mer_brand_name'] ?? ''; + foreach($merchantCartList as &$merchantCart){ $merchantCart['take'] = [ @@ -760,26 +768,38 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ $merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']); $integralFlag = $useIntegral && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0 && $merIntegralConfig['mer_integral_status']; - $orderWineIntegral = 0;// 当前订单使用的酒水卡积分 $orderWineIntegralPrice = 0;// 当前订单使用就是快积分抵扣的金额 $orderWineDiffMoney = 0;// 当前订单差价 $orderWineDiffMoneyPrice = 0;// 当前订单补差价支付金额 $orderRandomReduction = 0;//当前订单随机立减金额 - $orderMerQuota = 0;// 进货订单-补货额度抵扣金额 + $orderMerTitleQuota = 0;// 进货订单 - 补货额度 - 冠名品牌抵扣额度(本订单) + $orderMerOtherQuota = 0;// 进货订单 - 补货额度 - 其他品牌抵扣额度(本订单) //计算积分抵扣 foreach($merchantCart['list'] as &$cart){ if($cart['product_type'] == 35){ - // 进货订单 - $deductionAmount = (float)$merQuotaSurplus >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$merQuotaSurplus;// 实际抵扣金额 - $merQuotaSurplus = bcsub((float)$merQuotaSurplus,(float)$deductionAmount,2);// 剩余补货额度 - $cart['mer_quota_deduction'] = $deductionAmount; + // 进货订单 根据品牌类型进行判断:使用冠名品牌额度 or 其他品牌额度 + $brandName = $cart->product->brand_name ?? ''; + if($merBrandName && $merBrandName == $brandName){ + // 冠名品牌 + $deductionAmount = (float)$titleSurplusQuota >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$titleSurplusQuota;// 实际抵扣金额 + $titleSurplusQuota = bcsub((float)$titleSurplusQuota,(float)$deductionAmount,2);// 剩余冠名品牌补货额度 + $cart['mer_quota_title'] = $deductionAmount; + // 当前订单使用的补货额度及抵扣金额 + $orderMerTitleQuota = bcadd($orderMerTitleQuota,$deductionAmount,2); + }else{ + // 其他品牌 + $deductionAmount = (float)$otherSurplusQuota >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$otherSurplusQuota;// 实际抵扣金额 + $otherSurplusQuota = bcsub((float)$otherSurplusQuota,(float)$deductionAmount,2);// 剩余其他品牌补货额度 + $cart['mer_quota_other'] = $deductionAmount; + // 当前订单使用的补货额度及抵扣金额 + $orderMerOtherQuota = bcadd($orderMerOtherQuota,$deductionAmount,2); + } + // 订单总支付金额 先减去抵扣金额 $merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'],$deductionAmount,2); // 当前商品剩余应支付金额 $cart['true_price'] = bcsub($cart['true_price'],$deductionAmount,2); - // 当前订单使用的补货额度及抵扣金额 - $orderMerQuota = bcadd($orderMerQuota,$deductionAmount,2); } else if($cart['product_type'] == 36){ // 兑换酒道馆商品时 酒水卡积分抵扣处理 @@ -880,7 +900,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ $orderTotalRandomReduction = bcadd($orderTotalRandomReduction,$orderRandomReduction,2); $orderTotalWineDiffMoney = bcadd($orderTotalWineDiffMoney,$orderWineDiffMoney,2); $orderTotalWineDiffMoneyPrice = bcadd($orderTotalWineDiffMoneyPrice,$orderWineDiffMoneyPrice,2); - $orderTotalMerQuota = bcadd($orderTotalMerQuota,$orderMerQuota,2); + // 订单使用的补货额度 + $orderTotalMerTitleQuota = bcadd($orderTotalMerTitleQuota,$orderMerTitleQuota,2); + $orderTotalMerOtherQuota = bcadd($orderTotalMerOtherQuota,$orderMerOtherQuota,2); + $_pay_price = $merchantCart['order']['true_price']; $valid_total_price = $merchantCart['order']['valid_total_price']; @@ -930,7 +953,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ $merchantCart['order']['pay_price'] = $pay_price; $merchantCart['order']['coupon_price'] = $coupon_price; $merchantCart['order']['random_reduction'] = $orderRandomReduction; - $merchantCart['order']['mer_quota_deduction'] = $orderMerQuota; + $merchantCart['order']['mer_quota_title'] = $orderMerTitleQuota; + $merchantCart['order']['mer_quota_other'] = $orderMerOtherQuota; $order_price = bcadd($order_price,$pay_price,2); $order_total_price = bcadd($order_total_price,$total_price,2); @@ -978,7 +1002,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ 'orderTotalWineDiffMoney', 'orderTotalWineDiffMoneyPrice', 'orderTotalRandomReduction', - 'orderTotalMerQuota', + 'orderTotalMerOtherQuota', + 'orderTotalMerTitleQuota', 'order_total_give_integral', 'order_svip_discount', @@ -1198,7 +1223,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ // 随机立减金额 'random_reduction' => $merchantCart['order']['random_reduction'] ?? 0, // 进货订单 - 补货额度抵扣金额 - 'mer_quota_deduction' => $merchantCart['order']['mer_quota_deduction'] ?? 0, + 'mer_quota_title' => $merchantCart['order']['mer_quota_title'] ?? 0, + 'mer_quota_other' => $merchantCart['order']['mer_quota_other'] ?? 0, ]; $allUseCoupon = array_merge($allUseCoupon,$merchantCart['order']['useCouponIds']); @@ -1237,7 +1263,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ // 随机立减金额 'random_reduction' => $orderInfo['orderTotalRandomReduction'] ?? 0, // 进货订单 - 补货额度抵扣金额 - 'mer_quota_deduction' => $orderInfo['mer_quota_deduction'] ?? 0, + 'mer_quota_title' => $orderInfo['orderTotalMerTitleQuota'] ?? 0, + 'mer_quota_other' => $orderInfo['orderTotalMerOtherQuota'] ?? 0, ]; event('order.create.before',compact('groupOrder','orderList')); @@ -1297,9 +1324,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ } } } - if($orderInfo['order_type'] == 10 && !app() - ->make(StoreDiscountRepository::class) - ->decStock($orderList[0]['cartInfo']['list'][0]['source_id'])){ + if($orderInfo['order_type'] == 10 && !app()->make(StoreDiscountRepository::class)->decStock($orderList[0]['cartInfo']['list'][0]['source_id'])){ throw new ValidateException('套餐库不足'); } //修改购物车状态 @@ -1356,6 +1381,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ } $orderProduct = []; $orderStatus = []; + + $quotaHoldInfo = app()->make(MerchantQuotaRepository::class)->getQuotaInfo($groupOrder['with_goods_mer_id']); + $quotaRecordInsertData = []; + foreach($orderList as $order){ $cartInfo = $order['cartInfo']; unset($order['cartInfo']); @@ -1483,11 +1512,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ // 随机立减金额 'random_reduction' => $cart['random_reduction'] ?? 0, // 进货订单 - 补货额度抵扣金额 - 'mer_quota_deduction' => $cart['mer_quota_deduction'] ?? 0, + 'mer_quota_title' => $cart['mer_quota_title'] ?? 0, + 'mer_quota_other' => $cart['mer_quota_other'] ?? 0, ]; - // 用户兑换商品 变更相关额度 + // 根据商品类型进行特殊处理 if($cart['product_type'] == 36){ - // 酒类型:0=未知,1=瓶装酒,2=封坛酒 + // 用户兑换商品 变更相关额度 酒类型:0=未知,1=瓶装酒,2=封坛酒 $wineType = (int)Product::where('product_id', $cart['product_id'])->value('wine_type'); if($wineType > 0){ // 额度类型:1=酒卡额度(瓶装酒),2=菜卡额度,3=封坛酒额度,4=加油卡额度 @@ -1518,11 +1548,57 @@ class StoreOrderCreateRepository extends StoreOrderRepository{ } $userMerchantRepository->getInfo($uid,$order['mer_id']); app()->make(MerchantRepository::class)->incSales($order['mer_id'],$order['total_num']); + + // 进货订单 并且存在补货额度减免 减少进货商户的补货额度 + if($_order->activity_type == 35 && $_order->with_goods_mer_id > 0){ + // 判断:是否存在冠名品牌额度 + if((float)$_order->mer_quota_title > 0){ + // 变更持有信息 + $changeFront = (float)sprintf("%.2f", $quotaHoldInfo->title_brand_limit - $quotaHoldInfo->title_brand_used); + $quotaHoldInfo->title_brand_used += (float)$_order->mer_quota_title; + $quotaHoldInfo->title_brand_total += (float)$_order->mer_quota_title; + //变更记录 + $quotaRecordInsertData[] = [ + 'mer_id' => $_order->with_goods_mer_id, + 'change_type' => (int)0, + 'change_front' => $changeFront, + 'change_quantity' => (float)$_order->mer_quota_title, + 'change_after' => (float)sprintf("%.2f", $quotaHoldInfo->title_brand_limit - $quotaHoldInfo->title_brand_used), + 'source' => 1, + 'order_id' => $_order->order_id, + 'quota_type' => 3 + ]; + } + // 判断:是否存在其他品牌额度 + if((float)$_order->mer_quota_other > 0){ + // 变更持有信息 + $changeFront = (float)sprintf("%.2f", $quotaHoldInfo->other_brand_limit - $quotaHoldInfo->other_brand_used); + $quotaHoldInfo->other_brand_used += (float)$_order->mer_quota_other; + $quotaHoldInfo->other_brand_total += (float)$_order->mer_quota_other; + //变更记录 + $quotaRecordInsertData[] = [ + 'mer_id' => $_order->with_goods_mer_id, + 'change_type' => (int)0, + 'change_front' => $changeFront, + 'change_quantity' => (float)$_order->mer_quota_other, + 'change_after' => (float)sprintf("%.2f", $quotaHoldInfo->other_brand_limit - $quotaHoldInfo->other_brand_used), + 'source' => 1, + 'order_id' => $_order->order_id, + 'quota_type' => 4 + ]; + } + } } + + // 处理补货额度变更 + if($groupOrder['activity_type'] == 35){ + $quotaHoldInfo->save(); + if(count($quotaRecordInsertData) > 0) app()->make(MerchantQuotaRecordRepository::class)->insertAll($quotaRecordInsertData); + } + + if(count($bills) > 0){ - app() - ->make(UserBillRepository::class) - ->insertAll($bills); + app()->make(UserBillRepository::class)->insertAll($bills); } $storeOrderStatusRepository->batchCreateLog($orderStatus); diff --git a/app/common/repositories/store/product/SupplierProductRepository.php b/app/common/repositories/store/product/SupplierProductRepository.php index a88c059..aa846bb 100644 --- a/app/common/repositories/store/product/SupplierProductRepository.php +++ b/app/common/repositories/store/product/SupplierProductRepository.php @@ -53,7 +53,8 @@ class SupplierProductRepository extends BaseRepository{ 'batch_num', 'batch_unit', 'image', - 'stock' + 'stock', + 'brand_id' ]) ->with([ 'attr' => function($query){ @@ -61,6 +62,9 @@ class SupplierProductRepository extends BaseRepository{ }, 'attrValue' => function($query){ $query->field(['product_id','detail','image','price','sku','unique','value_id', 'stock']); + }, + 'brand'=>function($query){ + $query->bind(['brand_name']); } ]) ->order('sort desc,mer_id desc') diff --git a/app/common/repositories/system/merchant/MerchantQuotaRepository.php b/app/common/repositories/system/merchant/MerchantQuotaRepository.php index 5e7ec12..0170e45 100644 --- a/app/common/repositories/system/merchant/MerchantQuotaRepository.php +++ b/app/common/repositories/system/merchant/MerchantQuotaRepository.php @@ -43,10 +43,48 @@ class MerchantQuotaRepository extends BaseRepository{ return compact('count','list'); } + /** + * Common: 获取指定商户的补货额度信息&冠名品牌名称 + * Author: wu-hui + * Time: 2024/06/07 11:23 + * @param int $merId + * @return mixed + */ + public function getMerQuotaAndBrandInfo(int $merId){ + // 获取信息 + $info = $this->getQuotaInfo($merId); + // 计算剩余可用冠名品牌额度和其他品牌额度 + if($info){ + $info = $info->toArray(); + $info['title_surplus_quota'] = (float)sprintf("%.2f", $info['title_brand_limit'] - $info['title_brand_used']); + $info['other_surplus_quota'] = (float)sprintf("%.2f", $info['other_brand_limit'] - $info['other_brand_used']); + } + // 获取当前商户品牌信息 + $info['mer_brand_name'] = ''; + $merBrandId = (int)app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$merId])->value('brand_id'); + if($merBrandId > 0) $info['mer_brand_name'] = app()->make(MerchantBrandRepository::class)->getSearch(['id'=>$merBrandId])->value('title'); + return $info; + } + /** + * Common: 获取商户补货额度信息 不存在则创建并且返回 + * Author: wu-hui + * Time: 2024/06/07 15:04 + * @param $merId + * @return array|\think\Model + */ + public function getQuotaInfo($merId){ + // 获取信息 + $info = $this->dao->getSearch(['mer_id'=>$merId])->findOrEmpty(); + if($info->id <= 0){ + $info->mer_id = $merId; + $info->save(); + return $this->getQuotaInfo($merId); + } - + return $info ?? []; + } } diff --git a/app/controller/api/Supplier.php b/app/controller/api/Supplier.php index bf7bb4e..f06f9d9 100644 --- a/app/controller/api/Supplier.php +++ b/app/controller/api/Supplier.php @@ -179,7 +179,12 @@ class Supplier extends BaseController{ $query->field(['product_id','detail','image','price','sku','unique','value_id', 'stock']); }, 'product' => function($query){ - $query->field(['product_id','store_name','unit_name','is_batch','batch_num','batch_unit']); + $query->field(['product_id','store_name','unit_name','is_batch','batch_num','batch_unit','brand_id']) + ->with([ + 'brand'=>function($query){ + $query->bind(['brand_name']); + } + ]); } ]) ->select() diff --git a/app/controller/api/store/merchant/Merchant.php b/app/controller/api/store/merchant/Merchant.php index cd41b35..c2764f7 100644 --- a/app/controller/api/store/merchant/Merchant.php +++ b/app/controller/api/store/merchant/Merchant.php @@ -4,16 +4,17 @@ namespace app\controller\api\store\merchant; -use app\common\repositories\store\service\StoreServiceRepository; + use app\common\repositories\system\merchant\MerchantAdminRepository; +use app\common\repositories\system\merchant\MerchantBrandRepository; +use app\common\repositories\system\merchant\MerchantQuotaRepository; use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\user\UserMerchantRepository; -use crmeb\services\QrcodeService; use think\App; use crmeb\basic\BaseController; use app\common\repositories\system\merchant\MerchantRepository as repository; use think\exception\ValidateException; -use think\facade\Cache; + class Merchant extends BaseController { @@ -198,7 +199,6 @@ class Merchant extends BaseController // 判断:这里仅允许酒道馆和普通商户登录 if($admin['merchant_type'] == 2) throw new ValidateException('当前账号禁止登录!'); - return app('json')->success([ 'token' => $tokenInfo['token'], 'exp' => $tokenInfo['exp'], @@ -208,6 +208,23 @@ class Merchant extends BaseController 'mer_avatar' => $admin['mer_avatar'] ]); } + /** + * Common: 商户持有补货额度信息 + * Author: wu-hui + * Time: 2024/06/07 9:04 + * @param $merId + * @return mixed + */ + public function quotaInfo($merId){ + // 参数获取 + if($merId <= 0) throw new ValidateException('无有效门店!'); + // 获取信息 + $info = app()->make(MerchantQuotaRepository::class)->getMerQuotaAndBrandInfo((int)$merId); + + return app('json')->success($info); + } + + diff --git a/app/listener/exchangeQuota/OrderPaySuccessEvent.php b/app/listener/exchangeQuota/OrderPaySuccessEvent.php index c790cc1..9a34580 100644 --- a/app/listener/exchangeQuota/OrderPaySuccessEvent.php +++ b/app/listener/exchangeQuota/OrderPaySuccessEvent.php @@ -52,7 +52,7 @@ class OrderPaySuccessEvent{ } else if($groupOrder->activity_type == 35){ // 进货订单 - $this->quotaHandle($groupOrder); + }else{ // 其他订单 $this->orderPaySuccessHandle($groupOrder); @@ -311,21 +311,6 @@ class OrderPaySuccessEvent{ return true; } - // 支付成功 - 进货订单相关处理 - public function quotaHandle($groupOrder){ - // 循环处理 - foreach($groupOrder->orderList as $orderInfo){ - $with_goods_mer_id = $orderInfo->with_goods_mer_id ?? 0; - $mer_quota_deduction = $orderInfo->mer_quota_deduction ?? 0; - // 存在进货商户id 存在补货金额 - if($with_goods_mer_id > 0 && $mer_quota_deduction > 0){ - app()->make(MerchantQuotaRecordRepository::class) - ->changeQuota((int)$with_goods_mer_id,(float)$mer_quota_deduction, 0, 1,(int)$orderInfo->order_id); - } - } - - return true; - } diff --git a/route/api.php b/route/api.php index 48ab387..b08fa84 100644 --- a/route/api.php +++ b/route/api.php @@ -602,7 +602,8 @@ Route::group('api/', function () { Route::get('/detail/:id', 'Merchant/detail'); Route::get('/qrcode/:id', 'Merchant/qrcode'); Route::get('/local', 'Merchant/localLst'); - // 酒道馆登录相关 + Route::get('/quotaInfo/:merId', 'Merchant/quotaInfo'); + // 登录相关 Route::get('/login', 'Merchant/storeLogin'); Route::get('/simulation_login/:merId', 'Merchant/simulationLogin'); })->prefix('api.store.merchant.');