Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                UserId = Request["UserId"];
                if (!string.IsNullOrEmpty(UserId))
                {
                    BLLJIMP.Model.UserInfo uinfo = bllUser.GetCurrentUserInfo();
                    bllUserScore = new BLLUserScore(uinfo.UserID);
                    //uInfo = DataLoadTool.GetCurrUserModel();
                    GetTutor(UserId);
                    GetTagStr();
                    // BLLJuActivity juActivityBll = new BLLJuActivity();

                    if (string.IsNullOrEmpty(uinfo.TrueName) || string.IsNullOrEmpty(uinfo.Phone))
                    {
                        isUserRegistered = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Response.End();
            }
            //if (!IsPostBack)
            //{

            // }
        }
Exemple #2
0
 /// <summary>
 /// 是否所有客服都己下线
 /// </summary>
 //public string IsAllKefuOffLine = "false";
 protected void Page_Load(object sender, EventArgs e)
 {
     if (bllUser.IsLogin)
     {
         currentUserInfo = bllUser.GetCurrentUserInfo();
         //if (currentUserInfo.UserID=="jubit")
         //{
         //    currentUserInfo.AutoID = 7984;
         //}
     }
     else
     {
         Response.Redirect("/error/commonmsg.aspx?msg=请用微信打开");
     }
     WebSocketHost = ZentCloud.Common.ConfigHelper.GetConfigString("WebSocketHost");
     config        = bllWebsite.GetCompanyWebsiteConfig();
     if (string.IsNullOrEmpty(config.DistributionQRCodeIcon))
     {
         config.DistributionQRCodeIcon = "/img/icons/kefu.png";
     }
     RecordList  = bll.GetLiveChatDetailList(currentUserInfo.AutoID.ToString());
     WebsiteInfo = bll.GetWebsiteInfoModelFromDataBase(bll.WebsiteOwner);
     //IsAllKefuOffLine = bll.IsAllKefuOffLine(bll.WebsiteOwner).ToString();
     if (!string.IsNullOrEmpty(Request["product_id"]))
     {
         productInfo = bllMall.GetProduct(int.Parse(Request["product_id"]));
     }
 }
Exemple #3
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     context.Response.Expires     = 0;
     if (!bllUser.IsLogin)
     {
         apiResp.code = (int)APIErrCode.UserIsNotLogin;
         apiResp.msg  = "请先登录";
         context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
         return;
     }
     else
     {
         CurrentUserInfo = bllUser.GetCurrentUserInfo();
     }
     try
     {
         this.GetType().GetMethod("ProcessRequest").Invoke(this, new[] { context });
     }
     catch (Exception ex)
     {
         apiResp.code = (int)APIErrCode.OperateFail;
         if (ex.InnerException != null)
         {
             apiResp.msg = ex.InnerException.Message;
         }
         else
         {
             apiResp.msg = ex.Message;
         }
         context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
     }
 }
Exemple #4
0
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex = Convert.ToInt32(context.Request["pageindex"]),
                pageSize  = Convert.ToInt32(context.Request["pagesize"]);
            var commentId = context.Request["commentid"];

            var totalCount = 0;

            curUser = bllUser.GetCurrentUserInfo();

            //仅显示审核通过的
            var sourceData = this.bllReview.GetReviewList(BLLJIMP.Enums.ReviewTypeKey.CommentReply, out totalCount, pageIndex, pageSize, commentId, bllReview.WebsiteOwner, this.curUser == null ? "" : curUser.UserID, " AutoId ASC ");

            List <dynamic> returnList = new List <dynamic>();

            foreach (var item in sourceData)
            {
                returnList.Add(new
                {
                    id               = item.ReviewMainId,
                    content          = item.ReviewContent,
                    createDate       = item.InsertDate.ToString(),
                    replyCount       = item.ReplyCount,  //回复数
                    praiseCount      = item.PraiseCount, //点赞数
                    currUserIsPraise = item.CurrUserIsPraise,
                    pubUser          = new
                    {
                        id       = item.PubUser == null ? 0 : item.PubUser.AutoID,
                        userId   = item.PubUser == null ? "" : item.PubUser.UserID,
                        userName = item.PubUser == null ? "" : bllUser.GetUserDispalyName(item.PubUser),
                        avatar   = item.PubUser == null ? "" : bllUser.GetUserDispalyAvatar(item.PubUser),
                        isTutor  = item.PubUser == null ? false : bllUser.IsTutor(item.PubUser)
                    },
                    replayToUser = new
                    {
                        id       = item.ReplayToUser == null ? 0 : item.ReplayToUser.AutoID,
                        userId   = item.ReplayToUser == null ? "" : item.ReplayToUser.UserID,
                        userName = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyName(item.ReplayToUser),
                        avatar   = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyAvatar(item.ReplayToUser),
                        isTutor  = item.ReplayToUser == null ? false : bllUser.IsTutor(item.ReplayToUser)
                    }
                });
            }

            dynamic result = new
            {
                totalcount = totalCount,
                list       = returnList
            };

            apiResp.status = true;
            apiResp.msg    = "查询完成";
            apiResp.result = result;
            bllUser.ContextResponse(context, apiResp);
        }
Exemple #5
0
 public void ProcessRequest(HttpContext context)
 {
     BLLJIMP.Model.UserInfo currUser = bllUser.GetCurrentUserInfo();
     if (!string.IsNullOrEmpty(currUser.PayPassword))
     {
         apiResp.status = true;
         apiResp.result = currUser.PayPassword;
         apiResp.msg    = "已设置支付密码";
     }
     bllUser.ContextResponse(context, apiResp);
 }
Exemple #6
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            context.Response.Expires     = 0;

            try
            {
                if (!bllUser.IsLogin)
                {
                    apiResp.code = (int)APIErrCode.UserIsNotLogin;
                    apiResp.msg  = "请先登录";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                    return;
                }
                else
                {
                    currentUserInfo = bllUser.GetCurrentUserInfo();
                    if (
                        currentUserInfo.UserID == bllUser.WebsiteOwner
                        ||
                        currentUserInfo.UserType == 1
                        ||
                        currentUserInfo.IsSubAccount == "1"
                        ||
                        currentUserInfo.UserType == 7
                        )
                    {
                    }
                    else
                    {
                        apiResp.code = -4;
                        apiResp.msg  = "无权访问";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
                        return;
                    }
                }
                this.GetType().GetMethod("ProcessRequest").Invoke(this, new[] { context });
            }
            catch (Exception ex)
            {
                apiResp.code = -1;
                //if (ex.InnerException != null)
                //{
                //    apiResp.msg = ex.InnerException.Message;
                //}
                //else
                //{
                //    apiResp.msg = ex.Message;
                //}
                apiResp.msg = ex.ToString();
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
        }
Exemple #7
0
 protected override void OnInit(EventArgs e)
 {
     if (!bllUser.IsLogin)
     {
         Response.Write("请用微信打开");
         Response.End();
     }
     else
     {
         CurrentUserInfo = bllUser.GetCurrentUserInfo();
     }
 }
Exemple #8
0
        public void ProcessRequest(HttpContext context)
        {
            string lotteryId = context.Request["lottery_id"];

            curUser = bllUser.GetCurrentUserInfo();

            if (string.IsNullOrEmpty(lotteryId))
            {
                apiResp.msg  = "抽奖活动id为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            BLLJIMP.Model.LotteryUserInfo model = bllUser.Get <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryId={1} AND UserId='{2}' ", bllUser.WebsiteOwner, lotteryId, curUser.UserID));
            if (model != null)
            {
                apiResp.msg  = "您已参加抽奖";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            model = new BLLJIMP.Model.LotteryUserInfo();
            model.WebsiteOwner = bllUser.WebsiteOwner;
            model.CreateDate   = DateTime.Now;
            model.WinnerDate   = DateTime.Now;
            model.IsWinning    = 0;
            model.LotteryId    = Convert.ToInt32(lotteryId);
            model.UserId       = curUser.UserID;
            model.WXHeadimgurl = curUser.WXHeadimgurl;
            model.WXNickname   = bllUser.GetUserDispalyName(curUser);
            if (model.WXNickname.Trim() == string.Empty)
            {
                apiResp.msg  = "无昵称不能加入";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (bllUser.Add(model))
            {
                int count = bllUser.GetCount <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1}", bllUser.WebsiteOwner, lotteryId));
                bllUser.UpdateByKey <WXLotteryV1>("LotteryID", lotteryId, "WinnerCount", count.ToString());
                apiResp.msg    = "加入成功";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "加入失败";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllUser.ContextResponse(context, apiResp);
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request["lotteryId"]))
            {
                int lotteryId = Convert.ToInt32(Request["lotteryId"]);

                lottery = bllLotery.Get <WXLotteryV1>(string.Format(" WebsiteOwner='{0}' AND  LotteryID={1} ", bllLotery.WebsiteOwner, lotteryId));

                webSite = bllLotery.GetWebsiteInfoModel();

                var currentUserInfo = bllUser.GetCurrentUserInfo();


                if (string.IsNullOrEmpty(currentUserInfo.WXNickname))
                {
                    Session.Clear();
                    Response.Redirect(Request.Url.ToString());
                }


                lotteryUser = bllUser.Get <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryId={1} AND UserId='{2}' ", bllUser.WebsiteOwner, lotteryId, currentUserInfo.UserID));
                if (lotteryUser == null)
                {
                    lotteryUser = new BLLJIMP.Model.LotteryUserInfo();
                    lotteryUser.WebsiteOwner = bllUser.WebsiteOwner;
                    lotteryUser.CreateDate   = DateTime.Now;
                    lotteryUser.WinnerDate   = DateTime.Now;
                    lotteryUser.IsWinning    = 0;
                    lotteryUser.LotteryId    = Convert.ToInt32(lotteryId);
                    lotteryUser.UserId       = currentUserInfo.UserID;
                    lotteryUser.WXHeadimgurl = currentUserInfo.WXHeadimgurl;
                    lotteryUser.WXNickname   = bllUser.GetUserDispalyName(currentUserInfo);
                    if (bllUser.Add(lotteryUser))
                    {
                        msg       = "加入成功";
                        isSuccess = true;
                        int count = bllUser.GetCount <BLLJIMP.Model.LotteryUserInfo>(string.Format(" WebsiteOwner='{0}' AND LotteryID={1}", bllUser.WebsiteOwner, lotteryId));
                        bllUser.UpdateByKey <WXLotteryV1>("LotteryID", Request["lotteryId"], "WinnerCount", count.ToString());
                    }
                    else
                    {
                        isSuccess = false;
                        msg       = "加入失败";
                    }
                }
                else
                {
                    msg       = "您已参加抽奖";
                    isSuccess = true;
                }
            }
        }
