Article.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\model\{ArticleCategory,Article as ArticleModel};
  4. use app\common\controller\Api;
  5. use liuniu\UtilService;
  6. use think\Request;
  7. class Article extends Api
  8. {
  9. protected $noNeedRight = ['*'];
  10. public function ify(Request $request)
  11. {
  12. list($pid,$key) = UtilService::getMore(
  13. [
  14. ['pid',0],
  15. ['key',''],
  16. ],$request,true
  17. );
  18. $cid = $this->cid;
  19. return $this->success('获取成功',ArticleCategory::lst(compact('cid','pid','key')));
  20. }
  21. public function lst(Request $request)
  22. {
  23. list($ifyid,$key,$page,$limit,$is_hot,$cid) = UtilService::getMore(
  24. [
  25. ['ifyid',0],
  26. ['key',''],
  27. ['page',1],
  28. ['limit',20],
  29. ['is_hot',-1],
  30. ['is_rec',-1],
  31. ['cid',$this->cid],
  32. ],$request,true
  33. );
  34. return $this->success('获取成功',ArticleModel::lst(compact('ifyid','key','page','limit','is_hot','cid')));
  35. }
  36. public function view()
  37. {
  38. $id = input('id',0);
  39. return $this->success('获取成功',ArticleModel::find($id));
  40. }
  41. }