fix: 多语言翻译值转化key进行查询
This commit is contained in:
@@ -38,12 +38,17 @@ type SysDictDataController struct {
|
||||
//
|
||||
// GET /list
|
||||
func (s *SysDictDataController) List(c *gin.Context) {
|
||||
querys := ctx.QueryMap(c)
|
||||
data := s.sysDictDataService.SelectDictDataPage(querys)
|
||||
|
||||
rows := data["rows"].([]model.SysDictData)
|
||||
// 闭包函数处理多语言
|
||||
language := ctx.AcceptLanguage(c)
|
||||
querys := ctx.QueryMap(c)
|
||||
// 多语言值转key查询
|
||||
if v, ok := querys["dictLabel"]; ok && v != "" {
|
||||
querys["dictLabel"] = i18n.TFindKeyPrefix(language, "dictData", v.(string))
|
||||
}
|
||||
|
||||
data := s.sysDictDataService.SelectDictDataPage(querys)
|
||||
rows := data["rows"].([]model.SysDictData)
|
||||
|
||||
// 闭包函数处理多语言
|
||||
converI18n := func(language string, arr *[]model.SysDictData) {
|
||||
for i := range *arr {
|
||||
if strings.Contains((*arr)[i].DictType, "i18n") {
|
||||
|
||||
Reference in New Issue
Block a user