|
@@ -7,8 +7,10 @@ import (
|
|
|
cfacade "github.com/mhaya/facade"
|
|
|
"github.com/mhaya/game/game_cluster/internal/code"
|
|
|
"github.com/mhaya/game/game_cluster/internal/data"
|
|
|
- rpcCenter "github.com/mhaya/game/game_cluster/internal/rpc/center"
|
|
|
+ "github.com/mhaya/game/game_cluster/internal/mdb/models"
|
|
|
+ "github.com/mhaya/game/game_cluster/internal/param"
|
|
|
sessionKey "github.com/mhaya/game/game_cluster/internal/session_key"
|
|
|
+ clog "github.com/mhaya/logger"
|
|
|
)
|
|
|
|
|
|
type quickSdk struct {
|
|
@@ -50,16 +52,32 @@ func (p quickSdk) Login(config *data.SdkConfigRow, params Params, callback Callb
|
|
|
|
|
|
sign, _ := params.GetString("sign")
|
|
|
|
|
|
- account := rpcCenter.RegisterAccount(p.app, openid, ip, plt, channel, sign)
|
|
|
- if account == nil {
|
|
|
+ req := ¶m.LoginReq{
|
|
|
+ OpenID: openid,
|
|
|
+ IP: ip,
|
|
|
+ Platform: plt,
|
|
|
+ Channel: channel,
|
|
|
+ Sign: sign,
|
|
|
+ }
|
|
|
+ acc := &models.Account{}
|
|
|
+ account, err := acc.AccountRegisterOrLogin(req)
|
|
|
+ if err > 0 {
|
|
|
callback(code.LoginError, nil)
|
|
|
return
|
|
|
}
|
|
|
+ nodeId, ok := SetNode(p.app)
|
|
|
+ if code.IsFail(ok) {
|
|
|
+ clog.Warnf("[RegisterAccount] openID = %s,nodeID=%v, errCode = %v", openid, nodeId, err)
|
|
|
+ callback(code.LoginError, nil)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ targetPath := cfacade.NewChildPath(nodeId, "player", account.UserName)
|
|
|
|
|
|
callback(code.OK, map[string]string{
|
|
|
sessionKey.PlayerID: account.UserName, //返回 quick的uid做为 open id
|
|
|
sessionKey.OpenID: openid,
|
|
|
- sessionKey.TargetPath: account.TargetPath,
|
|
|
+ sessionKey.TargetPath: targetPath,
|
|
|
})
|
|
|
}
|
|
|
|