Browse Source

商品详情 添加店铺信息 店铺详情页 判断该店铺是否收藏过

master
Lemon 5 years ago
parent
commit
ca2c7b7b29
  1. 5
      app/Constants/v3/SsdbKeys.php
  2. 9
      app/Controller/v3/GoodsController.php
  3. 4
      app/Controller/v3/StoreController.php
  4. 4
      app/Service/v3/Implementations/StoreService.php
  5. 2
      app/Service/v3/Interfaces/StoreServiceInterface.php

5
app/Constants/v3/SsdbKeys.php

@ -20,6 +20,11 @@ class SsdbKeys extends AbstractConstants
*/
const GOODS_MONTH_SALES = 'goods_m_sales_';
/**
* @Message("商户月销")
*/
const STORE_MONTH_SALES = 'store_m_sales_';
/**
* @Message("用户新订单统计")
*/

9
app/Controller/v3/GoodsController.php

@ -3,6 +3,7 @@
namespace App\Controller\v3;
use App\Controller\BaseController;
use App\Service\v3\Interfaces\StoreServiceInterface;
use Hyperf\Di\Annotation\Inject;
use App\Service\v3\Interfaces\GoodsServiceInterface;
class GoodsController extends BaseController
@ -12,10 +13,18 @@ class GoodsController extends BaseController
* @var GoodsServiceInterface
*/
protected $goodsService;
/**
* @Inject
* @var StoreServiceInterface
*/
protected $storeService;
public function detail()
{
$params = $this->request->all();
$res['detail'] = $this->goodsService->do();
$res['banner'] = $this->goodsService->getBanner();
$res['store'] = $this->storeService->detail($params['store_id']);
return $this->success($res);
}
}

4
app/Controller/v3/StoreController.php

@ -43,8 +43,8 @@ class StoreController extends BaseController
public function index(StoreIndexRequest $request)
{
$params = $request->validated();
$data = $this->storeService->detail($params['store_id'], $params['market_id']);
$data['is_collected'] = (bool)$this->collectService->check($params['market_id'], $params['store_id'], $params['user_id']);
$data = $this->storeService->detail($params['store_id']);
$data['is_collected'] = (bool)$this->collectService->check($params['user_id'],$params['store_id']);
$data['goods_types'] = $this->categoryService->allForStore($params['store_id']);
return $this->success(['store' => $data]);
}

4
app/Service/v3/Implementations/StoreService.php

@ -24,14 +24,14 @@ class StoreService implements StoreServiceInterface
// TODO: Implement undo() method.
}
public function detail($storeId, $marketId)
public function detail($storeId)
{
return Store::query()
->select([
'id', 'name', 'logo', 'introduction', 'announcement', 'address', 'tel', 'stall_info',
'is_rest','time1', 'time2', 'time3', 'time4',
])
->where(['id' => $storeId, 'market_id' => $marketId])
->where('id',$storeId)
->first()->toArray();
}
}

2
app/Service/v3/Interfaces/StoreServiceInterface.php

@ -7,5 +7,5 @@ interface StoreServiceInterface
public function do();
public function check();
public function undo();
public function detail($storeId, $marketId);
public function detail($storeId);
}
Loading…
Cancel
Save