Просмотр исходного кода

执行添加好友的列表及取消发送申请

lichangdong 3 дней назад
Родитель
Сommit
93841b859e

+ 2 - 2
desc/wechat/add_wechat_friend_log.api

@@ -13,7 +13,7 @@ type (
 
     AddFriendListReq {
         PageInfo
-        OwnerWxId *string `json:"wxid,optional"`
+        OwnerWxId *string `json:"wxId,optional"`
         OwnerWxType *int `json:"wxType,optional"`
         FindContent *string `json:"phone,optional"`
         status *int `json:"status,optional"`
@@ -45,7 +45,7 @@ type (
     }
 
     CancelByIdsReq {
-        Ids []int64 `json:"ids" validate:"nonzero"`
+        Ids []int64 `json:"ids" validate:"required,min=1"`
     }
 )
 

+ 1 - 1
internal/logic/add_friend/add_friend_list_logic.go

@@ -50,7 +50,7 @@ func (l *AddFriendListLogic) AddFriendList(req *types.AddFriendListReq) (resp *t
 	predicates = append(predicates, addwechatfriendlog.OwnerWxIDIn(wxIds...))
 	ownerWxType := req.OwnerWxType
 	//查询企业微信机器人加的好友
-	if *ownerWxType > 0 {
+	if ownerWxType != nil && *ownerWxType > 0 {
 		predicates = append(predicates, addwechatfriendlog.OwnerWxTypeEQ(*ownerWxType))
 	}
 	//查找添加好友

+ 4 - 2
internal/types/types.go

@@ -4730,7 +4730,7 @@ type AddWechatFriendLogInfo struct {
 // swagger:model AddFriendListReq
 type AddFriendListReq struct {
 	PageInfo
-	OwnerWxId   *string `json:"wxid,optional"`
+	OwnerWxId   *string `json:"wxId,optional"`
 	OwnerWxType *int    `json:"wxType,optional"`
 	FindContent *string `json:"phone,optional"`
 	Status      *int    `json:"status,optional"`
@@ -4765,5 +4765,7 @@ type FriendList struct {
 
 // swagger:model CancelByIdsReq
 type CancelByIdsReq struct {
-	Ids []int64 `json:"ids" validate:"nonzero"`
+	// required : true
+	// min length : 1
+	Ids []int64 `json:"ids" validate:"required,min=1"`
 }

+ 6 - 0
internal/utils/strings.go

@@ -15,6 +15,12 @@ func UnixTimeToBeijing(i any) *string {
 		return nil
 	}
 
+	// 当传入的时间为0值时,返回固定字符串"---"
+	if unixTime == 0 {
+		defaultTime := "--"
+		return &defaultTime
+	}
+
 	// 转换为北京时间(UTC+8)
 	beijingTime := time.Unix(unixTime, 0).In(time.FixedZone("CST", 8*3600))