1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace app\api\controller;
- use app\common\model\{ArticleCategory,Article as ArticleModel};
- use app\common\controller\Api;
- use liuniu\UtilService;
- use think\Request;
- class Article extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- public function ify(Request $request)
- {
- list($pid,$key) = UtilService::getMore(
- [
- ['pid',0],
- ['key',''],
- ],$request,true
- );
- $cid = $this->cid;
- return $this->success('获取成功',ArticleCategory::lst(compact('cid','pid','key')));
- }
- public function lst(Request $request)
- {
- list($ifyid,$key,$page,$limit,$is_hot,$is_rec,$cid,$order) = UtilService::getMore(
- [
- ['ifyid',0],
- ['key',''],
- ['page',1],
- ['limit',20],
- ['is_hot',-1],
- ['is_rec',-1],
- ['cid',$this->cid],
- ['order','']
- ],$request,true
- );
- return $this->success('获取成功',ArticleModel::lst(compact('ifyid','key','page','limit','is_hot','is_rec','cid','order')));
- }
- public function view()
- {
- $id = input('id',0);
- ArticleModel::where('id',$id)->inc('visit',1)->update();
- return $this->success('获取成功',ArticleModel::find($id));
- }
- }
|