Beispiel #1
0
        public ErrorCode OnGc2BsAskLogin(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.GC2BS_AskLogin login    = (Protos.GC2BS_AskLogin)message;
            Protos.BS2GC_LoginRet loginRet = ProtoCreator.R_GC2BS_AskLogin(login.Opts.Pid);

            //验证并登陆
            BSUser user = BS.instance.userMgr.Online(login.SessionID, session.id);

            if (user != null)
            {
                ClientSession gcSession = ( ClientSession )session;
                //设置该Session为受信任的连接
                gcSession.accredited = true;
                //把战场的初始状态下发到GC
                loginRet.PlayerID     = user.gcNID;
                loginRet.RndSeed      = user.battle.rndSeed;
                loginRet.FrameRate    = user.battle.frameRate;
                loginRet.KeyframeStep = user.battle.keyframeStep;
                loginRet.SnapshotStep = user.battle.snapshotStep;
                loginRet.BattleTime   = user.battle.battleTime;
                loginRet.MapID        = user.battle.mapID;
                loginRet.CurFrame     = user.battle.frame;
                int c1 = user.battle.battleEntry.users.Length;
                for (int i = 0; i < c1; i++)
                {
                    var team     = user.battle.battleEntry.users[i];
                    int c2       = team.Length;
                    var teamInfo = new Protos.CS2BS_TeamInfo();
                    loginRet.TeamInfos.Add(teamInfo);
                    for (int j = 0; j < c2; j++)
                    {
                        BSUser player = team[j];
                        Protos.CS2BS_PlayerInfo playerInfo = new Protos.CS2BS_PlayerInfo
                        {
                            GcNID    = player.gcNID,
                            ActorID  = player.actorID,
                            Nickname = player.nickname,
                            Avatar   = player.avatar,
                            Gender   = player.gender,
                            Rank     = player.rank,
                            Exp      = player.exp
                        };
                        teamInfo.PlayerInfos.Add(playerInfo);
                    }
                }

                loginRet.Result = Protos.Global.Types.ECommon.Success;
                session.Send(loginRet);
            }
            else
            {
                loginRet.Result = Protos.Global.Types.ECommon.Failed;
                session.Send(loginRet);
                session.Close(true, "client login failed");
            }
            return(ErrorCode.Success);
        }
Beispiel #2
0
        public ErrorCode OnCs2DbQueryRanking(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.CS2DB_QueryRanking request = (Protos.CS2DB_QueryRanking)message;
            int @from = request.From;
            int count = request.Count;

            Protos.DB2CS_QueryRankingRet resp = ProtoCreator.R_CS2DB_QueryRanking(request.Opts.Pid);
            string    str       = $"SELECT id,uname,nickname,avatar,gender,last_login_time,ranking,exp FROM account_user ORDER BY ranking DESC LIMIT {@from}, {count}";
            ErrorCode errorCode = DB.instance.accountDB.SqlExecQuery(str, dataReader =>
            {
                while (dataReader.Read())
                {
                    Protos.DB2CS_RankingInfo rankingInfo = new Protos.DB2CS_RankingInfo();
                    rankingInfo.Ukey          = dataReader.GetUInt32("id");
                    rankingInfo.Name          = dataReader.GetString("nickname");
                    rankingInfo.Avatar        = dataReader.GetString("avatar");
                    rankingInfo.Gender        = dataReader.GetByte("gender");
                    rankingInfo.LastLoginTime = dataReader.GetInt64("last_login_time");
                    rankingInfo.Rank          = dataReader.GetInt32("ranking");
                    rankingInfo.Exp           = dataReader.GetInt32("exp");
                    resp.RankingInfos.Add(rankingInfo);
                }
                return(ErrorCode.Success);
            });

            session.Send(resp);
            return(ErrorCode.Success);
        }
Beispiel #3
0
 public ErrorCode OnBSAskPing(NetSessionBase session, Google.Protobuf.IMessage message)
 {
     Protos.G_AskPing    askPing    = (Protos.G_AskPing)message;
     Protos.G_AskPingRet askPingRet = ProtoCreator.R_G_AskPing(askPing.Opts.Pid);
     askPingRet.Stime = askPing.Time;
     askPingRet.Time  = TimeUtils.utcTime;
     session.Send(askPingRet);
     return(ErrorCode.Success);
 }
