Пример #1
0
        protected override DelayEventRD ProcessRequest(APIRequest <DelayEventRP> pRequest)
        {
            var                rd   = new DelayEventRD();
            var                para = pRequest.Parameters;
            var                loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            T_CTW_LEventBLL    bllCTWEvent        = new T_CTW_LEventBLL(loggingSessionInfo);
            T_CTW_LEventEntity entityCTWEvent     = new T_CTW_LEventEntity();

            entityCTWEvent         = bllCTWEvent.GetByID(para.CTWEventId);
            entityCTWEvent.EndDate = Convert.ToDateTime(para.EndDate);
            bllCTWEvent.Update(entityCTWEvent, null);
            if (para.EventType == "Game")
            {
                T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
                string strEventId = bllEventInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity()
                {
                    CTWEventId = new Guid(para.CTWEventId)
                }, null).FirstOrDefault().LeventId;
                LEventsBLL bllEvent = new LEventsBLL(loggingSessionInfo);
                bllEvent.Update(new LEventsEntity()
                {
                    EndTime = para.EndDate, EventID = strEventId
                }, false);
            }
            if (para.EventType == "Sales")
            {
                PanicbuyingEventBLL bllEvent = new PanicbuyingEventBLL(loggingSessionInfo);

                bllEvent.DelayEvent(para.CTWEventId, para.EndDate);
            }
            rd.EventId = para.CTWEventId;
            return(rd);
        }
        protected override InteractionModeRD ProcessRequest(APIRequest <InteractionModeRP> pRequest)
        {
            var rd = new InteractionModeRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            T_CTW_LEventInteractionBLL bllInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);

            var entityTheme = bllInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity()
            {
                ThemeId = new Guid(para.ThemeId), IsDelete = 0
            }, null).ToList();

            rd.InteractionModeList = entityTheme;
            return(rd);
        }
