浏览代码

对字符串的条件增加非空的判断

lichangdong 3 天之前
父节点
当前提交
6c4922a18d
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      internal/logic/contact/get_contact_list_logic.go

+ 5 - 1
internal/logic/contact/get_contact_list_logic.go

@@ -55,7 +55,7 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 	organizationId := l.ctx.Value("organizationId").(uint64)
 	isAdmin := l.ctx.Value("isAdmin").(bool)
 	var predicates []predicate.Contact
-	if req.WxWxid == nil || (req.WxWxid != nil && !isAdmin) {
+	if req.WxWxid == nil || (req.WxWxid != nil && *req.WxWxid != "" && !isAdmin) {
 		predicates = append(predicates, contact.OrganizationIDEQ(organizationId))
 	}
 	if req.Status != nil {
@@ -107,15 +107,19 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 	}
 
 	if req.WxWxid != nil && *req.WxWxid != "" {
+		logx.Info(111222)
 		predicates = append(predicates, contact.WxWxidContains(*req.WxWxid))
 	}
 	if req.Wxid != nil && *req.Wxid != "" {
+		logx.Info(3333)
 		predicates = append(predicates, contact.WxidContains(*req.Wxid))
 	}
 	if req.Account != nil && *req.Account != "" {
+		logx.Info(4444444)
 		predicates = append(predicates, contact.AccountContains(*req.Account))
 	}
 	if req.Nickname != nil && *req.Nickname != "" {
+		logx.Info(5555)
 		predicates = append(predicates, contact.NicknameContains(*req.Nickname))
 	}
 	if req.Type != nil {