Beispiel #4
0
 public ErrorCode OnGSAskPing(NetSessionBase session, IMessage message)
 {
     Protos.G_AskPing    request  = (Protos.G_AskPing)message;
     Protos.G_AskPingRet response = ProtoCreator.R_G_AskPing(request.Opts.Pid);
     response.Stime = request.Time;
     response.Time  = TimeUtils.utcTime;
     session.Send(response);
     return(ErrorCode.Success);
 }
Beispiel #5
0
        /// <summary>
        /// BS通知战场结束
        /// </summary>
        public ErrorCode OnBs2CsBattleEnd(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.BS2CS_BattleEnd battleEnd = (Protos.BS2CS_BattleEnd)message;
            //评分
            Dictionary <int, int> ratings = this.ComputeElorating(battleEnd.Infos);

            //数据库
            Protos.CS2DB_UpdateRank dbRequest = ProtoCreator.Q_CS2DB_UpdateRank();
            //通知客户端战场结束
            Protos.CS2GC_BattleEnd gcBattleEnd = ProtoCreator.Q_CS2GC_BattleEnd();
            foreach (var kv in battleEnd.Infos)
            {
                CSUser user = CS.instance.battleStaging.GetUser(kv.Key);

                Protos.BS2CS_BattleEndInfo info = kv.Value;
                gcBattleEnd.Result    = (Protos.CS2GC_BattleEnd.Types.Result)info.Result;
                gcBattleEnd.GMoney    = info.Result == Protos.BS2CS_BattleEndInfo.Types.Result.Win ? ( int )(0.01f * user.rank) : 0;
                gcBattleEnd.GDiamoned = 0;
                gcBattleEnd.GRank     = ratings[info.Team];
                gcBattleEnd.GExp      = info.Result == Protos.BS2CS_BattleEndInfo.Types.Result.Win ? 10u : 0u;

                user.money    += gcBattleEnd.GMoney;
                user.diamoned += gcBattleEnd.GDiamoned;
                user.rank     += gcBattleEnd.GRank;
                user.exp      += gcBattleEnd.GExp;

                gcBattleEnd.Money    = user.rank;
                gcBattleEnd.Diamoned = user.diamoned;
                gcBattleEnd.Rank     = user.rank;
                gcBattleEnd.Exp      = user.exp;

                CS.instance.netSessionMgr.Send(user.gsSID, gcBattleEnd, null, Protos.MsgOpts.Types.TransTarget.Gc, user.gcNID);

                //数据库
                Protos.CS2DB_Gain gain = new Protos.CS2DB_Gain();
                gain.Ukey     = user.ukey;
                gain.Money    = user.money;
                gain.Diamoned = user.diamoned;
                gain.Rank     = user.rank;
                gain.Exp      = user.exp;
                dbRequest.Gains.Add(gain);
            }
            //数据库
            CS.instance.netSessionMgr.Send(SessionType.ServerC2DB, dbRequest);
            //移除指定BS里指定战场里的所有玩家
            CS.instance.battleStaging.Remove(session.logicID, battleEnd.Bid);

            //回应
            Protos.CS2BS_BattleEndRet battleEndRet = ProtoCreator.R_BS2CS_BattleEnd(battleEnd.Opts.Pid);
            session.Send(battleEndRet);

            return(ErrorCode.Success);
        }
Beispiel #6
0
        public ErrorCode OnLs2DbExec(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.LS2DB_Exec    exec      = (Protos.LS2DB_Exec)message;
            Protos.DB2LS_ExecRet execRet   = ProtoCreator.R_LS2DB_Exec(exec.Opts.Pid);
            ErrorCode            errorCode = DB.instance.accountDB.SqlExecNonQuery(exec.Cmd, out int row, out uint id);

            execRet.Row    = row;
            execRet.Id     = id;
            execRet.Result = errorCode == ErrorCode.Success ? Protos.Global.Types.ECommon.Success : Protos.Global.Types.ECommon.Failed;
            session.Send(execRet);
            return(ErrorCode.Success);
        }
