Jelajahi Sumber

Merge branch 'feature/531-bowen-wecom' into task_526_lichangdong_250424

lichangdong 3 hari lalu
induk
melakukan
012dccb5b3

+ 4 - 4
internal/logic/contact/get_contact_list_logic.go

@@ -106,16 +106,16 @@ func (l *GetContactListLogic) GetContactList(req *types.ContactListReq) (*types.
 		predicates = append(predicates, contact.Ctype(1)) // 默认 Ctype = 1
 	}
 
-	if req.WxWxid != nil {
+	if req.WxWxid != nil && *req.WxWxid != "" {
 		predicates = append(predicates, contact.WxWxidContains(*req.WxWxid))
 	}
-	if req.Wxid != nil {
+	if req.Wxid != nil && *req.Wxid != "" {
 		predicates = append(predicates, contact.WxidContains(*req.Wxid))
 	}
-	if req.Account != nil {
+	if req.Account != nil && *req.Account != "" {
 		predicates = append(predicates, contact.AccountContains(*req.Account))
 	}
-	if req.Nickname != nil {
+	if req.Nickname != nil && *req.Nickname != "" {
 		predicates = append(predicates, contact.NicknameContains(*req.Nickname))
 	}
 	if req.Type != nil {

+ 1 - 1
internal/logic/label_relationship/get_label_relationship_list_logic.go

@@ -90,7 +90,7 @@ func (l *GetLabelRelationshipListLogic) GetLabelRelationshipList(req *types.Labe
 	if req.Type != nil {
 		conPreds = append(conPreds, contact.TypeEQ(*req.Type))
 	} else {
-		conPreds = append(conPreds, contact.Or(contact.TypeEQ(1), contact.TypeEQ(2)))
+		conPreds = append(conPreds, contact.Or(contact.TypeEQ(1), contact.TypeEQ(2), contact.TypeEQ(4)))
 	}
 
 	if req.Nickname != nil {

+ 6 - 0
internal/pkg/util/strings.go

@@ -0,0 +1,6 @@
+package util
+
+// IsNonEmptyString 判断字符串指针不为 nil 且不为空
+func IsNonEmptyString(s *string) bool {
+	return s != nil && *s != ""
+}

+ 2 - 2
internal/service/MessageHandlers/wecom/customer_push_notice.go

@@ -36,7 +36,7 @@ func (f *CustomerPushNoticeHandler) Handle(ctx context.Context, msg *wechat_ws.M
 	message := wecom.CustomerPushNoticeMessage{}
 	err := json.Unmarshal([]byte(msg.Message), &message)
 
-	logx.Infof("msg.Message 的内容是:%s", msg.Message)
+	logx.Infof("CustomerPushNotice.Message 的内容是:%s", msg.Message)
 	if err != nil {
 		logx.Errorf("Unmarshal.fail")
 		return err
@@ -56,7 +56,7 @@ func (f *CustomerPushNoticeHandler) Handle(ctx context.Context, msg *wechat_ws.M
 		//Wxid := strconv.FormatInt(friend.RemoteId, 10)
 
 		friendType := 1
-		if friend.Source == 2 {
+		if friend.Suffix == "微信" {
 			friendType = 1
 		} else {
 			friendType = 4

+ 2 - 2
internal/service/MessageHandlers/wecom/user_label_push_notice.go

@@ -31,7 +31,7 @@ func NewUserLabelPushNotice(svcCtx *svc.ServiceContext) *UserLabelPushNotice {
 // Handle 实现 MessageHandlerStrategy 接口
 func (f *UserLabelPushNotice) Handle(ctx context.Context, msg *wechat_ws.MsgJsonObject, svcCtx *svc.ServiceContext) error {
 	var message wecom.UserLabelPushNoticeMessage
-	logx.Infof("msg.Message 的内容是:%s", msg.Message)
+	logx.Infof("UserLabelPushNotice.Message 的内容是:%s", msg.Message)
 	if err := json.Unmarshal([]byte(msg.Message), &message); err != nil {
 		return err
 	}
@@ -125,7 +125,7 @@ func (f *UserLabelPushNotice) Handle(ctx context.Context, msg *wechat_ws.MsgJson
 				bulkLabels = append(bulkLabels,
 					svcCtx.DB.Label.Create().
 						SetName(s).
-						SetType(4).
+						SetType(1). //标签只有好友 和群组之分
 						SetStatus(1).
 						SetOrganizationID(wxInfo.OrganizationID).
 						SetFrom(3). // 标签来源:1后台创建 2个微同步 3企业微信同步