Пример #3
0
        protected override GetImageRD ProcessRequest(APIRequest <GetImageRP> pRequest)
        {
            var             rd       = new GetImageRD();
            ObjectImagesBLL bllImage = new ObjectImagesBLL(this.CurrentUserInfo);
            LEventsBLL      bllEvent = new LEventsBLL(this.CurrentUserInfo);
            LCoverBLL       bllCover = new LCoverBLL(CurrentUserInfo);

            string strEventId           = pRequest.Parameters.EventId;
            string strCTWEventId        = string.Empty;
            string strOnLineRedirectUrl = string.Empty;

            rd.EventId = strEventId;
            rd.IsCTW   = 0;
            //if (!string.IsNullOrEmpty(pRequest.Parameters.CTWEventId))
            //{
            T_CTW_LEventInteractionBLL bllLEventInteraction = new T_CTW_LEventInteractionBLL(this.CurrentUserInfo);
            DataSet ds = bllLEventInteraction.GetCTWLEventInteraction(strEventId);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                strEventId           = ds.Tables[0].Rows[0]["LeventId"].ToString();
                strCTWEventId        = ds.Tables[0].Rows[0]["CTWEventId"].ToString();
                strOnLineRedirectUrl = ds.Tables[0].Rows[0]["OnLineRedirectUrl"].ToString();
                ContactEventBLL bllContact = new ContactEventBLL(this.CurrentUserInfo);
                LPrizesBLL      bllPrize   = new LPrizesBLL(this.CurrentUserInfo);

                var contactList = bllContact.QueryByEntity(new ContactEventEntity()
                {
                    EventId = strCTWEventId, IsCTW = 1, IsDelete = 0
                }, null).ToList();

                T_CTW_SpreadSettingBLL bllSpreadSetting = new T_CTW_SpreadSettingBLL(this.CurrentUserInfo);

                DataSet    dsFocus    = bllSpreadSetting.GetSpreadSettingQRImageByCTWEventId(strCTWEventId, "Focus");
                var        regContact = contactList.Where(a => a.ContactTypeCode == "Reg").SingleOrDefault();
                ButtonInfo reg        = new ButtonInfo();
                reg.Text = "注册";
                if (regContact != null)
                {
                    if (dsFocus != null && dsFocus.Tables[0].Rows.Count > 0)
                    {
                        reg.Text = dsFocus.Tables[0].Rows[0]["LeadPageRegPromptText"].ToString();
                    }

                    if (bllPrize.QueryByEntity(new LPrizesEntity()
                    {
                        EventId = regContact.EventId
                    }, null).SingleOrDefault() != null)
                    {
                        reg.Text = "注册有惊喜";
                    }
                }
                rd.Reg = reg;

                ButtonInfo share = new ButtonInfo();
                share.Text = "分享";
                DataSet dsShare = bllSpreadSetting.GetSpreadSettingQRImageByCTWEventId(strCTWEventId, "Share");
                if (dsShare != null && dsShare.Tables.Count > 0 && dsShare.Tables[0].Rows.Count > 0)
                {
                    share.Title      = dsShare.Tables[0].Rows[0]["Title"].ToString();
                    share.Summary    = dsShare.Tables[0].Rows[0]["Summary"].ToString();
                    share.BGImageUrl = dsShare.Tables[0].Rows[0]["BGImageUrl"].ToString();
                }
                var shareContact = contactList.Where(a => a.ContactTypeCode == "Share").SingleOrDefault();
                if (shareContact != null)
                {
                    if (bllPrize.QueryByEntity(new LPrizesEntity()
                    {
                        EventId = shareContact.EventId
                    }, null).SingleOrDefault() != null)
                    {
                        share.Text = "分享有惊喜";
                    }
                    //if (dsFocus != null && dsFocus.Tables[0].Rows.Count > 0)
                    //{
                    //    share.Text = dsFocus.Tables[0].Rows[0]["LeadPageSharePromptText"].ToString();
                    //}
                }
                rd.Share = share;

                ButtonInfo focus = new ButtonInfo();
                focus.Text = "扫码关注";

                if (dsFocus != null && dsFocus.Tables.Count > 0 && dsFocus.Tables[0].Rows.Count > 0)
                {
                    focus.BGImageUrl             = dsFocus.Tables[0].Rows[0]["BGImageUrl"].ToString();
                    focus.LeadPageQRCodeImageUrl = dsFocus.Tables[0].Rows[0]["LeadPageQRCodeImageUrl"].ToString();
                    var focusContact = contactList.Where(a => a.ContactTypeCode == "Focus").SingleOrDefault();
                    if (focusContact != null)
                    {
                        focus.Text = dsFocus.Tables[0].Rows[0]["LeadPageFocusPromptText"].ToString();
                    }
                }

                rd.Focus = focus;

                rd.IsCTW             = 1;
                rd.CTWEventId        = strCTWEventId;
                rd.EventId           = strEventId;
                rd.OnLineRedirectUrl = strOnLineRedirectUrl;
            }
            //}

            var image = bllImage.QueryByEntity(new ObjectImagesEntity()
            {
                ObjectId = strEventId, IsDelete = 0
            }, null).ToList();
            var eventInfo = bllEvent.GetByID(strEventId);

            if (image.Count != 0)
            {
                foreach (var i in image)
                {
                    if (i.BatId == "BackGround")
                    {
                        rd.BackGround = i.ImageURL;
                    }
                    if (i.BatId == "BeforeGround")
                    {
                        rd.BeforeGround = i.ImageURL;
                    }
                    if (i.BatId == "Logo")
                    {
                        rd.Logo = i.ImageURL;
                    }
                    if (i.BatId == "Rule")
                    {
                        rd.Rule = i.ImageURL;
                    }
                    if (i.BatId == "LT_kvPic")
                    {
                        rd.LT_kvPic = i.ImageURL;
                    }
                    if (i.BatId == "LT_Rule")
                    {
                        rd.LT_Rule = i.ImageURL;
                    }
                    if (i.BatId == "LT_bgpic1")
                    {
                        rd.LT_bgpic1 = i.ImageURL;
                    }
                    if (i.BatId == "LT_bgpic2")
                    {
                        rd.LT_bgpic2 = i.ImageURL;
                    }
                    if (i.BatId == "LT_regularpic")
                    {
                        rd.LT_regularpic = i.ImageURL;
                    }
                    if (i.BatId == "Receive")
                    {
                        rd.Receive = i.ImageURL;
                    }
                    if (i.BatId == "NotReceive")
                    {
                        rd.NotReceive = i.ImageURL;
                    }
                }
                ;
                rd.RuleContent = image.FirstOrDefault().RuleContent;
                rd.RuleId      = image.FirstOrDefault().RuleId ?? 0;
                rd.ImageList   = bllImage.QueryByEntity(new ObjectImagesEntity()
                {
                    ObjectId = strEventId, BatId = "list", IsDelete = 0
                }, null).ToList();
            }
            rd.EventTitle     = eventInfo.Title;
            rd.EventContent   = eventInfo.Content;
            rd.BootUrl        = eventInfo.BootURL;
            rd.ShareRemark    = eventInfo.ShareRemark;
            rd.PosterImageUrl = eventInfo.PosterImageUrl;
            rd.OverRemark     = eventInfo.OverRemark;
            rd.ShareLogoUrl   = eventInfo.ShareLogoUrl;
            rd.IsShare        = eventInfo.IsShare == null ? 0 : (int)eventInfo.IsShare;

            var entityCover = bllCover.QueryByEntity(new LCoverEntity()
            {
                EventId = strEventId, IsDelete = 0, IsShow = 1
            }, null).FirstOrDefault();

            if (entityCover != null)
            {
                rd.CoverInfo = entityCover;
            }

            return(rd);
        }
