修改扫码商户下单限制

This commit is contained in:
codeliu 2024-03-22 17:00:49 +08:00
parent e371179faf
commit ce84c4c8aa
5 changed files with 35 additions and 21 deletions

View File

@ -899,6 +899,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
public function v2CreateOrder($key, int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post,$remarkMoney) public function v2CreateOrder($key, int $pay_type, $user, array $cartId, array $extend, array $mark, array $receipt_data, array $takes = null, array $useCoupon = null, bool $useIntegral = false, int $addressId = null, array $post,$remarkMoney)
{ {
//扫码自提标识
$ownRemark =0;
if($remarkMoney){
$ownRemark = 2;//订单类型为2
}
$uid = $user->uid; $uid = $user->uid;
// $orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true); // $orderInfo = $this->v2CartIdByOrderInfo($user, $cartId, $takes, $useCoupon, $useIntegral, $addressId, true);
$orderInfo = Cache::get('order_create_cache' . $uid . '_' . $key); $orderInfo = Cache::get('order_create_cache' . $uid . '_' . $key);
@ -975,7 +981,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
} }
if ($hasTake) { if ($hasTake && !$ownRemark) {
app()->make(UserAddressValidate::class)->scene('take')->check($post); app()->make(UserAddressValidate::class)->scene('take')->check($post);
} }
@ -1093,9 +1099,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
//整理订单数据 //整理订单数据
$payPrice_order = $merchantCart['order']['pay_price']; $payPrice_order = $merchantCart['order']['pay_price'];
$couponPrice_order = bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2); $couponPrice_order = bcadd($merchantCart['order']['coupon_price'], $merchantCart['order']['platform_coupon_price'], 2);
if($remarkMoney){
$order_type = $merchantCart['order']['isTake'] ? 1 : 0;
if($ownRemark){
$payPrice_order = $remarkMoney;//输入得金额 $payPrice_order = $remarkMoney;//输入得金额
$couponPrice_order = $merchantCart['order']['pay_price'] -$payPrice_order; $couponPrice_order = $merchantCart['order']['pay_price'] -$payPrice_order;
$order_type = $ownRemark;
} }
@ -1103,7 +1112,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'cartInfo' => $merchantCart, 'cartInfo' => $merchantCart,
'activity_type' => $orderInfo['order_type'], 'activity_type' => $orderInfo['order_type'],
'commission_rate' => (float)$rate, 'commission_rate' => (float)$rate,
'order_type' => $merchantCart['order']['isTake'] ? 1 : 0, 'order_type' =>$order_type ,
'is_virtual' => $order_model, 'is_virtual' => $order_model,
'extension_one' => $total_extension_one, 'extension_one' => $total_extension_one,
'extension_two' => $total_extension_two, 'extension_two' => $total_extension_two,
@ -1173,7 +1182,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'sale_type' => $saleType, 'sale_type' => $saleType,
]; ];
event('order.create.before', compact('groupOrder', 'orderList')); event('order.create.before', compact('groupOrder', 'orderList'));
$group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo, $useCoupon,$pay_type) { $group = Db::transaction(function () use ($ex, $user, $topUid, $spreadUid, $uid, $receipt_data, $cartIds, $allUseCoupon, $groupOrder, $orderList, $orderInfo, $useCoupon,$pay_type,$ownRemark) {
$storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class); $storeGroupOrderRepository = app()->make(StoreGroupOrderRepository::class);
$storeCartRepository = app()->make(StoreCartRepository::class); $storeCartRepository = app()->make(StoreCartRepository::class);
$attrValueRepository = app()->make(ProductAttrValueRepository::class); $attrValueRepository = app()->make(ProductAttrValueRepository::class);
@ -1185,9 +1194,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$userMerchantRepository = app()->make(UserMerchantRepository::class); $userMerchantRepository = app()->make(UserMerchantRepository::class);
$storeCouponUserDao = new StoreCouponUserDao(); $storeCouponUserDao = new StoreCouponUserDao();
//减库存 ---不为对公转账 //减库存
if ($pay_type != Enum::public) { if (!$ownRemark) {
foreach ($orderList as $order) { foreach ($orderList as $order) {
foreach ($order['cartInfo']['list'] as $cart) { foreach ($order['cartInfo']['list'] as $cart) {
if (!isset($uniqueList[$cart['productAttr']['product_id'] . $cart['productAttr']['unique']])) if (!isset($uniqueList[$cart['productAttr']['product_id'] . $cart['productAttr']['unique']]))
@ -1415,6 +1424,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
event('order.create', compact('groupOrder')); event('order.create', compact('groupOrder'));
return $groupOrder; return $groupOrder;
}); });
if (!$ownRemark) {
foreach ($merchantCartList as $merchantCart) { foreach ($merchantCartList as $merchantCart) {
foreach ($merchantCart['list'] as $cart) { foreach ($merchantCart['list'] as $cart) {
if (($cart['productAttr']['stock'] - $cart['cart_num']) < (int)merchantConfig($merchantCart['mer_id'], 'mer_store_stock')) { if (($cart['productAttr']['stock'] - $cart['cart_num']) < (int)merchantConfig($merchantCart['mer_id'], 'mer_store_stock')) {
@ -1429,6 +1440,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
} }
} }
} }
}
Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => $group->group_order_id]); Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'id' => $group->group_order_id]);
if ($addressId) if ($addressId)
app()->make(RecordRepository::class)->addRecord(RecordRepository::TYPE_ADDRESS_RECORD,['address_id' => $addressId,'num' => count($orderList)]); app()->make(RecordRepository::class)->addRecord(RecordRepository::TYPE_ADDRESS_RECORD,['address_id' => $addressId,'num' => count($orderList)]);

