|
@@ -316,6 +316,8 @@ class StoreOrder extends BaseModel
|
|
|
$cartIds = [];
|
|
$cartIds = [];
|
|
|
$totalNum = 0;
|
|
$totalNum = 0;
|
|
|
$gainIntegral = 0;
|
|
$gainIntegral = 0;
|
|
|
|
|
+ $is_explosive = 0;
|
|
|
|
|
+ $explosive_type = -1;
|
|
|
foreach ($cartInfo as $cart) {
|
|
foreach ($cartInfo as $cart) {
|
|
|
$cartIds[] = $cart['id'];
|
|
$cartIds[] = $cart['id'];
|
|
|
$totalNum += $cart['cart_num'];
|
|
$totalNum += $cart['cart_num'];
|
|
@@ -324,6 +326,16 @@ class StoreOrder extends BaseModel
|
|
|
if (!$combinationId) $combinationId = $cart['combination_id'];
|
|
if (!$combinationId) $combinationId = $cart['combination_id'];
|
|
|
$cartInfoGainIntegral = isset($cart['productInfo']['give_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['give_integral'], 2) : 0;
|
|
$cartInfoGainIntegral = isset($cart['productInfo']['give_integral']) ? bcmul($cart['cart_num'], $cart['productInfo']['give_integral'], 2) : 0;
|
|
|
$gainIntegral = bcadd($gainIntegral, $cartInfoGainIntegral, 2);
|
|
$gainIntegral = bcadd($gainIntegral, $cartInfoGainIntegral, 2);
|
|
|
|
|
+ if ($cart['productInfo']['is_explosive'] == 1) {
|
|
|
|
|
+ $is_explosive = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($explosive_type == -1){
|
|
|
|
|
+ $explosive_type =$cart['productInfo']['is_explosive'];
|
|
|
|
|
+ }else{
|
|
|
|
|
+ if ($explosive_type!= $cart['productInfo']['is_explosive']){
|
|
|
|
|
+ return self::setErrorInfo('报单商品和非报单商品不能混合购买!', true);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$deduction = $seckill_id || $bargain_id || $combinationId;
|
|
$deduction = $seckill_id || $bargain_id || $combinationId;
|
|
|
if ($deduction) {
|
|
if ($deduction) {
|
|
@@ -450,7 +462,8 @@ class StoreOrder extends BaseModel
|
|
|
'add_time' => time(),
|
|
'add_time' => time(),
|
|
|
'unique' => $key,
|
|
'unique' => $key,
|
|
|
'shipping_type' => $shipping_type,
|
|
'shipping_type' => $shipping_type,
|
|
|
- 'sale_uid' => $sale_uid
|
|
|
|
|
|
|
+ 'sale_uid' => $sale_uid,
|
|
|
|
|
+ 'is_explosive' => $is_explosive
|
|
|
];
|
|
];
|
|
|
if ($shipping_type === 2) {
|
|
if ($shipping_type === 2) {
|
|
|
$orderInfo['verify_code'] = self::getStoreCode();
|
|
$orderInfo['verify_code'] = self::getStoreCode();
|
|
@@ -786,7 +799,16 @@ class StoreOrder extends BaseModel
|
|
|
$sale_uid = User::where('uid', $order['uid'])->value('spread_uid');
|
|
$sale_uid = User::where('uid', $order['uid'])->value('spread_uid');
|
|
|
// 如果在分享下支付完成且没有推荐人就自动绑定
|
|
// 如果在分享下支付完成且没有推荐人就自动绑定
|
|
|
if ($order['sale_uid']>0&&$sale_uid==0){
|
|
if ($order['sale_uid']>0&&$sale_uid==0){
|
|
|
- User::where('uid', $order['uid'])->update(['spread_uid' => $order['sale_uid'],'spread_time'=>time()]);
|
|
|
|
|
|
|
+ $spread_order = User::where('uid', $order['sale_uid'])->value('spread_order');
|
|
|
|
|
+ $spread_order = bcadd($spread_order,1,2); //推荐订单数加1
|
|
|
|
|
+ User::where('uid', $order['uid'])->update(['spread_uid' => $order['sale_uid'],'spread_time'=>time(),'spread_order'=>$spread_order]);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+// 如果是报单商品就增加业绩
|
|
|
|
|
+ if ($order['is_explosive']==1){
|
|
|
|
|
+ $achievement = User::where('uid', $order['uid'])->value('achievement');
|
|
|
|
|
+ $achievement = bcadd($achievement, $order['pay_price'], 2);
|
|
|
|
|
+ User::where('uid', $order['uid'])->update(['achievement' => $achievement]);
|
|
|
}
|
|
}
|
|
|
$res = $res1 && $resPink && UserSpread::setSpreadSure($order['uid']) && User::backOrderBrokerage($order);
|
|
$res = $res1 && $resPink && UserSpread::setSpreadSure($order['uid']) && User::backOrderBrokerage($order);
|
|
|
return false !== $res;
|
|
return false !== $res;
|