IndexController.php 944 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Module\Base;
  4. use Redirect;
  5. /**
  6. * 页面
  7. * Class IndexController
  8. * @package App\Http\Controllers
  9. */
  10. class IndexController extends Controller
  11. {
  12. private $version = '1.4';
  13. public function __invoke($method, $action = '', $child = '')
  14. {
  15. $app = $method ? $method : 'main';
  16. if ($action) {
  17. $app .= "__" . $action;
  18. }
  19. return (method_exists($this, $app)) ? $this->$app($child) : Base::ajaxError("404 not found (" . str_replace("__", "/", $app) . ").");
  20. }
  21. /**
  22. * 首页
  23. * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  24. */
  25. public function main()
  26. {
  27. return view('main', ['version' => $this->version]);
  28. }
  29. /**
  30. * 接口文档
  31. * @return \Illuminate\Http\RedirectResponse
  32. */
  33. public function api()
  34. {
  35. return Redirect::to(Base::fillUrl('docs'), 301);
  36. }
  37. }