feat: 增加根据用户ID判断购物车商品是否参与活动的功能

This commit is contained in:
mkm 2024-07-09 15:15:51 +08:00
parent 02d488c296
commit 5835271186

View File

@ -42,7 +42,6 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
*/ */
public function lists($where = []): array public function lists($where = []): array
{ {
$userId = $this->request->get('uid');
$where = [ $where = [
'staff_id' => $this->adminId, 'staff_id' => $this->adminId,
'is_pay' => 0 'is_pay' => 0
@ -55,9 +54,19 @@ class CartList extends BaseAdminDataLists implements ListsSearchInterface, Lists
return $item; return $item;
}) })
->toArray(); ->toArray();
// $off_activity = Config::where('name', 'off_activity')->value('value'); $off_activity = Config::where('name', 'off_activity')->value('value');
$off_activity = 0; $off_activity = 0;
$this->off_activity = $off_activity; $this->off_activity = $off_activity;
$uid = 0;
if ($this->request->get('uid')) {
$uid = $this->request->get('uid');
}
if ($uid > 0) {
$user_ship = User::where('id', $uid)->value('user_ship');
if (in_array($user_ship, [4, 5, 6, 7])) {
$off_activity = 1;
}
}
foreach ($list as $key => &$item) { foreach ($list as $key => &$item) {
$find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']]) $find = StoreBranchProduct::where(['product_id' => $item['product_id'], 'store_id' => $item['store_id']])
->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price') ->field('product_id,image,price,cost,store_name,unit,delete_time,vip_price')