コード例 #1
0
        //创建推广奖励信息
        private static GeneralizeAwardInfo CreateGeneralizeAwardInfo(long userId)
        {
            GeneralizeAwardInfo generalizeAwardInfo = ComponentFactory.Create <GeneralizeAwardInfo>();

            generalizeAwardInfo.UserId = userId;
            return(generalizeAwardInfo);
        }
コード例 #2
0
        public static async Task GetGreenGift(this GeneralizeComponent generalizeComponent, long getUserId, long initeUserId, IResponse iResponse)
        {
            if (getUserId == initeUserId)
            {
                iResponse.Message = "邀请人不能是自己";
                return;
            }
            if (await generalizeComponent.GreenGiftGetStatu(getUserId))
            {
                iResponse.Message = "已经领取过礼包";
                return;
            }
            User user = await UserHelp.QueryUserInfo(initeUserId);

            if (user == null)
            {
                iResponse.Message = "邀请码不对";
                return;
            }
            //存储个领取新手奖励信息
            GetGreenGiftInfo getGreenGiftInfo = ComponentFactory.Create <GetGreenGiftInfo>();

            getGreenGiftInfo.GetUserId    = getUserId;
            getGreenGiftInfo.InviteUserId = initeUserId;
            getGreenGiftInfo.GetJewelNum  = GeneralizeComponent.AwardJewelNum;
            await generalizeComponent.dbProxyComponent.Save(getGreenGiftInfo);

            //存储推广奖励信息
            GeneralizeAwardInfo generalizeAwardInfo = await generalizeComponent.GetGeneralizeAwardInfo(initeUserId);

            if (generalizeAwardInfo == null)
            {
                generalizeAwardInfo = CreateGeneralizeAwardInfo(initeUserId);
            }
            generalizeAwardInfo.GeneralizeNumber++;
            generalizeAwardInfo.GetJewelTotalNum += GeneralizeComponent.AwardJewelNum;
            await generalizeComponent.dbProxyComponent.Save(generalizeAwardInfo);

            UserHelp.GoodsChange(getUserId, GoodsId.Jewel, GeneralizeComponent.AwardJewelNum, GoodsChangeType.GeneralizeAward, true);
            UserHelp.GoodsChange(initeUserId, GoodsId.Jewel, GeneralizeComponent.AwardJewelNum, GoodsChangeType.GeneralizeAward);
        }