Пример #4
0
        /// <summary>
        /// 保存更新促销活动信息
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public void SavePanicbuyingEvent(SetCTWEventRP para, T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV, ObjectImagesBLL imageBll, T_CTW_LEventInteractionBLL bllCustomerInteraction, string strThemeId, out string strStartDate, out string strEndDate)
        {
            strStartDate = string.Empty;
            strEndDate   = string.Empty;

            var PanicbuyingEvent = para.PanicbuyingEventInfo;

            imageEntity            = new ObjectImagesEntity();
            imageEntity.ImageURL   = PanicbuyingEvent.ImageUrl;
            imageEntity.ObjectId   = "";
            imageEntity.CreateBy   = loggingSessionInfo.UserID;
            imageEntity.IsDelete   = 0;
            imageEntity.CustomerId = loggingSessionInfo.ClientID;
            imageEntity.ImageId    = Guid.NewGuid().ToString();
            imageBll.Create(imageEntity);
            if (!string.IsNullOrEmpty(para.CTWEventId))
            {
                bllPanicbuyingEventKV.DeleteByCTWEventID(para.CTWEventId);
            }
            entityPanicbuyingEventKV = new T_CTW_PanicbuyingEventKVEntity()
            {
                CTWEventId = new Guid(strCTWEventId),
                EventName  = PanicbuyingEvent.EventName,
                ImageId    = imageEntity.ImageId
            };
            bllPanicbuyingEventKV.Create(entityPanicbuyingEventKV);

            if (!string.IsNullOrEmpty(para.CTWEventId))
            {
                bllCustomerInteraction.DeleteByCTWEventID(para.CTWEventId);
            }
            foreach (var eventid in PanicbuyingEvent.PanicbuyingEventId)
            {
                ///互动类型与(游戏或促销)关联
                entityInteraction = new T_CTW_LEventInteractionEntity()
                {
                    CTWEventId      = new Guid(strCTWEventId),
                    ThemeId         = new Guid(strThemeId),
                    InteractionType = para.InteractionType,
                    DrawMethodCode  = para.DrawMethodCode,
                    LeventId        = eventid.ToString(),
                    CustomerId      = loggingSessionInfo.ClientID
                };
                bllCustomerInteraction.Create(entityInteraction);
            }

            DataSet ds = bllCustomerInteraction.GetPanicbuyingEventDate(strCTWEventId);

            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                strStartDate = ds.Tables[0].Rows[0]["BeginTime"].ToString();
                strEndDate   = ds.Tables[0].Rows[0]["EndTime"].ToString();
            }
        }
