123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- /*
- |--------------------------------------------------------------------------
- | API Routes
- |--------------------------------------------------------------------------
- |
- | Here is where you can register API routes for your application. These
- | routes are loaded by the RouteServiceProvider within a group which
- | is assigned the "api" middleware group. Enjoy building your API!
- |
- */
- $api = app('Dingo\Api\Routing\Router');
- $api->version('v1', ['namespace' => 'App\Http\Controllers\V1'], function ($api) {
- /*
- |--------------------------------------------------------------
- | 不需要token验证的接口
- |--------------------------------------------------------------
- */
- $api->group([
- 'middleware' => ['throttle:120'], //代表1分钟内接口最高请求次数,超出返回 429: Too Many Attempts
- ], function ($api) {
- $api->post('sms/send', 'SmsController@send'); //发送手机验证码
- $api->post('email/send', 'SmsController@sendEmailCode'); //发送邮箱验证码
- $api->post('attachment/upload', 'AttachmentController@upload'); //上传附件
- $api->post('attachment/delete', 'AttachmentController@delete'); //删除附件
- $api->get('privacy', 'IndexController@privacyPolice'); //隐私政策
- $api->get('agreement', 'IndexController@userAgreement'); //用户协议
- });
- $api->group(['prefix' => 'auth'], function ($api) {
- $api->post('login', 'AuthController@login'); //账号密码登录
- $api->post('register', 'AuthController@register'); //注册
- $api->post('auth_login', 'AuthController@authLogin'); //APP第三方授权登录(微信)
- $api->post('decrypt_phone', 'AuthController@decryptPhone'); //微信小程序获取手机号
- $api->post('h5_oauth', 'AuthController@h5Oauth'); //H5授权登录
- $api->post('mini_program', 'AuthController@miniProgram'); //微信小程序登录(微信)
- $api->get('mini_code', 'AuthController@miniCode'); //获取微信小程序 code
- });
- $api->group(['prefix' => 'index'], function ($api) {
- $api->get('all_region', 'IndexController@allRegion'); //全国省市区
- $api->get('helps', 'IndexController@helpList'); //帮助类型
- $api->get('answer', 'IndexController@answer'); //问题答案
- });
- /*
- |--------------------------------------------------------------
- | 需要 token 验证的接口 'middleware' => ['api.auth'] 读取的 config/api.php 'auth' => ['jwt' => 'Dingo\Api\Auth\Provider\JWT'], 所以 在 Kernel.php 找不到这个中间件
- |--------------------------------------------------------------
- */
- $api->group([
- 'middleware' => ['api.auth', 'throttle:120'],
- ], function ($api) {
- /* @var Dingo\Api\Routing\Router $api*/
- $api->post('auth/logout', 'AuthController@logout'); //退出登录
- $api->post('auth/forget_password', 'AuthController@forgetPassword'); //忘记密码
- $api->group(['prefix' => 'user'], function($api){
- /* @var Dingo\Api\Routing\Router $api*/
- $api->post('h5_bind', 'UserController@h5Bind'); //H5绑定
- $api->post('h5_rebind', 'UserController@h5Rebind'); //H5解绑
- $api->post('mini_program_bind', 'UserController@miniProgramBind'); //微信小程序绑定
- $api->post('mini_program_rebind', 'UserController@miniProgramReBind'); //微信小程序解绑
- $api->post('sms_bind', 'UserController@smsBind'); //手机号绑定
- $api->post('sms_rebind', 'UserController@smsReBind'); //手机号解绑
- $api->get('group_by_initial', 'UserController@groupByInitial'); //用户列表按照首字母分组排序,类似手机通讯录
- $api->post('feedback', 'UserController@feedback'); //问题反馈
- $api->get('info', 'UserController@info'); //用户信息
- $api->post('update', 'UserController@update'); //更新用户信息
- });
- });
- });
|