feature/main20240421
郭嘉 8 months ago
parent 3867abb56f
commit cb86a52b3e
  1. 4
      app/admin/controller/Feedback.php
  2. 25
      app/api/controller/Category.php
  3. 3
      app/api/model/Category.php
  4. 4
      app/common/model/Category.php
  5. 11
      app/common/model/GoodsCategoryRel.php

@ -72,11 +72,11 @@ class Feedback extends Controller
$list = $model->getList($params, intval($pageSize))->toArray();
foreach ($list['data'] as $kr => $r) {
$res[$kr]['imgs'] = [];
$res[$kr]['imgsInfo'] = [];
if ($r['imgs']) {
$img_ids = explode(",", $r['imgs']);
$files = UploadFile::getFileListBySuper($img_ids);
$list['data'][$kr]['imgs'] = $files ?: null;
$list['data'][$kr]['imgsInfo'] = $files ?: null;
}
}
return $this->renderSuccess($list);

@ -47,11 +47,28 @@ class Category extends Controller
public function listmerchant(): Json
{
$merchantId = $this->request->param('merchantId', '');
$model = new CategoryModel;
$hasGoods = GoodsCategoryRel::getcategory($this->storeId,6);
$hasGoods = GoodsCategoryRel::getcategory($this->storeId,$merchantId);
$arr = [];
if (!empty($arr)) {
$arr = ['cataIds' => $hasGoods];
}
$list = $model->getListPublic($this->request->param(), $arr);
$tmplist = [];
foreach ($list as $kl => $l) {
$tmplist[$kl] = $this->listcata($list, $hasGoods);
}
return $this->renderSuccess(compact('tmplist'));
}
public function listcata($list, $hasGoods) {
foreach ($list as $kl => $l) {
}
$list = $model->getListPublic($this->request->param());
print_r($hasGoods);die;
return $this->renderSuccess(compact('list'));
}
}

@ -39,8 +39,9 @@ class Category extends CategoryModel
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getListPublic(array $param = []): array
public function getListPublic(array $param = [], $otherParam = []): array
{
$param = array_merge($param, $otherParam);
return parent::getList(array_merge($param, ['status' => 1]));
}
}

@ -118,6 +118,10 @@ class Category extends BaseModel
$filter[] = ['merchant_id', '=', $params['merchantId']];
}
if (isset($param['cataIds']) && $param['cataIds'] != "") {
$filter[] = ['category_id', 'in', $param['cataIds']];
}
// 查询列表数据
return $this->with(['image','rankimage'])
->where($filter)

@ -51,12 +51,15 @@ class GoodsCategoryRel extends BaseModel
}
public static function getcategory(int $storeId = null,int $merchantId = null) {
$where = [
'b.store_id' => $storeId,
];
if (!empty($merchantId)) {
$where['a.merchant_id'] = $merchantId;
}
$list = Goods::alias('a')
->rightjoin('goods_category_rel b', 'a.goods_id = b.goods_id')
->where([
'b.store_id' => $storeId,
'a.merchant_id' => $merchantId
])->group('category_id')
->where($where)->group('category_id')
->select();
return $list;
}

Loading…
Cancel
Save