Пример #5
0
        protected override SetCTWEventRD ProcessRequest(APIRequest <SetCTWEventRP> pRequest)
        {
            //图文信息
            //微信 公共平台
            var wapentity = new WApplicationInterfaceBLL(loggingSessionInfo).QueryByEntity(new WApplicationInterfaceEntity
            {
                CustomerId = loggingSessionInfo.ClientID,
                IsDelete   = 0
            }, null).FirstOrDefault();//取默认的第一个微信

            if (wapentity == null)
            {
                throw new APIException("微信公众号未授权")
                      {
                          ErrorCode = 343
                      };
            }

            var rd = new SetCTWEventRD();

            var para = pRequest.Parameters;

            strCTWEventId = para.CTWEventId;
            string strThemeId       = string.Empty;
            string strStartDate     = string.Empty;
            string strEndDate       = string.Empty;
            string strGameEventGuid = string.Empty;
            string strPageParamJson = string.Empty;

            T_CTW_LEventBLL             bllCustomerEvent       = new T_CTW_LEventBLL(loggingSessionInfo);
            T_CTW_LEventThemeBLL        bllCustomerTheme       = new T_CTW_LEventThemeBLL(loggingSessionInfo);
            T_CTW_LEventInteractionBLL  bllCustomerInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
            T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV  = new T_CTW_PanicbuyingEventKVBLL(loggingSessionInfo);
            T_CTW_SpreadSettingBLL      bllSpreadSetting       = new T_CTW_SpreadSettingBLL(loggingSessionInfo);
            LPrizesBLL      bllPrize = new LPrizesBLL(loggingSessionInfo);
            ObjectImagesBLL imageBll = new ObjectImagesBLL(loggingSessionInfo);


            entityCustomerEvent = bllCustomerEvent.GetByID(strCTWEventId);
            if (entityCustomerEvent != null)
            {
                ///风格
                entityTheme = bllCustomerTheme.QueryByEntity(new T_CTW_LEventThemeEntity()
                {
                    CTWEventId = new Guid(strCTWEventId), OriginalThemeId = new Guid(para.OriginalThemeId)
                }, null).FirstOrDefault();
                //互动方式
                entityInteraction = bllCustomerInteraction.QueryByEntity(new T_CTW_LEventInteractionEntity {
                    CTWEventId = new Guid(strCTWEventId), OriginalLeventId = new Guid(para.OriginalLeventId)
                }, null).FirstOrDefault();
            }
            //保存风格
            SaveAndUpdateTheme(para, entityTheme, out strThemeId);
            //互动类型--游戏
            if (para.InteractionType == 1 && para.GameEventInfo != null)
            {
                SaveGameEvent(para, bllPrize, bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate, out strGameEventGuid);
                para.MaterialText.PageParamJson = "[{\"key\":\"eventId\",\"value\":\"" + strCTWEventId + "\"}]";
                strPageParamJson = "[{\"key\":\"eventId\",\"value\":\"" + strCTWEventId + "\"}]";
            }
            //互动类型--促销
            if (para.InteractionType == 2 && para.PanicbuyingEventInfo != null)
            {
                SavePanicbuyingEvent(para, bllPanicbuyingEventKV, imageBll, bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate);
                string strEventType = string.Empty;
                switch (para.DrawMethodCode)
                {
                case "TG":
                    strEventType = "1";
                    break;

                case "QG":
                    strEventType = "2";
                    break;

                case "RX":
                    strEventType = "3";
                    break;

                default:
                    strEventType = "99";
                    break;
                }
                para.MaterialText.PageParamJson = "[{\"key\":\"CTWEventId\",\"value\":\"" + strCTWEventId + "\"},{\"key\":\"eventTypeId\",\"value\":\"" + strEventType + "\"}]";
                strPageParamJson = "[{\"key\":\"CTWEventId\",\"value\":\"" + strCTWEventId + "\"},{\"key\":\"eventTypeId\",\"value\":\"" + strEventType + "\"}]";


                //SaveAndUpdatePanicbuyingEvent(para,bllPrize,bllPanicbuyingEventKV,imageBll,bllCustomerInteraction, strThemeId, out strStartDate, out strEndDate);
            }
            string strFocesQRCodeUrl = string.Empty;

            //分享,推广
            if (para.SpreadSettingList.Count > 0)
            {
                SaveSpreadSetting(para, bllSpreadSetting, imageBll, wapentity, out strFocesQRCodeUrl);
            }
            ///推广关注的奖励设置入 触点活动数据表
            if (para.ContactPrizeList != null && para.ContactPrizeList.Count > 0)
            {
                SaveContactPrize(para, bllPrize, strStartDate, strEndDate);
            }
            string strOnlineQRCodeId     = string.Empty;
            string strOfflineQRCodeId    = string.Empty;
            string strOnlineQRCodeUrl    = string.Empty;
            string strOfflineQRCodeUrl   = string.Empty;
            string strOnlineRedirectUrl  = string.Empty;
            string strOfflineRedirectUrl = string.Empty;

            var WQRCodeManagerbll = new WQRCodeManagerBLL(loggingSessionInfo);

            if (!string.IsNullOrEmpty(para.OfflineQRCodeId))
            {
                WQRCodeManagerbll.Delete(new WQRCodeManagerEntity()
                {
                    QRCodeId = new Guid(para.OfflineQRCodeId)
                });
            }
            if (!string.IsNullOrEmpty(para.OnlineQRCodeId))
            {
                WQRCodeManagerbll.Delete(new WQRCodeManagerEntity()
                {
                    QRCodeId = new Guid(para.OnlineQRCodeId)
                });
            }
            CreateQRCode(para, wapentity, strPageParamJson, out strOfflineQRCodeId, out strOfflineQRCodeUrl, out strOfflineRedirectUrl);
            CreateH5QRCode(para, wapentity, out strOnlineQRCodeId, out strOnlineQRCodeUrl, out strOnlineRedirectUrl);

            rd.OfflineQRCodeUrl   = strOfflineQRCodeUrl;
            rd.OnlineQRCodeUrl    = strOnlineQRCodeUrl;
            rd.OfflineRedirectUrl = strOfflineRedirectUrl;
            rd.OnlineRedirectUrl  = strOnlineRedirectUrl;//strFocesQRCodeUrl;

            if (entityCustomerEvent != null)
            {   //活动主表
                entityCustomerEvent.Name               = para.TemplateName;
                entityCustomerEvent.Desc               = para.TemplateDesc;
                entityCustomerEvent.InteractionType    = para.InteractionType;
                entityCustomerEvent.ActivityGroupId    = new Guid(para.ActivityGroupId);
                entityCustomerEvent.ImageURL           = para.TemplateImageURL;
                entityCustomerEvent.StartDate          = Convert.ToDateTime(strStartDate);
                entityCustomerEvent.EndDate            = Convert.ToDateTime(strEndDate);
                entityCustomerEvent.OnlineQRCodeId     = strOnlineQRCodeId;
                entityCustomerEvent.OfflineQRCodeId    = strOfflineQRCodeId;
                entityCustomerEvent.OffLineRedirectUrl = strOfflineRedirectUrl;
                entityCustomerEvent.OnLineRedirectUrl  = strOnlineRedirectUrl;
                bllCustomerEvent.Update(entityCustomerEvent);
            }
            else
            {
                entityCustomerEvent = new T_CTW_LEventEntity()
                {
                    CTWEventId         = new Guid(para.CTWEventId),
                    TemplateId         = new Guid(para.TemplateId),
                    Name               = para.TemplateName,
                    Desc               = para.TemplateDesc,
                    ActivityGroupId    = new Guid(para.ActivityGroupId),
                    InteractionType    = para.InteractionType,
                    ImageURL           = para.TemplateImageURL,
                    Status             = 10,
                    CustomerId         = loggingSessionInfo.ClientID,
                    StartDate          = Convert.ToDateTime(strStartDate),
                    EndDate            = Convert.ToDateTime(strEndDate),
                    OfflineQRCodeId    = strOfflineQRCodeId,
                    OnlineQRCodeId     = strOnlineQRCodeId,
                    OffLineRedirectUrl = strOfflineRedirectUrl,
                    OnLineRedirectUrl  = strOnlineRedirectUrl
                };
                bllCustomerEvent.Create(entityCustomerEvent);
            }
            return(rd);
        }
