woj-server/internal/service/user/version.go
Paul Pan d42ee0ce54 feat: a big update
1. merge woj-runner scripts into woj-server
2. add woj-runner app
3. refactor submission status problem ...
4. jwt middleware update

Co-authored-by: cxy004 <cxy004@qq.com>
Co-authored-by: wzt <w.zhongtao@qq.com>
2022-10-22 17:38:39 +08:00

19 lines
399 B
Go

package user
import (
"context"
"fmt"
"github.com/WHUPRJ/woj-server/internal/e"
"go.uber.org/zap"
)
func (s *service) IncrVersion(uid uint) (int64, e.Status) {
version, err := s.redis.Incr(context.Background(), fmt.Sprintf("Version:%d", uid)).Result()
if err != nil {
s.log.Warn("RedisError", zap.Error(err), zap.Any("uid", uid))
return -1, e.RedisError
}
return version, e.Success
}