Beispiel #7
0
        /// <summary>
        /// LS通知CS有客户端登录成功
        /// </summary>
        public ErrorCode OnLs2CsGclogin(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.LS2CS_GCLogin gcLogin = (Protos.LS2CS_GCLogin)message;
            CSUser user = CS.instance.userMgr.CreateUser(gcLogin);

            Protos.CS2LS_GCLoginRet gcLoginRet = ProtoCreator.R_LS2CS_GCLogin(gcLogin.Opts.Pid);
            gcLoginRet.Result = user != null
                                                                        ? Protos.CS2LS_GCLoginRet.Types.EResult.Success
                                                                        : Protos.CS2LS_GCLoginRet.Types.EResult.Failed;
            session.Send(gcLoginRet);
            return(ErrorCode.Success);
        }
Beispiel #8
0
        public void ReportStateToCS(NetSessionBase session)
        {
            Protos.BS2CS_ReportState reportState = ProtoCreator.Q_BS2CS_ReportState();
            BSConfig config = BS.instance.config;

            reportState.BsInfo = new Protos.BSInfo
            {
                Id    = config.id,
                Ip    = config.externalIP,
                Port  = config.externalPort,
                State = (Protos.BSInfo.Types.State)BS.instance.state
            };
            session.Send(reportState);
        }
Beispiel #9
0
        /// <summary>
        /// GS请求CS,验证GC登陆的合法性
        /// </summary>
        public ErrorCode OnGs2CsGcaskLogin(NetSessionBase session, IMessage message)
        {
            Protos.GS2CS_GCAskLogin request  = (Protos.GS2CS_GCAskLogin)message;
            Protos.CS2GS_GCLoginRet response = ProtoCreator.R_GS2CS_GCAskLogin(request.Opts.Pid);

            //创建玩家并上线
            CSUser user = CS.instance.userMgr.Online(request.SessionID, session.id, session.logicID);

            if (user == null)
            {
                //非法登陆
                response.Result = Protos.CS2GS_GCLoginRet.Types.EResult.IllegalLogin;
            }
            else
            {
                response.UserInfo = new Protos.G_UserInfo
                {
                    Ukey     = user.ukey,
                    GcNID    = user.gcNID,
                    OpenID   = user.openID,
                    Nickname = user.nickname,
                    Avatar   = user.avatar,
                    Gender   = user.gender,
                    Rank     = user.rank,
                    Money    = user.money,
                    Diamoned = user.diamoned,
                    Exp      = user.exp,
                };
                response.UserInfo.Champions.AddRange(user.champions);

                //检查玩家是否在战场
                if (user.isInBattle)
                {
                    //检查是否存在BS信息(可能当玩家上线时,BS已丢失)
                    //这里理应不会成功断言,因为BS丢失时会把玩家从战场暂存器里移除
                    INetSession bsSession = CS.instance.netSessionMgr.GetSession(user.bsSID);
                    System.Diagnostics.Debug.Assert(bsSession != null, $"can not find BS:{user.bsSID}");

                    CS.instance.lIDToBSInfos.TryGetValue((( BattleSession )bsSession).logicID, out BSInfo bsInfo);
                    System.Diagnostics.Debug.Assert(bsInfo != null, $"can not find BS:{( ( BattleSession )bsSession ).logicID}");
                    response.GcState = Protos.CS2GS_GCLoginRet.Types.EGCCState.Battle;
                    response.GcNID   = user.ukey | ( ulong )bsInfo.lid << 32;
                    response.BsIP    = bsInfo.ip;
                    response.BsPort  = bsInfo.port;
                }
                response.Result = Protos.CS2GS_GCLoginRet.Types.EResult.Success;
            }
            session.Send(response);
            return(ErrorCode.Success);
        }
Beispiel #10
0
        public void ReportStateToCS(NetSessionBase session)
        {
            Protos.GS2CS_ReportState reportState = ProtoCreator.Q_GS2CS_ReportState();
            GSConfig config = GS.instance.config;

            reportState.GsInfo = new Protos.GSInfo
            {
                Id       = config.gsID,
                Name     = config.name,
                Ip       = config.externalIP,
                Port     = config.externalPort,
                Password = config.password,
                State    = (Protos.GSInfo.Types.State)GS.instance.state
            };
            session.Send(reportState);
        }
