增加账号重置GM
This commit is contained in:
parent
f962718717
commit
b6a3b6f0be
@ -306,6 +306,17 @@ func GetAccountInfoFromDb(name string) *Db_Account {
|
||||
return &res
|
||||
}
|
||||
|
||||
func ResetAccountData(oldName, newName string) error {
|
||||
sqlStr := "UPDATE t_account SET user_name = ? WHERE user_name = ?"
|
||||
_, err := SqlDb.Exec(sqlStr, newName, oldName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sqlStr = "UPDATE t_player_baseinfo SET user_name = ? WHERE user_name = ?"
|
||||
_, err = SqlDb.Exec(sqlStr, newName, oldName)
|
||||
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
|
||||
|
||||
@ -31,6 +31,7 @@ import (
|
||||
"server/pkg/github.com/name5566/leaf/log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
@ -547,6 +548,13 @@ func ReqGmCommand_(player *Player, Command string) error {
|
||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.WeeklyDiscount = make(map[int]int)
|
||||
player.PlayroomBackData()
|
||||
case "resetPlayer":
|
||||
de := time.Now().Format("2006-01-02 15:04:05")
|
||||
BaseMod := player.PlayMod.getBaseMod()
|
||||
account := BaseMod.Account
|
||||
newAccount := fmt.Sprintf("%s_reset_%s", account, de)
|
||||
db.ResetAccountData(account, newAccount)
|
||||
player.PushAndSendClienRes(&msg.ForceKickOut{})
|
||||
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