Exemple #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!bllUser.IsLogin)
     {
         Response.Redirect("/error/commonmsg.aspx?msg=请在微信客户端中打开");
         Response.End();
     }
     if (!bllUser.IsWeixinKefu(bllUser.GetCurrentUserInfo()))
     {
         Response.Redirect("/error/commonmsg.aspx?msg=无权操作");
         Response.End();
     }
 }
Exemple #11
0
        protected override void OnInit(EventArgs e)
        {
            var rawUrl = Request.RawUrl.ToLower();

            if (bllUser.IsLogin)
            {
                CurrentUserInfo = bllUser.GetCurrentUserInfo();
                CurrentUserInfo.WXHeadimgurlLocal = string.IsNullOrEmpty(CurrentUserInfo.WXHeadimgurlLocal) ? "/App/Cation/Wap/Mall/Distribution/images/person.png" : CurrentUserInfo.WXHeadimgurlLocal;
            }
            else if (rawUrl.IndexOf("/app/cation/wap/mall/distribution/mydistributionqcode.aspx") == -1)
            {
                this.Response.Write("<span style=\"font-size:40px;\">请在微信客户端中打开!</span>");
                this.Response.End();
            }
            base.OnInit(e);
        }
Exemple #12
0
 public void ProcessRequest(HttpContext context)
 {
     if (bllUser.IsLogin)
     {
         var currentUserInfo = bllUser.GetCurrentUserInfo();
         if (currentUserInfo.UserType.Equals(1) || currentUserInfo.UserID.Equals(bllUser.WebsiteOwner))
         {
             bllLog.Add(BLLJIMP.Enums.EnumLogType.DistributionOffLine, BLLJIMP.Enums.EnumLogTypeAction.Export, bllLog.GetCurrUserID(), "导出分销申请提现数据");
             string tranIds              = context.Request["tranids"];
             System.Data.DataTable dt    = new System.Data.DataTable();
             StringBuilder         sbSql = new StringBuilder();
             sbSql.AppendFormat("SELECT AutoID as 商户流水号,AccountName as 收款银行户名,BankAccount as 收款银行账号,BankName as 收款开户银行, AccountBranchName as 收款开户网点名称,AccountBranchProvince as 开户行省份,AccountBranchCity as 开户行所在市,RealAmount as 金额,IsPublic as 对公私标识,Remark as 备注 from ZCJ_WithdrawCash where AutoID in({0}) ", tranIds);
             dt = ZentCloud.ZCBLLEngine.BLLBase.Query(sbSql.ToString(), "WithdrawCash").Tables[0];
             DataLoadTool.ExportDataTable(dt, string.Format("提现申请IE浏览器请把后缀名改为xls{0}.xls", DateTime.Now.ToString("yyyyMMddHHmm")));
         }
     }
 }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var currentUserInfo = bllUser.GetCurrentUserInfo();

            if (!bllUser.IsDistributionChannel(currentUserInfo))
            {
                var website = bllUser.GetWebsiteInfoModelFromDataBase();
                int count   = bllUser.GetCount <UserInfo>(string.Format("DistributionOwner='{0}'", bllUser.WebsiteOwner));
                RootNodes = "{ \"name\": \"" + website.WebsiteName + "\", \"id\": \"" + bllUser.WebsiteOwner + "\", \"count\": " + count + ", \"times\": " + count + ", \"isParent\": true,\"icon\":\"/Plugins/zTree/css/zTreeStyle/img/diy/user.png\", \"tip\":\"\"}";
            }
            else
            {
                //当前用户是渠道
                int count = bllUser.GetCount <UserInfo>(string.Format("DistributionOwner='{0}'", currentUserInfo.UserID));
                RootNodes = "{ \"name\": \"" + bllUser.GetUserDispalyName(currentUserInfo) + "\", \"id\": \"" + currentUserInfo.UserID + "\", \"count\": " + count + ", \"times\": " + count + ", \"isParent\": true,\"icon\":\"/Plugins/zTree/css/zTreeStyle/img/diy/user.png\", \"tip\":\"\"}";
            }
        }
Exemple #14
0
 protected override void OnInit(EventArgs e)
 {
     if (!bllUser.IsLogin)
     {
         Response.Write("请用微信打开");
         Response.End();
     }
     else
     {
         CurrentUserInfo = bllUser.GetCurrentUserInfo();
         int voteId = int.Parse(System.Configuration.ConfigurationManager.AppSettings["IluxdayVoteId"]);
         var model  = bllVote.GetVoteObjectInfo(voteId, CurrentUserInfo.UserID);
         if (model != null)
         {
             signUpText = "我的报名";
         }
     }
 }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            currentUserInfo = bllUser.GetCurrentUserInfo();

            //if (currentUserInfo.UserID=="jubit")
            //{
            //    currentUserInfo.AutoID = 7984;
            //}

            if (string.IsNullOrEmpty(currentUserInfo.Ex15))
            {
                currentUserInfo.Ex15 = "1";
            }
            else
            {
            }
            WebSocketHost = ZentCloud.Common.ConfigHelper.GetConfigString("WebSocketHost");
        }
Exemple #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!bllUser.IsLogin)
            {
                Response.Redirect(Request.Url.ToString(), true);
                return;
            }
            var currUser = bllUser.GetCurrentUserInfo();

            website = bllWebsite.GetWebsiteInfo(bllWebsite.WebsiteOwner);//当前站点
            if (website.IsNeedDistributionRecommendCode == 0)
            {
                if (string.IsNullOrWhiteSpace(currUser.DistributionOwner) && currUser.UserID != bllUser.WebsiteOwner)
                {
                    bllUser.Update(new BLLJIMP.Model.UserInfo(), string.Format(" DistributionOwner = '{0}' ", bllUser.WebsiteOwner), string.Format(" AutoID = {0} ", currUser.AutoID));
                }
            }
        }
