routerAdd('POST', '/api/scheme/update', function (e) {
    const guards = require(`${__hooks}/bai_api_pb_hooks/bai_api_shared/middlewares/requestGuards.js`)
    const schemeService = require(`${__hooks}/bai_api_pb_hooks/bai_api_shared/services/schemeService.js`)
    const logger = require(`${__hooks}/bai_api_pb_hooks/bai_api_shared/utils/logger.js`)
    const { success, fail } = require(`${__hooks}/bai_api_pb_hooks/bai_api_shared/utils/response.js`)

    try {
        guards.requireJson(e)
        const authState = guards.requireManagePlatformUser(e)
        guards.duplicateGuard(e)

        const payload = guards.validateSchemeMutationBody(e, true)
        const data = schemeService.updateScheme(authState.openid, payload)

        return success(e, '更新方案成功', data)
    } catch (err) {
        const status = (err && err.statusCode) || (err && err.status) || 400
        logger.error('更新方案失败', {
            status: status,
            errMsg: (err && err.message) || '未知错误',
            data: (err && err.data) || {},
        })
        return fail(e, (err && err.message) || '操作失败', (err && err.data) || {}, status)
    }
})
