|
@@ -3,6 +3,8 @@ package chatrecords
|
|
|
import (
|
|
|
"context"
|
|
|
"github.com/suyuan32/simple-admin-common/msg/errormsg"
|
|
|
+ "github.com/zeromicro/go-zero/core/errorx"
|
|
|
+ "wechat-api/internal/utils/dberrorhandler"
|
|
|
|
|
|
"wechat-api/internal/svc"
|
|
|
"wechat-api/internal/types"
|
|
@@ -24,6 +26,21 @@ func NewUpdateChatRecordsLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
|
|
}
|
|
|
|
|
|
func (l *UpdateChatRecordsLogic) UpdateChatRecords(req *types.ChatRecordsInfo) (*types.BaseMsgResp, error) {
|
|
|
+ if req.Id == nil || *req.Id <= 0 {
|
|
|
+ return nil, errorx.NewInvalidArgumentError("id cannot be null")
|
|
|
+ }
|
|
|
+
|
|
|
+ err := l.svcCtx.DB.ChatRecords.UpdateOneID(*req.Id).
|
|
|
+ SetNotNilSessionID(req.SessionId).
|
|
|
+ SetNotNilUserID(req.UserId).
|
|
|
+ SetNotNilContent(req.Content).
|
|
|
+ SetNotNilContentType(req.ContentType).
|
|
|
+ SetNotNilBotID(req.BotId).
|
|
|
+ SetNotNilBotType(req.BotType).
|
|
|
+ Exec(l.ctx)
|
|
|
+ if err != nil {
|
|
|
+ return nil, dberrorhandler.DefaultEntError(l.Logger, err, req)
|
|
|
+ }
|
|
|
return &types.BaseMsgResp{
|
|
|
Code: 0,
|
|
|
Msg: errormsg.Success,
|