Esempio n. 1
0
        /// <summary>
        /// 扣除房卡
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static long ReduceRoomCard(long userID, int number)
        {
            var data = RoomCardBusiness.CreateBuilder().SetUserID(userID.ToString()).SetBusinessID("6").SetCounts(number).Build().ToByteArray();

            try
            {
                var resData = new MySocket(host, port).SendReceive(CreateHead.CreateMessage(10040, data.Length, 0, data));
                if (resData.FirstOrDefault() != null)
                {
                    var status = Result.ParseFrom(resData.FirstOrDefault().Data).Status;
                    if (status == 1)
                    {
                        return(1);
                    }
                    else
                    {
                        MyLogger.Logger.Info("请求扣除房卡" + status);
                        return(0);
                    }
                }
            }
            catch (Exception ex)
            {
                MyLogger.Logger.Info("请求扣除房卡:" + ex);
            }
            return(0);
        }
Esempio n. 2
0
        /// <summary>
        /// 根据证书获取用户登录信息
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static string GetloginInfoByCertStr(string certStr)
        {
            var data = GetLoginInfoStr.CreateBuilder().SetCertStr(certStr).Build().ToByteArray();

            try
            {
                var resData = new MySocket(host, port).SendReceive(CreateHead.CreateMessage(11003, data.Length, 0, data));
                if (resData.FirstOrDefault() != null)
                {
                    return(ReturnLoginInfoStr.ParseFrom(resData.FirstOrDefault().Data).LoginInfoStr);
                }
            }
            catch (Exception ex)
            {
                MyLogger.Logger.Info("请求用户登录:" + ex);
            }
            return("");
        }
Esempio n. 3
0
        /// <summary>
        /// 获取龙宝数量
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static int GetLongBaoNumber(string unionid)
        {
            var data = GetLongBaoCount.CreateBuilder().SetID(unionid).Build().ToByteArray();

            try
            {
                var resData = new MySocket(host, port).SendReceive(CreateHead.CreateMessage(11011, data.Length, 0, data));
                if (resData.FirstOrDefault() != null)
                {
                    return(ReturnLongBaoCount.ParseFrom(resData.FirstOrDefault().Data).Count);
                }
            }
            catch (Exception ex)
            {
                MyLogger.Logger.Info("请求用户登录:" + ex);
            }
            return(0);
        }
Esempio n. 4
0
        /// <summary>
        /// 根据账号密码获取用户信息
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static string GetloginInfoByPWD(string loginInfoStr, string pwd)
        {
            var data = LBUserLogin.CreateBuilder().SetUserName(loginInfoStr).SetPwd(pwd).Build().ToByteArray();

            try
            {
                var resData = new MySocket(host, port).SendReceive(CreateHead.CreateMessage(11005, data.Length, 0, data));
                if (resData.FirstOrDefault() != null)
                {
                    return(ReturnLBUserLoginInfo.ParseFrom(resData.FirstOrDefault().Data).UserInfoJson);
                }
            }
            catch (Exception ex)
            {
                MyLogger.Logger.Info("请求用户登录:" + ex);
            }
            return("");
        }
Esempio n. 5
0
        /// <summary>
        /// 获取房卡
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public static long GetRoomCard(long userID)
        {
            var data = RequestUserInfo.CreateBuilder().SetUserID(userID.ToString()).Build().ToByteArray();

            try
            {
                var resData = new MySocket(host, port).SendReceive(CreateHead.CreateMessage(10040, data.Length, 0, data));
                if (resData.FirstOrDefault() != null)
                {
                    var roomcard = ResponseUserInfo.ParseFrom(resData.FirstOrDefault().Data).RoomCard;
                    // MyLogger.Logger.Info("请求房卡:" + roomcard);
                    return(roomcard);
                }
            }
            catch (Exception ex)
            {
                MyLogger.Logger.Error("请求扣除房卡异常:" + ex);
            }
            return(0);

            //测试
            // return 5000;
        }