api.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. use Illuminate\Http\Request;
  3. /*
  4. |--------------------------------------------------------------------------
  5. | API Routes
  6. |--------------------------------------------------------------------------
  7. |
  8. | Here is where you can register API routes for your application. These
  9. | routes are loaded by the RouteServiceProvider within a group which
  10. | is assigned the "api" middleware group. Enjoy building your API!
  11. |
  12. */
  13. # 接管路由
  14. $api = app('Dingo\Api\Routing\Router');
  15. /** @var TYPE_NAME $api */
  16. $api->version('v1', function ($api) {
  17. $api->group([
  18. 'namespace' => 'App\Http\Controllers\Api\V1',
  19. 'middleware' => ['serializer:array', 'cross'],//'api.throttle',
  20. 'limit' => config('api.rate_limits.sign.limit'),
  21. 'expires' => config('api.rate_limits.sign.expires'),
  22. ], function ($api) {
  23. $api->get('addttt', 'HomeController@add'); #test
  24. $api->get('testdata', 'HomeController@testdata'); #test
  25. # 授权登录-code交换openid,session_key
  26. $api->any('/wxappLogin', 'AuthorizationsController@wxappLogin');
  27. #账号密码登录
  28. $api->post('/store', 'AuthorizationsController@store');
  29. # 微信授权登录测试
  30. /** -------------------- 游客可以访问的接口----------------------------------------------------------------------------------------*/
  31. $api->get('getNotice', 'MessageController@getNotice'); # 获取网站公告
  32. $api->get('notification', 'MessageController@notification'); # 消息通知
  33. $api->get('lockDetails', 'MessageController@lockDetails'); # 获取网站公告详情
  34. $api->get('makeHome', 'MakeJobsController@getMakeHomeShow'); # 预约页面-时间、设备、时间段
  35. $api->get('banner', 'IndexController@banner'); # banner
  36. $api->get('introduction', 'IndexController@introduction'); # 简介
  37. /** -------------------- 需要 token 验证的接口 refresh 定时刷新token------------------------------------------------------------------*/
  38. $api->group(['middleware' => ['refresh', 'jwt.auth']], function ($api) {
  39. $api->get('make-page-info', 'MakeJobsController@makePageInfo'); # 当前登录用户信息
  40. $api->post('decrypt', 'UserCenterController@decrypt'); #解密手机号
  41. // $api->post('sendCode', 'UserCenterController@sendCode'); #获取手机号验证码
  42. $api->post('verificationCodes', 'VerificationCodesController@store')->name('api.verificationCodes.store'); # 短信验证码
  43. $api->post('is_verification', 'UsersController@isVerification'); # 短信验证码校验
  44. $api->post('setPhone', 'UserCenterController@setPhone'); # 更新手机号验证码
  45. # 用户信息相关
  46. $api->group(['prefix' => 'user'], function ($api) {
  47. $api->get('info', 'UsersController@me'); # 当前登录用户信息
  48. $api->post('set-user-info', 'UserCenterController@setUserInfo'); # 修改当前用户信息
  49. $api->post('my-make-list', 'MakeJobsController@myMakeList'); # 我的预约列表
  50. $api->post('coupons-list', 'UserTicketController@getList'); # 优惠卷列表
  51. $api->post('cancel-make-info', 'MakeJobsController@cancelMakeInfo'); # 取消预约
  52. $api->post('change-website', 'UsersController@changeUserWebsite'); # 取消预约
  53. });
  54. # 获取默认店铺
  55. $api->get('getShop', 'WebsitesController@getShop');
  56. $api->get('shops', 'WebsitesController@shops');
  57. //is_material 检测手机号是否存在
  58. $api->group(['middleware' => ['is_material']], function ($api) {
  59. #token 相关
  60. /*$api->group(['prefix' => 'authorizations'], function ($api) {
  61. # 刷新token
  62. $api->put('current', 'AuthorizationsController@update')->name('api.authorizations.update');
  63. # 删除token
  64. $api->delete('current', 'AuthorizationsController@destroy')->name('api.authorizations.destroy');
  65. });*/
  66. # 获取配置信息列表
  67. $api->post('make-config-list', 'MakeJobsController@makeConfigList');
  68. # 预约
  69. $api->post('make', 'MakeJobsController@make'); # 预约
  70. $api->post('make_detect', 'MakeJobsController@makeDetect'); # 预约 检测
  71. });
  72. $api->get('operationAnalysis', 'SiteController@operationAnalysis'); #站点经营分析
  73. $api->get('siteList', 'SiteController@siteList'); #站点列表
  74. $api->get('userManage', 'SiteController@userManage'); #学员管理
  75. $api->get('paymentRecords', 'SiteController@paymentRecords'); #收款记录
  76. });
  77. $api->post('authorizations', 'AuthorizationsController@store')->name('api.authorizations.store'); # 登录
  78. /*$api->post('verificationCodes', 'VerificationCodesController@store')->name('api.verificationCodes.store'); # 短信验证码
  79. $api->get('is_verification', 'UsersController@isVerification'); # 短信验证码校验
  80. $api->post('users', 'UsersController@store')->name('api.users.store'); # 用户注册
  81. $api->post('forget_password', 'UsersController@forgetPassword'); # 忘记密码
  82. $api->post('authorizations', 'AuthorizationsController@store')->name('api.authorizations.store'); # 登录
  83. */
  84. });
  85. });