wanghousheng 1 year ago
commit ac72e42596
  1. 17
      app/api/model/Article.php

@ -14,6 +14,7 @@ namespace app\api\model;
use cores\exception\BaseException; use cores\exception\BaseException;
use app\common\model\Article as ArticleModel; use app\common\model\Article as ArticleModel;
use app\api\model\article\Category as CategoryModel;
/** /**
* 商品评价模型 * 商品评价模型
@ -97,12 +98,14 @@ class Article extends ArticleModel
public function helpCenter() public function helpCenter()
{ {
$list = $this->withoutField(['content']) $cat = CategoryModel::where(['status' => 1])->order('sort desc')->select()->toArray();
->where('status', '=', 1) foreach ($cat as $k => $v) {
->where('is_delete', '=', 0) $cat[$k]['child'] = $this->where('status', '=', 1)
->order(['sort' => 'asc', 'create_time' => 'desc']) ->where('is_delete', '=', 0)
->select()->toArray(); ->where('category_id', '=', $v['category_id'])
$data = static::preload($list, ['image', 'category']); ->order(['sort' => 'asc', 'create_time' => 'desc'])
return $data; ->select()->toArray();
}
return $cat;
} }
} }
Loading…
Cancel
Save