Index.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\controller;
  4. use think\Exception;use think\Request;
  5. class Index extends Base
  6. {
  7. /**
  8. * @return \think\response\Json
  9. */
  10. public function add()
  11. {
  12. try{
  13. throw new Exception("数据异常",1006);
  14. } catch (\Exception $e){
  15. return json(["msg"=>$e->getMessage(),"code"=>$e->getCode(),"data"=>[]]);
  16. }
  17. }
  18. /**
  19. * 显示创建资源表单页.
  20. *
  21. * @return \think\Response
  22. */
  23. public function hello($name)
  24. {
  25. return json(['msg'=>"11",'code'=>1,'data'=>[$name]]);
  26. }
  27. /**
  28. * 保存新建的资源
  29. *
  30. * @param \think\Request $request
  31. * @return \think\Response
  32. */
  33. public function save(Request $request)
  34. {
  35. //
  36. }
  37. /**
  38. * 显示指定的资源
  39. *
  40. * @param int $id
  41. * @return \think\Response
  42. */
  43. public function read($id)
  44. {
  45. //
  46. }
  47. /**
  48. * 显示编辑资源表单页.
  49. *
  50. * @param int $id
  51. * @return \think\Response
  52. */
  53. public function edit($id)
  54. {
  55. //
  56. }
  57. /**
  58. * 保存更新的资源
  59. *
  60. * @param \think\Request $request
  61. * @param int $id
  62. * @return \think\Response
  63. */
  64. public function update(Request $request, $id)
  65. {
  66. //
  67. }
  68. /**
  69. * 删除指定资源
  70. *
  71. * @param int $id
  72. * @return \think\Response
  73. */
  74. public function delete($id)
  75. {
  76. //
  77. }
  78. }