| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /**
- * @package merchant
- * @Author: Qinii
- * @Date: 2020/5/28
- */
- namespace app\controller\api\store\merchant;
- use think\App;
- use crmeb\basic\BaseController;
- use app\common\repositories\system\merchant\MerchantRepository as repository;
- use app\common\repositories\store\product\ProductAttrValueRepository;
- class MerchantMp extends BaseController
- {
- protected $repository;
- protected $userInfo;
- /**
- * ProductCategory constructor.
- * @param App $app
- * @param repository $repository
- */
- public function __construct(App $app, repository $repository)
- {
- parent::__construct($app);
- $this->repository = $repository;
- }
- public function getProduct($id){
- if(!$this->repository->merExists($id))
- return app('json')->fail('店铺不存在');
- $cateList = $this->repository->categoryList($id);
- [$page, $limit] = $this->getPage();
- // $where = $this->request->params(['keyword','order','mer_cate_id','price_on', 'price_off','brand_id']);
- $where['is_gift_bag'] = 0;
- $where['is_used'] = 1;
- $where['product_type'] = 0;
- $productAttrValueRepository = app()->make(ProductAttrValueRepository::class);
- foreach($cateList as $key => $value){
- $where['mer_cate_id'] = $value['store_category_id'];
- $cateList[$key]['product'] = $this->repository->productList($id,$where, $page, $limit,null);
- foreach($cateList[$key]['product']['list'] as $key1 => $value1){
- $cateList[$key]['product']['list'][$key1]['sku'] = $productAttrValueRepository -> getOptionByProductId($value1['product_id']);
- }
- }
- return app('json')->success($cateList);
- }
- public function getProductGood($id){
- if(!$this->repository->merExists($id))
- return app('json')->fail('店铺不存在');
- $res = $this->repository->getProductGoodList($id);
- return app('json')->success($res);
- }
- }
|