| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use app\common\model\AnnouncementModel;
- //空投
- class Airdrop extends Api
- {
- protected array $noNeedLogin = ['list','show'];
- protected string $lan = '';
- public function _initialize()
- {
- parent::_initialize();
- $this->lan = $this->request->getLan();
- }
- //新人福利
- public function newbie()
- {
- $paginator = (new AnnouncementModel)
- ->where('type_id', 1)
- ->where('status', 1)
- ->order('id DESC,weigh desc')
- ->field('id,img_url,createtime,' . $this->lan.'_title as title')
- ->paginate($this->pageSize);
- $this->success('', $this->buildResp($paginator->total(), $paginator->currentPage(), $paginator->items()));
- }
- public function show(int $id)
- {
- $info = (new AnnouncementModel)
- ->where('id', $id)
- ->where('status', 1)
- ->field('id,img_url,body,createtime,' . $this->lan.'_title as title')
- ->find();
- if(empty($info)){
- $this->error('公告信息不存');
- }
- $this->success('', $info);
- }
- }
|