Merge pull request '修改用户会员价' (#536) from dev into main
Reviewed-on: #536
This commit is contained in:
commit
7b153c2a0f
@ -105,7 +105,7 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
|
||||
$user_ship=-1;
|
||||
if ($uid > 0) {
|
||||
$user_ship = User::where('id', $uid)->value('user_ship');
|
||||
if (in_array($user_ship, [4, 6, 7]) && !empty($this->params['store_id']) && !SystemStore::isSelfOperate($this->params['store_id'])) {
|
||||
if ($user_ship == 4 && !empty($this->params['store_id']) && !SystemStore::isSelfOperate($this->params['store_id'])) {
|
||||
$fields = 'id,id product_id,top_cate_id,cate_id,store_name,cost,vip_price,purchase,cost price,bar_code,image,sales,store_info,delete_time,unit,batch,top_cate_id,two_cate_id,stock,is_lack';
|
||||
}
|
||||
}
|
||||
@ -119,6 +119,9 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($order)
|
||||
->select()->each(function ($item) use ($tag, $off_activity, $user_ship) {
|
||||
if ($user_ship > 0 && $user_ship != 4) {
|
||||
$item['price'] = $item['vip_price'];
|
||||
}
|
||||
if ($off_activity == 0 && $user_ship == 5 && $item['top_cate_id'] == 15189) {
|
||||
$item['price'] = $item['cost'];
|
||||
}
|
||||
@ -129,7 +132,6 @@ class ProductLists extends BaseApiDataLists implements ListsSearchInterface, Lis
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
$list = StoreProductGroupPrice::resetStoreProductsPrice($list, $user_ship, $this->params['store_id'] ?? 0);
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
@ -42,14 +42,11 @@ class StoreProductGroupPrice extends BaseModel
|
||||
|
||||
public static function resetProductPrice($product, $userShip)
|
||||
{
|
||||
$groupPrice = StoreProductPrice::whereIn('product_id', $product['id'])->field('product_id,purchase,cost,vip_price,price')->find();
|
||||
if (!empty($groupPrice) && $groupPrice['product_id'] == $product['id']) {
|
||||
if ($userShip > 0) {
|
||||
if ($userShip == 4) {
|
||||
$product['price'] = $groupPrice['cost'];
|
||||
} else {
|
||||
$product['price'] = $groupPrice['vip_price'];
|
||||
}
|
||||
if ($userShip > 0) {
|
||||
if ($userShip == 4) {
|
||||
$product['price'] = $product['cost'];
|
||||
} else {
|
||||
$product['price'] = $product['vip_price'];
|
||||
}
|
||||
}
|
||||
return $product;
|
||||
|
Loading…
x
Reference in New Issue
Block a user