GM 指令,映射账号
This commit is contained in:
parent
410d918a75
commit
6450c857ce
@ -311,6 +311,27 @@ func ResetAccountData(oldName, newName string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
func MappingAccountData(oldName, newName string) error {
|
||||
sqlStr := "UPDATE t_account SET user_name = ? WHERE user_name = ?"
|
||||
_, err := SqlDb.Exec(sqlStr, "", oldName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sqlStr = "UPDATE t_player_baseinfo SET user_name = ? WHERE user_name = ?"
|
||||
_, err = SqlDb.Exec(sqlStr, "", oldName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sqlStr = "UPDATE t_account SET user_name = ? WHERE user_name = ?"
|
||||
_, err = SqlDb.Exec(sqlStr, oldName, newName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sqlStr = "UPDATE t_player_baseinfo SET user_name = ? WHERE user_name = ?"
|
||||
_, err = SqlDb.Exec(sqlStr, oldName, newName)
|
||||
return err
|
||||
}
|
||||
|
||||
func UpdateAccountInfoToDb(account *Db_Account) (err error) {
|
||||
_, err = SqlDb.Exec("UPDATE t_account SET user_password = ? WHERE user_name = ?", account.UserPassword, account.UserName)
|
||||
return
|
||||
|
||||
@ -591,6 +591,22 @@ func ReqGmCommand_(player *Player, Command string) error {
|
||||
BaseMod.Account = newAccount
|
||||
player.GetPlayerBaseMod().Data.UserName = newAccount
|
||||
player.PushAndSendClienRes(&msg.ForceKickOut{})
|
||||
case "mapping":
|
||||
if len(arg) < 2 {
|
||||
return fmt.Errorf("mapping command requires an argument")
|
||||
}
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
account := BaseMod.Account
|
||||
err := db.MappingAccountData(account, arg[1])
|
||||
if err != nil {
|
||||
log.Error("resetPlayer err:%s", err.Error())
|
||||
return err
|
||||
}
|
||||
log.Debug("player reset: old account: %s; new account %s", account, arg[1])
|
||||
BaseMod.Account = ""
|
||||
player.GetPlayerBaseMod().Data.UserName = ""
|
||||
player.PushAndSendClienRes(&msg.ForceKickOut{})
|
||||
player.ClearData()
|
||||
case "resetCode":
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
BaseMod.AddCode = fmt.Sprintf("MMM-%s-%s", "156", GoUtil.UniqueStringFromInt(int(BaseMod.Uid)))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user