1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?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','apiLogs'], //代表1分钟内接口最高请求次数,超出返回 429: Too Many Attempts
- ], function ($api) {
- $api->get('test', 'IndexController@index'); //用户配置信息
- $api->get('setting/{tags?}', 'SettingsController@get'); //用户配置信息
- $api->post('setting', 'SettingsController@set'); //设置用户信息
- $api->post('sms/send', 'SmsController@send'); //发送手机验证码
- $api->post('email/send', 'EmailController@sendEmailCode'); //发送邮箱验证码
- $api->post('attachments', 'AttachmentController@upload'); //上传附件
- $api->delete('attachments/{uid}', 'AttachmentController@delete'); //删除附件
- $api->get('reset-password', 'AuthController@forgetPassword'); //用户找回密码
- $api->get('privacy', 'IndexController@privacyPolice'); //隐私政策
- $api->get('agreement', 'IndexController@userAgreement'); //用户协议
- $api->get('aboutus', 'IndexController@aboutus'); //关于我们
- });
- $api->group(['prefix' => 'auth'], function ($api) {
- $api->post('register', 'AuthController@register'); //注册
- $api->post('login', 'AuthController@login'); //账号密码登录
- $api->post('smslogin', 'AuthController@loginBySmsCode'); //短信验证码登录
- $api->get('forget_password', 'AuthController@forgetPassword'); //忘记密码
- $api->post('oplogin', 'AuthController@authLogin'); //APP第三方授权登录(微信)
- $api->post('decrypt_phone', 'AuthController@decryptPhone'); //微信小程序获取手机号
- $api->post('mnplogin', 'AuthController@miniProgram'); //微信小程序登录(微信)
- $api->post('oalogin', 'AuthController@h5Oauth'); //H5授权登录[未实现]
- $api->get('minicode', 'AuthController@miniCode'); //获取微信小程序code[未实现]
- });
- $api->group(['prefix' => 'index'], function ($api) {
- $api->get('all_region', 'RegionController@allRegion'); //全国省市区
- $api->get('helps', 'ArticleController@helpList'); //帮助类型
- $api->get('answer', 'ArticleController@answer'); //问题答案
- });
- /*
- |--------------------------------------------------------------
- | 需要 token 验证的接口 'middleware' => ['api.auth'] 读取的 config/api.php 'auth' => ['jwt' => 'Dingo\Api\Auth\Provider\JWT'], 所以 在 Kernel.php 找不到这个中间件
- |--------------------------------------------------------------
- */
- $api->group([
- 'middleware' => ['api.auth', 'throttle:120','checkAuth','apiLogs'],
- ], function ($api) {
- $api->post('logout', 'AuthController@logout')->name('logout'); //退出登录
- $api->post('auth/forget_password', 'AuthController@forgetPassword'); //忘记密码
- $api->group(['prefix' => 'users'], function($api){
- //restful实例
- $api->get('/', 'UserController@index'); //获取用户列表数据
- $api->get('/{id}', 'UserController@show'); //根据用户id查询用户数据
- $api->post('/', 'UserController@create'); //新增用户
- $api->put('/{id}', 'UserController@update'); //修改用户信息
- $api->delete('/{id}', 'UserController@destroy'); //删除用户信息
- $api->post('/{id}/avatar', 'UserController@avatar'); //上传头像接口
- //[未实现:h5绑定、h5解绑;小程序绑定、小程序解绑]
- $api->post('bind_mobile', 'UserController@bindMobile'); //手机号绑定
- $api->post('rebind_mobile', 'UserController@bindMobile'); //手机号解绑
- $api->get('group_by_initial', 'UserController@groupByInitial'); //用户列表按照首字母分组排序,类似手机通讯录 ?
- $api->post('feedback', 'UserController@feedback'); //问题反馈 意见反馈
- });
- });
- $api->post('pay/alipay/notify', 'PayController@alipayNotify'); //支付宝支付回调
- $api->post('pay/wechatpay/notify', 'PayController@wechatpayNotify'); //微信支付回调
- });
|