Browse Source

fix:save 12

jimmyyem 5 months ago
parent
commit
7176264bbb

+ 7 - 0
desc/wechat/avatar.api

@@ -32,7 +32,14 @@ type (
 
         // Agent information | Agent数据
         Data AvatarInfo `json:"data"`
+		
+		Extra Extra `json:"extra"`
     }
+
+	Extra {
+		Live int64 `json:"live"`
+		Total int64 `json:"total"`
+	}
 )
 
 @server(

+ 1 - 0
desc/wechat/chat_session.api

@@ -38,6 +38,7 @@ type (
     ChatSessionListReq {
         PageInfo
 
+		BotId  *uint64 `json:"botId,optional"`
         BotType  *uint8 `json:"botType,optional"`
     }
 

+ 1 - 1
hook/aliyun/avatar.go

@@ -137,7 +137,7 @@ func GetAccessKeySecret() string {
 
 // GetAppId 获取AppId
 func GetAppId() string {
-	return "3dj6714h14"
+	return "3dt553bl52"
 }
 
 // GetTenantId 租户ID

+ 8 - 0
internal/logic/chatsession/get_api_session_list_logic.go

@@ -4,6 +4,7 @@ import (
 	"context"
 	"github.com/suyuan32/simple-admin-common/msg/errormsg"
 	"github.com/suyuan32/simple-admin-common/utils/pointy"
+	"github.com/zeromicro/go-zero/core/errorx"
 	"wechat-api/ent/chatsession"
 	"wechat-api/ent/predicate"
 	"wechat-api/internal/utils/dberrorhandler"
@@ -34,6 +35,13 @@ func (l *GetApiSessionListLogic) GetApiSessionList(req *types.ChatSessionListReq
 	predicates = append(predicates, chatsession.UserID(userId))
 	if req.BotType != nil && *req.BotType > 0 {
 		predicates = append(predicates, chatsession.BotType(*req.BotType))
+	} else {
+		return nil, errorx.NewInvalidArgumentError("BotType cannot be null")
+	}
+	if req.BotId != nil && *req.BotId > 0 {
+		predicates = append(predicates, chatsession.BotID(*req.BotId))
+	} else {
+		return nil, errorx.NewInvalidArgumentError("BotId cannot be null")
 	}
 
 	data, err := l.svcCtx.DB.ChatSession.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)

+ 9 - 2
internal/types/types.go

@@ -2210,7 +2210,8 @@ type ChatSessionListInfo struct {
 // swagger:model ChatSessionListReq
 type ChatSessionListReq struct {
 	PageInfo
-	BotType *uint8 `json:"botType,optional"`
+	BotId   *uint64 `json:"botId,optional"`
+	BotType *uint8  `json:"botType,optional"`
 }
 
 // ChatSession information response | ChatSession信息返回体
@@ -2453,5 +2454,11 @@ type AvatarConfigReq struct {
 type AvatarConfigResp struct {
 	BaseDataInfo
 	// Agent information | Agent数据
-	Data AvatarInfo `json:"data"`
+	Data  AvatarInfo `json:"data"`
+	Extra Extra      `json:"extra"`
+}
+
+type Extra struct {
+	Live  int64 `json:"live"`
+	Total int64 `json:"total"`
 }