|
|
|
@ -14,6 +14,7 @@ namespace app\api\model; |
|
|
|
|
|
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
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() |
|
|
|
|
{ |
|
|
|
|
$list = $this->withoutField(['content']) |
|
|
|
|
->where('status', '=', 1) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->order(['sort' => 'asc', 'create_time' => 'desc']) |
|
|
|
|
->select()->toArray(); |
|
|
|
|
$data = static::preload($list, ['image', 'category']); |
|
|
|
|
return $data; |
|
|
|
|
$cat = CategoryModel::where(['status' => 1])->order('sort desc')->select()->toArray(); |
|
|
|
|
foreach ($cat as $k => $v) { |
|
|
|
|
$cat[$k]['child'] = $this->where('status', '=', 1) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->where('category_id', '=', $v['category_id']) |
|
|
|
|
->order(['sort' => 'asc', 'create_time' => 'desc']) |
|
|
|
|
->select()->toArray(); |
|
|
|
|
} |
|
|
|
|
return $cat; |
|
|
|
|
} |
|
|
|
|
} |