api.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. /**
  3. * @Created by PhpStorm
  4. * @author: Kirin
  5. * @day: 2024/11/19
  6. * @time: 11:16
  7. */
  8. use app\http\middleware\AllowOriginMiddleware;
  9. use app\http\middleware\api\AuthTokenMiddleware;
  10. use app\http\middleware\api\BlockerMiddleware;
  11. use app\http\middleware\api\LocationMiddleware;
  12. use app\http\middleware\api\MemberTypeMiddleware;
  13. use app\http\middleware\StationOpenMiddleware;
  14. use think\facade\Route;
  15. Route::group('api', function () {
  16. //城市列表
  17. Route::get('city', 'Pub/city');
  18. //城市列表
  19. Route::get('cityList', 'Pub/cityList');
  20. //APP版本号
  21. Route::get('version', 'Pub/version');
  22. //登陆相关
  23. Route::group(function () {
  24. //账号密码登录
  25. Route::post('login', 'Login/login')->name('login');
  26. //注册
  27. Route::post('register', 'Login/register')->name('register');
  28. //获取发短信的key
  29. Route::get('verify_code', 'Login/verifyCode')->name('verifyCode');
  30. //手机号登录
  31. Route::post('login/mobile', 'Login/mobile')->name('loginMobile');
  32. //图片验证码
  33. Route::get('sms_captcha', 'Login/captcha')->name('captcha');
  34. //验证码发送
  35. Route::post('verify', 'Login/verify')->name('registerVerify');
  36. //手机号修改密码
  37. Route::post('pwd/reset', 'Login/reset')->name('resetPwd');
  38. //图形验证码
  39. Route::get('ajcaptcha', 'Login/ajcaptcha')->name('ajcaptcha');
  40. //图形验证码
  41. Route::post('ajcheck', 'Login/ajcheck')->name('ajcheck');
  42. });
  43. //定位接口
  44. Route::group(function () {
  45. //可登可不登的接口
  46. Route::group('', function () {
  47. //公共类
  48. Route::get('index', 'Pub/index')->name('index');//首页
  49. })->middleware(AuthTokenMiddleware::class, false);
  50. //用户接口
  51. Route::group('', function () {
  52. //退出登录
  53. Route::get('logout', 'Login/logout')->name('logout');
  54. //修改交易密码
  55. Route::post('trade_pwd/reset', 'Login/reset_trade_pwd')->middleware(BlockerMiddleware::class)->name('resetTradePwd');
  56. //上传图片
  57. Route::post('upload', 'Pub/upload_image')->middleware(BlockerMiddleware::class)->name('uploadImage');
  58. //修改账号
  59. Route::put('account', 'user.User/setAccount')->name('setAccount')->middleware(BlockerMiddleware::class)->name('setAccount');
  60. //用户相关
  61. Route::group('user', function () {
  62. //用户信息
  63. Route::get('info', 'user.User/info')->name('userInfo');
  64. //转账
  65. //资金流
  66. //推广
  67. });
  68. })->middleware(AuthTokenMiddleware::class);
  69. //装修工接口
  70. Route::group('', function () {
  71. })->middleware(AuthTokenMiddleware::class)->middleware(MemberTypeMiddleware::class, 'worker');
  72. //设计师接口
  73. Route::group('', function () {
  74. })->middleware(AuthTokenMiddleware::class)->middleware(MemberTypeMiddleware::class, 'designer');
  75. //业务员接口
  76. Route::group('', function () {
  77. })->middleware(AuthTokenMiddleware::class)->middleware(MemberTypeMiddleware::class, 'salesperson');
  78. })->middleware(LocationMiddleware::class);
  79. })
  80. ->prefix('api.')
  81. ->middleware(AllowOriginMiddleware::class)
  82. ->middleware(StationOpenMiddleware::class);