Skip to content

Commit

Permalink
fix: issues
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Aug 26, 2023
1 parent 8efdc0d commit 8fe8b54
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/poll/v1/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

type PollReq struct {
g.Meta `path:"/poll/:id" tags:"Poll" method:"put" summary:"投票"`
ID int `json:"id" dc:"投票ID" v:"required|int" in:"path"`
ID int `json:"id" dc:"投票ID" v:"required|integer" in:"path"`
Method consts.PollMethod `json:"method" dc:"投票方式" v:"required|enums"`
MarkIDs []int `json:"mark_ids" dc:"标记"`
Comment string `json:"comment" dc:"理由" v:"length:1,255"`
Expand Down
2 changes: 1 addition & 1 deletion internal/boot/boot_enums.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/net/ghttp"
"github.com/gogf/gf/v2/os/gcmd"
_ "github.com/hitokoto-osc/reviewer/internal/boot"
)

var (
Expand Down
1 change: 1 addition & 0 deletions internal/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ const (
PollOverdueThreshold = 7 // 7 天

ReviewerInactiveDays = 30 // 30 天
PollOverdueDays = 15 // 15 天
)
4 changes: 1 addition & 3 deletions internal/logic/job/poll/move_overdue_poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func MoveOverduePolls(ctx context.Context) error {
)
query := dao.Poll.Ctx(ctx).
Where(dao.Poll.Columns().Status, consts.PollStatusOpen).
WhereLT(dao.Poll.Columns().CreatedAt, gdb.Raw("DATE_SUB(now(), INTERVAL 15 DAY)")) // 15 天
Wheref("%s < DATE_SUB(now(), INTERVAL %d DAY)", dao.Poll.Columns().CreatedAt, consts.PollOverdueDays) // 15 天
total, err := query.Clone().Fields("1").Count()
if err != nil {
return gerror.Wrap(err, "获取过期投票数量失败")
Expand All @@ -50,8 +50,6 @@ func MoveOverduePolls(ctx context.Context) error {
if err != nil {
return gerror.Wrapf(err, "获取第 %d 页记录失败", page)
}
// g.Log().Debug(ctx, "%+v", polls)
// return nil
// 获取 pollLogs
var (
poll *entity.Poll
Expand Down
2 changes: 1 addition & 1 deletion internal/logic/job/poll/remove_invalid_polls.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func RemoveInvalidPolls(ctx context.Context) error {
poll := &out.Collection[i]
g.Log().Debugf(ctx, "正在处理投票 %d...", poll.ID)
if poll.Sentence.Status == consts.HitokotoStatusApproved || poll.Sentence.Status == consts.HitokotoStatusRejected {
g.Log().Debugf(ctx, "投票 %d: 句子 %s 状态为 %s,属于无效投票(已通过或已驳回),开始清除……", poll.ID, poll.Sentence.Status)
g.Log().Debugf(ctx, "投票 %d: 句子 %s 状态为 %s,属于无效投票(已通过或已驳回),开始清除……", poll.ID, poll.Sentence.UUID, poll.Sentence.Status)
var status int
if poll.Sentence.Status == consts.HitokotoStatusApproved {
status = int(consts.PollStatusApproved)
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
_ "github.com/hitokoto-osc/reviewer/internal/boot"
_ "github.com/hitokoto-osc/reviewer/internal/logic"
_ "github.com/hitokoto-osc/reviewer/internal/packed"

Expand Down

0 comments on commit 8fe8b54

Please sign in to comment.