View File

@ -94,7 +94,7 @@ class MerchantIntention extends BaseController
$data = $this->request->params(['status','fail_msg']); $data = $this->request->params(['status','fail_msg']);
if(empty($data['status'])) return app('json')->fail('缺失参数'); if(empty($data['status'])) return app('json')->fail('缺失参数');
$this->repository->updateIdent($id, $data); $this->repository->updateIdent($id, $data);
return app('json')->success('修改身份成功'); return app('json')->success('审核通过');
} }

View File

@ -348,7 +348,7 @@ class MerchantIntention extends BaseController
} }
public function deatail() public function list()
{ {
$id = $this->request->params([ $id = $this->request->params([
'uid' 'uid'
@ -358,6 +358,7 @@ class MerchantIntention extends BaseController
->where('uid',$id['uid']) ->where('uid',$id['uid'])
->whereIn('type',[3,4]) ->whereIn('type',[3,4])
->field('i.mer_intention_id,i.uid,i.mer_name,i.name,i.create_time,i.status,i.fail_msg,i.update_time,m.type_name') ->field('i.mer_intention_id,i.uid,i.mer_name,i.name,i.create_time,i.status,i.fail_msg,i.update_time,m.type_name')
->order('create_time','desc')
->select(); ->select();
//后期看改 //后期看改
foreach ($list as $k => &$v){ foreach ($list as $k => &$v){

View File

@ -83,7 +83,7 @@ class StoreOrder extends BaseController
$payType = $this->request->param('pay_type'); $payType = $this->request->param('pay_type');
$key = (string)$this->request->param('key'); $key = (string)$this->request->param('key');
$post = (array)$this->request->param('post'); $post = (array)$this->request->param('post');
$remarkMoney = $this->request->param('money')??0;//匹配金额 $remarkMoney = $this->request->param('money',0);//匹配金额
if(!$key){ if(!$key){
return app('json')->fail('订单操作超时,请刷新页面'); return app('json')->fail('订单操作超时,请刷新页面');
} }

View File

@ -585,7 +585,7 @@ Route::group('api/', function () {
Route::get('intention/type', 'api.store.merchant.MerchantIntention/typeLst'); Route::get('intention/type', 'api.store.merchant.MerchantIntention/typeLst');
Route::post('intention/change', 'api.store.merchant.MerchantIntention/changeIdentity');//更新身份 Route::post('intention/change', 'api.store.merchant.MerchantIntention/changeIdentity');//更新身份
Route::get('intention/detail', 'api.store.merchant.MerchantIntention/deatail');//审核列表 Route::get('intention/detail', 'api.store.merchant.MerchantIntention/list');//审核列表
//浏览 //浏览
Route::post('common/visit', 'api.Common/visit'); Route::post('common/visit', 'api.Common/visit');