feat sn 改成 int64
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
// RandomGetQuestion 获取题目
|
||||
func (s *Server) RandomGetQuestion(ctx context.Context, req *grpc_pb.RandomGetQuestionReq) (*grpc_pb.RandomGetQuestionResp, error) {
|
||||
question, err := repository.NewQuestionDao(ctx, s.query).FindByRandom("")
|
||||
question, err := repository.NewQuestionDao(ctx, s.query).FindByRandom(0)
|
||||
if err != nil {
|
||||
return nil, utils.ErrorsWrap(err)
|
||||
}
|
||||
@@ -45,9 +45,9 @@ func (s *Server) RandomAnswerQuestion(ctx context.Context, req *grpc_pb.RandomAn
|
||||
return nil, utils.ErrorsWrapF(err, "data: %v", question.Options)
|
||||
}
|
||||
// 保存答题记录
|
||||
if req.USN != "" {
|
||||
if req.USN != 0 {
|
||||
kafka.NewProducer().Produce(ctx, &timer.TopicQuestionAnswer{
|
||||
MessageSn: utils.SnowflakeInstance().Generate().String(),
|
||||
MessageSn: utils.SnowflakeInstance().Generate().Int64(),
|
||||
USN: req.USN,
|
||||
QuestionSn: question.Sn,
|
||||
QuestionAnswer: question.Answer,
|
||||
@@ -57,7 +57,7 @@ func (s *Server) RandomAnswerQuestion(ctx context.Context, req *grpc_pb.RandomAn
|
||||
// 随机答题正确给10分,错误不得分
|
||||
if req.Answer == question.Answer {
|
||||
kafka.NewProducer().Produce(ctx, &timer.TopicAddPoint{
|
||||
MessageSn: utils.SnowflakeInstance().Generate().String(),
|
||||
MessageSn: utils.SnowflakeInstance().Generate().Int64(),
|
||||
Source: timer.AddPointSourceRandom,
|
||||
USN: req.USN,
|
||||
Point: 10,
|
||||
|
||||
Reference in New Issue
Block a user