Пример #6
0
        /// <summary>
        /// 保存更新游戏信息
        /// </summary>
        /// <param name="para"></param>
        /// <returns></returns>
        public void SaveGameEvent(SetCTWEventRP para, LPrizesBLL bllPrize, T_CTW_LEventInteractionBLL bllCustomerInteraction, string strThemeId, out string strStartDate, out string strEndDate, out string strGameEventGuid)
        {
            strGameEventGuid = string.Empty;

            var imageBll = new ObjectImagesBLL(loggingSessionInfo);

            LEventsBLL bllGameEvent = new LEventsBLL(loggingSessionInfo);

            var eventEntity = new LEventsEntity();

            strStartDate = para.GameEventInfo.BeginTime;
            strEndDate   = para.GameEventInfo.EndTime + " 23:59:59";
            if (string.IsNullOrEmpty(para.GameEventInfo.LeventId))
            {
                strGameEventGuid          = Guid.NewGuid().ToString();
                eventEntity.EventID       = strGameEventGuid;
                eventEntity.Title         = para.GameEventInfo.Title;
                eventEntity.BeginTime     = para.GameEventInfo.BeginTime;
                eventEntity.EndTime       = para.GameEventInfo.EndTime;
                eventEntity.DrawMethodId  = GetDrawMethodIdByDrawMethodCode(para.DrawMethodCode);
                eventEntity.PersonCount   = para.GameEventInfo.PersonCount;
                eventEntity.PointsLottery = para.GameEventInfo.PointsLottery;
                eventEntity.LotteryNum    = para.GameEventInfo.LotteryNum;
                eventEntity.IsDelete      = 0;

                if (DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.BeginTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) <= 0 && DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.EndTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) >= 0)
                {
                    eventEntity.EventStatus = 20;    //10=未开始,20=运行中,30=暂停,40=结束
                }
                else if (DateTime.Compare(Convert.ToDateTime(para.GameEventInfo.BeginTime), Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))) > 0)
                {
                    eventEntity.EventStatus = 10;    //10=未开始,20=运行中,30=暂停,40=结束
                }
                eventEntity.IsCTW      = 1;
                eventEntity.CustomerId = loggingSessionInfo.ClientID;
                bllGameEvent.Create(eventEntity);
            }
            else
            {
                strGameEventGuid          = para.GameEventInfo.LeventId;
                eventEntity               = bllGameEvent.GetByID(strGameEventGuid);
                eventEntity.Title         = para.GameEventInfo.Title;
                eventEntity.BeginTime     = para.GameEventInfo.BeginTime;
                eventEntity.EndTime       = para.GameEventInfo.EndTime;
                eventEntity.DrawMethodId  = GetDrawMethodIdByDrawMethodCode(para.DrawMethodCode);
                eventEntity.PersonCount   = para.GameEventInfo.PersonCount;
                eventEntity.PointsLottery = para.GameEventInfo.PointsLottery;
                eventEntity.LotteryNum    = para.GameEventInfo.LotteryNum;

                bllGameEvent.Update(eventEntity);
            }

            ///图片
            if (para.GameEventInfo.ImageList.Count > 0)
            {
                imageBll.DeleteByObjectID(strGameEventGuid);

                foreach (var i in para.GameEventInfo.ImageList)
                {
                    imageEntity             = new ObjectImagesEntity();
                    imageEntity.ImageURL    = i.ImageURL;
                    imageEntity.ObjectId    = strGameEventGuid;
                    imageEntity.CreateBy    = loggingSessionInfo.UserID;
                    imageEntity.ImageId     = Guid.NewGuid().ToString();
                    imageEntity.BatId       = i.BatId;
                    imageEntity.RuleId      = para.GameEventInfo.RuleId ?? 1;
                    imageEntity.RuleContent = para.GameEventInfo.RuleContent;
                    imageEntity.IsDelete    = 0;
                    imageEntity.CustomerId  = loggingSessionInfo.ClientID;
                    imageBll.Create(imageEntity);
                }
            }
            //奖品信息
            var entityPrize        = new LPrizesEntity();
            var redisPrizePoolsBLL = new JIT.CPOS.BS.BLL.RedisOperationBLL.PrizePools.RedisPrizePoolsBLL();

            if (!string.IsNullOrEmpty(para.GameEventInfo.LeventId))
            {
                //bllPrize.Delete(new LPrizesEntity() { EventId = para.GameEventInfo.LeventId });
                bllPrize.DeletePrizesByEventId(para.GameEventInfo.LeventId);

                CC_PrizePool prizePool = new CC_PrizePool();
                prizePool.CustomerId = loggingSessionInfo.ClientID;
                prizePool.EventId    = para.GameEventInfo.LeventId;
                redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
            }
            if (para.GameEventInfo.PrizeList.Count > 0)
            {
                foreach (var i in para.GameEventInfo.PrizeList)
                {
                    entityPrize.EventId      = strGameEventGuid;
                    entityPrize.PrizeTypeId  = i.PrizeTypeId;
                    entityPrize.Point        = i.Point;
                    entityPrize.CouponTypeID = i.CouponTypeID;
                    entityPrize.PrizeName    = i.PrizeName;
                    entityPrize.CountTotal   = i.PrizeCount;
                    entityPrize.CreateBy     = loggingSessionInfo.UserID;
                    entityPrize.PrizesID     = Guid.NewGuid().ToString();

                    bllPrize.SavePrize(entityPrize);
                }

                //入奖品池队列
                LPrizePoolsBLL bllPools = new LPrizePoolsBLL(loggingSessionInfo);
                DataSet        dsPools  = bllPools.GetPrizePoolsByEvent(loggingSessionInfo.ClientID, strGameEventGuid);
                if (dsPools != null && dsPools.Tables.Count > 0 && dsPools.Tables[0].Rows.Count > 0)
                {
                    var poolTemp  = DataTableToObject.ConvertToList <CC_PrizePool>(dsPools.Tables[0]);
                    var poolsList = Utils.GetRandomList <CC_PrizePool>(poolTemp);   //随机列表
                    if (poolsList != null && poolsList.Count > 0)
                    {
                        CC_PrizePool prizePool = new CC_PrizePool();
                        prizePool.CustomerId = loggingSessionInfo.ClientID;
                        prizePool.EventId    = strGameEventGuid;

                        redisPrizePoolsBLL.DeletePrizePoolsList(prizePool);
                        redisPrizePoolsBLL.SetPrizePoolsToRedis(poolsList);
                    }
                }
            }
            if (!string.IsNullOrEmpty(para.CTWEventId))
            {
                bllCustomerInteraction.DeleteByCTWEventID(para.CTWEventId);
            }
            ///互动类型与(游戏或促销)关联
            entityInteraction = new T_CTW_LEventInteractionEntity()
            {
                CTWEventId       = new Guid(strCTWEventId),
                ThemeId          = new Guid(strThemeId),
                InteractionType  = para.InteractionType,
                DrawMethodCode   = para.DrawMethodCode,
                LeventId         = strGameEventGuid,
                OriginalLeventId = new Guid(para.OriginalLeventId),
                CustomerId       = loggingSessionInfo.ClientID
            };
            bllCustomerInteraction.Create(entityInteraction);
        }
