<?php

use think\facade\Route;

/**
 * 第三方平台代小程序实现业务 相关路由
 */
Route::group('third', function () {
    //快速创建小程序(不一定用)
    Route::post('miniprogram/create', 'v1.merchant.Third/createMiniProgram')->name('createMiniProgram');//快速创建小程序

    //基础信息设置
    Route::post('code/modify_domain/:mer_id', 'v1.merchant.Third/modifyDomain')->name('modifyDomain');//设置服务器域名

    //代码模板库设置
    Route::get('template/draft_list', 'v1.merchant.Third/getTemplateDraftList')->name('getTemplateDraftList');//获取代码草稿列表
    Route::get('template/list', 'v1.merchant.Third/getTemplateList')->name('getTemplateList');//获取代码模板列表
    Route::post('template/add/:draft_id', 'v1.merchant.Third/addToTemplate')->name('addToTemplate');//将草稿添加到代码模板库
    Route::post('template/del/:template_id', 'v1.merchant.Third/deleteTemplate')->name('deleteTemplate');//删除指定代码模板

    //代码管理
    Route::post('code/commit/:mer_id/:template_id', 'v1.merchant.Third/commitCode')->name('commitCode');//上传小程序代码
    Route::get('code/list/:mer_id', 'v1.merchant.Third/getPageList')->name('getPageList');//获取已上传的代码的页面列表
    Route::get('code/qrcode/:mer_id', 'v1.merchant.Third/getQrCode')->name('getQrCode');//获取体验版二维码
    Route::post('code/audit/:mer_id', 'v1.merchant.Third/submitAudit')->name('submitAudit');//提交审核
    Route::post('code/audit/media/:mer_id', 'v1.merchant.Third/addAuditMedia')->name('addAuditMedia');//提交审核素材
    Route::get('code/audit_list', 'v1.merchant.Third/getAuditList')->name('getAuditList');//获取审核列表
    Route::post('code/audit_status/:mer_id/:auditid', 'v1.merchant.Third/getAuditStatus')->name('getAuditStatus');//查询指定发布审核单的审核状态
    Route::post('code/undo/:mer_id', 'v1.merchant.Third/undoAudit')->name('undoAudit');//小程序审核撤回
    Route::get('code/audit_last_status/:mer_id', 'v1.merchant.Third/getLatestAuditStatus')->name('getLatestAuditStatus');//查询最新一次审核单的审核状态
    Route::post('code/release/:mer_id', 'v1.merchant.Third/release')->name('release');//发布已通过审核的小程序
    Route::post('code/revert/:mer_id', 'v1.merchant.Third/revertCodeRelease')->name('revertCodeRelease');//版本回退
    Route::post('code/gray_release/:mer_id/:gray', 'v1.merchant.Third/grayRelease')->name('grayRelease');//分阶段发布
    Route::post('code/gray_release/revert/:mer_id/', 'v1.merchant.Third/revertGrayRelease')->name('revertGrayRelease');//分阶段发布
    Route::get('code/gray_release/plan/:mer_id', 'v1.merchant.Third/getGrayReleasePlan')->name('getGrayReleasePlan');//查询当前分阶段发布详情
    Route::post('code/visit_status/:mer_id/:action', 'v1.merchant.Third/changeVisitStatus')->name('changeVisitStatus');//修改小程序线上代码的可见状态（仅供第三方代小程序调用）
    Route::get('code/support_version/:mer_id', 'v1.merchant.Third/getWeAppSupportVersion')->name('getWeAppSupportVersion');//查询当前设置的最低基础库版本及各版本用户占比
    Route::post('code/support_version/:mer_id', 'v1.merchant.Third/setWeAppSupportVersion')->name('setWeAppSupportVersion');//设置最低基础库版本
    Route::get('code/query_quota/:mer_id', 'v1.merchant.Third/queryQuota')->name('queryQuota');//询服务商的当月提审限额（quota）和加急次数
    Route::post('code/speed_up_audit/:mer_id/:auditid', 'v1.merchant.Third/speedUpAudit')->name('speedUpAudit');//加急审核申请
    Route::get('code/cate/:mer_id', 'v1.merchant.Third/getCategory')->name('getCategory');//获取审核时可填写的类目信息

    //体验者管理
    Route::post('tester/add/:mer_id', 'v1.merchant.Third/bindTester')->name('bindTester');//绑定体验者
    Route::post('tester/del/:mer_id', 'v1.merchant.Third/unbindTester')->name('unbindTester');//解绑体验者
})->middleware([
    \app\http\middleware\AllowOriginMiddleware::class,
    \app\adminapi\middleware\AdminAuthTokenMiddleware::class,
    \app\adminapi\middleware\AdminCkeckRole::class
]);