Beispiel #11
0
        /// <summary>
        /// 处理cs通知开始战斗
        /// </summary>
        public ErrorCode OnCs2BsBattleInfo(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.CS2BS_BattleInfo battleInfo = (Protos.CS2BS_BattleInfo)message;

            BS.instance.battleMgr.CreateBattle(battleInfo, (bid, success) =>
            {
                Protos.BS2CS_BattleInfoRet battleInfoRet = ProtoCreator.R_CS2BS_BattleInfo(battleInfo.Opts.Pid);
                battleInfoRet.Bid    = bid;
                battleInfoRet.Result = success
                                                                                   ? Protos.Global.Types.ECommon.Success
                                                                                   : Protos.Global.Types.ECommon.Failed;
                session.Send(battleInfoRet);
            });

            return(ErrorCode.Success);
        }
Beispiel #12
0
        public ErrorCode OnLs2DbQueryAccount(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.LS2DB_QueryAccount    queryUser    = (Protos.LS2DB_QueryAccount)message;
            Protos.DB2LS_QueryAccountRet queryUserRet = ProtoCreator.R_LS2DB_QueryAccount(queryUser.Opts.Pid);
            ErrorCode errorCode = DB.instance.accountDB.SqlExecQuery($"select id from account_user where uname=\'{queryUser.Name}\'",
                                                                     dataReader =>
            {
                if (dataReader.HasRows)
                {
                    return(ErrorCode.UsernameExists);
                }
                return(ErrorCode.Success);
            });

            queryUserRet.Result = errorCode == ErrorCode.Success ? Protos.Global.Types.ECommon.Success : Protos.Global.Types.ECommon.Failed;
            session.Send(queryUserRet);
            return(ErrorCode.Success);
        }
Beispiel #13
0
        public ErrorCode OnGc2LsAskSmartLogin(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            uint   sid    = session.id;
            string remote = session.connection.remoteEndPoint.ToString();

            Protos.GC2LS_AskSmartLogin login      = (Protos.GC2LS_AskSmartLogin)message;
            Protos.LS2GC_AskLoginRet   gcLoginRet = ProtoCreator.R_GC2LS_AskLogin(login.Opts.Pid);

            Logger.Log($"GC {login.Id}, {session.connection.remoteEndPoint} ask login");

            //检测用户名的合法性
            if (!CheckUsername(login.Id))
            {
                gcLoginRet.Result = Protos.LS2GC_AskLoginRet.Types.EResult.InvalidUname;
                session.Send(gcLoginRet);
                session.Close(true, "login failed");
                return(ErrorCode.Success);
            }

            LoginContext context = new LoginContext();

            context.id       = login.Id;
            context.channel  = login.Channel;
            context.browser  = login.Browser;
            context.platform = login.Platform;

            //查询数据库
            //若查询失败则自动注册
            Protos.LS2DB_QueryLogin queryLogin = ProtoCreator.Q_LS2DB_QueryLogin();
            queryLogin.Name     = login.Id;
            queryLogin.Nickname = login.Id;
            queryLogin.VertPwd  = false;
            queryLogin.Time     = TimeUtils.utcTime;
            queryLogin.Ip       = remote;
            queryLogin.Channel  = login.Channel;
            queryLogin.Browser  = login.Browser;
            queryLogin.Platform = login.Platform;
            queryLogin.Money    = LS.instance.config.initMoney;
            queryLogin.Diamoned = LS.instance.config.initDiamoned;
            queryLogin.Rank     = LS.instance.config.initRank;
            LS.instance.netSessionMgr.Send(SessionType.ServerL2DB, queryLogin,
                                           RPCEntry.Pop(OnSmartQueryLoginRet, gcLoginRet, sid, context));
            return(ErrorCode.Success);
        }
Beispiel #14
0
        public ErrorCode OnCs2DbBuyChampion(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.CS2DB_BuyChampion    request = (Protos.CS2DB_BuyChampion)message;
            Protos.DB2CS_BuyChampionRet resp    = ProtoCreator.R_CS2DB_BuyChampion(request.Opts.Pid);
            string    cids      = string.Join('|', request.Cids);
            string    str       = $"UPDATE account_user SET money={request.Money},diamoned={request.Diamoned},champions={cids} where id={request.Ukey}";
            ErrorCode errorCode = DB.instance.accountDB.SqlExecNonQuery(str, out _, out uint _);

            switch (errorCode)
            {
            case ErrorCode.Success:
                request.Result = Protos.Global.Types.ECommon.Success;
                break;

            default:
                request.Result = Protos.Global.Types.ECommon.Failed;
                break;
            }
            session.Send(resp);
            return(ErrorCode.Success);
        }
