NewsController.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * NewsController.php UTF-8
  4. * H5浮点资讯
  5. *
  6. * @date : 2018/5/3 11:13
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\float\controller;
  13. use api\common\controller\FloatBaseController;
  14. use huo\controller\posts\Post;
  15. use huo\controller\posts\Posts;
  16. class NewsController extends FloatBaseController {
  17. public function _initialize() {
  18. parent::_initialize();
  19. }
  20. /**
  21. * H5浮点资讯列表
  22. * http://doc.1tsdk.com/138?page_id=3209
  23. * 【域名】/float/news/list
  24. */
  25. public function index() {
  26. $_param = $this->request->param();
  27. $_page = $this->request->param('page/d', 1);
  28. $_offset = $this->request->param('offset/d', 10);
  29. $_post_class = new Posts();
  30. $_data = $_post_class->getList($_param, $_page.','.$_offset);
  31. $this->returnData($_data);
  32. }
  33. /**
  34. * H5浮点资讯详情
  35. * http://doc.1tsdk.com/138?page_id=3210
  36. * 【域名】/float/news/detail
  37. */
  38. public function read() {
  39. $_news_id = $this->request->param('news_id/d', 0);
  40. $_post_class = new Posts();
  41. $_data = $_post_class->getDetail($_news_id);
  42. $this->returnData($_data);
  43. }
  44. }