fix: 多语言翻译前缀匹配查询
This commit is contained in:
@@ -35,12 +35,17 @@ type SysConfigController struct {
|
||||
//
|
||||
// GET /list
|
||||
func (s *SysConfigController) List(c *gin.Context) {
|
||||
querys := ctx.QueryMap(c)
|
||||
data := s.sysConfigService.SelectConfigPage(querys)
|
||||
|
||||
rows := data["rows"].([]model.SysConfig)
|
||||
// 闭包函数处理多语言
|
||||
language := ctx.AcceptLanguage(c)
|
||||
querys := ctx.QueryMap(c)
|
||||
// 多语言值转key查询
|
||||
if v, ok := querys["configName"]; ok && v != "" {
|
||||
querys["configName"] = i18n.TFindKeyPrefix(language, "config", v.(string))
|
||||
}
|
||||
|
||||
data := s.sysConfigService.SelectConfigPage(querys)
|
||||
rows := data["rows"].([]model.SysConfig)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysConfig) {
|
||||
for i := range *arr {
|
||||
(*arr)[i].ConfigName = i18n.TKey(language, (*arr)[i].ConfigName)
|
||||
|
||||
Reference in New Issue
Block a user