Beispiel #15
0
        public ErrorCode OnLs2DbQueryLogin(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            Protos.LS2DB_QueryLogin    queryLogin    = (Protos.LS2DB_QueryLogin)message;
            Protos.DB2LS_QueryLoginRet queryLoginRet = ProtoCreator.R_LS2DB_QueryLogin(queryLogin.Opts.Pid);
            ErrorCode errorCode = DB.instance.accountDB.SqlExecQuery(
                $"select * from account_user where uname=\'{queryLogin.Name}\'",
                dataReader =>
            {
                if (!dataReader.HasRows)
                {
                    return(ErrorCode.InvalidUname);
                }
                dataReader.Read();
                queryLoginRet.Ukey      = dataReader.GetUInt32("id");
                queryLoginRet.Channel   = (Protos.Global.Types.Channel)dataReader.GetByte("channel");
                queryLoginRet.Browser   = (Protos.Global.Types.Browser)dataReader.GetByte("browser");
                queryLoginRet.Platform  = (Protos.Global.Types.Platform)dataReader.GetByte("platform");
                queryLoginRet.UnionID   = dataReader.GetString("unionID");
                queryLoginRet.Nickname  = dataReader.GetString("nickname");
                queryLoginRet.Avatar    = dataReader.GetString("avatar");
                queryLoginRet.Gender    = dataReader.GetByte("gender");
                queryLoginRet.Money     = dataReader.GetInt32("money");
                queryLoginRet.Diamoned  = dataReader.GetInt32("diamoned");
                queryLoginRet.Rank      = dataReader.GetInt32("ranking");
                queryLoginRet.Exp       = dataReader.GetUInt32("exp");
                queryLoginRet.Champions = dataReader.GetString("champions");
                queryLoginRet.ActorID   = dataReader.GetInt32("actorID");

                ErrorCode QueryError = ErrorCode.Success;
                if (queryLogin.VertPwd)
                {
                    if (dataReader.GetString("pwd") != queryLogin.Pwd)
                    {
                        QueryError = ErrorCode.InvalidPwd;
                    }
                }
                return(QueryError);
            });

            if (errorCode == ErrorCode.Success)
            {
                //成功则更新记录
                errorCode = DB.instance.accountDB.SqlExecNonQuery(
                    $"update account_user SET channel={( byte )queryLogin.Channel},browser={( byte )queryLogin.Browser},platform={( byte )queryLogin.Platform}," +
                    $"unionID=\'{queryLogin.UnionID}\',nickname=\'{queryLogin.Nickname}\',avatar=\'{queryLogin.Avatar}\',gender={( byte )queryLogin.Gender}," +
                    $"last_login_time={queryLogin.Time},last_login_ip=\'{queryLogin.Ip}\'" +
                    $" where uname=\'{queryLogin.Name}\'",
                    out _, out uint _);
            }
            else
            {
                //自动注册
                errorCode = DB.instance.accountDB.SqlExecNonQuery(
                    $"insert account_user( uname,channel,browser,platform,unionID,nickname,avatar,gender,money,diamoned,ranking,last_login_time,last_login_ip ) values" +
                    $"(\'{queryLogin.Name}\',{( byte )queryLogin.Channel},{( byte )queryLogin.Browser},{( byte )queryLogin.Platform}," +
                    $"\'{queryLogin.UnionID}\',\'{queryLogin.Nickname}\',\'{queryLogin.Avatar}\',\'{( byte )queryLogin.Gender}\'," +
                    $"{queryLogin.Money},{queryLogin.Diamoned},{queryLogin.Rank}," +
                    $"{queryLogin.Time},\'{queryLogin.Ip}\');",
                    out _, out uint id);

                queryLoginRet.Ukey      = id;
                queryLoginRet.Channel   = queryLogin.Channel;
                queryLoginRet.Browser   = queryLogin.Browser;
                queryLoginRet.Platform  = queryLogin.Platform;
                queryLoginRet.UnionID   = queryLogin.UnionID;
                queryLoginRet.Nickname  = queryLogin.Nickname;
                queryLoginRet.Avatar    = queryLogin.Avatar;
                queryLoginRet.Gender    = queryLogin.Gender;
                queryLoginRet.Money     = queryLogin.Money;
                queryLoginRet.Diamoned  = queryLogin.Diamoned;
                queryLoginRet.Rank      = queryLogin.Rank;
                queryLoginRet.Exp       = queryLogin.Exp;
                queryLoginRet.Champions = queryLogin.Champions;
            }
            switch (errorCode)
            {
            case ErrorCode.Success:
                queryLoginRet.Result = Protos.Global.Types.ECommon.Success;
                break;

            default:
                queryLoginRet.Result = Protos.Global.Types.ECommon.Failed;
                break;
            }
            session.Send(queryLoginRet);
            return(ErrorCode.Success);
        }
