Ejemplo n.º 1
0
        public static void WXLocation(HttpContext httpContext, CommonBLL commonService, RequestParams requestParams, string locationX, string locationY)
        {
            WMenuDAO wMenuDAO = new WMenuDAO(requestParams.LoggingSessionInfo);
            var      custId   = wMenuDAO.GetCustomerIdByWx(requestParams.WeixinId);

            if (requestParams.LoggingSessionInfo.CurrentUser == null)
            {
                requestParams.LoggingSessionInfo.CurrentUser = new Entity.User.UserInfo();
            }
            requestParams.LoggingSessionInfo.CurrentUser.customer_id = custId;

            BaseService.WriteLogWeixin("customerId:---------------" + custId);
            BaseService.WriteLogWeixin("openID:---------------" + requestParams.OpenId);
            BaseService.WriteLogWeixin("weixinID:---------------" + requestParams.WeixinId);

            string HandlerLocation_xyds = ConfigurationManager.AppSettings["HandlerLocation_xyds"];

            BaseService.WriteLogWeixin("HandlerLocation_xyds:---------------" + HandlerLocation_xyds);
            if (HandlerLocation_xyds != null && HandlerLocation_xyds.Length > 0 && HandlerLocation_xyds.Contains(requestParams.WeixinId))
            {
                BaseService.WriteLogWeixin("xyds:---------------");
                VipBLL server  = new VipBLL(requestParams.LoggingSessionInfo);
                var    vipInfo = server.SearchVipInfoLocation(new VipSearchEntity()
                {
                    RoleCode  = "CampusAmbassadors",
                    Longitude = locationY,
                    Latitude  = locationX,
                    OrderBy   = " a.Distance asc ",
                    Page      = 1,
                    PageSize  = 1,
                });

                if (vipInfo != null && vipInfo.vipInfoList != null && vipInfo.vipInfoList.Count > 0)
                {
                    var vip = vipInfo.vipInfoList[0];
                    if (vip != null)
                    {
                        var content = "";
                        content += "目前离你最近的校园产品专家是{0},电话:{1},{2},距离{3}米。如有任何疑问也可直接回复消息与我们联系,我们将尽快答复。";
                        content  = string.Format(
                            content,
                            vip.VipName,
                            vip.Phone,
                            vip.DeliveryAddress,
                            vip.Distance * 1000
                            );

                        BaseService.WriteLogWeixin("发送微信消息:---------------");
                        commonService.ResponseTextMessage(requestParams.WeixinId, requestParams.OpenId, content, httpContext, requestParams);
                        BaseService.WriteLogWeixin("发送微信消息完成:---------------");

                        MarketSendLogBLL marketSendLogBLL = new BLL.MarketSendLogBLL(requestParams.LoggingSessionInfo);
                        var logObj = new MarketSendLogEntity()
                        {
                            LogId           = Common.Utils.NewGuid(),
                            VipId           = vip.VIPID,
                            MarketEventId   = "华硕校园大使推介活动",
                            TemplateContent = content,
                            SendTypeId      = "1",
                            WeiXinUserId    = vip.WeiXinUserId,
                            Phone           = vip.Phone,
                            IsSuccess       = 0
                        };
                        marketSendLogBLL.Create(logObj);

                        VipVipMappingBLL vipVipMappingBLL = new VipVipMappingBLL(requestParams.LoggingSessionInfo);
                        var vipMapObj = new VipVipMappingEntity()
                        {
                            MappingId = Guid.NewGuid(),
                            VipIdSrc  = vip.VIPID,
                            VipIdDst  = requestParams.OpenId
                        };
                        vipVipMappingBLL.Create(vipMapObj);

                        logObj.IsSuccess = 1;
                        marketSendLogBLL.Update(logObj, false);
                    }
                }
            }
            else
            {
                string strError             = "";
                StoreBrandMappingBLL server = new StoreBrandMappingBLL(requestParams.LoggingSessionInfo);
                var storeInfo = server.GetStoreListByItem(null
                                                          , 1
                                                          , 10
                                                          , locationY
                                                          , locationX
                                                          , out strError);

                if (storeInfo != null && storeInfo.StoreBrandList != null && storeInfo.StoreBrandList.Count > 0)
                {
                    var newsList     = new List <WMaterialTextEntity>();
                    var original_url = ConfigurationManager.AppSettings["website_WWW"].ToString();
                    if (!original_url.EndsWith("/"))
                    {
                        original_url += "/";
                    }
                    foreach (var store in storeInfo.StoreBrandList)
                    {
                        var url = original_url + "HtmlApps/Auth.html?pageName=Map&customerId=" + requestParams.LoggingSessionInfo.CurrentUser.customer_id;
                        url += "&lng=" + store.Longitude + "&lat=" + store.Latitude;
                        url += "&storeId=" + store.StoreId;
                        url += "&addr=" + HttpUtility.UrlEncode(store.Address);
                        url += "&store=" + HttpUtility.UrlEncode(store.StoreName);

                        #region 分享业务 链接后面加上openId和userId

                        //if (url.IndexOf("ParAll=") != -1)
                        //{
                        //    var vipId = string.Empty;

                        //    VipBLL vipService = new VipBLL(requestParams.LoggingSessionInfo);
                        //    var vipEntity = vipService.QueryByEntity(new VipEntity { WeiXinUserId = requestParams.OpenId, WeiXin = requestParams.WeixinId }, null);
                        //    if (vipEntity != null && vipEntity.Length > 0)
                        //    {
                        //        vipId = vipEntity.FirstOrDefault().VIPID;
                        //    }

                        //    url += "&openId=" + requestParams.OpenId + "&userId=" + vipId;
                        //}

                        #endregion

                        newsList.Add(new WMaterialTextEntity()
                        {
                            Title         = store.StoreName + "(" + store.Distance.ToString("f1") + "公里)", // Title
                            Text          = store.StoreName + "(" + store.Distance.ToString("f1") + "公里)", // Author
                            CoverImageUrl = store.ImageUrl,                                                // CoverImageUrl
                            OriginalUrl   = url
                        });
                    }

                    commonService.ResponseNewsMessage(requestParams.WeixinId, requestParams.OpenId, newsList, httpContext, requestParams);
                }
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(VipVipMappingEntity pEntity, IDbTransaction pTran)
 {
     Update(pEntity, true, pTran);
 }
Ejemplo n.º 3
0
 public void Update(VipVipMappingEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField, pTran);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(VipVipMappingEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 在事务内创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Create(VipVipMappingEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Create(pEntity, pTran);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <VipVipMappingEntity> PagedQueryByEntity(VipVipMappingEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public VipVipMappingEntity[] QueryByEntity(VipVipMappingEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(VipVipMappingEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
Ejemplo n.º 9
0
 public void Update(VipVipMappingEntity pEntity, bool pIsUpdateNullField)
 {
     _currentDAO.Update(pEntity, pIsUpdateNullField);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(VipVipMappingEntity pEntity)
 {
     Update(pEntity, true);
 }