修复机器人标记

This commit is contained in:
sk 2024-10-16 17:15:46 +08:00
parent a61fdc3a7f
commit 5ee2dd9eac
1 changed files with 10 additions and 1 deletions

View File

@ -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(),