package sys import ( "eta/eta_mini_ht_api/common/contants" "eta/eta_mini_ht_api/controllers" configService "eta/eta_mini_ht_api/service/sys" ) type SysController struct { controllers.BaseController } type SysconfigResp struct { Value interface{} } // GetRiskInfoToken 获取风险测评问卷请求Token // @Summary 获取风险测评问卷请求Token // @Description 获取风险测评问卷请求Token // @Success 200 {object} controllers.BaseResponse // @router /config [get] func (s *SysController) GetConfig(config string) { controllers.Wrap(&s.BaseController, func() (result *controllers.WrapData, err error) { result = s.InitWrapData("获取配置项失败") sysConfig := contants.GetConfig(config) if sysConfig == nil { s.FailedResult("配置项不存在", result) return } var value interface{} switch sysConfig.ConfigType { case "string": value, err = configService.GetStrConfig(sysConfig.ConfigId) case "int": value, err = configService.GetIntConfig(sysConfig.ConfigId) case "byte": value, err = configService.GetByteConfig(sysConfig.ConfigId) default: s.FailedResult("配置项类型错误", result) return } if err != nil { s.FailedResult("配置项获取失败", result) return } result = s.InitWrapData("风险测评问卷请求token生成成功") s.SuccessResult("success", SysconfigResp{ Value: value, }, result) return }) }