Browse Source

Merge branch 'cygx/cygx_need_933' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 11 months ago
parent
commit
ab91db6da8
1 changed files with 16 additions and 15 deletions
  1. 16 15
      controllers/cygx/yanxuan_special.go

+ 16 - 15
controllers/cygx/yanxuan_special.go

@@ -959,30 +959,31 @@ func (this *YanxuanSpecialController) AuthorSearch() {
 	keyWord := this.GetString("KeyWord")
 	var condition string
 	var pars []interface{}
-
+	resp := new(cygx.CygxYanxuanSpecialKeyWordListReesp)
 	//关键词搜索
 	if keyWord != "" {
 		keyWord = "%" + keyWord + "%"
 		condition += ` AND art.nick_name like  ? `
 		pars = append(pars, keyWord)
-	}
-
-	list, tmpErr := cygx.GetYanxuanSpecialAuthorList(condition, pars, 0, 99)
-	if tmpErr != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
-		return
-	}
-	resp := new(cygx.CygxYanxuanSpecialKeyWordListReesp)
-	if len(list) > 0 {
-		for _, v := range list {
-			item := new(cygx.CygxYanxuanSpecialKeyWordReesp)
-			item.KeyWord = v.NickName
-			resp.List = append(resp.List, item)
+		list, tmpErr := cygx.GetYanxuanSpecialAuthorList(condition, pars, 0, 99)
+		if tmpErr != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+			return
+		}
+		if len(list) > 0 {
+			for _, v := range list {
+				item := new(cygx.CygxYanxuanSpecialKeyWordReesp)
+				item.KeyWord = v.NickName
+				resp.List = append(resp.List, item)
+			}
+		} else {
+			resp.List = make([]*cygx.CygxYanxuanSpecialKeyWordReesp, 0)
 		}
 	} else {
 		resp.List = make([]*cygx.CygxYanxuanSpecialKeyWordReesp, 0)
 	}
+
 	br.Data = resp
 	br.Ret = 200
 	br.Success = true