1
This commit is contained in:
@@ -3,14 +3,36 @@ package model
|
||||
import (
|
||||
"blazing/common/data"
|
||||
"blazing/cool"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gogf/gf/v2/os/gfile"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/tnnmigga/enum"
|
||||
)
|
||||
|
||||
// 表名常量
|
||||
const TableNamePlayerPVP = "player_pvp"
|
||||
const Curpvp = 0
|
||||
const DefaultPVPSeason = 0
|
||||
|
||||
const pvpConfigPath = "public/config/pvp.json"
|
||||
|
||||
type pvpConfig struct {
|
||||
CurrentSeason uint32 `json:"current_season"`
|
||||
}
|
||||
|
||||
func CurrentPVPSeason() uint32 {
|
||||
content := gfile.GetBytes(pvpConfigPath)
|
||||
if len(content) == 0 {
|
||||
return DefaultPVPSeason
|
||||
}
|
||||
|
||||
var config pvpConfig
|
||||
if err := json.Unmarshal(content, &config); err != nil {
|
||||
return DefaultPVPSeason
|
||||
}
|
||||
|
||||
return config.CurrentSeason
|
||||
}
|
||||
|
||||
// PVP 对应数据库表 player_pvp,用于记录用户PVP赛季数据及场次统计
|
||||
type PVP struct {
|
||||
|
||||
Reference in New Issue
Block a user