Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user): 提交问卷返回提交时间, 统一认证返回用户剩余提交次数 #32

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

Tim3088
Copy link
Contributor

@Tim3088 Tim3088 commented Mar 13, 2025

No description provided.

// 从 redis 中获取用户的对该问卷的访问次数
item := "survey:" + strconv.Itoa(sid) + ":stu_id:" + stu_id
var limit int
var limit uint
err := redis.RedisClient.Get(c, item).Scan(&limit)
return limit, err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果redis没有该键会返回什么

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还会是0吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0

code.AbortWithException(c, code.VoteLimitError, errors.New("投票次数已达上限"))
return
}
}

err = service.SubmitSurvey(data.ID, data.QuestionsList, time.Now().Format("2006-01-02 15:04:05"))
submitTime := time.Now().Format("2006-01-02 15:04:05")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里建议改成time.DateTime,硬编码容易出错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants