更新
This commit is contained in:
parent
3911709d32
commit
e2f1dbafd0
@ -118,6 +118,17 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
if ($oldProductStock < $cart['cart_num']) {
|
if ($oldProductStock < $cart['cart_num']) {
|
||||||
throw new ValidateException('商品库存不足');
|
throw new ValidateException('商品库存不足');
|
||||||
}
|
}
|
||||||
|
if ($source == 103) {
|
||||||
|
$canBuy = (new StoreActivityDao())->canBuy($cart['uid'], $cart['product_id']);
|
||||||
|
if ($canBuy['is_true'] == false) {
|
||||||
|
throw new ValidateException('活动商品限购1个');
|
||||||
|
}
|
||||||
|
if ($canBuy['activityId'] == 2) {
|
||||||
|
$activityProductCount += $cart['cart_num'];
|
||||||
|
if ($activityProductCount > 1) {
|
||||||
|
throw new ValidateException('活动商品限购1个');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
if ($cart['product_type'] <= 97 && $cart['product_type'] > 0 && (($cart['product_type'] != 10 && count($merchantCart['list']) != 1) || count($merchantCartList) != 1)) {
|
||||||
throw new ValidateException('活动商品必须单独购买');
|
throw new ValidateException('活动商品必须单独购买');
|
||||||
@ -143,6 +154,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
// if (($order_type == 98 || $order_type == 99) && count($merchantCartList) > 1) {
|
||||||
// throw new ValidateException('采购、委托商品不支持跨店购买');
|
// throw new ValidateException('采购、委托商品不支持跨店购买');
|
||||||
// }
|
// }
|
||||||
@ -154,6 +166,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$order_coupon_price = 0;
|
$order_coupon_price = 0;
|
||||||
$noDeliver = false;
|
$noDeliver = false;
|
||||||
$presellType = 0;
|
$presellType = 0;
|
||||||
|
$consumption_coupon_id = 0;
|
||||||
$fn = [];
|
$fn = [];
|
||||||
if (in_array($source, [0, 2, 103])) {
|
if (in_array($source, [0, 2, 103])) {
|
||||||
$enabledPlatformCoupon = true;
|
$enabledPlatformCoupon = true;
|
||||||
@ -586,6 +599,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$pay_price = $org_price;
|
$pay_price = $org_price;
|
||||||
}
|
}
|
||||||
//计算总红包金额
|
//计算总红包金额
|
||||||
|
if ($source == 105) {
|
||||||
|
$this->consumption_money = bcsub($pay_price, 2, 2);
|
||||||
|
$pay_price =2; ;
|
||||||
|
$this->balance = 0;
|
||||||
|
$consumption_coupon_id=100;
|
||||||
|
} else {
|
||||||
if ($consumption_id > 0) {
|
if ($consumption_id > 0) {
|
||||||
if ($this->store_consumption_user) {
|
if ($this->store_consumption_user) {
|
||||||
if ($this->store_consumption_user['type'] == 2 && $pay_price >= 6) {
|
if ($this->store_consumption_user['type'] == 2 && $pay_price >= 6) {
|
||||||
@ -609,12 +628,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
$this->consumption_money = $pay_price;
|
$this->consumption_money = $pay_price;
|
||||||
$this->balance = bcsub($this->balance, $pay_price, 2);
|
$this->balance = bcsub($this->balance, $pay_price, 2);
|
||||||
$pay_price = 0;
|
$pay_price = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$giveIntegralFlag = $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_order_rate'] > 0;
|
$giveIntegralFlag = $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_order_rate'] > 0;
|
||||||
$total_give_integral = 0;
|
$total_give_integral = 0;
|
||||||
@ -687,7 +706,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'key',
|
'key',
|
||||||
'platformConsumption',
|
'platformConsumption',
|
||||||
'consumption_money',
|
'consumption_money',
|
||||||
'consumption_id'
|
'consumption_id',
|
||||||
|
'consumption_coupon_id'
|
||||||
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
) + ['allow_address' => !$allow_no_address, 'order_delivery_status' => $orderDeliveryStatus];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,9 +991,15 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
]);
|
]);
|
||||||
$user->save();
|
$user->save();
|
||||||
}
|
}
|
||||||
|
$consumption_coupon_id = 0;
|
||||||
if ($groupOrder['consumption_money'] > 0) {
|
if ($groupOrder['consumption_money'] > 0) {
|
||||||
$balance = 0;
|
$balance = 0;
|
||||||
|
if($groupOrder['consumption_coupon_id']==100){
|
||||||
|
$consumption_coupon_id=Db::name('store_consumption_user')->insertGetId(['coupon_id'=>100,'mer_id'=>0,'uid'=>$uid,
|
||||||
|
'order_amount'=>$groupOrder['pay_price'],'coupon_title'=>'2元活动红包','coupon_price'=>$groupOrder['consumption_money'],
|
||||||
|
'balance'=>0,'use_min_price'=>0,'order_id_set'=>'','create_time'=>date('Y-m-d H:i:s'),'start_time'=>date('Y-m-d H:i:s'),
|
||||||
|
'end_time'=>date('Y-m-d H:i:s'),'use_time'=>date('Y-m-d H:i:s'),'type'=>1,'send_id'=>0,'status'=>1]);
|
||||||
|
}else{
|
||||||
$store_consumption_user = Db::name('store_consumption_user')->where('uid', $uid)->where('coupon_user_id', $groupOrder['consumption_id'])->where('status', 0)->find();
|
$store_consumption_user = Db::name('store_consumption_user')->where('uid', $uid)->where('coupon_user_id', $groupOrder['consumption_id'])->where('status', 0)->find();
|
||||||
if ($store_consumption_user) {
|
if ($store_consumption_user) {
|
||||||
if ($store_consumption_user['type'] == 1) {
|
if ($store_consumption_user['type'] == 1) {
|
||||||
@ -987,6 +1013,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app()->make(UserBillRepository::class)->decBill($user['uid'], 'consumption', 'deduction', [
|
app()->make(UserBillRepository::class)->decBill($user['uid'], 'consumption', 'deduction', [
|
||||||
'link_id' => $groupOrder['group_order_id'],
|
'link_id' => $groupOrder['group_order_id'],
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
@ -1032,7 +1060,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository
|
|||||||
'user_id' => $uid,
|
'user_id' => $uid,
|
||||||
'order_id' => $_order->order_id,
|
'order_id' => $_order->order_id,
|
||||||
'group_order_id' => $groupOrder->group_order_id,
|
'group_order_id' => $groupOrder->group_order_id,
|
||||||
'coupon_user_id' => $order['consumption_id'],
|
'coupon_user_id' => $order['consumption_id']!=0?$order['consumption_id']:$consumption_coupon_id,
|
||||||
'type' => 1,
|
'type' => 1,
|
||||||
'amount' => $order['consumption_money'],
|
'amount' => $order['consumption_money'],
|
||||||
'pay_price' => $order['pay_price'],
|
'pay_price' => $order['pay_price'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user