|
@@ -63,7 +63,7 @@ class StoreCart extends BaseModel
|
|
|
$product_attr_unique = $unique;
|
|
|
}
|
|
|
}
|
|
|
- @file_put_contents("cart.txt", $cart_num);
|
|
|
+
|
|
|
if (!StoreOrder::checkProductStock($uid, $product_id, $cart_num, $product_attr_unique, $combination_id, $seckill_id, $bargain_id)) {
|
|
|
return self::setErrorInfo(StoreOrder::getErrorInfo());
|
|
|
}
|
|
@@ -118,8 +118,10 @@ class StoreCart extends BaseModel
|
|
|
$id = self::getkeytoid('cart_id');
|
|
|
$is_suit = (!$combination_id && !$seckill_id && !$bargain_id && StoreProduct::where('id', $product_id)->value('is_suit')) ? 1 : 0;
|
|
|
$is_award = (!$combination_id && !$seckill_id && !$bargain_id && StoreProduct::where('id', $product_id)->value('is_award')) ? 1 : 0;
|
|
|
+ $store_bag = (!$combination_id && !$seckill_id && !$bargain_id && StoreProduct::where('id', $product_id)->value('store_bag')) ? 1 : 0;
|
|
|
+ $is_bind = (!$combination_id && !$seckill_id && !$bargain_id && StoreProduct::where('id', $product_id)->value('is_bind')) ? 1 : 0;
|
|
|
|
|
|
- $rs = self::create(compact('uid', 'is_award', 'product_id', 'cart_num', 'product_attr_unique', 'is_new', 'type', 'combination_id', 'add_time', 'bargain_id', 'seckill_id', 'id', 'is_consumer', 'is_suit', 'store_id'));
|
|
|
+ $rs = self::create(compact('store_bag', 'is_bind', 'uid', 'is_award', 'product_id', 'cart_num', 'product_attr_unique', 'is_new', 'type', 'combination_id', 'add_time', 'bargain_id', 'seckill_id', 'id', 'is_consumer', 'is_suit', 'store_id'));
|
|
|
|
|
|
return $rs;
|
|
|
}
|
|
@@ -176,7 +178,7 @@ class StoreCart extends BaseModel
|
|
|
return self::where('uid', $uid)->where('id', $cartId)->update(['cart_num' => $cartNum]);
|
|
|
}
|
|
|
|
|
|
- public static function getUserProductCartList($uid, $cartIds = '', $status = 0, $store_id = 0)
|
|
|
+ public static function getUserProductCartList($uid, $cartIds = '', $status = 0, $store_id = 0, $type = -1)
|
|
|
{
|
|
|
$productInfoField = 'id,image,price,ot_price,vip_price,postage,give_integral,sales,stock,store_name,unit_name,is_show,is_del,is_postage,cost,is_sub,temp_id,is_consumer,is_suit,is_bind,max_use_integral,store_id,store_bag,store_spread,time_area_discount';
|
|
|
$seckillInfoField = 'id,image,price,ot_price,postage,give_integral,sales,stock,title as store_name,unit_name,is_show,is_del,is_postage,cost,temp_id,weight,volume,start_time,stop_time,time_id';
|
|
@@ -192,6 +194,20 @@ class StoreCart extends BaseModel
|
|
|
if (!$status) $model = $model->where('c.is_new', 0);
|
|
|
if ($cartIds) $model = $model->where('c.id', 'IN', $cartIds);
|
|
|
if ($store_id) $model = $model->where('c.store_id', 'IN', $store_id);
|
|
|
+ if ($type >= 0) switch ($type) {
|
|
|
+ case 1:
|
|
|
+ $model = $model->where('is_suit', 1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $model = $model->where('store_bag', 1);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $model = $model->where('is_bind', 1);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $model = $model->where('is_suit', 0)->where('store_bag', 0)->where('is_bind', 0);
|
|
|
+ break;
|
|
|
+ }
|
|
|
$model = $model->order('c.add_time DESC');
|
|
|
$list = $model->select()->toArray();
|
|
|
if (!count($list)) return compact('valid', 'invalid');
|