コード例 #1
0
ファイル: Action2500.cs プロジェクト: dannisliang/scutlogic
        bool addProductOnServer(PayOrderPersion payData, HappyModeData hmd)
        {
            string hd = GameConfigMgr.Instance().getProductInfo(payData.ProductId, payData.ServerOrderId);

            string[] infos   = hd.Split('*');
            int      itemID  = int.Parse(infos[0]);
            int      itemNum = int.Parse(infos[1]);
            string   infoLog = string.Format("add item:{0}num:{1}", itemID, payData.num * itemNum);

            ConsoleLog.showNotifyInfo(infoLog);
            TraceLog.WriteInfo(infoLog);
            hmd.ModifyLocked(() => {
                if (payData.ProductId == "5019")
                {
                    hmd.HappyPoint += payData.num * itemNum;
                }
                if (payData.ProductId == "5020")
                {
                    hmd.HappyReliveNum += payData.num * itemNum;
                }
                if (payData.ProductId == "5021")
                {
                    hmd.HappyReliveNum += payData.num * itemNum;
                }
            });
            if (payData.ProductId == "5019" ||
                payData.ProductId == "5020" ||
                payData.ProductId == "5021")
            {
                return(true);
            }

            return(false);
        }
コード例 #2
0
ファイル: Action1006.cs プロジェクト: dannisliang/scutlogic
        public override bool TakeAction()
        {
            // 存入数据库
            var      hmdCache      = new PersonalCacheStruct <HappyModeData>();
            var      cache         = new ShareCacheStruct <PayOrder>();
            int      index         = (int)cache.GetNextNo();
            PayOrder PayData       = new PayOrder();
            string   ServerOrderId = System.Guid.NewGuid().ToString("N");
            int      keyid         = utils.KeyUInt2Int(requestPack.the3rdUserId);

            PayData.Index            = index;
            PayData.UserId           = requestPack.UserID;
            PayData.Identify         = requestPack.identify;
            PayData.typeUser         = requestPack.typeUser; // 360Pay..maybe
            PayData.ProductId        = requestPack.productId;
            PayData.num              = requestPack.num;
            PayData.the3rdUserId     = keyid;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            PayData.strThe3rdOrderId = requestPack.strThe3rdUserId;
            PayData.ServerOrderId    = ServerOrderId;
            PayData.the3rdOrderId    = "";
            cache.Add(PayData);

            // hmd persion
            HappyModeData hmd = hmdCache.FindKey(keyid.ToString());
            int           happyPointMaxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3);

            if (null == hmd)
            {
                responsePack.errorCode = 1;
                return(true);
            }
            PayOrderPersion pop = new PayOrderPersion();

            pop.Index            = index;
            pop.UserId           = requestPack.UserID;
            pop.Identify         = requestPack.identify;
            pop.typeUser         = requestPack.typeUser; // 360Pay..maybe
            pop.ProductId        = requestPack.productId;
            pop.num              = requestPack.num;
            pop.the3rdUsrID      = (int)requestPack.the3rdUserId;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            pop.strThe3rdOrderId = requestPack.strThe3rdUserId;
            pop.ServerOrderId    = ServerOrderId;
            pop.the3rdOrderId    = "";
            hmd.PayInfoDic.Add(ServerOrderId, pop);

            // end return
            responsePack.errorCode = 0;
            responsePack.typeUser  = requestPack.typeUser;
            responsePack.result    = PayData.ServerOrderId; // 服务器订单号

            ConsoleLog.showErrorInfo(0, "create order success" + requestPack.the3rdUserId + ":" + ServerOrderId);
            return(true);
        }
コード例 #3
0
ファイル: Action2502.cs プロジェクト: dannisliang/scutlogic
        bool ProcessHMD(string orderId, bool bSuccess, string jrRet)
        {
            // hmd
            var           hmdCache = new PersonalCacheStruct <HappyModeData>();
            int           keyid    = Action1005.getHappyIndex("YYS_BaiDu", app_uid);
            HappyModeData hmd      = hmdCache.FindKey(keyid.ToString());

            if (null == hmd)
            {
                // errorcode
                ConsoleLog.showErrorInfo(0, "PayLog ProcessHMD hmd is null");
                TraceLog.WriteError("PayLog ProcessHMD hmd is null");
                return(false);
            }
            else
            {
                if (false == hmd.PayInfoDic.ContainsKey(server_orderid))
                {
                    // errorcode
                    ConsoleLog.showErrorInfo(0, "PayLog ProcessHMD server_orderid not find :" + server_orderid + "/nbaidu orderID" + order_id);
                    TraceLog.WriteError("PayLog ProcessHMD server_orderid not find :" + server_orderid + "baidu orderID" + order_id);
                    return(false);
                }
                else
                {
                    hmd.PayInfoDic[server_orderid].userParms     = urlParams;
                    hmd.PayInfoDic[server_orderid].the3rdOrderId = order_id;
                }
            }

            PayOrderPersion payDataPersion  = hmd.PayInfoDic[server_orderid];
            bool            hasGetPayReward = false;

            if (false == payDataPersion.process)
            {
                if (bSuccess)
                {
                    hasGetPayReward = addProductOnServer(payDataPersion, hmd);
                }
                hmd.PayInfoDic.ModifyLocked(() =>
                {
                    payDataPersion.state           = bSuccess ? PayOrderPersion.PayStatus.paySuccess : PayOrderPersion.PayStatus.payFailed;
                    payDataPersion.process         = true;
                    payDataPersion.typeUser        = "******";
                    payDataPersion.jrRet           = jrRet;
                    payDataPersion.hasGetPayReward = hasGetPayReward;
                });
            }
            return(hasGetPayReward);
        }
