增加:商户进货 支持使用 冠名品牌额度和其他品牌额度进行抵扣,但是每种品牌额度仅允许抵扣同品牌的商品,额度不足时需要进行支付
This commit is contained in:
parent
a386776429
commit
764173a22d
|
|
@ -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']);
|
||||
}
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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 ?? [];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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.');
|
||||
|
|
|
|||
Loading…
Reference in New Issue