补充登录和身份证校验逻辑
This commit is contained in:
parent
9326a2a75c
commit
97350e8bde
@ -8,6 +8,7 @@ const (
|
||||
Protocol_Error_Account_OR_PWD_Short int32 = 102
|
||||
Protocol_Error_Account_Fail int32 = 103
|
||||
Protocol_Error_Account_NoExsit int32 = 104
|
||||
Protocol_Error_Account_Code_Error int32 = 105
|
||||
Protocol_Res_Buy_Cnt_Limit int32 = 110
|
||||
Protocol_Res_Buy_CD int32 = 111
|
||||
Protocol_Email_Find_Fail int32 = 120
|
||||
|
||||
@ -5,7 +5,9 @@ import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"server/GoUtil"
|
||||
"server/MergeConst"
|
||||
"server/conf"
|
||||
"server/db"
|
||||
Msg "server/game/mod/msg"
|
||||
"server/gamedata"
|
||||
"server/msg"
|
||||
@ -37,6 +39,66 @@ func AdminProcess(Func string, args []interface{}) {
|
||||
log.Debug("AdminProcess error: %v", "Func not found")
|
||||
}
|
||||
|
||||
func LoginCodeProcess(Detail *msg.ReqLoginCode) {
|
||||
// 处理登录验证码请求
|
||||
}
|
||||
|
||||
func ReqIdentifyCard(a gate.Agent, Detail *msg.ReqIdentifyCard) {
|
||||
// 处理身份证请求
|
||||
res := &msg.ResIdentifyCard{}
|
||||
res.ResultCode = 0
|
||||
data, _ := proto.Marshal(res)
|
||||
G_getGameLogic().PackResInfo(a, "ResIdentifyCard", data)
|
||||
}
|
||||
|
||||
func VerifyUser(accountInfo *db.Db_Account, detail *msg.ReqLogin) (ResLogin *msg.ResLogin) {
|
||||
if accountInfo == nil {
|
||||
ResLogin = &msg.ResLogin{
|
||||
ResultCode: MergeConst.Protocol_Error_Account_NoExsit,
|
||||
DwUin: 0,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if accountInfo.UserPassword != "" && accountInfo.UserPassword != detail.UserPwd {
|
||||
ResLogin = &msg.ResLogin{
|
||||
ResultCode: MergeConst.Protocol_Error_Account_OR_PWD_ERROR,
|
||||
DwUin: 0,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if detail.Code != "" {
|
||||
err := VerifyUserCode(detail.UserName, detail.Code)
|
||||
if err != nil {
|
||||
ResLogin = &msg.ResLogin{
|
||||
ResultCode: MergeConst.Protocol_Error_Account_Code_Error,
|
||||
DwUin: 0,
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
playerbaseinfo := db.GetPlayerBaseInfoFromDbByName(detail.UserName)
|
||||
if playerbaseinfo == nil {
|
||||
ResLogin = &msg.ResLogin{
|
||||
ResultCode: MergeConst.Protocol_Error_Account_NoExsit,
|
||||
DwUin: 0,
|
||||
}
|
||||
return
|
||||
}
|
||||
ResLogin = &msg.ResLogin{
|
||||
ResultCode: 0,
|
||||
DwUin: playerbaseinfo.DwUin,
|
||||
FaceBookId: playerbaseinfo.FaceBookId,
|
||||
UserName: playerbaseinfo.UserName,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func VerifyUserCode(telphone string, code string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func AdminPlayerInfo(args []interface{}) error {
|
||||
a, buf := ParseAdminArgs(args)
|
||||
req := &msg.ReqAdminInfo{}
|
||||
|
||||
@ -99,9 +99,17 @@ func HandleClientReq(args []interface{}) {
|
||||
ResChangePassword.ResultCode = 0
|
||||
data, _ := proto.Marshal(ResChangePassword)
|
||||
G_GameLogicPtr.PackResInfo(a, "ResChangePassword", data)
|
||||
|
||||
case "ReqAdminInfo":
|
||||
case "ReqAdminInfo": // 后台接口
|
||||
AdminProcess(m.GetFunc(), []interface{}{a, buf})
|
||||
case "ReqLoginCode":
|
||||
Detail := &msg.ReqLoginCode{}
|
||||
proto.Unmarshal(buf, Detail)
|
||||
LoginCodeProcess(Detail)
|
||||
case "ReqIdentifyCard":
|
||||
detail := &msg.ReqIdentifyCard{}
|
||||
proto.Unmarshal(buf, detail)
|
||||
ReqIdentifyCard(a, detail)
|
||||
|
||||
case "ReqServerVersion":
|
||||
G_GameLogicPtr.SendServerVersion(a)
|
||||
case "ReqRegisterAccount":
|
||||
@ -151,28 +159,7 @@ func HandleClientReq(args []interface{}) {
|
||||
log.Error("uid : %d, func : %s, fatal : %s", 0, m.GetFunc(), r)
|
||||
}
|
||||
}()
|
||||
ResLogin := &msg.ResLogin{}
|
||||
if accountInfo != nil {
|
||||
if accountInfo.UserPassword == detail.UserPwd {
|
||||
playerbaseinfo := db.GetPlayerBaseInfoFromDbByName(detail.UserName)
|
||||
if playerbaseinfo != nil {
|
||||
ResLogin.ResultCode = 0
|
||||
ResLogin.DwUin = playerbaseinfo.DwUin
|
||||
ResLogin.FaceBookId = playerbaseinfo.FaceBookId
|
||||
ResLogin.UserName = playerbaseinfo.UserName
|
||||
} else {
|
||||
ResLogin.ResultCode = MergeConst.Protocol_Error_Account_NoExsit
|
||||
ResLogin.DwUin = 0
|
||||
}
|
||||
} else {
|
||||
ResLogin.ResultCode = MergeConst.Protocol_Error_Account_OR_PWD_ERROR
|
||||
ResLogin.DwUin = 0
|
||||
}
|
||||
|
||||
} else {
|
||||
ResLogin.ResultCode = MergeConst.Protocol_Error_Account_NoExsit
|
||||
ResLogin.DwUin = 0
|
||||
}
|
||||
ResLogin := VerifyUser(accountInfo, detail)
|
||||
if ResLogin.ResultCode != 0 {
|
||||
resBuff, _ := proto.Marshal(ResLogin)
|
||||
G_GameLogicPtr.PackResInfo(a, "ResLogin", resBuff)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user