Exemple #17
0
        public void ProcessRequest(HttpContext context)
        {
            string pId   = context.Request["product_id"];
            string props = context.Request["props"];
            string count = context.Request["num"];
            string pName = context.Request["product_name"];

            if (string.IsNullOrEmpty(pId))
            {
                apiResp.msg  = "必填参数为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }


            UserInfo curUser = bllUser.GetCurrentUserInfo();

            ProductStock stock = new ProductStock();

            stock.ProductId    = Convert.ToInt32(pId);
            stock.UserId       = curUser.UserID;
            stock.PName        = pName;
            stock.CreateDate   = DateTime.Now;
            stock.Count        = Convert.ToInt32(count);
            stock.WebsiteOwner = bllUser.WebsiteOwner;
            stock.Props        = props;
            stock.WXNickname   = curUser.WXNickname;
            stock.WXHeadimgurl = curUser.WXHeadimgurl;


            if (bllUser.Add(stock))
            {
                apiResp.msg    = "成功";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "失败";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            bllUser.ContextResponse(context, apiResp);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (bllUser.GetCurrentUserInfo().UserType != 7)
            {
                Response.Write("无权访问,只有商户可访问本页面");
                Response.End();
            }
            //int totalCount = 0;
            //supplierList = bllUser.GetSupplierList(bllUser.WebsiteOwner, 1, int.MaxValue, "", "", out totalCount);
            //supplierList = supplierList.OrderBy(p => p.Company).ToList();

            DateTime dtFrom = new DateTime(2017, 1, 1);

            yearList.Add(2017);
            if (DateTime.Now.Year > dtFrom.Year)
            {
                for (int i = 0; i < DateTime.Now.Year - dtFrom.Year; i++)
                {
                    DateTime dt = dtFrom.AddYears(i + 1);
                    yearList.Add(dt.Year);
                }
            }
        }
Exemple #19
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            currentUserInfo = bllUser.GetCurrentUserInfo();
            string            data              = context.Request["data"];
            decimal           productFee        = 0;                       //商品总价格 不包含邮费
            OrderRequestModel orderRequestModel = new OrderRequestModel(); //订单模型

            try
            {
                orderRequestModel = ZentCloud.Common.JSONHelper.JsonToModel <OrderRequestModel>(data);
            }
            catch (Exception ex)
            {
                resp.errcode = 1;
                resp.errmsg  = "JSON格式错误,请检查。错误信息:" + ex.Message;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            }
            WXMallOrderInfo orderInfo = new WXMallOrderInfo();//订单表

            orderInfo.InsertDate     = DateTime.Now;
            orderInfo.OrderUserID    = currentUserInfo.UserID;
            orderInfo.WebsiteOwner   = bllMall.WebsiteOwner;
            orderInfo.Transport_Fee  = 0;
            orderInfo.OrderID        = bllMall.GetGUID(BLLJIMP.TransacType.AddMallOrder);
            orderInfo.OrderMemo      = orderRequestModel.buyer_memo;
            orderInfo.MyCouponCardId = orderRequestModel.cardcoupon_id.ToString();
            orderInfo.UseScore       = orderRequestModel.use_score;
            orderInfo.Status         = "待付款";
            orderInfo.OrderType      = 1;
            if (orderRequestModel.pay_type == "WEIXIN")//微信支付
            {
                orderInfo.PaymentType = 2;
            }
            else if (orderRequestModel.pay_type == "ALIPAY")//支付宝支付
            {
                orderInfo.PaymentType = 1;
            }

            #region 格式检查
            //相关检查
            if (orderRequestModel.skus == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "参数skus 不能为空";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            //相关检查
            #endregion


            #region 商品检查 订单详情生成
            ///订单详情
            List <WXMallOrderDetailsInfo> detailList = new List <WXMallOrderDetailsInfo>();//订单详情
            orderRequestModel.skus = orderRequestModel.skus.Distinct().ToList();
            foreach (var sku in orderRequestModel.skus)
            {
                //先检查库存
                ProductSku productSku = bllMall.GetProductSku(sku.sku_id);
                if (productSku == null)
                {
                    resp.errcode = 1;
                    resp.errmsg  = "SKU不存在";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }

                WXMallProductInfo productInfo = bllMall.GetProduct(productSku.ProductId.ToString());
                if (productInfo.IsOnSale == "0")
                {
                    resp.errcode = 1;
                    resp.errmsg  = string.Format("{0}已下架", productInfo.PName);
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (bllMall.GetSkuCount(productSku) < sku.count)
                {
                    resp.errcode = 1;
                    resp.errmsg  = string.Format("{0}{1}库存余量为{2},库存不足,请减少购买数量", productInfo.PName, bllMall.GetProductShowProperties(productSku.SkuId), productSku.Stock);
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (bllMall.IsPromotionTime(productSku))
                {
                    if (sku.count > productSku.PromotionStock)
                    {
                        resp.errcode = 1;
                        resp.errmsg  = string.Format("{0}{1}特卖库存余量为{2},库存不足,请减少购买数量", productInfo.PName, bllMall.GetProductShowProperties(productSku.SkuId), productSku.PromotionStock);
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                WXMallOrderDetailsInfo detailModel = new WXMallOrderDetailsInfo();
                detailModel.OrderID     = orderInfo.OrderID;
                detailModel.PID         = productInfo.PID;
                detailModel.TotalCount  = sku.count;
                detailModel.OrderPrice  = bllMall.GetSkuPrice(productSku);
                detailModel.ProductName = productInfo.PName;
                detailModel.SkuId       = productSku.SkuId;
                detailModel.SkuShowProp = bllMall.GetProductShowProperties(productSku.SkuId);
                detailList.Add(detailModel);
            }
            #endregion

            productFee = detailList.Sum(p => p.OrderPrice * p.TotalCount).Value;//商品费用

            //物流费用
            #region 运费计算
            FreightModel freightModel = new FreightModel();
            freightModel.skus = orderRequestModel.skus;
            decimal freight    = 0;//运费
            string  freightMsg = "";
            if (!bllMall.CalcFreight(freightModel, out freight, out freightMsg))
            {
                resp.errcode = 1;
                resp.errmsg  = freightMsg;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            orderInfo.Transport_Fee = freight;
            #endregion
            #region 优惠券计算
            decimal discountAmount   = 0;//优惠金额
            bool    canUseCardCoupon = false;
            string  msg = "";
            if (orderRequestModel.cardcoupon_id > 0)//有优惠券
            {
                discountAmount = bllMall.CalcDiscountAmount(orderRequestModel.cardcoupon_id.ToString(), data, currentUserInfo.UserID, out canUseCardCoupon, out msg);
                if (!canUseCardCoupon)
                {
                    resp.errcode = 1;
                    resp.errmsg  = msg;
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                if (discountAmount > productFee + orderInfo.Transport_Fee)
                {
                    resp.errcode = 1;
                    resp.errmsg  = "优惠券可优惠金额超过了订单总金额";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            //优惠券计算
            #endregion


            #region 积分计算
            decimal scoreExchangeAmount = 0;///积分抵扣的金额
            //积分计算
            if (orderRequestModel.use_score > 0)
            {
                if (currentUserInfo.TotalScore < orderRequestModel.use_score)
                {
                    resp.errcode = 1;
                    resp.errmsg  = "积分不足";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                ScoreConfig scoreConfig = bllScore.GetScoreConfig();
                scoreExchangeAmount = Math.Round(orderRequestModel.use_score / (scoreConfig.ExchangeScore / scoreConfig.ExchangeAmount), 2);
            }
            #region 驿氪积分同步



            #endregion


            //积分计算
            #endregion


            //合计计算
            orderInfo.Product_Fee   = productFee;
            orderInfo.TotalAmount   = orderInfo.Product_Fee + orderInfo.Transport_Fee;
            orderInfo.TotalAmount  -= discountAmount;                  //优惠券优惠金额
            orderInfo.TotalAmount  -= scoreExchangeAmount;             //积分优惠金额
            orderInfo.PayableAmount = orderInfo.TotalAmount - freight; //应付金额
            if ((productFee + orderInfo.Transport_Fee - discountAmount - scoreExchangeAmount) < orderInfo.TotalAmount)
            {
                resp.errcode = 1;
                resp.errmsg  = "积分兑换金额不能大于订单总金额,请减少积分兑换";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }



            ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();
            try
            {
                if (!this.bllMall.Add(orderInfo, tran))
                {
                    tran.Rollback();
                    resp.errcode = 1;
                    resp.errmsg  = "提交失败";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }

                #region 更新优惠券使用状态
                //优惠券
                if (orderRequestModel.cardcoupon_id > 0 && (canUseCardCoupon == true))//有优惠券且已经成功使用
                {
                    MyCardCoupons myCardCoupon = bllCardCoupon.GetMyCardCoupon(orderRequestModel.cardcoupon_id, currentUserInfo.UserID);
                    myCardCoupon.UseDate = DateTime.Now;
                    myCardCoupon.Status  = 1;
                    if (!bllCardCoupon.Update(myCardCoupon, tran))
                    {
                        tran.Rollback();
                        resp.errcode = 1;
                        resp.errmsg  = "更新优惠券状态失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                //优惠券
                #endregion

                #region 积分抵扣
                //积分扣除
                if (orderRequestModel.use_score > 0)
                {
                    currentUserInfo.TotalScore -= orderRequestModel.use_score;
                    if (

                        bllMall.Update(currentUserInfo, string.Format(" TotalScore-={0}", orderRequestModel.use_score), string.Format(" AutoID={0}", currentUserInfo.AutoID)) < 0)
                    {
                        tran.Rollback();
                        resp.errcode = 1;
                        resp.errmsg  = "更新用户积分失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }

                    //积分记录
                    WXMallScoreRecord scoreRecord = new WXMallScoreRecord();
                    scoreRecord.InsertDate   = DateTime.Now;
                    scoreRecord.OrderID      = orderInfo.OrderID;
                    scoreRecord.Score        = orderRequestModel.use_score;
                    scoreRecord.Type         = 1;
                    scoreRecord.UserId       = currentUserInfo.UserID;
                    scoreRecord.WebsiteOwner = bllMall.WebsiteOwner;
                    scoreRecord.Remark       = "积分抵扣";
                    if (!bllMall.Add(scoreRecord))
                    {
                        tran.Rollback();
                        resp.errcode = 1;
                        resp.errmsg  = "插入积分记录失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }

                    //积分记录
                }

                //积分扣除
                #endregion

                #region 插入订单详情页及更新库存
                foreach (var item in detailList)
                {
                    ProductSku        productSku  = bllMall.GetProductSku((int)(item.SkuId));
                    WXMallProductInfo productInfo = bllMall.GetProduct(productSku.ProductId.ToString());
                    if (!this.bllMall.Add(item, tran))
                    {
                        tran.Rollback();
                        resp.errcode = 1;
                        resp.errmsg  = "提交失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                    //更新 SKU库存
                    productSku.Stock -= item.TotalCount;
                    if (bllMall.IsPromotionTime(productSku))
                    {
                        productSku.PromotionStock -= item.TotalCount;
                    }
                    if (!bllMall.Update(productSku, tran))
                    {
                        tran.Rollback();
                        resp.errcode = 1;
                        resp.errmsg  = "更新SKU失败";
                        context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        return;
                    }
                }
                #endregion
                tran.Commit();//提交订单事务
            }
            catch (Exception ex)
            {
                //回滚事物
                tran.Rollback();
                resp.errcode = 1;
                resp.errmsg  = ex.Message;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(new
            {
                errcode  = 0,
                errmsg   = "ok",
                order_id = orderInfo.OrderID
            }));
        }
Exemple #20
0
        protected override void OnInit(EventArgs e)
        {
            if (!bllUser.IsLogin)
            {
                Response.Write("请用微信打开");
                Response.End();
            }
            else
            {
                currentUserInfo = bllUser.GetCurrentUserInfo();

                currVote = bllVote.GetVoteInfo(Convert.ToInt32(Request["vid"]));

                if (currVote == null)
                {
                    Response.Redirect("/Error/CommonMsg.aspx?msg=投票活动不存在");
                    Response.End();
                }

                //if (currVote.VoteCountAutoUpdate.Equals(1))
                //{
                //    //检查是否更新票数
                //    bllVote.UpdateUserVoteCount(currVote.AutoID, currentUserInfo);

                //}

                #region footerHtml
                toolbarList = bllWebsite.GetToolBarList(int.MaxValue, 1, bllUser.WebsiteOwner, "nav", currVote.FooterMenuGroup, false);

                if (string.IsNullOrWhiteSpace(currVote.FooterMenuGroup))
                {
                    //默认导航
                    footerHtml.AppendFormat("<div id =\"footer\">");
                    footerHtml.AppendFormat("     <div class=\"menu3 font14\">");
                    footerHtml.AppendFormat("        <ul>");
                    footerHtml.AppendFormat("            <li id=\"li0\" >");
                    footerHtml.AppendFormat("                <a href=\"Index.aspx?vid={0} \">", currVote.AutoID);
                    //footerHtml.AppendFormat("                   <img src = \"images/tab_00.jpg\" alt=\"\" title=\"\" class=\"mTop4\" />");
                    footerHtml.AppendFormat("首页");
                    footerHtml.AppendFormat("                </a>");
                    footerHtml.AppendFormat("            </li>");
                    footerHtml.AppendFormat("            <li id=\"li4\" >");
                    footerHtml.AppendFormat("                <a href=\"Rule.aspx?vid={0}\" >", currVote.AutoID);
                    footerHtml.AppendFormat("                   <div class=\"arrow-right\"></div>海选规则");
                    footerHtml.AppendFormat("                </a>");
                    footerHtml.AppendFormat("            </li>");
                    footerHtml.AppendFormat("            <li id=\"li5\" >");
                    footerHtml.AppendFormat("                <a href=\"SignUp.aspx?vid={0}\" >", currVote.AutoID);
                    footerHtml.AppendFormat("                   <div class=\"arrow-right\"></div>参与海选");
                    footerHtml.AppendFormat("                </a>");
                    footerHtml.AppendFormat("            </li>");
                    footerHtml.AppendFormat("            <li id=\"li6\" >");
                    footerHtml.AppendFormat("                <a href=\"List.aspx?vid={0}\" >", currVote.AutoID);
                    footerHtml.AppendFormat("                   <div class=\"arrow-right\"></div>为TA投票");
                    footerHtml.AppendFormat("                </a>");
                    footerHtml.AppendFormat("            </li>");
                    footerHtml.AppendFormat("        </ul>");
                    footerHtml.AppendFormat("    </div>");
                    footerHtml.AppendFormat("</div>");
                }
                else
                {
                    //自定义导航
                    footerHtml.AppendFormat("<div id =\"footer\">");
                    footerHtml.AppendFormat("     <div class=\"row\">");

                    for (int i = 0; i < toolbarList.Count; i++)
                    {
                        //            < div class="col">
                        //    <i class="iconfont icon-shouyeshixin"></i>
                        //    <a href = "#" > 首页 </ a >
                        //</ div >

                        footerHtml.AppendFormat("<div class=\"col\">");

                        if (!string.IsNullOrWhiteSpace(toolbarList[i].ToolBarImage) && toolbarList[i].ToolBarImage.IndexOf("iconfont") > -1)
                        {
                            footerHtml.AppendFormat("<i class=\"{0}\"></i>", toolbarList[i].ToolBarImage);
                        }

                        footerHtml.AppendFormat("<a href=\"{0}\">", toolbarList[i].ToolBarTypeValue);
                        footerHtml.AppendFormat(toolbarList[i].ToolBarName);
                        footerHtml.AppendFormat("</a>");


                        footerHtml.AppendFormat("</div>");
                    }

                    footerHtml.AppendFormat("    </div>");
                    footerHtml.AppendFormat("</div>");
                }
                #endregion

                styleCustomize.AppendFormat("<style type=\"text/css\">");


                //主题色 主题字色
                if (!string.IsNullOrWhiteSpace(currVote.ThemeColor) && !string.IsNullOrWhiteSpace(currVote.ThemeFontColor))
                {
                    if (currVote.ThemeColor.IndexOf("#") > -1)
                    {
                        currVote.ThemeColor = currVote.ThemeColor.Replace("#", "");
                        currVote.ThemeColor = "#" + currVote.ThemeColor;
                    }
                    if (currVote.ThemeFontColor.IndexOf("#") > -1)
                    {
                        currVote.ThemeFontColor = currVote.ThemeFontColor.Replace("#", "");
                        currVote.ThemeFontColor = "#" + currVote.ThemeFontColor;
                    }
                    styleCustomize.AppendFormat("#footer{1}border-top: 1px {0} solid;background: {0};{2}", currVote.ThemeColor, "{", "}");
                    styleCustomize.AppendFormat("#footer a{1}color: {0};{2}", currVote.ThemeFontColor, "{", "}");
                    styleCustomize.AppendFormat(".red{0} background-color:{2} {1} ", "{", "}", currVote.ThemeColor);
                    styleCustomize.AppendFormat(".form_a{0} color:{2} {1} ", "{", "}", currVote.ThemeFontColor);
                    //.top-search
                    styleCustomize.AppendFormat(".top-search{0} -webkit-box-shadow: 1px 1px 4px {2}, -1px 1px 4px {2},1px -1px 4px {2};     box-shadow: 1px 1px 4px {2}, -1px 1px 4px {2},1px -1px 4px {2}; {1} ", "{", "}", currVote.ThemeColor);
                    //.form_div
                    styleCustomize.AppendFormat(".form_div{0} -webkit-box-shadow: 1px 1px 4px {2}, -1px 1px 4px {2},1px -1px 4px {2};     box-shadow: 1px 1px 4px {2}, -1px 1px 4px {2},1px -1px 4px {2}; {1} ", "{", "}", currVote.ThemeColor);
                    //.btnToVote
                    styleCustomize.AppendFormat(".btnToVote{0} background-color:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);

                    //.wrapList .btnSort
                    styleCustomize.AppendFormat(".wrapList .btnSort{0} background-color:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);

                    styleCustomize.AppendFormat(".left_maskbar{0} background:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);
                    styleCustomize.AppendFormat(".bottom_maskbar{0} background:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);

                    //.flex-control-nav li a.active {background: #f1698a; cursor: default;}
                    styleCustomize.AppendFormat(".flex-control-nav li a.active{0} background:{2}; {1} ", "{", "}", currVote.ThemeColor);

                    //.votedetail
                    styleCustomize.AppendFormat(".votedetail{0} background:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);

                    styleCustomize.AppendFormat(".themeColor{0} color:{2} !important; {1} ", "{", "}", currVote.ThemeColor);

                    styleCustomize.AppendFormat(".themeBgColor{0} background-color:{2} !important; {1} ", "{", "}", currVote.ThemeColor);

                    styleCustomize.AppendFormat(".themeFontColor{0} color:{2} !important; {1} ", "{", "}", currVote.ThemeFontColor);

                    //.swiper-pagination-bullet-active
                    styleCustomize.AppendFormat(".swiper-pagination-bullet-active{0} background:{2}; {1} ", "{", "}", currVote.ThemeColor);

                    //.wrapList .btnSearch
                    //styleCustomize.AppendFormat(".wrapList .btnSearch{0} background-color:{2}; color: {3}; {1} ", "{", "}", currVote.ThemeColor, currVote.ThemeFontColor);
                }

                styleCustomize.AppendFormat("</style>");
            }
        }
        public virtual void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            context.Response.Expires     = 0;
            string result = "false";

            try
            {
                page = Convert.ToInt32(context.Request["page"]);
                rows = Convert.ToInt32(context.Request["rows"]);

                pageIndex = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1;
                pageSize  = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10;

                if (page > 0)
                {
                    pageIndex = page;
                }

                if (rows > 0)
                {
                    pageSize = rows;
                }

                //baseUrl = string.Format("http://{0}", context.Request.Url.Host);
                if (!bllUser.IsLogin)
                {
                    resp.errcode = (int)APIErrCode.UserIsNotLogin;
                    resp.errmsg  = "请先登录";
                    result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                    goto outoff;
                }
                else
                {
                    currentUserInfo = bllUser.GetCurrentUserInfo();
                    if (
                        currentUserInfo.UserID == bllUser.WebsiteOwner
                        ||
                        currentUserInfo.UserType == 1
                        ||
                        currentUserInfo.IsSubAccount == "1"
                        ||
                        currentUserInfo.UserType == 7
                        )
                    {
                    }
                    else
                    {
                        resp.errcode = -4;
                        resp.errmsg  = "无权访问";
                        result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                        goto outoff;
                    }
                }
                string action = context.Request["action"];
                //利用反射找到未知的调用的方法
                if (!string.IsNullOrEmpty(action))
                {
                    MethodInfo method = this.GetType().GetMethod(action, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase); //找到方法BindingFlags.NonPublic指定搜索非公有方法

                    if (method == null)
                    {
                        resp.errcode = -3;
                        resp.errmsg  = "action not exist";
                        result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                        context.Response.Write(result);
                        return;
                    }

                    result = Convert.ToString(method.Invoke(this, new[] { context }));  //调用方法
                }
                else
                {
                    resp.errcode = -3;
                    resp.errmsg  = "action not exist";
                    result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                }
            }
            catch (Exception ex)
            {
                resp.errcode = -1;
                resp.errmsg  = ex.ToString();
                result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
            }
            if (!string.IsNullOrEmpty(context.Request["callback"]))
            {
                //返回 jsonp数据
                result = string.Format("{0}({1})", context.Request["callback"], result);
            }
            else
            {
                //返回json数据
            }
outoff:

            context.Response.Write(result);
        }
Exemple #22
0
        public void ProcessRequest(HttpContext context)
        {
            string result = "";

            if (bllUser.IsLogin)
            {
                var    currentUserInfo = bllUser.GetCurrentUserInfo();
                string noYike          = context.Request["no_yike"];
                #region mixblu检查
                if (noYike != "1" && bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, ""))
                {
                    if ((!string.IsNullOrEmpty(currentUserInfo.Ex2)) && (!string.IsNullOrEmpty(currentUserInfo.Phone)))
                    {
                        result = ZentCloud.Common.JSONHelper.ObjectToJson(new
                        {
                            is_login  = true,
                            user_name = currentUserInfo.UserID,
                            id        = currentUserInfo.AutoID
                        });
                    }
                    #region 去yike 拉取数据
                    else
                    {
                        try
                        {
                            string userInfoJson = yiKeClient.GetUserInfo(currentUserInfo.WXUnionID);
                            JToken token        = JToken.Parse(userInfoJson);
                            if (token["Status"].ToString().ToLower() == "true")//有会员信息
                            {
                                var cardNum = token["Result"]["Code"].ToString();
                                var phone   = token["Result"]["MobileNo"].ToString();
                                if (bllUser.Update(currentUserInfo, string.Format(" Phone='{0}',Ex2='{1}'", phone, cardNum), string.Format(" AutoId={0}", currentUserInfo.AutoID)) > 0)
                                {
                                    result = ZentCloud.Common.JSONHelper.ObjectToJson(new
                                    {
                                        is_login  = true,
                                        user_name = currentUserInfo.UserID,
                                        id        = currentUserInfo.AutoID
                                    });
                                    context.Response.Write(result);
                                    return;
                                }
                            }
                        }
                        catch (Exception)
                        {
                        }
                        result = ZentCloud.Common.JSONHelper.ObjectToJson(new
                        {
                            is_login  = false,
                            user_name = ""
                        });
                    }
                    #endregion
                }
                #endregion

                #region 一般检查已登录
                else
                {
                    result = ZentCloud.Common.JSONHelper.ObjectToJson(new
                    {
                        is_login  = true,
                        user_name = currentUserInfo.UserID,
                        id        = currentUserInfo.AutoID,
                        score     = currentUserInfo.TotalScore
                    });
                }
                #endregion
            }
            else
            {
                result = ZentCloud.Common.JSONHelper.ObjectToJson(new
                {
                    is_login  = false,
                    user_name = "",
                    id        = 0
                });
            }
            if (!string.IsNullOrEmpty(context.Request["callback"]))
            {
                //返回 jsonp数据
                result = string.Format("{0}({1})", context.Request["callback"], result);
            }
            else
            {
                //返回json数据
            }
            context.Response.Write(result);
        }
Exemple #23
0
        public void ProcessRequest(HttpContext context)
        {
            var articleId = context.Request["articleid"];
            var content   = context.Request["content"];
            var replyId   = Convert.ToInt32(context.Request["replyid"]);//评论了文章里的哪个评论

            int isHideUserName = Convert.ToInt32(context.Request["ishideusername"]);

            currentUserInfo = bllUser.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(articleId) || string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (bllUser.GetCount <JuActivityInfo>(string.Format(" JuActivityID = {0} ", articleId)) == 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //敏感词检查
            BLLFilterWord bllFilterWord = new BLLFilterWord();
            string        errmsg        = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllUser.WebsiteOwner, out errmsg, "0"))
            {
                apiResp.msg  = errmsg;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            //添加评论
            int            reviewId = 0;
            JuActivityInfo article  = bll.GetJuActivity(int.Parse(articleId), true);

            BLLJIMP.Enums.ReviewTypeKey reviewType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (article.ArticleType == "Question")
            {
                reviewType = BLLJIMP.Enums.ReviewTypeKey.Answer;
            }
            var addResult = bllReview.AddReview(reviewType, articleId, replyId, this.currentUserInfo.UserID, "评论", content, this.bll.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                if (reviewType == BLLJIMP.Enums.ReviewTypeKey.Answer)
                {
                    bllUser.AddUserScoreDetail(this.currentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.AnswerQuestions), this.bll.WebsiteOwner, null, null);
                }

                if (article.ArticleType == "Question")
                {
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.QuestionIsAnswered, this.currentUserInfo, article, article.UserID, content);

                    List <UserInfo> users = bllUser.GetRelationUserList(BLLJIMP.Enums.CommRelationType.JuActivityFollow, articleId);
                    bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.FollowQuestionIsAnswered, this.currentUserInfo, article, users, content);
                }
                apiResp.status = true;
                apiResp.msg    = "评论完成";
                apiResp.result = reviewId.ToString();
                apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
            }
            else
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "评论出错";
            }
            bllReview.ContextResponse(context, apiResp);
        }
Exemple #24
0
        public void ProcessRequest(HttpContext context)
        {
            int pageIndex  = Convert.ToInt32(context.Request["pageindex"]),
                pageSize   = Convert.ToInt32(context.Request["pagesize"]);
            var articleId  = context.Request["articleid"];
            var userAutoId = context.Request["user_autoid"];
            var reviewType = context.Request["review_type"];

            currentUserInfo = bllUser.GetCurrentUserInfo();

            var totalCount = 0;

            BLLJIMP.Enums.ReviewTypeKey nType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment;
            if (string.IsNullOrWhiteSpace(reviewType) && !string.IsNullOrWhiteSpace(articleId))
            {
                int            artId    = Convert.ToInt32(articleId);
                JuActivityInfo juArtcle = bll.GetJuActivity(artId);
                if (juArtcle.ArticleType.ToLower() == "question")
                {
                    nType = BLLJIMP.Enums.ReviewTypeKey.Answer;
                }
            }
            else
            {
                Enum.TryParse(reviewType, out nType);
            }
            string userId = "";

            if (!string.IsNullOrWhiteSpace(userAutoId))
            {
                UserInfo user = bllUser.GetUserInfoByAutoID(int.Parse(userAutoId));
                if (user != null)
                {
                    userId = user.UserID;
                }
                else
                {
                    userId = "-1";
                }
            }
            //仅显示审核通过的
            var sourceData = this.bllReview.GetReviewList(nType, out totalCount, pageIndex, pageSize, articleId, this.bll.WebsiteOwner, this.currentUserInfo == null ? "" : this.currentUserInfo.UserID, "", userId);

            List <dynamic> returnList = new List <dynamic>();

            foreach (var item in sourceData)
            {
                int actId = 0;
                int.TryParse(item.Expand1, out actId);
                JuActivityInfo actInfo = bll.GetJuActivity(actId);
                returnList.Add(new
                {
                    id               = item.ReviewMainId,
                    content          = item.ReviewContent,
                    createDate       = item.InsertDate.ToString(),
                    replyCount       = item.ReplyCount,  //回复数
                    praiseCount      = item.PraiseCount, //点赞数
                    pv               = item.Pv,          //浏览数
                    currUserIsPraise = item.CurrUserIsPraise,
                    articleId        = actInfo != null ? actInfo.JuActivityID : 0,
                    articleName      = actInfo != null ? actInfo.ActivityName : "",
                    pubUser          = new
                    {
                        id       = item.PubUser == null ? 0 : item.PubUser.AutoID,
                        userId   = item.PubUser == null ? "" : item.PubUser.UserID,
                        userName = item.PubUser == null ? "" : bllUser.GetUserDispalyName(item.PubUser),
                        avatar   = item.PubUser == null ? "" : bllUser.GetUserDispalyAvatar(item.PubUser),
                        isTutor  = item.PubUser == null ? false : bllUser.IsTutor(item.PubUser)
                    },
                    replayToUser = new
                    {
                        id       = item.ReplayToUser == null ? 0 : item.ReplayToUser.AutoID,
                        userId   = item.ReplayToUser == null ? "" : item.ReplayToUser.UserID,
                        userName = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyName(item.ReplayToUser),
                        avatar   = item.ReplayToUser == null ? "" : bllUser.GetUserDispalyAvatar(item.ReplayToUser),
                        isTutor  = item.ReplayToUser == null ? false : bllUser.IsTutor(item.ReplayToUser)
                    }
                });
            }

            dynamic result = new
            {
                totalcount = totalCount,
                list       = returnList
            };

            apiResp.status = true;
            apiResp.msg    = "查询完成";
            apiResp.result = result;
            bllUser.ContextResponse(context, apiResp);
        }
Exemple #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!Request.UserAgent.ToLower().Contains("micromessenger"))
            //{
            //    // ToLog("非微信浏览器进入不执行授权");
            //    Response.Write("请用微信浏览器打开");
            //    Response.End();
            //    return;//非微信浏览器进入不执行授权
            //}
            if (!bllUser.IsLogin)
            {
                Response.Write("请用微信打开");
                Response.End();
                return;
            }
            var website = bll.GetWebsiteInfoModelFromDataBase();
            CompanyWebsite_Config companyWebsiteConfig = bllWebSite.GetCompanyWebsiteConfig();;
            string   indexStr        = File.ReadAllText(this.Server.MapPath(@"\App\Distribution\m\app.html"));
            UserInfo CurrentUserInfo = bllUser.GetCurrentUserInfo();

            if (indexStr.Contains("'$$CURRENTUSERINFO$$'"))
            {
                var websiteLogo = companyWebsiteConfig.WebsiteImage;
                if (string.IsNullOrEmpty(websiteLogo))
                {
                    websiteLogo = ConfigHelper.GetConfigString("WebsiteLogo");
                }
                else
                {
                    websiteLogo = bll.GetImgUrl(websiteLogo);
                }

                string nextLevelName          = string.Empty;
                double distanceNextLevelScore = 0;

                UserLevelConfig currUserLevel = bll.GetUserLevel(CurrentUserInfo, out nextLevelName, out distanceNextLevelScore);


                apiResp.result = new
                {
                    user_show_name         = bllUser.GetUserDispalyName(CurrentUserInfo),
                    website_logo           = websiteLogo,
                    website_name           = website.WebsiteName,
                    is_distribution_member = IsDistributionMember(CurrentUserInfo, website),                                   //是否是分销会员
                    recommend_id           = CurrentUserInfo.AutoID,                                                           //我的推荐码
                    recommend_count        = bll.GetUserCommendCount(CurrentUserInfo.UserID),                                  //推荐人数
                    nick_name    = CurrentUserInfo.WXNickname,                                                                 //昵称
                    true_name    = CurrentUserInfo.TrueName,                                                                   //真实姓名
                    head_img_url = bllUser.GetUserDispalyAvatar(CurrentUserInfo),                                              //头像
                    history_commission_total_amount = CurrentUserInfo.HistoryDistributionOffLineTotalAmount,                   //累计佣金
                    can_use_amount            = bll.GetUserCanUseAmount(CurrentUserInfo),                                      //可提现金额
                    level_name                = currUserLevel.LevelString,
                    direct_rate               = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel0,                      //直销佣金比例
                    direct_sale_amount        = bll.GetDirectSaleAmount(CurrentUserInfo.UserID),                               //累计直接销售
                    down_user_total_count     = bll.GetDownUserTotalCount(CurrentUserInfo.UserID, bll.GetDistributionLevel()), //下级用户总和
                    down_user_level1_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 1),                               //一级分销用户数
                    down_user_level2_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 2),                               //二级分销用户数
                    down_user_level3_count    = bll.GetDownUserCount(CurrentUserInfo.UserID, 3),                               //三级分销用户数
                    distribution_level1_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel1,                      //一级分销佣金比例
                    distribution_level2_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel2,                      //二级分销佣金比例
                    distribution_level3_rate  = bll.GetUserLevel(CurrentUserInfo).DistributionRateLevel3,                      //三级分销佣金比例
                    next_level_name           = nextLevelName,                                                                 //下个等级名称
                    distance_next_level_score = distanceNextLevelScore                                                         //距离下个等级的积分
                };
                apiResp.status = true;
                apiResp.msg    = "ok";
                indexStr       = indexStr.Replace("'$$CURRENTUSERINFO$$'", ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }

            if (indexStr.Contains("'$$fx-websiteConfig$$'"))
            {
                dynamic websiteConfigResult = new
                {
                    website_name              = website.WebsiteName,                                                                           //站点名称
                    distribution_level        = bll.GetDistributionLevel(),                                                                    //后台配置的几级
                    distribution_show_level   = bll.GetDistributionShowLevel(),                                                                //会员显示分销级别
                    commission_show_name      = string.IsNullOrWhiteSpace(website.CommissionShowName) ? "积分" : website.CommissionShowName,     //佣金显示名称
                    distribution_show_name    = string.IsNullOrWhiteSpace(website.DistributionShowName) ? "会员" : website.DistributionShowName, //分销显示名称
                    is_show_distribution_rate = website.IsShowDistributionOffLineRate,                                                         //是否显示分销比例
                    share_title          = companyWebsiteConfig.WebsiteTitle,                                                                  //分享标题
                    share_desc           = companyWebsiteConfig.WebsiteDescription,                                                            //分享描述
                    share_img_url        = companyWebsiteConfig.WebsiteImage,                                                                  //分享图片
                    project_field_list   = bll.GetProjectFieldMapListF(),                                                                      //项目自定义字段
                    slide_type           = website.DistributionOffLineSlideType,
                    is_show_member_score = website.DistributionOffLineIsShowMemberScore
                };

                indexStr = indexStr.Replace("'$$fx-websiteConfig$$'", ZentCloud.Common.JSONHelper.ObjectToJson(websiteConfigResult));
            }

            if (indexStr.Contains("$$fx-wrapApplyHeader$$"))
            {
                indexStr = indexStr.Replace("$$fx-wrapApplyHeader$$", website.DistributionOffLineDescription);
            }

            if (indexStr.Contains("$$fx-wrapApplyWaitInfo$$"))
            {
                indexStr = indexStr.Replace("$$fx-wrapApplyWaitInfo$$", website.DistributionOffLineApplyWaitInfo);
            }

            //直接返回广告数组
            if (indexStr.Contains("'$$fx-slides$$'") && !string.IsNullOrWhiteSpace(website.DistributionOffLineSlideType))
            {
                string slideType = website.DistributionOffLineSlideType;
                System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebsiteOwner='{0}'", bll.WebsiteOwner));
                if (!string.IsNullOrEmpty(slideType))
                {
                    sbWhere.AppendFormat(" And Type='{0}'", slideType);
                }
                sbWhere.Append(" order by Sort DESC");
                var sourceData = bll.GetList <BLLJIMP.Model.Slide>(sbWhere.ToString());
                var list       = from p in sourceData
                                 select new
                {
                    img_url    = bll.GetImgUrl(p.ImageUrl),
                    link       = p.Link,
                    slide_type = p.Type,
                    link_text  = p.LinkText
                };

                var data = new
                {
                    totalcount = sourceData.Count,
                    proportion = bllKeyValue.GetSlideProportion(slideType),
                    list       = list,//列表
                };

                indexStr = indexStr.Replace("'$$fx-slides$$'", ZentCloud.Common.JSONHelper.ObjectToJson(data));
            }

            this.Response.Write(indexStr);
        }
Exemple #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     uinfo = bllUser.GetCurrentUserInfo();
 }
Exemple #27
0
        public void ProcessRequest(HttpContext context)
        {
            var commentId      = context.Request["commentid"];
            var replyId        = Convert.ToInt32(context.Request["replyid"]);//回复了评论里的哪个回复
            var content        = context.Request["content"];
            int isHideUserName = Convert.ToInt32(context.Request["isHideUserName"]);

            currentUserInfo = bllUser.GetCurrentUserInfo();
            if (this.currentUserInfo == null)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin;
                apiResp.msg  = "请先登录";
                bllUser.ContextResponse(context, apiResp);
                return;
            }

            if (string.IsNullOrWhiteSpace(commentId) || string.IsNullOrWhiteSpace(content))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                bllReview.ContextResponse(context, apiResp);
                return;
            }


            if (bllReview.GetCount <ReviewInfo>(string.Format(" ReviewMainId = {0} ", commentId)) == 0)
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound;
                bllReview.ContextResponse(context, apiResp);
                return;
            }

            //敏感词检查
            BLLFilterWord bllFilterWord = new BLLFilterWord();
            string        errmsg        = "";

            if (!bllFilterWord.CheckFilterWord(content, this.bllReview.WebsiteOwner, out errmsg, "0"))
            {
                apiResp.msg  = errmsg;
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                bllReview.ContextResponse(context, apiResp);
                return;
            }

            //添加回复

            int reviewId = 0;

            var addResult = bllReview.AddReview(BLLJIMP.Enums.ReviewTypeKey.CommentReply, commentId, replyId, this.currentUserInfo.UserID, "评论", content, this.bllReview.WebsiteOwner, out reviewId, isHideUserName);

            if (addResult)
            {
                apiResp.status = true;
                apiResp.result = reviewId.ToString();

                if (bllUser.IsTutor(this.currentUserInfo.UserID))
                {
                    bllTutor.UpdateAnswers(this.currentUserInfo.UserID);
                }
            }
            else
            {
                apiResp.status = false;
            }
            bllReview.ContextResponse(context, apiResp);
        }
Exemple #28
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Expires     = 0;
            string action = context.Request["Action"];
            string result = string.Empty;

            try
            {
                this.currentUserInfo = userBll.GetCurrentUserInfo();
                switch (action)
                {
                //case "GetCodeListInfo":
                //    result = GetCodeListInfo(context);
                //    break;

                //case "GetUserInfoByOpenId":
                //    result = GetUserInfov(context);
                //    break;
                case "GetUserInfo":
                    result = GetUserInfo(context);
                    break;

                case "EditUserInfoByOpenId":
                    result = EditUserInfoV1(context);
                    break;

                case "EditUserInfo":
                    result = EditUserInfo(context);
                    break;

                case "EditUserInfoV1":
                    result = EditUserInfoV1(context);
                    break;

                //case "SendPhoneVerifyCode":
                //    result = SendPhoneVerifyCode(context);
                // break;
                case "VerifyPhone":
                    result = VerifyPhone(context);
                    break;

                //IsAllUserBaseInfo
                case "IsAllUserBaseInfo":
                    result = IsAllUserBaseInfo(context);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                this.resp.Status = -1;
                this.resp.Msg    = "异常" + ex.Message;

                result = ZentCloud.Common.JSONHelper.ObjectToJson(this.resp);
            }

            context.Response.Write(result);
        }
Exemple #29
0
        public void ProcessRequest(HttpContext context)
        {
            //try
            //{
            BLLJIMP.BLLJuActivity   bllJuactivity   = new BLLJIMP.BLLJuActivity("");
            BLLJIMP.BLLUser         bllUser         = new BLLJIMP.BLLUser("");
            BLLJIMP.BLLMonitor      bllMonitor      = new BLLJIMP.BLLMonitor();
            BLLJIMP.BLLWebSite      bllwebSite      = new BLLJIMP.BLLWebSite();
            BLLJIMP.BLLShareMonitor bllShareMonitor = new BLLJIMP.BLLShareMonitor();

            ///推广用户信息
            UserInfo spreadUser = null;

            //分享用户
            UserInfo shareUser = null;

            CompanyWebsite_Config companyConfig = bllwebSite.GetCompanyWebsiteConfig();

            currentUrl = context.Request.Url.ToString(); //当前绝对地址
            string filePath = context.Request.FilePath;  //当前相对路径

            #region 微信推广(展示文章页面)
            if (filePath.Contains(".chtml"))
            {
                ToLog(context, " monitorhandler filePath:" + filePath);
                string[] parameters = filePath.Split('/');
                if (parameters.Length > 2)
                {
                    int activityId = Convert.ToInt32(parameters[1], 16);//ZCJ_JuActivityInfo 文章ID;
                    ToLog(context, " monitorhandler 文章ID:" + activityId);
                    long memberID = 0;

                    if (parameters.Length > 3)
                    {
                        //memberID = parameters[2] == "XXX" ? 0 : Convert.ToInt32(parameters[2], 16);//ZCJ_WXMemberInfo 会员注册ID;
                        spreadUser = bllUser.GetUserInfoByAutoID(Convert.ToInt32(parameters[2], 16));
                    }


                    string currOpenerOpenID = parameters.Length > 5 ? parameters[3] : string.Empty;//当前打开者的OpenID

                    string spreadUserID = context.Request["spreadU"] == null ? "" : context.Request["spreadU"].ToString();

                    string shareTimestamp = context.Request["shareTimestamp"];

                    if (!string.IsNullOrWhiteSpace(spreadUserID))
                    {
                        spreadUserID = Common.Base64Change.DecodeBase64ByUTF8(spreadUserID);
                    }

                    string spreadUserAutoIDStr = context.Request["ua"] == null ? "" : context.Request["ua"].ToString();//推广ID,原始id*1000,16进制后进行base64,然后“=”变成“_”
                    int    spreadUserAutoID    = 0;
                    if (!string.IsNullOrWhiteSpace(spreadUserAutoIDStr))
                    {
                        spreadUserAutoID = bllJuactivity.TransmitIntDeCode(spreadUserAutoIDStr);//Convert.ToInt32(Common.Base64Change.DecodeBase64ByUTF8(spreadUserAutoIDStr.Replace("_", "=")), 16) / 1000;
                    }

                    string shareId = context.Request["comeonshareid"] == null ? "" : context.Request["comeonshareid"].ToString();

                    if (!string.IsNullOrWhiteSpace(shareId))
                    {
                        ToLog(context, " monitorhandler 执行shareId查找分享任务: " + shareId);
                        try
                        {
                            var shareInfo = bllShareMonitor.GetShareInfo(shareId);

                            if (!string.IsNullOrWhiteSpace(shareInfo.UserId))
                            {
                                shareUser = bllUser.GetUserInfo(shareInfo.UserId);
                            }
                        }
                        catch (Exception ex)
                        {
                            ToLog(context, " monitorhandler 获取shareUser异常: " + ex.Message);
                        }
                    }



                    JuActivityInfo activityInfo = bllJuactivity.Get <JuActivityInfo>(string.Format("JuActivityID={0} AND IsDelete=0 ", activityId));//文章信息

                    if (activityInfo == null)
                    {
                        context.Response.WriteFile("/Error/NotExist.html");
                        return;
                    }

                    ToLog(context, " monitorhandler 找到文章,开始构造内容: " + activityInfo.JuActivityID);

                    //if (activityInfo.ArticleType == "activity")
                    //{
                    //    if (activityInfo.ActivityStatus == 1)
                    //    {
                    //        context.Response.Redirect("/Error/CommonMsg.aspx?msg=报名已结束,有疑问请联系我们&&icon=icon iconfont icon-kulian kulian");
                    //        return;
                    //    }
                    //}

                    #region 检查是否付费活动

                    if (activityInfo.IsFee == 1 && !bllJuactivity.IsLogin)
                    {
                        context.Response.Redirect("/App/Cation/Wap/FreeActivityPage.aspx?aid=" + activityInfo.JuActivityID);
                        return;
                    }
                    #endregion

                    #region 检查访问级别
                    if (activityInfo.AccessLevel > 0)
                    {
                        if (!bllUser.IsLogin)
                        {
                            appLoginUrl = Common.ConfigHelper.GetConfigString("appLoginUrl").ToLower();
                            context.Response.Redirect(appLoginUrl + string.Format("?redirect=" + HttpUtility.UrlEncode(currentUrl)), true);
                            return;
                        }
                        //else if (!bllUser.IsMember() && activityInfo.AccessLevel == 1)
                        //{

                        //}
                        else if (bllUser.GetCurrentUserInfo().AccessLevel < activityInfo.AccessLevel)
                        {
                            //if (companyConfig.NoPermissionsPage == 0)
                            //{
                            //    context.Response.WriteFile("/Error/NoPmsMobile.htm");
                            //    return;
                            //}
                            //else if (companyConfig.NoPermissionsPage == 1)
                            //{
                            //    context.Response.Redirect("/App/Cation/Wap/UserEdit.aspx",true);
                            //    context.Response.End();
                            //    return;
                            //}
                            context.Response.WriteFile("/Error/NoPmsMobile.htm");
                            return;
                        }
                    }
                    #endregion

                    #region 检查访问级别

                    //WXMemberInfo regInfo = juactivityBll.Get<WXMemberInfo>(string.Format("MemberID={0}", memberID));//会员注册信息
                    // UserInfo userInfo = juactivityBll.Get<UserInfo>(string.Format("UserID='{0}'", activityInfo.UserID));//文章发布者信息
                    SystemSet systemset  = bllJuactivity.Get <SystemSet>(""); //系统配置信息
                    string    pageSource = "";                                //待输出的html源代码

                    if (systemset != null)
                    {
                        if (string.IsNullOrWhiteSpace(currOpenerOpenID))
                        {
                            //取得Session里的当前OpenID
                            currOpenerOpenID = context.Session[systemset.WXCurrOpenerOpenIDKey] != null ? context.Session[systemset.WXCurrOpenerOpenIDKey].ToString() : "";
                        }

                        if (string.IsNullOrWhiteSpace(currOpenerOpenID))
                        {
                            //如果再为空,由链接上面get参数获取
                            currOpenerOpenID = context.Request[systemset.WXCurrOpenerOpenIDKey] != null ? context.Request[systemset.WXCurrOpenerOpenIDKey].ToString() : "";
                        }
                    }
                    #endregion



                    //if (regInfo == null)
                    //{
                    //    regInfo = new WXMemberInfo() { Name = "none", WeixinOpenID = "" };
                    //}

                    if ((activityInfo != null))//
                    {
                        //var planInfo = bllJuactivity.Get<MonitorPlan>(string.Format("MonitorPlanID={0}", activityInfo.MonitorPlanID));
                        //if (planInfo == null)
                        //{
                        //    return;
                        //}
                        //else
                        //{
                        //    if (planInfo.PlanStatus == "0")//任务已停止
                        //    {
                        //        return;
                        //    }

                        //}

                        ToLog(context, " monitorhandler 开始执行GetJuactivityHtml: " + activityInfo.JuActivityID);
                        pageSource = bllJuactivity.GetJuactivityHtml(activityInfo, currOpenerOpenID, context.Request.Url.ToString(), spreadUser, shareUser);
                        ToLog(context, " monitorhandler 执行GetJuactivityHtml完毕: " + activityInfo.JuActivityID);

                        #region 事件记录
                        //事件
                        //int OpenCount = 0;//打开人数
                        //int DistinctOpenCount = 0;//独立IP数量
                        MonitorEventDetailsInfo detailInfo = new MonitorEventDetailsInfo();
                        detailInfo.MonitorPlanID  = activityInfo.MonitorPlanID;
                        detailInfo.EventType      = 0;
                        detailInfo.EventBrowser   = HttpContext.Current.Request.Browser == null ? "" : HttpContext.Current.Request.Browser.ToString();
                        detailInfo.EventBrowserID = HttpContext.Current.Request.Browser.Id;;
                        if (HttpContext.Current.Request.Browser.Beta)
                        {
                            detailInfo.EventBrowserIsBata = "测试版";
                        }
                        else
                        {
                            detailInfo.EventBrowserIsBata = "正式版";
                        }

                        detailInfo.EventBrowserVersion = HttpContext.Current.Request.Browser.Version;
                        detailInfo.EventDate           = DateTime.Now;
                        if (HttpContext.Current.Request.Browser.Win16)
                        {
                            detailInfo.EventSysByte = "16位系统";
                        }
                        else
                        if (HttpContext.Current.Request.Browser.Win32)
                        {
                            detailInfo.EventSysByte = "32位系统";
                        }
                        else
                        {
                            detailInfo.EventSysByte = "64位系统";
                        }

                        detailInfo.EventSysPlatform = HttpContext.Current.Request.Browser.Platform;
                        detailInfo.SourceIP         = Common.MySpider.GetClientIP();
                        detailInfo.IPLocation       = Common.MySpider.GetIPLocation(detailInfo.SourceIP);
                        detailInfo.SourceUrl        = HttpContext.Current.Request.Url.ToString();
                        detailInfo.RequesSourcetUrl = HttpContext.Current.Request.UrlReferrer != null?HttpContext.Current.Request.UrlReferrer.ToString() : "";

                        if (spreadUser != null)
                        {
                            detailInfo.SpreadUserID = spreadUser.UserID;
                        }
                        detailInfo.SpreadUserAutoID = spreadUserAutoID;
                        detailInfo.ShareTimestamp   = shareTimestamp;
                        detailInfo.WebsiteOwner     = bllJuactivity.WebsiteOwner;
                        detailInfo.ModuleType       = activityInfo.ArticleType;
                        if (bllUser.IsLogin)
                        {
                            detailInfo.EventUserID = bllUser.GetCurrUserID();
                        }


                        if (spreadUser != null)//带推广信息
                        {
                            //try
                            //{
                            //    if (!string.IsNullOrWhiteSpace(currOpenerOpenID))
                            //    {
                            //        //记录触发人
                            //        UserInfo eventUser = new BLLJIMP.BLLUser("").GetUserInfoByOpenId(currOpenerOpenID);
                            //        detailInfo.EventUserID = eventUser.UserID;
                            //    }
                            //}
                            //catch { }
                            string          url = string.Format("http://{0}{1}", context.Request.Url.Host, filePath);
                            MonitorLinkInfo linkInfo;
                            try
                            {
                                linkInfo = bllJuactivity.Get <MonitorLinkInfo>(string.Format(" LinkName='{0}' And MonitorPlanID={1}", spreadUser.UserID, activityInfo.MonitorPlanID));
                            }
                            catch (Exception ex)
                            {
                                context.Response.Write("ex" + ex.ToString());
                                return;
                            }



                            if (linkInfo != null)
                            {
                                linkInfo.ActivityName   = activityInfo.ActivityName;
                                linkInfo.ThumbnailsPath = activityInfo.ThumbnailsPath;
                                //已经为该用户建立推广链接
                                detailInfo.LinkID = linkInfo.LinkID;
                                //if (linkInfo.OpenCount != null)//增加打开人数
                                //{
                                linkInfo.OpenCount++;
                                //}
                                //else
                                //{
                                //    linkInfo.OpenCount = 1;
                                //}
                                int shareCount = bllJuactivity.GetCount <MonitorEventDetailsInfo>("ShareTimestamp", string.Format(" LinkID ={0} and ShareTimestamp is not null and ShareTimestamp <> '' and ShareTimestamp <> '0' ", linkInfo.LinkID));
                                linkInfo.ShareCount = shareCount;
                                int ipCount = bllJuactivity.GetCount <MonitorEventDetailsInfo>(" SourceIP ", string.Format(" LinkID = {0} ", linkInfo.LinkID));
                                linkInfo.DistinctOpenCount = ipCount;
                                bllJuactivity.Update(linkInfo, string.Format(" OpenCount={0},DistinctOpenCount={1},ShareCount={2}", linkInfo.OpenCount, ipCount, shareCount), string.Format("LinkID={0}", linkInfo.LinkID));
                            }
                            else
                            {
                                //还没有为该用户建立推广链接
                                MonitorLinkInfo newLinkinfo = new MonitorLinkInfo();
                                newLinkinfo.LinkID            = int.Parse(bllJuactivity.GetGUID(ZentCloud.BLLJIMP.TransacType.MonitorLinkID));
                                newLinkinfo.MonitorPlanID     = activityInfo.MonitorPlanID;
                                newLinkinfo.WXMemberID        = memberID;
                                newLinkinfo.LinkName          = spreadUser.UserID;
                                newLinkinfo.RealLink          = url;
                                newLinkinfo.InsertDate        = DateTime.Now;
                                newLinkinfo.OpenCount         = 1;
                                newLinkinfo.ActivityName      = activityInfo.ActivityName;
                                newLinkinfo.ThumbnailsPath    = activityInfo.ThumbnailsPath;
                                newLinkinfo.WebsiteOwner      = bllJuactivity.WebsiteOwner;
                                newLinkinfo.DistinctOpenCount = 1; // ip
                                newLinkinfo.ShareCount        = 0; //分享数
                                if (activityInfo.ArticleType == "article")
                                {
                                    newLinkinfo.ForwardType = "fans";
                                    newLinkinfo.ActivityId  = activityInfo.JuActivityID;
                                }
                                if (!string.IsNullOrEmpty(activityInfo.SignUpActivityID) && activityInfo.ArticleType == "activity")
                                {
                                    newLinkinfo.ActivityId = int.Parse(activityInfo.SignUpActivityID);
                                }

                                StringBuilder sqlWhere = new StringBuilder();
                                sqlWhere.AppendFormat(@"
                                if not exists(select 1 from ZCJ_MonitorLinkInfo where LinkName='{14}' and MonitorPlanID={15} ) 
                                begin
                                    insert into ZCJ_MonitorLinkInfo (LinkID,MonitorPlanID,WXMemberID,LinkName,RealLink,InsertDate,OpenCount,ActivityName,ThumbnailsPath,WebsiteOwner,DistinctOpenCount,ShareCount,ForwardType,ActivityId)
                                                values({0},{1},{2},'{3}','{4}','{5}',{6},'{7}','{8}','{9}',{10},{11},'{12}',{13})
                                end 
                                ", newLinkinfo.LinkID, newLinkinfo.MonitorPlanID, newLinkinfo.WXMemberID, newLinkinfo.LinkName, newLinkinfo.RealLink, newLinkinfo.InsertDate, newLinkinfo.OpenCount, newLinkinfo.ActivityName, newLinkinfo.ThumbnailsPath, newLinkinfo.WebsiteOwner, newLinkinfo.DistinctOpenCount, newLinkinfo.ShareCount, newLinkinfo.ForwardType, newLinkinfo.ActivityId, spreadUser.UserID, activityInfo.MonitorPlanID);


                                if (ZentCloud.ZCDALEngine.DALEngine.ExecuteSql(sqlWhere.ToString()) > 0)
                                {
                                    detailInfo.LinkID = newLinkinfo.LinkID;
                                }
                            }
                        }


                        //添加事件详细
                        //if (!filePath.Contains("?"))
                        //{
                        bllJuactivity.Add(detailInfo);
                        //DistinctOpenCount = juactivityBll.GetCount<ZentCloud.BLLJIMP.Model.MonitorEventDetailsInfo>("SourceIP", string.Format("LinkID={0} and EventType=0", detailInfo.LinkID));
                        //juactivityBll.Update(new MonitorLinkInfo(), string.Format(" OpenCount={0},DistinctOpenCount={1}", OpenCount, DistinctOpenCount), string.Format("LinkID={0}", detailInfo.LinkID));
                        #region 微转发活动加积分
                        if (bllUser.IsLogin && spreadUser != null)
                        {
                            if (activityInfo.ArticleType == "activity")
                            {
                                if (bllJuactivity.GetCount <MonitorEventDetailsInfo>(string.Format(" MonitorPlanID='{0}' And EventUserID='{1}' And SpreadUserID='{2}' And EventUserID!='{2}'", detailInfo.MonitorPlanID, bllUser.GetCurrUserID(), spreadUser.UserID)) == 1)
                                {
                                    string remark = string.Format("转发活动《{0}》", activityInfo.ActivityName);
                                    //微转发加积分
                                    bllUser.AddUserScoreDetail(spreadUser.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.ForwardArticle), spreadUser.WebsiteOwner, null, remark);
                                }
                            }
                        }
                        #endregion


                        //}
                        context.Response.ClearContent();
                        //处理完成
                        context.Response.Write(pageSource);
                        //更新微信阅读人数
                        //bllJuactivity.UpdateUVCount(activityInfo.JuActivityID);
                        bllJuactivity.UpDateIPPVShareCount(activityInfo);
                        bllJuactivity.UpdateActivityForwardPVUV(activityInfo);
                        if (spreadUser != null)
                        {
                            bllMonitor.UpdateUV(activityInfo.MonitorPlanID, spreadUser.UserID);
                            //bllMonitor.UpdateSignUpCount(activityInfo.MonitorPlanID, spreadUser.UserID);
                        }
                        if (!string.IsNullOrWhiteSpace(activityInfo.RedirectUrl))
                        {
                            context.Response.Redirect(activityInfo.RedirectUrl);
                        }
                        return;

                        #endregion

                        ToLog(context, " monitorhandler 事件记录完毕: " + activityInfo.JuActivityID);
                    }
                    else
                    {
                        context.Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\" /></head><body>链接无效。</body></html>");
                        return;
                    }
                }
            }
            #endregion
            #region 注释
            //#region 微信会员注册
            //else if (filePath.StartsWith("/weixin"))
            //{

            //    //微信会员注册
            //    if (filePath.Contains("wx_reg.chtml") && (!filePath.Contains("/weixin/wx_reg.chtml")))
            //    {
            //        string[] parameters = filePath.Split('/');

            //        string weixinMemberId = Convert.ToInt32(parameters[2], 16).ToString();// ZCJ_WeixinMemberInfo WeixinMemberID
            //        var weixinmemberinfo = juactivityBll.Get<WeixinMemberInfo>(string.Format("WeixinMemberID={0}", weixinMemberId));
            //        string RegCode = Common.IOHelper.GetFileStr(context.Server.MapPath("/weixin/wx_reg.htm"), Encoding.UTF8);//注册代码

            //        if (RegCode.Contains("$CCWXOPENID$"))
            //        {
            //            RegCode = RegCode.Replace("$CCWXOPENID$", weixinmemberinfo.WeixinOpenID);
            //        }
            //        if (RegCode.Contains("$CCWXAID$"))//注册到哪个账户下
            //        {

            //            RegCode = RegCode.Replace("$CCWXAID$", Convert.ToString(juactivityBll.Get<UserInfo>(string.Format("UserID='{0}'", weixinmemberinfo.UserID)).AutoID, 16));

            //        }

            //        context.Response.Write(RegCode);//输出注册代码


            //        //微信会员注册

            //    }

            //}

            //#endregion
            #endregion

            //}
            //catch (Exception ex)
            //{
            //    using (StreamWriter sw = new StreamWriter(@"C:\MonitorHandlerException.txt", true, Encoding.UTF8))
            //    {
            //        sw.WriteLine(string.Format("{0} MonitorHandler拦截处理异常:{1}", DateTime.Now.ToString(), ex.ToString()));

            //    }
            //    context.Response.Write("exception");
            //}
        }
Exemple #30
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            context.Response.Expires     = 0;
            string result = "false";

            try
            {
                baseUrl = string.Format("http://{0}", context.Request.Url.Authority);
                if (!bllUser.IsLogin)
                {
                    resp.errcode = (int)APIErrCode.UserIsNotLogin;
                    resp.errmsg  = "请先登录";
                    result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                    goto outoff;
                }

                else
                {
                    currentUserInfo = bllUser.GetCurrentUserInfo();
                }
                string action = context.Request["action"];
                //利用反射找到未知的调用的方法
                if (!string.IsNullOrEmpty(action))
                {
                    MethodInfo method = this.GetType().GetMethod(action, BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.IgnoreCase); //找到方法BindingFlags.NonPublic指定搜索非公有方法

                    if (method == null)
                    {
                        resp.errcode = -3;
                        resp.errmsg  = "action not exist";
                        result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                        context.Response.Write(result);
                        return;
                    }

                    result = Convert.ToString(method.Invoke(this, new[] { context }));  //调用方法
                }
                else
                {
                    resp.errcode = -3;
                    resp.errmsg  = "action not exist";
                    result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
                }
            }
            catch (Exception ex)
            {
                resp.errcode = -1;
                resp.errmsg  = ex.Message;
                result       = ZentCloud.Common.JSONHelper.ObjectToJson(resp);
            }
            if (!string.IsNullOrEmpty(context.Request["callback"]))
            {
                //返回 jsonp数据
                result = string.Format("{0}({1})", context.Request["callback"], result);
            }
            else
            {
                //返回json数据
            }
outoff:

            context.Response.Write(result);
        }