|
|
@@ -4,6 +4,7 @@ namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\AnnouncementModel;
|
|
|
+use app\common\model\AnnouncementType;
|
|
|
|
|
|
class Announcement extends Api
|
|
|
{
|
|
|
@@ -25,15 +26,16 @@ class Announcement extends Api
|
|
|
}
|
|
|
|
|
|
//列表
|
|
|
- public function list(AnnouncementModel $announcementModel)
|
|
|
+ public function list(AnnouncementModel $announcementModel, AnnouncementType $announcementType)
|
|
|
{
|
|
|
$typeId = $this->request->param('type_id', 1, 'intval');
|
|
|
$paginator = $announcementModel->where('type_id', $typeId)
|
|
|
->where('status', 1)->where('to_lang', $this->lan)
|
|
|
- ->field('id,to_lang,weigh,img_url,createtime,title as title,introduction,body')
|
|
|
- ->order('weigh desc, id desc')
|
|
|
+ ->field('id,to_lang,weigh,img_url,createtime,title as title,introduction,body,is_top,sub_type_id')
|
|
|
+ ->order('is_top desc, weigh desc')
|
|
|
->paginate($this->pageSize);
|
|
|
-
|
|
|
+
|
|
|
+ $paginator = $announcementType::getSubTypeById($paginator);
|
|
|
$this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
|
|
|
}
|
|
|
|