正在显示
1 个修改的文件
包含
11 行增加
和
3 行删除
| @@ -17,6 +17,7 @@ type RankTypeAutoPeriod struct { | @@ -17,6 +17,7 @@ type RankTypeAutoPeriod struct { | ||
| 17 | CompanyId int64 `orm:"column(company_id)"` | 17 | CompanyId int64 `orm:"column(company_id)"` |
| 18 | AutoPeriod int64 `orm:"column(auto_period)"` | 18 | AutoPeriod int64 `orm:"column(auto_period)"` |
| 19 | CreateTime int64 `orm:"column(create_time)"` | 19 | CreateTime int64 `orm:"column(create_time)"` |
| 20 | + RankType int8 `orm:"column(rank_type)` | ||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | // | 23 | // |
| @@ -28,7 +29,7 @@ type RankPeriodEndTime struct { | @@ -28,7 +29,7 @@ type RankPeriodEndTime struct { | ||
| 28 | func AutoCreateRankPeriod() error { | 29 | func AutoCreateRankPeriod() error { |
| 29 | log.Info("计划任务:【自动创建赛季】") | 30 | log.Info("计划任务:【自动创建赛季】") |
| 30 | //获取需要执行自动创建的榜单记录 | 31 | //获取需要执行自动创建的榜单记录 |
| 31 | - sql1 := `SELECT a.id AS rank_type_id,a.auto_period,UNIX_TIMESTAMP(a.create_at) AS create_time | 32 | + sql1 := `SELECT a.id AS rank_type_id,a.type AS rank_type,a.auto_period,UNIX_TIMESTAMP(a.create_at) AS create_time |
| 32 | ,a.company_id | 33 | ,a.company_id |
| 33 | FROM rank_type AS a | 34 | FROM rank_type AS a |
| 34 | JOIN company AS b ON a.company_id=b.id AND b.enable=1 AND b.delete_at=0 | 35 | JOIN company AS b ON a.company_id=b.id AND b.enable=1 AND b.delete_at=0 |
| @@ -111,7 +112,7 @@ LOOP0: | @@ -111,7 +112,7 @@ LOOP0: | ||
| 111 | end := begin + v.AutoPeriod*24*60*60 - 1 | 112 | end := begin + v.AutoPeriod*24*60*60 - 1 |
| 112 | m.BeginTime = time.Unix(begin, 0).Local() | 113 | m.BeginTime = time.Unix(begin, 0).Local() |
| 113 | m.EndTime = time.Unix(end, 0).Local() | 114 | m.EndTime = time.Unix(end, 0).Local() |
| 114 | - m.SeasonName = fmt.Sprintf("自动创建赛季%s", s) | 115 | + // m.SeasonName = fmt.Sprintf("自动创建赛季%s", s) |
| 115 | } else { | 116 | } else { |
| 116 | s := nowTime.Format("2006-01-02") | 117 | s := nowTime.Format("2006-01-02") |
| 117 | dayTime, _ := time.ParseInLocation("2006-01-02", s, time.Local) | 118 | dayTime, _ := time.ParseInLocation("2006-01-02", s, time.Local) |
| @@ -119,7 +120,14 @@ LOOP0: | @@ -119,7 +120,14 @@ LOOP0: | ||
| 119 | end := begin + v.AutoPeriod*24*60*60 - 1 | 120 | end := begin + v.AutoPeriod*24*60*60 - 1 |
| 120 | m.BeginTime = time.Unix(begin, 0).Local() | 121 | m.BeginTime = time.Unix(begin, 0).Local() |
| 121 | m.EndTime = time.Unix(end, 0).Local() | 122 | m.EndTime = time.Unix(end, 0).Local() |
| 122 | - m.SeasonName = fmt.Sprintf("自动创建赛季%s", s) | 123 | + // m.SeasonName = fmt.Sprintf("自动创建赛季%s", s) |
| 124 | + } | ||
| 125 | + if v.RankType == models.RANK_TYPE_YEAR { | ||
| 126 | + //年榜 | ||
| 127 | + m.SeasonName = fmt.Sprintf("%d%s", nowTime.Year(), "年赛季") | ||
| 128 | + } else if v.RankType == models.RANK_TYPE_SEASON { | ||
| 129 | + //季榜 | ||
| 130 | + m.SeasonName = fmt.Sprintf("%d%s", nowTime.Month(), "月赛季") | ||
| 123 | } | 131 | } |
| 124 | addRankPeriod = append(addRankPeriod, m) | 132 | addRankPeriod = append(addRankPeriod, m) |
| 125 | } | 133 | } |
-
请 注册 或 登录 后发表评论