Browse Source

店铺收藏状态

master
Lemon 5 years ago
parent
commit
8165e1c6e0
  1. 2
      app/Controller/v3/GoodsController.php
  2. 2
      app/Service/v3/Implementations/CollectStoreService.php

2
app/Controller/v3/GoodsController.php

@ -56,7 +56,7 @@ class GoodsController extends BaseController
if(isset($params['user_id'])) { if(isset($params['user_id'])) {
$res['shopcart']['count'] = $this->shopCartService->check(111); $res['shopcart']['count'] = $this->shopCartService->check(111);
$res['shopcart']['total'] = $this->shopCartService->getTotal(); $res['shopcart']['total'] = $this->shopCartService->getTotal();
$res['detail']->store->is_collected = (bool)$this->collectService->check($params['user_id'], $params['store_id']);
$res['detail']->store->is_collected = (bool)$this->collectService->check($params['user_id'], $res['detail']->store->id);
}else{ }else{
$res['shopcart'] = ''; $res['shopcart'] = '';
$res['detail']->store->is_collected = ''; $res['detail']->store->is_collected = '';

2
app/Service/v3/Implementations/CollectStoreService.php

@ -37,7 +37,7 @@ class CollectStoreService implements CollectStoreServiceInterface
//用户收藏数量自减 //用户收藏数量自减
$userIncr = $ssdb->exec('incr', SsdbKeys::COUNT_COLLECT_STORE_USER.$userId,'-1'); $userIncr = $ssdb->exec('incr', SsdbKeys::COUNT_COLLECT_STORE_USER.$userId,'-1');
//店铺被收藏数自减 //店铺被收藏数自减
$storeIncr = $ssdb->exec('incr', SsdbKeys::COUNT_COLLECT_STORE.$userId,'-1');
$storeIncr = $ssdb->exec('incr', SsdbKeys::COUNT_COLLECT_STORE.$storeId,'-1');
return $userDel && $userIncr && $storeIncr; return $userDel && $userIncr && $storeIncr;
} }
//获取用户收藏店铺数量 //获取用户收藏店铺数量

Loading…
Cancel
Save