Преглед на файлове

联系人支持按昵称搜索

boweniac преди 8 месеца
родител
ревизия
ba1190a4a9
променени са 3 файла, в които са добавени 8 реда и са изтрити 0 реда
  1. 3 0
      desc/wechat/contact.api
  2. 3 0
      internal/logic/contact/get_contact_list_logic.go
  3. 2 0
      internal/types/types.go

+ 3 - 0
desc/wechat/contact.api

@@ -34,6 +34,9 @@ type (
         // 微信账号 
         Account  *string `json:"account,optional"`
 
+        // 昵称
+        Nickname  *string `json:"nickname,optional"`
+
         // 联系人类型:1好友,2群组,3公众号,4企业微信联系人
         Type  *int `json:"type,optional"`
     }

+ 3 - 0
internal/logic/contact/get_contact_list_logic.go

@@ -69,6 +69,9 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 	if req.Account != nil {
 		predicates = append(predicates, contact.AccountContains(*req.Account))
 	}
+	if req.Nickname != nil {
+		predicates = append(predicates, contact.NicknameContains(*req.Nickname))
+	}
 	if req.Type != nil {
 		predicates = append(predicates, contact.TypeEQ(*req.Type))
 	}

+ 2 - 0
internal/types/types.go

@@ -935,6 +935,8 @@ type ContactListReq struct {
 	Wxid *string `json:"wxid,optional"`
 	// 微信账号
 	Account *string `json:"account,optional"`
+	// 昵称
+	Nickname *string `json:"nickname,optional"`
 	// 联系人类型:1好友,2群组,3公众号,4企业微信联系人
 	Type *int `json:"type,optional"`
 }