|
@@ -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)
|