Esempio n. 1
0
        public static void MemberTransOperateNotify(string requestDataJson, UDPClientItemBusiness.ClientItem item)
        {
            string errMsg = string.Empty;

            //获取雷达通知请求数据模式
            MemberTransOperateResultNotifyRequestModel requestDataModel = JsonHelper.DataContractJsonDeserializer <MemberTransOperateResultNotifyRequestModel>(requestDataJson);
            UDPSocketCommonQueryAnswerModel            asnwerModel      = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(requestDataModel.SN);

            //验证MD5
            if (!SignKeyHelper.CheckSignKey(requestDataModel, asnwerModel.StorePassword))
            {
                errMsg = "签名不正确";
                return;
            }

            asnwerModel.Status = 1;
            asnwerModel.Result = requestDataModel;

            SignalrServerToClient.BroadcastMessage(Convert.ToInt32(TransmiteEnum.远程门店会员转账操作请求响应), "远程门店会员转账操作请求响应", asnwerModel.RadarToken, requestDataJson);
        }
Esempio n. 2
0
        public object transICCardCoins(Dictionary <string, object> dicParas)
        {
            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);

            string cardIdOut         = dicParas.ContainsKey("cardIdOut") ? dicParas["cardIdOut"].ToString() : string.Empty;
            string cardIdOutPassword = dicParas.ContainsKey("cardIdOutPassword") ? dicParas["cardIdOutPassword"].ToString() : string.Empty;
            string cardIdIn          = dicParas.ContainsKey("cardIdIn") ? dicParas["cardIdIn"].ToString() : string.Empty;
            string coins             = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;
            string mobileName        = dicParas.ContainsKey("mobileName") ? dicParas["mobileName"].ToString() : string.Empty;

            StoreBusiness   store         = new StoreBusiness();
            string          errMsg        = string.Empty;
            StoreCacheModel storeModel    = null;
            StoreBusiness   storeBusiness = new StoreBusiness();

            if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            if (storeModel.StoreDBDeployType == 0)
            {
                string         storeProc  = "TransICCardCoins";
                SqlParameter[] parameters = new SqlParameter[8];
                parameters[0]           = new SqlParameter("@CardIdOut", cardIdOut);
                parameters[1]           = new SqlParameter("@CardIdOutPassword", cardIdOutPassword);
                parameters[2]           = new SqlParameter("@CardIdIn", cardIdIn);
                parameters[3]           = new SqlParameter("@Coins", coins);
                parameters[4]           = new SqlParameter("@UserId", userTokenModel.XCGameUserId);
                parameters[5]           = new SqlParameter("@Mobile", userTokenModel.Mobile);
                parameters[6]           = new SqlParameter("@ErrMsg", System.Data.SqlDbType.VarChar, 200);
                parameters[6].Direction = System.Data.ParameterDirection.Output;
                parameters[7]           = new SqlParameter("@Return", 0);
                parameters[7].Direction = System.Data.ParameterDirection.ReturnValue;

                XCGameBLL.ExecuteStoredProcedureSentence(storeProc, storeModel.StoreDBName, parameters);
                if (Convert.ToInt32(parameters[7].Value) == 1)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, parameters[6].Value.ToString()));
                }
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                if (DataFactory.SendMemberTransOperate(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, mobileName, userTokenModel.Mobile, cardIdIn, cardIdOut, int.Parse(coins), out radarToken, out errMsg))
                {
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                answerModel = null;
                int whileCount = 0;
                while (answerModel == null && whileCount <= 25)
                {
                    //获取应答缓存数据
                    whileCount++;
                    System.Threading.Thread.Sleep(1000);
                    answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                }

                if (answerModel != null)
                {
                    MemberTransOperateResultNotifyRequestModel model = (MemberTransOperateResultNotifyRequestModel)(answerModel.Result);
                    //移除应答缓存数据
                    UDPSocketCommonQueryAnswerBusiness.Remove(sn);

                    if (model.Result_Code == "1")
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                }
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店设置错误"));
            }
        }