Index.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\api\controller;
  10. use think\facade\Request;
  11. use app\api\service\Home as HomeService;
  12. use app\common\exception\BaseException;
  13. /**
  14. * 首页控制器
  15. * Class Index
  16. * @package app\api\controller
  17. */
  18. class Index extends Base {
  19. /**
  20. * 首页
  21. * @return \think\response\Json
  22. */
  23. public function index(){
  24. try{
  25. return $this->returnAjax("ok",1,HomeService::getData());
  26. }catch (\Exception $ex){
  27. return $this->returnAjax($ex->getMessage(),0);
  28. }
  29. }
  30. /**
  31. * 获取列表数据
  32. * @return \think\response\Json
  33. */
  34. public function get_list(){
  35. try{
  36. return $this->returnAjax("ok",1,HomeService::getList(Request::param()));
  37. }catch (BaseException $ex){
  38. return $this->returnAjax($ex->getMessage(),$ex->getCode(),$ex->getRaw());
  39. }
  40. }
  41. }