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.

48 lines
1.2 KiB

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