You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

8 years ago
8 years ago
8 years ago
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Controllers\Api\CommonController;
  4. use Illuminate\Http\Request;
  5. use App\Common\ReturnData;
  6. use App\Http\Model\Article;
  7. class ArticleController extends CommonController
  8. {
  9. public function __construct()
  10. {
  11. parent::__construct();
  12. }
  13. public function articleList(Request $request)
  14. {
  15. //参数
  16. $data['limit'] = $request->input('limit', 10);
  17. $data['offset'] = $request->input('offset', 0);
  18. if($request->input('typeid', null) !== null){$data['typeid'] = $request->input('typeid');}
  19. $data['ischeck'] = Article::IS_CHECK;
  20. $res = Article::getList($data);
  21. if($res == false)
  22. {
  23. return ReturnData::create(ReturnData::SYSTEM_FAIL);
  24. }
  25. return ReturnData::create(ReturnData::SUCCESS,$res);
  26. }
  27. public function articleDetail(Request $request)
  28. {
  29. //参数
  30. $data['id'] = $request->input('id');
  31. $data['ischeck'] = Article::IS_CHECK;
  32. $res = Article::getOne($data);
  33. if($res === false)
  34. {
  35. return ReturnData::create(ReturnData::SYSTEM_FAIL);
  36. }
  37. return ReturnData::create(ReturnData::SUCCESS,$res);
  38. }
  39. }