123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- /**
- * NewsController.php UTF-8
- * 资讯详情
- *
- * @date : 2017/11/15 18:41
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace api\wapapp\controller\v8;
- use api\common\controller\V2ApiBaseController;
- use huo\controller\posts\Post;
- use huo\controller\posts\Posts;
- use huolib\constant\FormatConst;
- use huolib\status\CommonStatus;
- class NewsController extends V2ApiBaseController {
- public function __construct() {
- parent::__construct();
- }
- /**
- * 资讯列表
- * http://doc.1tsdk.com/95?page_id=2297
- * 【域名】/v8/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']);
- }
- if (FormatConst::FORMAT_HTML == $this->response_type) {
- $this->assign($_data);
- return $this->fetch('news/index');
- }
- $this->success(lang('SUCCESS'), $_data);
- }
- /**
- * 资讯详情
- * http://doc.1tsdk.com/138?page_id=2850
- * 【域名】/v8/news/detail
- *
- */
- public function read() {
- $_news_id = $this->request->param('news_id/d', 0);
- $_post_class = new Posts();
- $_data = $_post_class->getDetail($_news_id);
- if (CommonStatus::NO_ERROR != $_data['code']) {
- $this->error($_data['msg'], $_data['data'], $_data['code']);
- }
- if (FormatConst::FORMAT_HTML == $this->response_type) {
- $this->assign($_data);
- return $this->fetch('news/detail');
- }
- $this->success(lang('SUCCESS'), $_data);
- }
- }
|