From 5ee2dd9eac085fe2c521e4b18f8e7f325b64f6ca Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Wed, 16 Oct 2024 17:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/player.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/model/player.go b/model/player.go index 4089e74..eb8f529 100644 --- a/model/player.go +++ b/model/player.go @@ -2,7 +2,9 @@ package model import ( "bytes" + "crypto/md5" "encoding/gob" + "encoding/hex" "encoding/json" "errors" "fmt" @@ -909,7 +911,13 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform logger.Logger.Trace("New player name is empty.") return nil } + raw := fmt.Sprintf("%v%v", DEFAULT_PLAYER_SAFEBOX_PWD, common.GetAppId()) + h := md5.New() + io.WriteString(h, raw) + pwd := hex.EncodeToString(h.Sum(nil)) tNow := time.Now() + isRobot := channel == common.Channel_Rob + pd := &PlayerData{ Id: bson.NewObjectId(), AccountId: acc, @@ -920,6 +928,7 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform SnId: id, Head: rand.Int31n(common.HeadRange), HeadUrl: headUrl, + SafeBoxPassword: pwd, Ip: ip, RegIp: ip, Params: params, @@ -929,7 +938,7 @@ func NewPlayerData(acc string, name, headUrl string, id int32, channel, platform CreateTime: tNow.Local(), Ver: VER_PLAYER_MAX - 1, HeadOutLine: 1, - IsRob: false, + IsRob: isRobot, PackageID: packTag, YesterdayGameData: NewPlayerGameCtrlData(), TodayGameData: NewPlayerGameCtrlData(),