| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Services\Common\ArticleService;
- /**
- * 文章
- * Class ArticleController
- * @package App\Http\Controllers\Api
- */
- class ArticleController extends webApp
- {
- public function __construct()
- {
- parent::__construct();
- $this->service = new ArticleService();
- }
- /**
- * 获取列表
- * @return array|mixed
- */
- public function help()
- {
- $pageSize = request()->post('limit', 15);
- $params = request()->all();
- $params['status'] = 1;
- $params['time_type'] = 1;
- $params['type'] = 1;
- $list = ArticleService::make()->getDataList($params, $pageSize);
- return message(1002, true, $list);
- }
- /**
- * 详情
- * @return array|mixed
- */
- public function info()
- {
- $id = request()->post('id', 0);
- if($id<=0){
- return message(1003, false);
- }
- $info = ArticleService::make()->getInfo(['id'=> $id,'mark'=> 1]);
- if($info){
- ArticleService::make()->updateViews($id);
- }
- return message(1002, true, $info);
- }
- /**
- * 单页数据
- * @return array
- */
- public function page()
- {
- $type = request()->post('type', 0);
- if($type<=0){
- return message(1003, false);
- }
- $info = ArticleService::make()->getInfo(['type'=> $type,'mark'=> 1]);
- return message(1002, true, $info);
- }
- }
|