package batch_msg import ( "context" "github.com/suyuan32/simple-admin-common/msg/errormsg" "github.com/suyuan32/simple-admin-common/utils/pointy" "wechat-api/internal/utils/dberrorhandler" "wechat-api/internal/svc" "wechat-api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type UpdateWhatcappBatchMsgLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewUpdateWhatcappBatchMsgLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateWhatcappBatchMsgLogic { return &UpdateWhatcappBatchMsgLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *UpdateWhatcappBatchMsgLogic) UpdateWhatcappBatchMsg(req *types.BatchMsgInfo) (*types.BaseMsgResp, error) { err := l.svcCtx.DB.BatchMsg.UpdateOneID(*req.Id). SetNotNilBatchNo(req.BatchNo). SetNotNilFromwxid(req.Fromwxid). SetNotNilMsg(req.Msg). SetNotNilTag(req.Tag). SetNotNilTotal(req.Total). SetNotNilSuccess(req.Success). SetNotNilFail(req.Fail). SetNotNilStartTime(pointy.GetTimeMilliPointer(req.StartTime)). SetNotNilStopTime(pointy.GetTimeMilliPointer(req.StopTime)). Exec(l.ctx) if err != nil { return nil, dberrorhandler.DefaultEntError(l.Logger, err, req) } return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil }