...
|
...
|
@@ -197,6 +197,31 @@ func AddRankPeriod(rankTypeId int64, beginTime int64, endTime int64, name string |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
//RankPeriodCheckTime 设置赛季时检查时间范围的合法性
|
|
|
func RankPeriodCheckTime(rankTypeId int64, beginTime int64, endTime int64, idNot int64) bool {
|
|
|
sql := `SELECT 1 FROM rank_period
|
|
|
WHERE rank_type_id = %d
|
|
|
AND id <> %d
|
|
|
AND
|
|
|
(
|
|
|
(UNIX_TIMESTAMP(begin_time) BETWEEN %d AND %d)
|
|
|
OR
|
|
|
(UNIX_TIMESTAMP(end_time) BETWEEN %d AND %d)
|
|
|
)
|
|
|
LIMIT 1 `
|
|
|
sql = fmt.Sprintf(sql, rankTypeId, idNot, beginTime, endTime, beginTime, endTime)
|
|
|
var cnt int
|
|
|
err := utils.ExecuteQueryOne(&cnt, sql)
|
|
|
if err != nil {
|
|
|
log.Error("SQL Execute err:%s", err)
|
|
|
return false
|
|
|
}
|
|
|
if cnt > 0 {
|
|
|
return false
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
|
|
|
func EditRankPeriod(id int64, beginTime int64, endTime int64, name string, companyid int64) error {
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -607,3 +632,21 @@ func AllowRankRange(id int64, companyid int64) error { |
|
|
}
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func RankRangeMove(fromId int64, toId int64, moveIds []int64, companyid int64) error {
|
|
|
// var (
|
|
|
// err error
|
|
|
// rankRange *models.RankRange
|
|
|
// )
|
|
|
// rankRange, err = models.GetRankRangeById(id)
|
|
|
// if err != nil {
|
|
|
// log.Error("获取rank_range数据失败:%s", err)
|
|
|
// return protocol.NewErrWithMessage("1")
|
|
|
// }
|
|
|
// rankRange.Status = 0
|
|
|
// err = models.UpdateRankRangeById(rankRange, []string{"Status"})
|
|
|
// if err != nil {
|
|
|
// log.Error("更新rank_range数据失败:%s", err)
|
|
|
// }
|
|
|
return nil
|
|
|
} |
...
|
...
|
|