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