| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\webApp;
- use App\Services\Api\ArticleService;
- /**
- * 文章资讯
- * @package App\Http\Controllers\Api\v1
- */
- class ArticleController extends webApp
- {
- /**
- * 信息
- * @return array
- */
- public function info()
- {
- $id = request()->post('id', 0);
- try {
- if($info = ArticleService::make()->getInfo($id, $this->userId)){
- return showJson(1010, true, $info);
- }else{
- return showJson(1009,false,'',403);
- }
- } catch (\Exception $exception){
- return showJson(1036,false,['error'=>$exception->getMessage()]);
- }
- }
- /**
- * 列表
- * @return array|mixed
- */
- public function index()
- {
- $params = request()->post();
- try {
- if($datas = ArticleService::make()->getDataList($params, $this->userId)){
- return showJson(1010, true, $datas);
- }else{
- return showJson(1009,false,'',403);
- }
- } catch (\Exception $exception){
- return showJson(1041,false,['error'=>$exception->getMessage()]);
- }
- }
- }
|