package token import ( "context" "wechat-api/internal/svc" "wechat-api/internal/types" "wechat-api/internal/utils/dberrorhandler" "github.com/suyuan32/simple-admin-common/msg/errormsg" "github.com/zeromicro/go-zero/core/logx" ) type UpdateTokenLogic struct { ctx context.Context svcCtx *svc.ServiceContext logx.Logger } func NewUpdateTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateTokenLogic { return &UpdateTokenLogic{ ctx: ctx, svcCtx: svcCtx, Logger: logx.WithContext(ctx), } } func (l *UpdateTokenLogic) UpdateToken(req *types.TokenInfo) (*types.BaseMsgResp, error) { err := l.svcCtx.DB.Token.UpdateOneID(*req.Id). //SetNotNilExpireAt(pointy.GetTimeMilliPointer(req.ExpireAt)). SetNotNilToken(req.Token). SetNotNilMAC(req.Mac). Exec(l.ctx) if err != nil { return nil, dberrorhandler.DefaultEntError(l.Logger, err, req) } return &types.BaseMsgResp{Msg: errormsg.UpdateSuccess}, nil }