コード例 #4
0
        void test()
        {
            HappyModeData   hmd = new HappyModeData();
            PayOrderPersion pop = new PayOrderPersion();

            pop.Index            = 1;
            pop.UserId           = 2;
            pop.Identify         = "1";
            pop.typeUser         = "******"; // 360Pay..maybe
            pop.ProductId        = "1";
            pop.num              = 1;
            pop.the3rdUsrID      = 1;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            pop.strThe3rdOrderId = "1";
            pop.ServerOrderId    = "1";
            pop.the3rdOrderId    = "1";
            hmd.PayInfoDic.Add("1", pop);
            HappyModeData d = new HappyModeData();

            persionRealItemInfo prii = new persionRealItemInfo();

            prii.Index = 1;
            hmd.RealItemInfoLst.Add(prii);

            UserActionInfo uai = new UserActionInfo();

            uai.index = 1;
            hmd.ActionEnterHappyPoint.Add(1, uai);

            RefleshCacheInfo rci = new RefleshCacheInfo();

            rci.itemId = 1;
            hmd.realItemBuyCntInRefleshTime.Add(1, rci);


            d.realItemBuyCntInRefleshTime = clone <CacheDictionary <int, RefleshCacheInfo> >(hmd.realItemBuyCntInRefleshTime);
            d.ActionEnterHappyPoint       = clone <CacheDictionary <int, UserActionInfo> >(hmd.ActionEnterHappyPoint);
            d.RealItemInfoLst             = clone <CacheList <persionRealItemInfo> >(hmd.RealItemInfoLst);
            d.PayInfoDic = clone <CacheDictionary <string, PayOrderPersion> >(hmd.PayInfoDic);
        }
コード例 #5
0
ファイル: Action1006.cs プロジェクト: guccang/scutlogic
        public override bool TakeAction()
        {
            // 存入数据库
            var hmdCache = new PersonalCacheStruct<HappyModeData>();
            var cache    = new ShareCacheStruct<PayOrder>();
            int index = (int)cache.GetNextNo();
            PayOrder PayData    = new PayOrder();
            string ServerOrderId = System.Guid.NewGuid().ToString("N");
            int keyid = utils.KeyUInt2Int(requestPack.the3rdUserId);

            PayData.Index       = index;
            PayData.UserId      = requestPack.UserID;
            PayData.Identify    = requestPack.identify;
            PayData.typeUser    = requestPack.typeUser; // 360Pay..maybe
            PayData.ProductId   = requestPack.productId;
            PayData.num         = requestPack.num;
            PayData.the3rdUserId = keyid;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            PayData.strThe3rdOrderId = requestPack.strThe3rdUserId;
            PayData.ServerOrderId = ServerOrderId;
            PayData.the3rdOrderId = "";
            cache.Add(PayData);

            // hmd persion
            HappyModeData hmd = hmdCache.FindKey(keyid.ToString());
            int happyPointMaxEnterNum = GameConfigMgr.Instance().getInt("happyPointMaxEnterNum", 3);
            if (null == hmd)
            {
                responsePack.errorCode = 1;
                return true;
            }
            PayOrderPersion pop = new PayOrderPersion();
            pop.Index = index;
            pop.UserId = requestPack.UserID;
            pop.Identify = requestPack.identify;
            pop.typeUser = requestPack.typeUser; // 360Pay..maybe
            pop.ProductId = requestPack.productId;
            pop.num = requestPack.num;
            pop.the3rdUsrID = (int)requestPack.the3rdUserId;// utils.KeyUInt2Int(requestPack.the3rdUserId);
            pop.strThe3rdOrderId = requestPack.strThe3rdUserId;
            pop.ServerOrderId = ServerOrderId;
            pop.the3rdOrderId = "";
            hmd.PayInfoDic.Add(ServerOrderId, pop);

            // end return
            responsePack.errorCode = 0;
            responsePack.typeUser  = requestPack.typeUser;
            responsePack.result    = PayData.ServerOrderId; // 服务器订单号

            ConsoleLog.showErrorInfo(0,"create order success"+requestPack.the3rdUserId+":"+ServerOrderId);
            return true;
        }
コード例 #6
0
ファイル: Action2502.cs プロジェクト: guccang/scutlogic
        bool addProductOnServer(PayOrderPersion payData, HappyModeData hmd)
        {
            string hd = GameConfigMgr.Instance().getProductInfo(payData.ProductId, payData.ServerOrderId);
            //ConsoleLog.showNotifyInfo(hd);
            string[] itemInfos = hd.Split(',');
            bool add = false;
            for(int i=0; i<itemInfos.Length; ++i)
            {
                string[] infos = itemInfos[i].Split('*');
                int itemID = int.Parse(infos[0]);
                int itemNum = int.Parse(infos[1]);
                string infoLog = string.Format("add item:{0}num:{1}", itemID, payData.num * itemNum);
                ConsoleLog.showNotifyInfo(infoLog);
                TraceLog.WriteInfo(infoLog);
                hmd.ModifyLocked(() =>
                {
                    if (payData.ProductId == "5019")
                    {
                        hmd.HappyPoint += payData.num * itemNum;
                    }
                    if (payData.ProductId == "5020")
                    {
                        hmd.HappyReliveNum += payData.num * itemNum;
                    }
                    if (payData.ProductId == "5021")
                    {
                        hmd.HappyReliveNum += payData.num * itemNum;
                    }
                });
                if (payData.ProductId == "5019" ||
                    payData.ProductId == "5020" ||
                    payData.ProductId == "5021")
                {
                    add = true;
                }
            }

            return add;
        }