增加了使用设别号登录

This commit is contained in:
hahwu 2025-06-17 10:24:10 +08:00
parent 97350e8bde
commit 72b4d08d93
5 changed files with 848 additions and 748 deletions

View File

@ -9,6 +9,7 @@ const (
Protocol_Error_Account_Fail int32 = 103 Protocol_Error_Account_Fail int32 = 103
Protocol_Error_Account_NoExsit int32 = 104 Protocol_Error_Account_NoExsit int32 = 104
Protocol_Error_Account_Code_Error int32 = 105 Protocol_Error_Account_Code_Error int32 = 105
Protocol_Error_Account_Device_Error int32 = 106
Protocol_Res_Buy_Cnt_Limit int32 = 110 Protocol_Res_Buy_Cnt_Limit int32 = 110
Protocol_Res_Buy_CD int32 = 111 Protocol_Res_Buy_CD int32 = 111
Protocol_Email_Find_Fail int32 = 120 Protocol_Email_Find_Fail int32 = 120

View File

@ -248,6 +248,11 @@ func UpdateAccountInfoToDb(account *Db_Account) (err error) {
return return
} }
func UpdateAccountInfoDeviceToDb(account *Db_Account) (err error) {
_, err = SqlDb.Exec("UPDATE t_account SET device_id = ? WHERE user_name = ?", account.DeviceId, account.UserName)
return
}
func FormatAllMemLoadDb(u interface{}, tableName string, Exclude string) (err error) { func FormatAllMemLoadDb(u interface{}, tableName string, Exclude string) (err error) {
t := reflect.TypeOf(u) t := reflect.TypeOf(u)
len := t.Elem().NumField() len := t.Elem().NumField()

View File

@ -60,7 +60,7 @@ func VerifyUser(accountInfo *db.Db_Account, detail *msg.ReqLogin) (ResLogin *msg
return return
} }
if accountInfo.UserPassword != "" && accountInfo.UserPassword != detail.UserPwd { if detail.Type == msg.LOGIN_TYPE_ACCOUNT_LOGIN {
ResLogin = &msg.ResLogin{ ResLogin = &msg.ResLogin{
ResultCode: MergeConst.Protocol_Error_Account_OR_PWD_ERROR, ResultCode: MergeConst.Protocol_Error_Account_OR_PWD_ERROR,
DwUin: 0, DwUin: 0,
@ -68,7 +68,7 @@ func VerifyUser(accountInfo *db.Db_Account, detail *msg.ReqLogin) (ResLogin *msg
return return
} }
if detail.Code != "" { if detail.Type == msg.LOGIN_TYPE_ACCOUNT_LOGIN {
err := VerifyUserCode(detail.UserName, detail.Code) err := VerifyUserCode(detail.UserName, detail.Code)
if err != nil { if err != nil {
ResLogin = &msg.ResLogin{ ResLogin = &msg.ResLogin{
@ -78,6 +78,15 @@ func VerifyUser(accountInfo *db.Db_Account, detail *msg.ReqLogin) (ResLogin *msg
return return
} }
} }
if detail.Type == msg.LOGIN_TYPE_DEVICE_LOGIN {
if detail.Device != accountInfo.DeviceId {
ResLogin = &msg.ResLogin{
ResultCode: MergeConst.Protocol_Error_Account_Device_Error,
DwUin: 0,
}
return
}
}
playerbaseinfo := db.GetPlayerBaseInfoFromDbByName(detail.UserName) playerbaseinfo := db.GetPlayerBaseInfoFromDbByName(detail.UserName)
if playerbaseinfo == nil { if playerbaseinfo == nil {
ResLogin = &msg.ResLogin{ ResLogin = &msg.ResLogin{

View File

@ -172,6 +172,8 @@ func HandleClientReq(args []interface{}) {
G_GameLogicPtr.CreateNewPlayer(a, detail.UserName) G_GameLogicPtr.CreateNewPlayer(a, detail.UserName)
} }
} }
accountInfo.DeviceId = detail.Device
db.UpdateAccountInfoDeviceToDb(accountInfo)
p, _ := internal.Agents.Load(a) p, _ := internal.Agents.Load(a)
if p != nil { if p != nil {
p.(*Player).PushClientRes(ResLogin) p.(*Player).PushClientRes(ResLogin)

File diff suppressed because it is too large Load Diff