123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <?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('email/send', 'EmailController@sendEmailCode'); //发送邮箱验证码
- $api->post('email/email_verify', 'EmailController@emailVerify'); //验证码验证
- $api->post('attachments/upload', 'AttachmentController@upload'); //上传附件
- $api->delete('attachments/{uid}', 'AttachmentController@delete'); //删除附件
- $api->post('reset_password', 'AuthController@forgetPassword'); //用户找回密码
- $api->post('find_id', 'AuthController@findId'); //用户找回ID
- $api->get('captcha', 'AuthController@captcha'); // 图形二维码
- $api->get('privacy', 'IndexController@privacyPolice'); //隐私政策
- $api->get('agreement', 'IndexController@userAgreement'); //用户协议
- $api->get('aboutus', 'IndexController@aboutus'); //关于我们
- $api->get('filter_type_list', 'ProductController@filterTypeList'); //产品类型(分类)
- $api->get('upload_type_list', 'ProductController@uploadTypeList'); //产品类型(上传)
- });
- $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->group(['prefix' => 'index'], function ($api) {
- $api->get('product_list', 'ProductController@productList'); //首页产品列表
- });
- // 系统设置
- $api->group(['prefix' => 'settings'], function ($api) {
- $api->get('notice_policy', 'SettingsController@noticePolicy'); //公告|政策
- $api->get('record', 'SettingsController@record'); //备案信息
- $api->get('clause', 'SettingsController@clause'); //条款
- $api->get('law', 'SettingsController@law'); //法律声明
- $api->get('copyright', 'SettingsController@copyright'); //版权
- });
- /*
- |--------------------------------------------------------------
- | 需要 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) {
- $api->get('logout', 'AuthController@logout')->name('logout'); //退出登录
- $api->post('auth/forget_password', 'AuthController@forgetPassword'); //忘记密码
- // 用户
- $api->group(['prefix' => 'users'], function($api){
- $api->get('show', 'UserController@show'); //根据用户id查询用户数据
- $api->post('up_user_info', 'UserController@upUserInfo'); //修改用户信息
- $api->delete('destroy', 'UserController@destroy'); //删除用户信息
- $api->post('avatar', 'UserController@avatar'); //上传头像接口
- $api->get('add_follow', 'UserController@addFollow'); //添加关注
- $api->get('cancelFollow', 'UserController@cancelFollow'); //添加关注
- $api->get('group_by_initial', 'UserController@groupByInitial'); //用户列表按照首字母分组排序
- $api->post('accountStop', 'UserController@accountStop'); //账号停用
- $api->post('accountOpen', 'UserController@accountOpen'); //账号启用
- });
- // 产品
- $api->group(['prefix' => 'product'], function($api){
- $api->post('add_product', 'ProductController@addProduct'); //添加产品
- $api->delete('del_product', 'ProductController@delProduct'); //删除产品
- $api->get('user_product_list', 'ProductController@userProductList'); //我的产品列表
- $api->get('product_detail', 'ProductController@productDetail'); //产品详情
- $api->get('add_collect', 'ProductController@addCollect'); //添加收藏
- $api->get('cancel_collect', 'ProductController@cancelCollect'); //取消收藏
- $api->get('add_like', 'ProductController@addLike'); //喜欢产品
- $api->get('collect_list', 'ProductController@collectList'); //收藏列表
- $api->get('report_list', 'ProductController@reportList'); //举报列表
- $api->post('report', 'ProductController@report'); //举报图片
- $api->get('getProductRecommend', 'ProductController@getProductRecommend'); //获取推荐数据
- });
- // 消息
- $api->group(['prefix' => 'msg'], function($api){
- $api->get('msg_list', 'MsgController@msgList'); //消息列表
- $api->get('msg_detail', 'MsgController@msgDetail'); //消息详情
- $api->get('getNewMsgState', 'MsgController@getNewMsgState'); //消息详情
- });
- // 会员
- $api->group(['prefix' => 'member'], function($api){
- $api->get('member_list', 'MemberController@memberList'); //会员价格
- $api->post('join_member', 'MemberController@joinMember'); //加入会员
- });
- // 文件夹
- $api->group(['prefix' => 'folder'], function($api){
- $api->post('add_folder', 'UserFolderController@addFolder'); //新建文件夹
- $api->get('folder_list', 'UserFolderController@folderList'); //文件夹列表
- $api->get('folder_detail', 'UserFolderController@folderDetail'); //文件夹详情
- $api->post('edit_folder', 'UserFolderController@editFolder'); //编辑文件夹
- $api->post('move_file', 'UserFolderController@moveFile'); //移动文件
- $api->get('image_list', 'UserFolderController@imageList'); //图片列表
- });
- // 支付
- $api->group(['prefix' => 'pay'], function($api){
- $api->get('payment', 'PayController@payment'); //构建支付
- });
- });
- });
|