1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /**
- * NewsController.php UTF-8
- *
- *
- * @date : 2018/5/28 16:54
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\cfloat\controller;
- use api\common\controller\CFloatBaseController;
- use huo\controller\posts\Posts;
- use huolib\status\CommonStatus;
- class NewsController extends CFloatBaseController {
- public function _initialize() {
- parent::_initialize();
- }
- /**
- * Client浮点获取资讯列表
- * http://doc.1tsdk.com/138?page_id=3281
- * 【域名】/cfloat/news/list
- */
- public function index() {
- $_param = $this->request->param();
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_post_class = new Posts();
- $_data = $_post_class->getList($_param, $_page.','.$_offset);
- if (CommonStatus::NO_ERROR != $_data['code']) {
- $this->error($_data['msg'], $_data['data'], $_data['code']);
- }
- $this->success(lang('SUCCESS'), $_data['data'], $_data['code']);
- }
- /**
- * Client浮点获取资讯详情
- * http://doc.1tsdk.com/138?page_id=3282
- * 【域名】/cfloat/news/detail
- */
- public function detail() {
- $_news_id = $this->request->param('news_id/d', 0);
- if (empty($_news_id)) {
- $this->error('资讯ID不能为空', [], CommonStatus::INVALID_PARAMS);
- }
- $_post_class = new Posts();
- $_data = $_post_class->getDetail($_news_id);
- $this->success(lang('SUCCESS'), $_data['data'], $_data['code']);
- }
- }
|