Example #1
0
        private string BatchSetSort(HttpContext context)
        {
            string sort = context.Request["sort"];
            string pids = context.Request["pids"];

            if (string.IsNullOrEmpty(sort))
            {
                apiResp.msg  = "排序不能为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                return(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
            if (string.IsNullOrEmpty(pids))
            {
                apiResp.msg  = "商品ID不能为空";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                return(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
            }
            int count = bllMall.Update(new WXMallProductInfo(), string.Format(" Sort={0}", int.Parse(sort)), string.Format(" WebsiteOwner='{0}' AND PID IN ({1})", bllMall.WebsiteOwner, pids));

            if (count > 0)
            {
                BLLRedis.ClearProductByIds(bllMall.WebsiteOwner, pids, false);
                BLLRedis.ClearProductList(bllMall.WebsiteOwner);
                apiResp.msg    = "操作完成";
                apiResp.status = true;
            }
            else
            {
                apiResp.msg  = "操作出错";
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
            }
            return(ZentCloud.Common.JSONHelper.ObjectToJson(apiResp));
        }
Example #2
0
File: Add.ashx.cs Project: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            RequestModel requestModel = bllReview.ConvertRequestToModel <RequestModel>(new RequestModel());

            if (string.IsNullOrWhiteSpace(requestModel.for_id))
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete;
                apiResp.msg  = "评论对象Id为空";
                bllReview.ContextResponse(context, apiResp);
                return;
            }
            BLLJIMP.Model.ReviewInfo review = new BLLJIMP.Model.ReviewInfo();
            review.AuditStatus    = 0;
            review.ForeignkeyId   = requestModel.for_id;
            review.Expand1        = requestModel.ex_id;
            review.UserId         = CurrentUserInfo.UserID;
            review.UserName       = bllUser.GetUserDispalyName(CurrentUserInfo);
            review.ReviewScore    = requestModel.score;
            review.ReviewContent  = requestModel.content;
            review.InsertDate     = DateTime.Now;
            review.ReviewType     = requestModel.type;
            review.ReviewTitle    = requestModel.title;
            review.WebsiteOwner   = bllReview.WebsiteOwner;
            review.IsHideUserName = 0;
            review.ReviewMainId   = int.Parse(bllReview.GetGUID(TransacType.CommAdd));
            review.CommentImg     = requestModel.comment_img;
            review.Ex2            = requestModel.order_detail_id;
            if (bllReview.Add(review))
            {
                if (review.ReviewType == "OrderComment" && !string.IsNullOrWhiteSpace(review.Expand1)) //更新 平均分 评分人数
                {
                    var total = 0;
                    List <BLLJIMP.Model.ReviewInfo> sourceData = bllReview.GetActReviewList(out total, 1, 0, "", "", "", "OrderComment", review.Expand1, "0", "AutoId");
                    double reviewAvgScore = bllReview.GetReviewAvgScore(bllReview.WebsiteOwner, "", "OrderComment", review.Expand1, "0");
                    bllReview.Update(new BLLJIMP.Model.WXMallProductInfo(),
                                     string.Format("ReviewCount='{0}',ReviewScore='{1}'", total, reviewAvgScore),
                                     string.Format("PID='{0}' And WebsiteOwner='{1}' ", review.Expand1, bllReview.WebsiteOwner));

                    bllReview.Update(new BLLJIMP.Model.WXMallOrderInfo(),
                                     string.Format("ReviewScore='{0}'", review.ReviewScore),
                                     string.Format("OrderID='{0}' And WebsiteOwner='{1}' ", review.ForeignkeyId, bllReview.WebsiteOwner));
                }

                apiResp.status = true;
                apiResp.code   = (int)BLLJIMP.Enums.APIErrCode.IsSuccess;
                apiResp.msg    = "评论完成";

                BLLRedis.ClearReviewList(bllReview.WebsiteOwner);
            }
            else
            {
                apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                apiResp.msg  = "评论失败";
            }
            bllReview.ContextResponse(context, apiResp);
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            string title   = context.Request["Title"];
            string content = context.Request["Context"];

            if (string.IsNullOrEmpty(title))
            {
                apiResp.msg = "标题不能为空";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            if (string.IsNullOrEmpty(content))
            {
                apiResp.msg = "内容不能为空";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            currentWebsteInfo = bllUser.GetWebsiteInfoModelFromDataBase();
            if (currentWebsteInfo.IsEnableUserReleaseReview == 0)
            {
                apiResp.msg = "暂不开放发布话题功能";
                context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
                return;
            }
            ReviewInfo model = new ReviewInfo
            {
                ForeignkeyId   = bllUser.WebsiteOwner,
                ForeignkeyName = bllUser.WebsiteOwner,
                UserId         = CurrentUserInfo.UserID,
                UserName       = CurrentUserInfo.TrueName,
                ReviewPower    = 0,
                InsertDate     = DateTime.Now,
                ReviewTitle    = title,
                ReviewContent  = content,
                WebsiteOwner   = bllUser.WebsiteOwner,
                PraiseNum      = 0,
                StepNum        = 0,
                ReviewType     = "话题",
                CategoryType   = "",
                ReplyDateTiem  = DateTime.Now
            };

            if (bllReview.Add(model))
            {
                BLLRedis.ClearReviewList(bllUser.WebsiteOwner);
                apiResp.status = true;
            }
            else
            {
                apiResp.msg = "发布失败";
            }
            context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
        }
Example #4
0
        /// <summary>
        /// 审核通过
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string NoPass(HttpContext context)
        {
            string        ids    = context.Request["ids"];
            List <string> IdList = ids.Split(',').ToList();

            for (int i = 0; i < IdList.Count; i++)
            {
                if (string.IsNullOrWhiteSpace(IdList[i]))
                {
                    continue;
                }
                bllReview.UpdateByKey <ReviewInfo>("AutoId", IdList[i], "AuditStatus", "2");
            }
            BLLRedis.ClearProductList(bllReview.WebsiteOwner);
            resp.Status = 1;
            resp.Msg    = "审核不通过";
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Example #5
0
File: Add.ashx.cs Project: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            int             autoId      = int.Parse(context.Request["AutoID"]);
            string          content     = context.Request["Context"];
            ReviewInfo      reviewInfo  = bllReview.Get <ReviewInfo>(string.Format("AutoId={0}", autoId));
            ReplyReviewInfo replyReview = new ReplyReviewInfo()
            {
                ReviewID     = Convert.ToInt32(autoId),
                InsertDate   = DateTime.Now,
                ReplyContent = content,
                UserId       = CurrentUserInfo.UserID,
                UserName     = CurrentUserInfo.LoginName,
                PraentId     = 0,
                WebSiteOwner = bllReview.WebsiteOwner
            };
            bool isSuccess = bllReview.Add(replyReview);

            if (isSuccess)
            {
                reviewInfo.NumCount++;
                reviewInfo.ReplyDateTiem = DateTime.Now;
                if (bllReview.Update(reviewInfo))
                {
                    //给回复者加分
                    int replyCount = bllReview.GetCount <ReplyReviewInfo>(string.Format("ReviewID={0} And  UserId='{1}'", autoId, CurrentUserInfo.UserID));
                    if (replyCount <= 1)//第一次回答才得分
                    {
                        bllUser.AddUserScoreDetail(CurrentUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.AnswerQuestions), bllUser.WebsiteOwner, null, null);
                    }
                    apiResp.status = true;
                }
                else
                {
                }
            }
            else
            {
            }
            BLLRedis.ClearReviewList(bllReview.WebsiteOwner);
            context.Response.Write(Common.JSONHelper.ObjectToJson(apiResp));
        }
Example #6
0
        /// <summary>
        /// 同步Efast库存
        /// </summary>
        private void SynEfastStock()
        {
            try
            {
                var skuList = bllMall.GetList <ProductSku>(string.Format(" OutBarCode is not null And OutBarCode!='' And WebSiteOwner='{0}'", websiteOwner));
                ToLog(string.Format("共获取到{0}条数据,开始同步...", skuList.Count));
                DateTime dtNow = DateTime.Now;
                int      index = 1;
                foreach (var skuInfo in skuList)
                {
                    //ToLog("刷新redis库存测试,skuid:" + skuInfo.SkuId);
                    ////刷新redis库存
                    //BLLRedis.ClearProductSkuSingle(skuInfo.WebSiteOwner, skuInfo.SkuId);
                    //ToLog("执行redis库存刷新测试完毕");

                    ToLog(string.Format("正在同步第{0}条数据,共{1}条...", index, skuList.Count));
                    var eFastSku = efastClient.GetSkuStock(int.Parse(shopId), skuInfo.OutBarCode);
                    if (eFastSku != null)
                    {
                        if (eFastSku.sl != skuInfo.Stock)
                        {
                            skuInfo.Stock = eFastSku.sl;

                            if (ZentCloud.ZCBLLEngine.BLLBase.ExecuteSql(string.Format("update ZCJ_ProductSku set Stock={0} where SkuId={1}", skuInfo.Stock, skuInfo.SkuId)) >= 0)
                            {
                                ToLog("刷新redis库存,skuid:" + skuInfo.SkuId);
                                //刷新redis库存
                                BLLRedis.ClearProductSkuSingle(skuInfo.WebSiteOwner, skuInfo.SkuId);
                                ToLog("执行redis库存刷新完毕");
                                ToLog(string.Format("同步成功,条码:{0}库存:{1}", skuInfo.OutBarCode, skuInfo.Stock));
                            }
                        }
                        else
                        {
                            ToLog(string.Format("库存一致,跳过 条码:{0}库存:{1}", skuInfo.OutBarCode, skuInfo.Stock));
                        }
                    }
                    else
                    {
                        if (skuInfo.Stock > 0)
                        {
                            skuInfo.Stock = 0;
                            if (ZentCloud.ZCBLLEngine.BLLBase.ExecuteSql(string.Format("update ZCJ_ProductSku set Stock=0 where SkuId={0}", skuInfo.SkuId)) >= 0)
                            {
                                ToLog("刷新redis库存,skuid:" + skuInfo.SkuId);
                                //刷新redis库存
                                BLLRedis.ClearProductSkuSingle(skuInfo.WebSiteOwner, skuInfo.SkuId);
                                ToLog("执行redis库存刷新完毕");
                                ToLog(string.Format("同步成功,条码:{0}库存:{1}", skuInfo.OutBarCode, skuInfo.Stock));
                            }
                        }
                        else
                        {
                            ToLog(string.Format("库存为已为0,条码:{0}", skuInfo.OutBarCode));
                        }
                    }
                    index++;
                }
                ToLog("操作完成。耗时:" + (DateTime.Now - dtNow).TotalSeconds + "S");
                WriteLog(string.Format("Efast库存同步完成.耗时{0}", (DateTime.Now - dtNow).TotalSeconds + "秒"));
            }
            catch (Exception ex)
            {
                ToLog(ex.Message);
                WriteLog(ex.Message);
            }
            ToLog("线程休眠1秒...");
            Thread.Sleep(1000);
        }