Beispiel #16
0
 public void PingCS(NetSessionBase session)
 {
     Protos.G_AskPing msg = ProtoCreator.Q_G_AskPing();
     msg.Time = TimeUtils.utcTime;
     session.Send(msg, RPCEntry.Pop(OnGSAskPingRet));
 }
Beispiel #17
0
        public ErrorCode OnGc2LsAskWxlogin(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            uint   sid    = session.id;
            string remote = session.connection.remoteEndPoint.ToString();

            Protos.GC2LS_AskWXLogin  login      = (Protos.GC2LS_AskWXLogin)message;
            Protos.LS2GC_AskLoginRet gcLoginRet = ProtoCreator.R_GC2LS_AskLogin(login.Opts.Pid);
            string    reqUrl = string.Format(LS.instance.config.code2sessionUrl, LS.instance.config.wxAppID, LS.instance.config.wxAppSecret, login.Code);
            WebClient client = new WebClient();

            client.DownloadStringTaskAsync(reqUrl).ContinueWith((t, o) =>
            {
                Hashtable json = ( Hashtable )MiniJSON.JsonDecode(t.Result);
                int errorCode  = json.GetInt("errcode");
                if (errorCode != 0)
                {
                    //错误码,参考 https://developers.weixin.qq.com/minigame/dev/api/code2Session.html
                    switch (errorCode)
                    {
                    case -1:
                        gcLoginRet.Result = Protos.LS2GC_AskLoginRet.Types.EResult.Busy;
                        break;

                    case 40029:
                        gcLoginRet.Result = Protos.LS2GC_AskLoginRet.Types.EResult.InvalidCode;
                        break;

                    case 45011:
                        gcLoginRet.Result = Protos.LS2GC_AskLoginRet.Types.EResult.Frequent;
                        break;
                    }
                    session.Send(gcLoginRet);
                    session.Close(true, $"login fail:{errorCode}");
                }
                else
                {
                    string openID     = json.GetString("openid");
                    string sessionKey = json.GetString("session_key");
                    string unionID    = json.GetString("unionid");

                    Logger.Log($"wxLogin success, id:{openID}, sessionKey:{sessionKey}, unionID:{unionID}");

                    LoginContext context = new LoginContext();
                    context.id           = openID;
                    context.channel      = Protos.Global.Types.Channel.Wxmini;
                    context.browser      = login.Browser;
                    context.platform     = login.Platform;
                    context.sessionKey   = sessionKey;
                    context.unionID      = unionID;
                    context.nickname     = login.Nickname;
                    context.avatar       = login.Avatar;
                    context.gender       = ( byte )login.Gender;

                    //查询数据库
                    //若查询失败则自动注册
                    Protos.LS2DB_QueryLogin queryLogin = ProtoCreator.Q_LS2DB_QueryLogin();
                    queryLogin.Name     = openID;
                    queryLogin.VertPwd  = false;
                    queryLogin.Time     = TimeUtils.utcTime;
                    queryLogin.Ip       = remote;
                    queryLogin.Channel  = Protos.Global.Types.Channel.Wxmini;
                    queryLogin.Browser  = login.Browser;
                    queryLogin.Platform = login.Platform;
                    queryLogin.UnionID  = unionID;
                    queryLogin.Nickname = login.Nickname;
                    queryLogin.Avatar   = login.Avatar;
                    queryLogin.Gender   = login.Gender;
                    queryLogin.Money    = LS.instance.config.initMoney;
                    queryLogin.Diamoned = LS.instance.config.initDiamoned;
                    queryLogin.Rank     = LS.instance.config.initRank;
                    LS.instance.netSessionMgr.Send(SessionType.ServerL2DB, queryLogin,
                                                   RPCEntry.Pop(OnSmartQueryLoginRet, gcLoginRet, sid, context));
                }
            }, null, CancellationToken.None);
            return(ErrorCode.Success);
        }