|
|
@@ -9,6 +9,7 @@ namespace app\models\store;
|
|
|
|
|
|
use app\admin\model\store\StoreProductAttrValue;
|
|
|
use app\admin\model\system\SystemGroupData;
|
|
|
+use app\models\user\User;
|
|
|
use crmeb\basic\BaseModel;
|
|
|
use crmeb\services\UtilService;
|
|
|
use crmeb\traits\ModelTrait;
|
|
|
@@ -155,7 +156,7 @@ class StoreCart extends BaseModel
|
|
|
|
|
|
public static function getUserProductCartList($uid, $cartIds = '', $status = 0)
|
|
|
{
|
|
|
- $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,store_type';
|
|
|
+ $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,store_type,is_best';
|
|
|
$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';
|
|
|
$bargainInfoField = 'id,image,min_price as price,price as ot_price,postage,give_integral,sales,stock,title as store_name,unit_name,status as is_show,is_del,is_postage,cost,temp_id,weight,volume';
|
|
|
$combinationInfoField = 'id,image,price,postage,sales,stock,title as store_name,is_show,is_del,is_postage,cost,temp_id,weight,volume';
|
|
|
@@ -165,6 +166,7 @@ class StoreCart extends BaseModel
|
|
|
->where('is_del', 0);
|
|
|
if (!$status) $model = $model->where('is_new', 0);
|
|
|
if ($cartIds) $model = $model->where('id', 'IN', $cartIds);
|
|
|
+ $user = User::where('uid', $uid)->find();
|
|
|
$model = $model->order('add_time DESC');
|
|
|
$list = $model->select()->toArray();
|
|
|
if (!count($list)) return compact('valid', 'invalid');
|
|
|
@@ -183,6 +185,14 @@ class StoreCart extends BaseModel
|
|
|
$product = StoreProduct::field($productInfoField)
|
|
|
->find($cart['product_id'])->toArray();
|
|
|
}
|
|
|
+
|
|
|
+ if ($product['is_best'] == 1){
|
|
|
+ if ($user['identity'] >= 1){
|
|
|
+ $product['price'] = $product['price']/2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
$product['image'] = set_file_url($product['image']);
|
|
|
$cart['productInfo'] = $product;
|
|
|
|
|
|
@@ -229,6 +239,11 @@ class StoreCart extends BaseModel
|
|
|
if (!$attrInfo || !$attrInfo['stock'])
|
|
|
$invalid[] = $cart;
|
|
|
else {
|
|
|
+ if ($product['is_best'] == 1){
|
|
|
+ if ($user['identity'] >= 1){
|
|
|
+ $attrInfo['price'] = $product['price'];
|
|
|
+ }
|
|
|
+ }
|
|
|
$cart['productInfo']['attrInfo'] = $attrInfo;
|
|
|
if ($cart['combination_id'] || $cart['seckill_id'] || $cart['bargain_id']) {
|
|
|
$cart['truePrice'] = $attrInfo['price'];
|