IndexController.php 735 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\index\controller;
  3. use app\BaseController;
  4. use app\common\service\JsonService;
  5. use think\facade\Request;
  6. class IndexController extends BaseController
  7. {
  8. /**
  9. * @notes 主页
  10. * @param string $name
  11. * @return \think\response\Json|\think\response\View
  12. * @author 段誉
  13. * @date 2022/10/27 18:12
  14. */
  15. public function index($name = '你好,likeadmin')
  16. {
  17. $template = app()->getRootPath() . 'public/admin/index.html';
  18. if (Request::isMobile()) {
  19. $template = app()->getRootPath() . 'public/admin/index.html';
  20. }
  21. if (file_exists($template)) {
  22. return view($template);
  23. }
  24. return JsonService::success($name);
  25. }
  26. }