Пример #7
0
        protected override TemplateDetailRD ProcessRequest(APIRequest <TemplateDetailRP> pRequest)
        {
            var rd = new TemplateDetailRD();

            var para = pRequest.Parameters;
            var loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;

            CTW_LEventThemeBLL        bllTheme         = new CTW_LEventThemeBLL(loggingSessionInfo);
            CTW_LEventInteractionBLL  bllInteraction   = new CTW_LEventInteractionBLL(loggingSessionInfo);
            CTW_SpreadSettingBLL      bllSpreadSetting = new CTW_SpreadSettingBLL(loggingSessionInfo);
            T_CTW_LEventsBLL          bllEvents        = new T_CTW_LEventsBLL(loggingSessionInfo);
            T_CTW_PanicbuyingEventBLL bllPanicbuying   = new T_CTW_PanicbuyingEventBLL(loggingSessionInfo);
            //更新模板点击数量
            T_CTW_LEventTemplateBLL bllTemplate = new T_CTW_LEventTemplateBLL(loggingSessionInfo);

            try
            {
                bllTemplate.UpdateTemplateInfo(para.TemplateId, 2);
            }
            catch { }
            ///获取模版信息
            DataSet dsInteraction = bllInteraction.GetEventInteractionByTemplateId(para.TemplateId);

            if (dsInteraction != null && dsInteraction.Tables[0].Rows.Count > 0)
            {
                var entityInteraction = DataTableToObject.ConvertToList <EventInteractionInfo>(dsInteraction.Tables[0]);

                var entityTheme = DataTableToObject.ConvertToList <CTW_LEventThemeEntity>(bllTheme.GetThemeInfo(para.TemplateId).Tables[0]);//.QueryByEntity(new CTW_LEventThemeEntity() { TemplateId = new Guid(para.TemplateId), IsDelete = 0 }, null);
                List <CTW_LEventThemeEntity> listTheme = new List <CTW_LEventThemeEntity>();
                foreach (var theme in entityTheme)
                {
                    List <EventInteractionInfo> listEventInteractionInfo = new List <EventInteractionInfo>();

                    ///互动信息
                    foreach (var itemAction in entityInteraction.Where(a => a.ThemeId == theme.ThemeId.ToString() && a.TemplateId == theme.TemplateId.ToString()))
                    {
                        listEventInteractionInfo.Add(itemAction);
                        if (itemAction.InteractionType == 1)
                        {
                            itemAction.GameEventImageList = DataTableToObject.ConvertToList <GameEventImageInfo>(bllEvents.GetImageList(itemAction.LeventId).Tables[0]);
                        }
                        if (itemAction.InteractionType == 2)//促销
                        {
                            itemAction.PanicbuyingEventImage = DataTableToObject.ConvertToObject <PanicbuyingEventImageInfo>(bllPanicbuying.GetPanicbuyingEventImage(itemAction.LeventId).Tables[0].Rows[0]);
                        }
                        theme.EventInteractionList = listEventInteractionInfo;
                    }
                    ;
                    listTheme.Add(theme);
                    rd.TemplateThemeList = listTheme;
                }
                rd.ActivityGroupId = entityTheme.FirstOrDefault().ActivityGroupId;
                rd.TemplateId      = entityTheme.FirstOrDefault().TemplateId.ToString();
                rd.TemplateName    = entityTheme.FirstOrDefault().TemplateName;
                rd.ImageURL        = dsInteraction.Tables[0].Rows[0]["ImageURL"].ToString();
                //推广设置
                DataSet dsSpresd = bllSpreadSetting.GetSpreadSettingInfoByTemplateId(para.TemplateId);
                if (dsSpresd != null && dsSpresd.Tables[0].Rows.Count > 0)
                {
                    rd.TemplateSpreadSettingList = DataTableToObject.ConvertToList <CTW_SpreadSettingEntity>(dsSpresd.Tables[0]);
                }

                ///获取商户所有信息
                if (!string.IsNullOrEmpty(para.CTWEventId))
                {
                    T_CTW_LEventBLL bllCTWEvent = new T_CTW_LEventBLL(loggingSessionInfo);
                    DataSet         dsCTWEvent  = bllCTWEvent.GetLeventInfoByCTWEventId(para.CTWEventId);
                    ObjectImagesBLL bllImage    = new ObjectImagesBLL(loggingSessionInfo);
                    var             bllPrizes   = new LPrizesBLL(loggingSessionInfo);

                    T_CTW_SpreadSettingBLL bllCustomerSpreadSetting = new T_CTW_SpreadSettingBLL(loggingSessionInfo);
                    if (dsCTWEvent != null && dsCTWEvent.Tables.Count > 0 && dsCTWEvent.Tables[0].Rows.Count > 0)
                    {
                        rd.CustomerCTWEventInfo = DataTableToObject.ConvertToObject <CustomerCTWEventInfo>(dsCTWEvent.Tables[0].Rows[0]);
                        //游戏活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "1")
                        {
                            LEventsBLL bllLevents = new LEventsBLL(loggingSessionInfo);
                            string     strEventId = dsCTWEvent.Tables[0].Rows[0]["LeventId"].ToString();
                            var        ds         = bllLevents.GetNewEventInfo(strEventId);
                            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo = DataTableToObject.ConvertToObject <LEventsInfo>(ds.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            }
                            DataSet dsPrizes = bllPrizes.GetPirzeList(strEventId);
                            if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.EventInfo.PrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                            }


                            rd.CustomerCTWEventInfo.EventInfo.ImageList = bllImage.QueryByEntity(new ObjectImagesEntity()
                            {
                                ObjectId = strEventId, IsDelete = 0
                            }, null).ToList();
                        }
                        //促销活动信息
                        if (dsCTWEvent.Tables[0].Rows[0]["InteractionType"].ToString() == "2")
                        {
                            T_CTW_PanicbuyingEventKVBLL bllPanicbuyingEventKV = new T_CTW_PanicbuyingEventKVBLL(loggingSessionInfo);
                            rd.CustomerCTWEventInfo.PanicbuyingEventInfo = DataTableToObject.ConvertToObject <T_CTW_PanicbuyingEventKVEntity>(bllPanicbuyingEventKV.GetPanicbuyingEventKV(para.CTWEventId).Tables[0].Rows[0]);
                            T_CTW_LEventInteractionBLL bllEventInteraction = new T_CTW_LEventInteractionBLL(loggingSessionInfo);
                            DataSet dsP = bllEventInteraction.GetPanicbuyingEventId(para.CTWEventId);
                            if (dsP != null && dsP.Tables.Count > 0 && dsP.Tables[0].Rows.Count > 0)
                            {
                                rd.CustomerCTWEventInfo.PanicbuyingEventInfo.PanicbuyingEventList = DataTableToObject.ConvertToList <PanicbuyingEventId>(dsP.Tables[0]);
                            }
                        }

                        //图文信息
                        var ds2 = bllCTWEvent.GetMaterialTextInfo(dsCTWEvent.Tables[0].Rows[0]["OnlineQRCodeId"].ToString());//活动图文素材对应的keyword其实是这个活动的标识,也就是生成二维码的关键字
                        if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.MaterialText = DataTableToObject.ConvertToObject <WMaterialTextEntity>(ds2.Tables[0].Rows[0]);//直接根据所需要的字段反序列化
                            rd.CustomerCTWEventInfo.MappingId    = ds2.Tables[0].Rows[0]["MappingId"].ToString();
                        }
                        //推广设置

                        DataSet dsCustomerSpread = bllCustomerSpreadSetting.GetSpreadSettingByCTWEventId(para.CTWEventId);
                        if (dsCustomerSpread != null && dsCustomerSpread.Tables[0].Rows.Count > 0)
                        {
                            rd.CustomerCTWEventInfo.SpreadSettingList = DataTableToObject.ConvertToList <T_CTW_SpreadSettingEntity>(dsCustomerSpread.Tables[0]);
                        }
                        //触点
                        ContactEventBLL bllContactEvent = new ContactEventBLL(loggingSessionInfo);
                        DataSet         dsContact       = bllContactEvent.GetContactEventByCTWEventId(para.CTWEventId);
                        if (dsContact != null && dsContact.Tables[0].Rows.Count > 0)
                        {
                            List <ContactEventInfo> ContactInfoList = new List <ContactEventInfo>();
                            ContactEventInfo        ContactInfo     = new ContactEventInfo();
                            foreach (DataRow dr in dsContact.Tables[0].Rows)
                            {
                                ContactInfo = new ContactEventInfo();
                                ContactInfo.ContactTypeCode = dr["ContactTypeCode"].ToString();
                                DataSet dsPrizes = bllPrizes.GetPirzeListForCTW(dr["ContactEventId"].ToString());
                                if (dsPrizes.Tables != null && dsPrizes.Tables.Count > 0 && dsPrizes.Tables[0] != null && dsPrizes.Tables[0].Rows.Count > 0)
                                {
                                    ContactInfo.ContactPrizeList = DataTableToObject.ConvertToList <Prize>(dsPrizes.Tables[0]);
                                }
                                ContactInfoList.Add(ContactInfo);
                            }
                            rd.CustomerCTWEventInfo.ContactEventList = ContactInfoList;
                        }
                    }


                    rd.CTWEventId = para.CTWEventId;
                }
                else
                {
                    rd.CTWEventId = Guid.NewGuid().ToString();
                }
            }
            return(rd);
        }