///// <summary> ///// 获取限时特卖商品列表 ///// </summary> ///// <param name="context"></param> ///// <returns></returns> //private string PromotionList(HttpContext context) //{ // int totalCount = 0; // var sourceData = bllMall.GetPromotionProductList(context, out totalCount); // var list = from p in sourceData // select new // { // product_id = p.PID, // category_id = p.CategoryId, // title = p.PName, // quote_price = p.PreviousPrice, // price = p.PromotionPrice, // img_url = bllMall.GetImgUrl(p.RecommendImg), // is_onsale = (!string.IsNullOrEmpty(p.IsOnSale) && p.IsOnSale == "1") ? 1 : 0, // count = p.PromotionStock // }; // var data = new // { // totalcount = totalCount, // list = list,//列表 // }; // return ZentCloud.Common.JSONHelper.ObjectToJson(data); //} ///// <summary> ///// 限时特卖日期列表 ///// </summary> ///// <param name="context"></param> ///// <returns></returns> //private string PromotinDateList(HttpContext context) //{ // var sourceData = bllMall.GetPromotionDateList(); // var list = from p in sourceData // select new // { // date=p, // weekday=bllMall.CaculateWeekDay(DateTime.Parse(p)) // }; // var data = new // { // totalcount = sourceData.Count, // list = list,//列表 // }; // return ZentCloud.Common.JSONHelper.ObjectToJson(data); //} /// <summary> /// 获取商品详情 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Get(HttpContext context) { //bllMall.ToLog("进入get",@"d:\songhedev.txt"); try { string productId = context.Request["product_id"]; string supplierId = context.Request["supplier_id"];//供应商Id //bllMall.ToLog("productId:" + productId, @"d:\songhedev.txt"); var productInfo = bllMall.GetProduct(productId); if (productInfo == null) { resp.errcode = 1; resp.errmsg = "商品ID不存在"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (productInfo.MinPrice == null && productInfo.WebsiteOwner == "jikuwifi") { bllWXMallProduct.UpdateProductPriceRange(productInfo.PID, bllWXMallProduct.WebsiteOwner); productInfo = bllMall.GetProduct(productId, true); } if (productInfo.WebsiteOwner != bllMall.WebsiteOwner) { resp.errcode = 1; resp.errmsg = "无权访问"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //bllMall.ToLog("GetCurrentUserInfo", @"d:\songhedev.txt"); UserInfo curUser = bllUser.GetUserInfoByCache(bllUser.GetCurrUserID(), bllUser.WebsiteOwner);//bllMall.GetCurrentUserInfo(); //bllMall.ToLog("GetCurrentUserInfo end", @"d:\songhedev.txt"); decimal currUserRebateScoreRate = 0; currUserRebateScoreRate = bllScore.GetUserRebateScoreRate(curUser != null ? curUser.UserID : null, bllMall.WebsiteOwner); #region 检查用户访问权限 int userAccessLevel = curUser == null ? 0 : curUser.AccessLevel; if (productInfo.AccessLevel > 0 && userAccessLevel < productInfo.AccessLevel) { dynamic nresp = new { errcode = 1, errmsg = "您的访问权限不足", access_level = productInfo.AccessLevel }; return(ZentCloud.Common.JSONHelper.ObjectToJson(nresp)); } #endregion var productSkuList = bllMall.GetProductSkuList(int.Parse(productId), true, supplierId);//源SKU var skus = from p in productSkuList select new { sku_id = p.SkuId, properties = bllMall.GetProductProperties(p.SkuId), show_properties = bllMall.GetProductShowProperties(p.SkuId), price = productInfo.Score > 0 ? productInfo.Price : bllMall.GetSkuPrice(p), count = bllMall.IsPromotionTime(p) ? p.PromotionStock : p.Stock, score = productInfo.Score, is_cashpay_only = productInfo.IsCashPayOnly, rebate_score = bllScore.CalcProductSkuRebateScore(p.SkuId, currUserRebateScoreRate, null, 1, true), sku_img = !string.IsNullOrEmpty(p.SkuImg) ? p.SkuImg : "" }; #region 展示图片列表 List <string> showImgList = new List <string>(); if (!string.IsNullOrEmpty(productInfo.ShowImage)) { foreach (var item in productInfo.ShowImage.Split(',')) { if (!string.IsNullOrEmpty(item)) { showImgList.Add(bllMall.GetImgUrl(item)); } } } if (showImgList.Count == 0) { showImgList.Add(bllMall.GetImgUrl(productInfo.RecommendImg)); } #endregion #region 文章内容 string exContent1 = string.Empty; string exContent2 = string.Empty; string exContent3 = string.Empty; string exContent4 = string.Empty; string exContent5 = string.Empty; if (!string.IsNullOrEmpty(productInfo.ExArticleId_1)) { JuActivityInfo model1 = bllJuActivity.GetJuActivity(int.Parse(productInfo.ExArticleId_1), true, bllMall.WebsiteOwner); if (model1 != null) { exContent1 = model1.ActivityDescription; } } if (!string.IsNullOrEmpty(productInfo.ExArticleId_2)) { JuActivityInfo model2 = bllJuActivity.GetJuActivity(int.Parse(productInfo.ExArticleId_2), true, bllMall.WebsiteOwner); if (model2 != null) { exContent2 = model2.ActivityDescription; } } if (!string.IsNullOrEmpty(productInfo.ExArticleId_3)) { JuActivityInfo model3 = bllJuActivity.GetJuActivity(int.Parse(productInfo.ExArticleId_3), true, bllMall.WebsiteOwner); if (model3 != null) { exContent3 = model3.ActivityDescription; } } if (!string.IsNullOrEmpty(productInfo.ExArticleId_4)) { JuActivityInfo model4 = bllJuActivity.GetJuActivity(int.Parse(productInfo.ExArticleId_4), true, bllMall.WebsiteOwner); if (model4 != null) { exContent4 = model4.ActivityDescription; } } if (!string.IsNullOrEmpty(productInfo.ExArticleId_5)) { JuActivityInfo model5 = bllJuActivity.GetJuActivity(int.Parse(productInfo.ExArticleId_5), true, bllMall.WebsiteOwner); if (model5 != null) { exContent5 = model5.ActivityDescription; } } #endregion #region 价格配置 var priceConfigListSource = bllMall.GetList <ProductPriceConfig>(string.Format(" WebsiteOwner='{0}' And ProductId='{1}' ", bllMall.WebsiteOwner, productId)); priceConfigListSource = priceConfigListSource.OrderBy(p => p.Date).ToList(); var priceConfigList = from p in priceConfigListSource select new { id = p.AutoId, date = p.Date, price = p.Price }; #endregion var storeInfo = new JuActivityInfo(); if (!string.IsNullOrEmpty(supplierId)) { storeInfo = bllMall.Get <JuActivityInfo>(string.Format(" K5='{0}'", supplierId)); if (storeInfo == null) { storeInfo = new JuActivityInfo(); } } dynamic data = null; data = new { product_id = productInfo.PID, category_id = productInfo.CategoryId, category_name = bllMall.GetWXMallCategoryName(productInfo.CategoryId), title = productInfo.PName, product_summary = productInfo.Summary, quote_price = productInfo.PreviousPrice, price = bllMall.GetShowPrice(productInfo), base_price = productInfo.BasePrice, score = productInfo.Score, is_cashpay_only = productInfo.IsCashPayOnly, img_url = bllMall.GetImgUrl(productInfo.RecommendImg), is_onsale = (!string.IsNullOrEmpty(productInfo.IsOnSale) && productInfo.IsOnSale == "1") ? 1 : 0, tags = productInfo.Tags, is_collect = IsCollectProduct(int.Parse(productInfo.PID), productInfo.ArticleCategoryType), show_img_list = showImgList, is_promotion_product = productInfo.IsPromotionProduct, promotion_price = bllMall.GetMinPrommotionPrice(int.Parse(productInfo.PID)), promotion_start_time = productInfo.PromotionStartTime, promotion_stop_time = productInfo.PromotionStopTime, promotion_count = bllMall.GetProductTotalPromotionSaleStock(int.Parse(productInfo.PID)), promotion_stock = bllMall.GetProductTotalStockPromotion(int.Parse(productInfo.PID)), skus = skus, product_desc = productInfo.PDescription, pre_product_id = bllMall.GetPreProductId(int.Parse(productInfo.PID)), next_product_id = bllMall.GetNextProductId(int.Parse(productInfo.PID)), product_code = productInfo.ProductCode, current_product_index = bllMall.GetCurrentProductIndex(int.Parse(productInfo.PID)), total_product_count = bllMall.GetTotalProductCount(), sale_count = productInfo.SaleCount, relation_product_id = productInfo.RelationProductId, totalcount = bllMall.GetProductTotalStock(int.Parse(productInfo.PID)), group_buy_rule_list = from r in bllMall.GetProductGroupBuyRuleList(productInfo.PID) select new { rule_id = r.RuleId, rule_name = r.RuleName, head_discount = r.HeadDiscount, head_price = Math.Round((decimal)productInfo.Price * (decimal)(r.HeadDiscount / 10), 2), member_discount = r.MemberDiscount, member_price = Math.Round((decimal)productInfo.Price * (decimal)(r.MemberDiscount / 10), 2), people_count = r.PeopleCount, expire_day = r.ExpireDay }, collect_count = collect.GetProductCollectCount(productInfo.PID, "ProductCollect"), ex_article_title_1 = productInfo.ExArticleTitle_1, ex_article_title_2 = productInfo.ExArticleTitle_2, ex_article_title_3 = productInfo.ExArticleTitle_3, ex_article_title_4 = productInfo.ExArticleTitle_4, ex_article_title_5 = productInfo.ExArticleTitle_5, ex_article_id_1 = productInfo.ExArticleId_1, ex_article_id_2 = productInfo.ExArticleId_2, ex_article_id_3 = productInfo.ExArticleId_3, ex_article_id_4 = productInfo.ExArticleId_4, ex_article_id_5 = productInfo.ExArticleId_5, ex_content_1 = exContent1, ex_content_2 = exContent2, ex_content_3 = exContent3, ex_content_4 = exContent4, ex_content_5 = exContent5, access_level = productInfo.AccessLevel, buy_time = productInfo.LimitBuyTime, price_config_list = priceConfigList, relevant_product_ids = productInfo.RelevantProductIds, relevant_product = GetRelevantProduct(productInfo), is_no_express = productInfo.IsNoExpress, min_price = productInfo.MinPrice, max_price = productInfo.MaxPrice, review_score = productInfo.ReviewScore, rebate_score = bllScore.CalcProductRebateScore(productInfo, currUserRebateScoreRate, 1, true), is_appointment = productInfo.IsAppointment, appointment_info = bllMall.GetProductAppointmentInfo(productInfo),//预购信息 address = productInfo.Address, //property_data=propData//规格信息 ex2 = productInfo.Ex2, ex3 = productInfo.Ex3, ex4 = productInfo.Ex4, ex5 = productInfo.Ex5, ex6 = productInfo.Ex6, ex7 = productInfo.Ex7, ex8 = productInfo.Ex8, ex9 = productInfo.Ex9, ex10 = productInfo.Ex10, ex11 = productInfo.Ex11, ex12 = productInfo.Ex12, ex13 = productInfo.Ex13, ex14 = productInfo.Ex14, ex15 = productInfo.Ex15, ex16 = productInfo.Ex16, ex17 = productInfo.Ex17, ex18 = productInfo.Ex18, ex19 = productInfo.Ex19, supplier_name = storeInfo.ActivityName }; #region 访问记录统计 ShopDetailOpenStatisticsThread sParms = new ShopDetailOpenStatisticsThread() { HttpContextCurrent = HttpContext.Current, WebsiteOwner = bllMall.WebsiteOwner, ProductId = int.Parse(productId), EventUserID = bllMall.IsLogin? bllMall.GetCurrUserID():"" }; Thread t = new Thread(new ThreadStart(sParms.ShopDetailOpenStatistics)); t.Start(); #endregion return(ZentCloud.Common.JSONHelper.ObjectToJson(data)); } catch (Exception ex) { resp.errcode = -1; resp.errmsg = ex.ToString(); return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } }
public void ProcessRequest(HttpContext context) { JuActivityInfo ninfo = new JuActivityInfo(); ninfo.WebsiteOwner = bll.WebsiteOwner; ninfo.UserID = currentUserInfo.UserID; ninfo.ArticleType = context.Request["ArticleType"]; #region 字段检查 ArticleCategoryTypeConfig typeConfig = bllArticleCategory.GetArticleCategoryTypeConfig(bllArticleCategory.WebsiteOwner, ninfo.ArticleType); if (typeConfig.TimeSetMethod == 1 || typeConfig.TimeSetMethod == 2) { ninfo.UserLongitude = context.Request["UserLongitude"]; ninfo.UserLatitude = context.Request["UserLatitude"]; } List <TableFieldMapping> listFieldList = bllTableFieldMap.GetTableFieldMapByWebsite(bllTableFieldMap.WebsiteOwner, "ZCJ_JuActivityInfo", ninfo.ArticleType, null, "0", null); List <string> DefFields = new List <string>() { "JuActivityID" }; JObject jtCurUser = JObject.FromObject(ninfo); List <string> listPropertys = jtCurUser.Properties().Select(p => p.Name).ToList(); foreach (var item in listFieldList.Where(p => !DefFields.Contains(p.Field) && listPropertys.Contains(p.Field)).OrderBy(p => p.Sort)) { string nValue = context.Request[item.Field]; if (item.FieldIsNull == 1 && string.IsNullOrWhiteSpace(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "请完善" + item.MappingName; bllTableFieldMap.ContextResponse(context, apiResp); return; } if (!string.IsNullOrWhiteSpace(item.FormatValiFunc)) { #region 检查数据格式 //检查数据格式 if (item.FormatValiFunc == "number") { if (!MyRegex.IsNumber(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "phone")//email检查 { if (!MyRegex.PhoneNumLogicJudge(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "email")//email检查 { if (!MyRegex.EmailLogicJudge(nValue)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "url") //url检查 { System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址 System.Text.RegularExpressions.Match match = regUrl.Match(nValue); if (!match.Success) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bllTableFieldMap.ContextResponse(context, apiResp); return; } } #endregion } ninfo = bll.ConvertToModel <JuActivityInfo>(ninfo, item.Field, nValue); } #endregion ninfo.JuActivityID = int.Parse(bll.GetGUID(BLLJIMP.TransacType.AddOutlets)); if (bll.Add(ninfo)) { apiResp.status = true; apiResp.msg = "提交成功"; apiResp.code = (int)APIErrCode.IsSuccess; } else { apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bll.ContextResponse(context, apiResp); }
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"); //} }
public void ProcessRequest(HttpContext context) { string data = context.Request["data"]; if (string.IsNullOrEmpty(data)) { apiResp.msg = " data 参数必传"; bll.ContextResponse(context, apiResp); return; } //模型 ActivityDataModel requestModel; try { requestModel = ZentCloud.Common.JSONHelper.JsonToModel <ActivityDataModel>(data); } catch (Exception ex) { apiResp.msg = "格式错误,请检查。错误信息:" + ex.Message; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.activity_id)) { apiResp.msg = " activity_id 必传"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.name)) { apiResp.msg = " 请填写联系人姓名"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.phone)) { apiResp.msg = " 请填写联系人手机号"; bll.ContextResponse(context, apiResp); return; } if (bll.GetCount <ActivityDataInfo>(string.Format(" ActivityId={0} And Name='{1}' And Phone='{2}' And GroupType='{3}' And IsMember='{4}'", requestModel.activity_id, requestModel.name, requestModel.phone, requestModel.group_type, requestModel.member_type)) > 0) { apiResp.msg = " 重复添加"; bll.ContextResponse(context, apiResp); return; } JuActivityInfo activity = bll.GetActivity(requestModel.activity_id); ActivityDataInfo model = new ActivityDataInfo(); var newActivityUID = 1001; var lastActivityDataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", requestModel.activity_id)); if (lastActivityDataInfo != null) { newActivityUID = lastActivityDataInfo.UID + 1; } model.UID = newActivityUID; model.ActivityID = requestModel.activity_id; model.ActivityName = bll.GetActivity(model.ActivityID).ActivityName; model.InsertDate = DateTime.Now; model.Phone = requestModel.phone; model.OrderId = bll.GetGUID(BLLJIMP.TransacType.CommAdd); if (!string.IsNullOrEmpty(requestModel.amount)) { model.Amount = decimal.Parse(requestModel.amount); } model.BirthDay = requestModel.birthDay; model.DateRange = string.Format("{0}-{1}", activity.BeginDate, activity.EndDate); model.Email = requestModel.email; model.GroupType = requestModel.group_type; model.IsMember = requestModel.member_type; model.Name = requestModel.name; model.Phone = requestModel.phone; model.Sex = requestModel.sex; model.UserId = requestModel.user_id; model.UserRemark = requestModel.remark; model.ActivityType = "activity"; model.PaymentStatus = requestModel.is_pay; model.WebsiteOwner = bll.WebsiteOwner; if (bll.Add(model)) { apiResp.status = true; apiResp.msg = "ok"; apiResp.result = new { order_id = model.OrderId }; } else { apiResp.msg = "提交失败"; } bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string data = context.Request["data"]; RequestModel requestModel; try { requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(context.Request["data"]); } catch (Exception) { resp.errcode = -1; resp.errmsg = "json格式错误,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (string.IsNullOrEmpty(requestModel.activity_id)) { resp.errmsg = "activity_id 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (requestModel.field_index <= 0) { resp.errmsg = "field_index 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (string.IsNullOrEmpty(requestModel.field_name)) { resp.errmsg = "field_name 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (requestModel.field_index >= 61) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; resp.errmsg = "最多只能添加60个扩展字段"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(requestModel.activity_id), false); if (juActivity == null) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; resp.errmsg = "没有找到该活动"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } ActivityFieldMappingInfo fieldMap = new ActivityFieldMappingInfo(); fieldMap.ActivityID = juActivity.SignUpActivityID; fieldMap.ExFieldIndex = requestModel.field_index; fieldMap.MappingName = requestModel.field_name; fieldMap.FieldIsNull = requestModel.field_null; fieldMap.FormatValiFunc = requestModel.field_format_vali_func; fieldMap.FormatValiExpression = requestModel.field_format_vali_expression; fieldMap.FieldType = requestModel.field_type; fieldMap.IsMultiline = requestModel.field_multiline; if (bll.Update(fieldMap)) { resp.errmsg = "ok"; resp.isSuccess = true; } else { resp.errmsg = "修改出错"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// /// </summary> /// <param name="curUser"></param> /// <param name="author"></param> /// <param name="activity"></param> /// <returns></returns> public bool RewardJuActivity(UserInfo curUser, UserInfo author, JuActivityInfo activity, double score, string websiteOwner, out string msg, string scoreName = "积分", string actionName = "赠送") { msg = ""; msg = string.Format("{0}{1}完成", actionName, scoreName); if (author == null && activity == null) { msg = string.Format("{0}目标不能为空", actionName); return(false); } DateTime curTime = DateTime.Now; BLLSystemNotice bllSystemNotice = new BLLSystemNotice(); BLLUser bllUser = new BLLUser(); UserScoreDetailsInfo scoreModel = new UserScoreDetailsInfo(); #region 打赏明细 scoreModel.Score = 0 - score; scoreModel.ScoreType = "Reward"; scoreModel.UserID = curUser.UserID; scoreModel.WebSiteOwner = websiteOwner; scoreModel.AddTime = curTime; scoreModel.AddNote = string.Format("{0}消耗{1}", actionName, scoreName); if (activity != null) { scoreModel.RelationID = activity.JuActivityID.ToString(); } if (author != null) { scoreModel.Ex1 = author.AutoID.ToString(); } #endregion SystemNotice systemNotice = new SystemNotice(); #region 打赏通知 systemNotice.Title = scoreModel.AddNote; if (activity != null) { systemNotice.Ncontent = string.Format("您{0}了<a href=\"{6}\">{7}</a>{1}{2}{3} : <a href=\"{4}\">{5}</a>", actionName, bllSystemNotice.GetArticleTypeName(activity.ArticleType, websiteOwner), score, scoreName, bllSystemNotice.GetArticleLink(activity.JuActivityID, websiteOwner, activity.ArticleType), bllSystemNotice.GetArticleLinkText(activity), bllSystemNotice.GetUserLink(author.AutoID, websiteOwner), bllUser.GetUserDispalyName(author) ); } else { systemNotice.Ncontent = string.Format("您{0}了<a href=\"{4}\">{1}</a>{2}{3}", actionName, bllUser.GetUserDispalyName(author), score, scoreName, bllSystemNotice.GetUserLink(author.AutoID, websiteOwner)); } systemNotice.NoticeType = (int)BLLSystemNotice.NoticeType.Reward; systemNotice.InsertTime = curTime; systemNotice.WebsiteOwner = websiteOwner; systemNotice.SendType = 2; systemNotice.UserId = curUser.UserID; systemNotice.Receivers = curUser.UserID; #endregion 打赏通知 UserScoreDetailsInfo scoreGetModel = new UserScoreDetailsInfo(); SystemNotice systemNoticeGet = new SystemNotice(); #region 获赏明细 if (author != null) { scoreGetModel.Score = score; scoreGetModel.ScoreType = "GetReward"; scoreGetModel.UserID = author.UserID; scoreGetModel.WebSiteOwner = websiteOwner; scoreGetModel.AddTime = curTime; scoreGetModel.AddNote = string.Format("获得{0}{1}", actionName, scoreName); if (activity != null) { scoreGetModel.RelationID = activity.JuActivityID.ToString(); } scoreGetModel.Ex1 = curUser.AutoID.ToString(); #region 获赏通知 systemNoticeGet.Title = scoreGetModel.AddNote; if (activity != null) { systemNoticeGet.Ncontent = string.Format("您的{0}获得了<a href=\"{1}\">{2}</a>{3}的{4}{5} : <a href=\"{6}\">{7}</a>", bllSystemNotice.GetArticleTypeName(activity.ArticleType, websiteOwner), bllSystemNotice.GetUserLink(curUser.AutoID, websiteOwner), bllUser.GetUserDispalyName(curUser), actionName, score, scoreName, bllSystemNotice.GetArticleLink(activity.JuActivityID, websiteOwner, activity.ArticleType), bllSystemNotice.GetArticleLinkText(activity)); } else { systemNoticeGet.Ncontent = string.Format("您获得了<a href=\"{0}\">{1}</a>{2}的{3}{4}", bllSystemNotice.GetUserLink(curUser.AutoID, websiteOwner), bllUser.GetUserDispalyName(curUser), actionName, score, scoreName); } systemNoticeGet.NoticeType = (int)BLLSystemNotice.NoticeType.GetReward; systemNoticeGet.InsertTime = curTime; systemNoticeGet.WebsiteOwner = websiteOwner; systemNoticeGet.SendType = 2; systemNoticeGet.UserId = author.UserID; systemNoticeGet.Receivers = author.UserID; #endregion 打赏通知 } #endregion ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction(); #region 打赏用户积分处理 if (Update(curUser, string.Format(" TotalScore = TotalScore - {0}", score), string.Format(" AutoID = {0} And TotalScore>= {1}", curUser.AutoID, score), tran) <= 0) { tran.Rollback(); msg = string.Format("{0}失败,可能是{1}不足", actionName, scoreName); return(false); } curUser = GetByKey <UserInfo>("AutoID", curUser.AutoID.ToString(), false, tran: tran); scoreModel.TotalScore = curUser.TotalScore; if (!Add(scoreModel, tran)) { tran.Rollback(); msg = string.Format("{0}记录{1}明细出错", actionName, scoreName); return(false); } systemNotice.SerialNum = GetGUID(TransacType.SendSystemNotice); if (!Add(systemNotice, tran)) { tran.Rollback(); msg = string.Format("{0}{1}通知出错", actionName, scoreName); return(false); } #endregion #region 打赏目标用户积分处理 if (author != null) { if (Update(author, string.Format(" TotalScore = TotalScore + {0}", score), string.Format(" AutoID = {0} ", author.AutoID), tran) <= 0) { tran.Rollback(); msg = string.Format("{0}目标用户加{1}出错", actionName, scoreName); return(false); } author = GetByKey <UserInfo>("AutoID", author.AutoID.ToString(), false, tran: tran); scoreGetModel.TotalScore = author.TotalScore; if (!Add(scoreGetModel, tran)) { tran.Rollback(); msg = string.Format("{0}目标用户记录{1}明细出错", actionName, scoreName); return(false); } systemNoticeGet.SerialNum = GetGUID(TransacType.SendSystemNotice); if (!Add(systemNoticeGet, tran)) { tran.Rollback(); msg = string.Format("获得{0}{1}通知出错", actionName, scoreName); return(false); } } #endregion #region 打赏目标积分处理 if (activity != null) { double sumScore = GetSumScore(websiteOwner, "GetReward", activity.JuActivityID.ToString(), "", tran); if (Update(activity, string.Format(" RewardTotal={0}", sumScore), string.Format(" JuActivityID = {0} ", activity.JuActivityID), tran) <= 0) { tran.Rollback(); msg = string.Format("{0}目标加{1}出错", actionName, scoreName); return(false); } } #endregion tran.Commit(); return(true); }
/// <summary> /// 获取竞赛状态 /// </summary> /// <param name="activity"></param> /// <param name="userInfo"></param> /// <returns></returns> public string GetMyMatchStatus(JuActivityInfo activity, UserInfo userInfo) { var data = Get <ActivityDataInfo>(string.Format("ActivityId={0} And UserId='{1}'", activity.JuActivityID, userInfo.UserID)); return(GetMyMatchStatus(data)); }
public void ProcessRequest(HttpContext context) { ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction(); try { string json = context.Request["data"]; ActivityModel requestModel = ZentCloud.Common.JSONHelper.JsonToModel <ActivityModel>(json);//jSON 反序 JuActivityInfo model = bll.GetActivity(requestModel.activity_id); //model.ActivityId = bll.GetGUID(BLLJIMP.TransacType.CommAdd); model.ThumbnailsPath = requestModel.activity_img; model.ActivityName = requestModel.activity_name; //model.ActivityType = "match"; model.ActivityDescription = requestModel.description; // model.InsertDate = DateTime.Now; model.IsFee = requestModel.is_need_pay; model.MainPoints = requestModel.main_points; model.Summary = requestModel.summary; //model.Websiteowner = bll.WebsiteOwner; if (!bll.Update(model, tran)) { tran.Rollback(); apiResp.msg = "添加失败"; bll.ContextResponse(context, apiResp); return; } if (requestModel.is_need_pay == 1) { #region 除旧选项 var oldItems = bll.ActivityItemList(requestModel.activity_id); foreach (var item in oldItems) { if (requestModel.items.Count(p => p.item_id == item.AutoId.ToString()) == 0) { if (bll.Delete(item) == 0) { tran.Rollback(); apiResp.msg = "操作失败"; bll.ContextResponse(context, apiResp); return; } } } #endregion foreach (var item in requestModel.items) { #region 添加选项 if (string.IsNullOrEmpty(item.item_id))//添加 { if (string.IsNullOrEmpty(item.from_date)) { tran.Rollback(); apiResp.msg = "请输入开始时间"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(item.from_date)) { tran.Rollback(); apiResp.msg = "请输入结束时间"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(item.amount)) { tran.Rollback(); apiResp.msg = "请输入金额"; bll.ContextResponse(context, apiResp); return; } if (requestModel.items.Count(p => p.from_date == item.from_date && p.to_date == item.to_date && p.group_type == item.group_type && p.is_member == item.is_member) > 1) { tran.Rollback(); apiResp.msg = "时间,组别,会员类型不能重复"; bll.ContextResponse(context, apiResp); return; } MeifanActivityItem itemModel = new MeifanActivityItem(); itemModel.ActivityId = model.JuActivityID.ToString(); itemModel.Amount = decimal.Parse(item.amount); itemModel.FromDate = Convert.ToDateTime(item.from_date).ToString("yyyy/MM/dd HH:mm"); itemModel.ToDate = Convert.ToDateTime(item.to_date).ToString("yyyy/MM/dd HH:mm"); itemModel.GroupType = item.group_type; itemModel.IsMember = item.is_member; if (!bll.Add(itemModel)) { tran.Rollback(); apiResp.msg = "操作失败"; bll.ContextResponse(context, apiResp); return; } } #endregion #region 编辑选项 else//编辑 { MeifanActivityItem itemModel = bll.Get <MeifanActivityItem>(string.Format(" AutoId={0}", item.item_id)); itemModel.ActivityId = model.JuActivityID.ToString(); itemModel.Amount = decimal.Parse(item.amount); itemModel.FromDate = Convert.ToDateTime(item.from_date).ToString("yyyy/MM/dd HH:mm"); itemModel.ToDate = Convert.ToDateTime(item.to_date).ToString("yyyy/MM/dd HH:mm"); itemModel.GroupType = item.group_type; itemModel.IsMember = item.is_member; if (!bll.Update(itemModel)) { tran.Rollback(); apiResp.msg = "操作失败"; bll.ContextResponse(context, apiResp); return; } } #endregion } } tran.Commit(); apiResp.status = true; } catch (Exception ex) { tran.Rollback(); apiResp.msg = "操作失败"; bll.ContextResponse(context, apiResp); return; } bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string activityId = context.Request["activity_id"]; if (string.IsNullOrEmpty(activityId)) { resp.errcode = 1; resp.errmsg = "activityid 参数为空,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } ActivityDataInfo activityInfo = bllTrueActivity.GetActivityDataInfo(activityId, bll.GetCurrUserID()); bool isEnroll = false; if (activityInfo == null) { isEnroll = true; } JuActivityInfo model = bll.GetJuActivity(int.Parse(activityId), true); bll.Update(model, string.Format("PV+=1"), string.Format(" JuActivityID={0}", model.JuActivityID)); RequestModel requestModel = new RequestModel(); requestModel.signfield = new List <signfield>(); requestModel.activity_id = model.JuActivityID; requestModel.activity_img_url = bll.GetImgUrl(model.ThumbnailsPath); requestModel.activity_name = model.ActivityName; requestModel.activity_address = model.ActivityAddress; requestModel.category_name = model.CategoryName; requestModel.activity_pv = model.PV; requestModel.activity_signcount = model.SignUpTotalCount; requestModel.activity_summary = model.Summary; requestModel.is_enroll = isEnroll; if (model.ActivityStartDate != null) { requestModel.activity_start_time = bll.GetTimeStamp((DateTime)model.ActivityStartDate); } if (model.IsHide == 1) { requestModel.activity_status = 1; } if ((model.MaxSignUpTotalCount > 0) && (model.SignUpTotalCount >= model.MaxSignUpTotalCount)) { requestModel.activity_status = 2; } requestModel.activity_content = model.ActivityDescription; if (model.ActivityDescription.Contains("/FileUpload/")) { requestModel.activity_content = model.ActivityDescription.Replace("/FileUpload/", string.Format("http://{0}/FileUpload/", context.Request.Url.Host)); } requestModel.activity_score = model.ActivityIntegral; requestModel.activity_commentcount = bllReview.GetReviewCount(BLLJIMP.Enums.ReviewTypeKey.ArticleComment, model.JuActivityID.ToString(), null); var fieldlist = bllTrueActivity.GetActivityFieldMappingList(model.SignUpActivityID); foreach (var item in fieldlist) { signfield signModel = new signfield(); signModel.key = item.MappingName; signModel.value = item.FieldName; signModel.isnull = item.FieldIsNull; requestModel.signfield.Add(signModel); } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(requestModel)); }
public void ProcessRequest(HttpContext context) { Add.PostModel requestModel = new Add.PostModel();//订单模型 try { requestModel = bllJuActivity.ConvertRequestToModel <Add.PostModel>(requestModel); } catch (Exception ex) { apiResp.msg = "提交格式错误"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } //数据检查 if (string.IsNullOrEmpty(requestModel.title)) { apiResp.msg = "标题必填"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } JuActivityInfo pInfo = bllJuActivity.GetByKey <JuActivityInfo>("JuActivityID", requestModel.id.ToString(), true); pInfo = bllJuActivity.GetByKey <JuActivityInfo>("JuActivityID", requestModel.id.ToString(), true); if (pInfo == null) { apiResp.msg = "网点未找到"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } pInfo.ActivityName = requestModel.title; pInfo.ActivityAddress = requestModel.address; pInfo.ServerTimeMsg = requestModel.server_time; pInfo.ServicesMsg = requestModel.server_msg; pInfo.ThumbnailsPath = requestModel.img; pInfo.ArticleType = "Outlets"; pInfo.CategoryId = requestModel.cate_id; pInfo.Province = requestModel.province; pInfo.ProvinceCode = requestModel.province_code; pInfo.City = requestModel.city; pInfo.CityCode = requestModel.city_code; pInfo.District = requestModel.district; pInfo.DistrictCode = requestModel.district_code; pInfo.K1 = requestModel.k1; pInfo.K4 = requestModel.k4; pInfo.Tags = requestModel.tags; pInfo.Sort = requestModel.sort; pInfo.UserLongitude = requestModel.longitude; pInfo.UserLatitude = requestModel.latitude; pInfo.IsHide = 0; pInfo.CreateDate = DateTime.Now; pInfo.LastUpdateDate = DateTime.Now; pInfo.WebsiteOwner = bllJuActivity.WebsiteOwner; pInfo.UserID = currentUserInfo.UserID; List <string> tagList = null; if (!string.IsNullOrWhiteSpace(pInfo.Tags)) { tagList = pInfo.Tags.Split(',').ToList(); } BLLTransaction tran = new BLLTransaction(); bool result = bllJuActivity.Update(pInfo, tran); if (!result) { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } result = bllJuActivity.SetJuActivityContentTags(pInfo.JuActivityID, tagList); if (result) { tran.Commit(); apiResp.status = true; apiResp.msg = "提交完成"; apiResp.code = (int)APIErrCode.IsSuccess; } else { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bllJuActivity.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { try { string activityId = context.Request["activity_id"]; int pageIndex = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1; int pageSize = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10; string keyWord = context.Request["keyword"]; if (string.IsNullOrEmpty(activityId)) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; resp.errmsg = "activity_id 为必填项,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(activityId), false); if (juActivity == null) { resp.errmsg = "不存在该条活动"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } System.Text.StringBuilder sbWhere = new System.Text.StringBuilder(string.Format(" WebSiteOwner='{0}' AND isDelete=0 AND ActivityID='{1}' ", bllActivity.WebsiteOwner, juActivity.SignUpActivityID)); if (!string.IsNullOrEmpty(keyWord)) { sbWhere.AppendFormat(" AND Name like '%{0}%' ", keyWord); } int totalCount = bllActivity.GetCount <ActivityDataInfo>(sbWhere.ToString()); var dataList = bllActivity.GetLit <ActivityDataInfo>(pageSize, pageIndex, sbWhere.ToString()); List <ActivityFieldMappingInfo> fieldMapList = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID); resp.isSuccess = true; List <dynamic> list = new List <dynamic>(); List <dynamic> maplist = new List <dynamic>(); var fieldlist = bllActivity.GetActivityFieldMappingList(juActivity.SignUpActivityID); foreach (var item in fieldlist) { maplist.Add(new { key = item.MappingName, value = item.FieldName }); } for (int i = 0; i < dataList.Count; i++) { list.Add(new { name = dataList[i].Name, phone = dataList[i].Phone, insert_time = bllActivity.GetTimeStamp(dataList[i].InsertDate), k1 = dataList[i].K1, k2 = dataList[i].K2, k3 = dataList[i].K3, k4 = dataList[i].K4, k5 = dataList[i].K5, k6 = dataList[i].K6, k7 = dataList[i].K7, k8 = dataList[i].K8, k9 = dataList[i].K9, k10 = dataList[i].K10, k11 = dataList[i].K11, k12 = dataList[i].K12, k13 = dataList[i].K13, k14 = dataList[i].K14, k15 = dataList[i].K15, k16 = dataList[i].K16, k17 = dataList[i].K17, k18 = dataList[i].K18, k19 = dataList[i].K19, k20 = dataList[i].K20, k21 = dataList[i].K21, k22 = dataList[i].K22, k23 = dataList[i].K23, k24 = dataList[i].K24, k25 = dataList[i].K25, k26 = dataList[i].K26, k27 = dataList[i].K27, k28 = dataList[i].K28, k29 = dataList[i].K29, k30 = dataList[i].K30, k31 = dataList[i].K31, k32 = dataList[i].K32, k33 = dataList[i].K33, k34 = dataList[i].K34, k35 = dataList[i].K35, k36 = dataList[i].K36, k37 = dataList[i].K37, k38 = dataList[i].K38, k39 = dataList[i].K39, k40 = dataList[i].K40, k41 = dataList[i].K41, k42 = dataList[i].K42, k43 = dataList[i].K43, k44 = dataList[i].K44, k45 = dataList[i].K45, k46 = dataList[i].K46, k47 = dataList[i].K47, k48 = dataList[i].K48, k49 = dataList[i].K49, k50 = dataList[i].K50, k51 = dataList[i].K51, k52 = dataList[i].K52, k53 = dataList[i].K53, k54 = dataList[i].K54, k55 = dataList[i].K55, k56 = dataList[i].K56, k57 = dataList[i].K57, k58 = dataList[i].K58, k59 = dataList[i].K59, k60 = dataList[i].K60, }); } var data = new { totalcount = totalCount, list = list, }; resp.returnObj = new { data = data, maplist = maplist }; } catch (Exception ex) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; resp.errmsg = ex.Message; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
protected void Page_Load(object sender, EventArgs e) { try { if (!bll.IsLogin) { Response.Write("该活动不支持扫码签到,请联系管理员"); Response.End(); } //取得当前访问用户 //取得要签到的活动 //记录签到日志并入库 int juActivityID = Convert.ToInt32(Request["id"]); UserInfo currUser = bll.GetCurrentUserInfo(); //查询活动是否存在 juActivityInfo = bll.GetJuActivity(juActivityID); //if (juActivityInfo == null) //{ // juActivityInfo = bll.GetJuActivityByActivityID(juActivityID.ToString()); //} if (juActivityInfo == null) { Response.Write("对不起,您签到的活动不存在!"); Response.End(); } ActivityDataInfo dataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID={0} And IsDelete=0 And (WeixinOpenID='{1}' Or UserId='{2}')", juActivityInfo.SignUpActivityID, currUser.WXOpenId, currUser.UserID)); if (dataInfo == null) { //lbMsg.InnerText = "请先报名再签到"; NeedSignUp = true; return; } WXSignInInfo signInInfo = new WXSignInInfo(); signInInfo.SignInUserID = currUser.UserID; signInInfo.Name = dataInfo.Name; signInInfo.Phone = dataInfo.Phone; signInInfo.JuActivityID = juActivityID; signInInfo.SignInOpenID = currUser.WXOpenId; signInInfo.SignInTime = DateTime.Now; //判断是否已经签到过 if (this.bll.Exists(signInInfo, new List <string>() { "SignInUserID", "JuActivityID" })) { //lbMsg.InnerText = "您已经签过到了!"; // return; IsHaveSignIn = true; return; } if (this.bll.Add(signInInfo)) { bllUser.AddUserScoreDetail(currUser.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.SignIn), currUser.WebsiteOwner, null, null); //lbMsg.InnerText = "签到成功!"; IsSignInSuccess = true; } else { Response.Write("签到失败"); Response.End(); } } catch (Exception ex) { Response.Write(ex.Message); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { string activityId = Request["activityId"];//报名活动ID if (string.IsNullOrEmpty(activityId)) { Response.Write("活动ID 必传"); Response.End(); } JuActivityInfo activityInfo = bllJuactivity.GetJuActivity(int.Parse(activityId)); if (activityInfo == null) { Response.Write("活动不存在"); Response.End(); } ActivityName = activityInfo.ActivityName; List <MonitorLinkInfo> linkInfoList = bllActivity.GetList <MonitorLinkInfo>(string.Format(" WebsiteOwner='{0}' AND MonitorPlanID={1}", bllActivity.WebsiteOwner, activityInfo.MonitorPlanID)); if (linkInfoList.Count == 0) { Response.Write("没有转发"); Response.End(); } string uids = "";//转发人用户id foreach (var item in linkInfoList) { uids += "'" + item.LinkName + "'" + ","; } uids = uids.TrimEnd(','); List <UserInfo> userInfoList = bllUser.GetList <UserInfo>(string.Format(" UserId in ({0})", uids)); UserList = new List <UserModel>(); if (userInfoList.Count > 0) { foreach (UserInfo item in userInfoList) { UserModel model = new UserModel(); model.HeadImg = item.WXHeadimgurl; model.ShowName = item.TrueName; model.SpreadCount = bllUser.GetCount <UserInfo>(string.Format(" WebsiteOwner='{0}' AND ArticleId='{1}' AND DistributionOwner='{2}' ", bllUser.WebsiteOwner, activityId, item.UserID)); UserList.Add(model); } } UserList = UserList.OrderByDescending(p => p.SpreadCount).ToList(); //List<UserInfo> userModelList = bllUser.GetList<UserInfo>(string.Format(" WebsiteOwner='{0}' AND ArticleId='{1}' AND DistributionOwner!='' ", bllUser.WebsiteOwner, activityId)); //string ids = ""; //foreach (UserInfo item in userModelList) //{ // ids += "'" + item.DistributionOwner + "'" + ","; //} //ids = ids.TrimEnd(','); //List<UserInfo> userLit = new List<UserInfo>(); //if (userModelList.Count > 0) //{ // userLit=bllUser.GetList<UserInfo>(string.Format(" UserID in ({0})", ids)); //} //UserList = new List<UserModel>(); //foreach (UserInfo item in userLit) //{ // UserModel user = new UserModel(); // user.HeadImg = item.WXHeadimgurl; // user.ShowName = item.TrueName; // user.SpreadCount = userModelList.Where(p => p.DistributionOwner == item.UserID).Count(); // UserList.Add(user); //} //UserList = UserList.OrderByDescending(p => p.SpreadCount).ToList(); }
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); }
public void ProcessRequest(HttpContext context) { string title = context.Request["title"]; string detail = context.Request["detail"]; string time = context.Request["time"]; if (string.IsNullOrWhiteSpace(title) || string.IsNullOrWhiteSpace(detail)) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "标题,内容不能为空"; bllActivity.ContextResponse(context, resp); return; } string receiverOpenid = context.Request["receiveropenid"]; if (string.IsNullOrWhiteSpace(receiverOpenid)) { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = "接收者OpenId不能为空"; bllActivity.ContextResponse(context, resp); return; } string url = context.Request.Form["toUrl"]; string haveUrl = context.Request["haveUrl"]; if (string.IsNullOrWhiteSpace(time)) { time = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); } string accessToken = bllWeixin.GetAccessToken(); JToken sendData = JToken.Parse("{}"); sendData["touser"] = receiverOpenid; string activityId = string.Empty; if (!string.IsNullOrWhiteSpace(url)) { sendData["url"] = url; } else if (haveUrl == "1") { activityId = bllActivity.GetGUID(TransacType.ActivityAdd); sendData["url"] = "http://guoye.gotocloud8.net/customize/guoye/#/tongzhi/" + activityId; //SendData["url"] = "http://guoyetest.comeoncloud.net/customize/guoye/#/tongzhi/" + ActivityID; } sendData["K1"] = "标题:" + title; sendData["K2"] = detail; sendData["K3"] = time; sendData["K4"] = ""; resp.errmsg = bllWeixin.SendTemplateMessage(accessToken, keyValueId, sendData); if (!string.IsNullOrWhiteSpace(resp.errmsg)) { resp.errcode = (int)APIErrCode.OperateFail; bllActivity.ContextResponse(context, resp); return; } if (string.IsNullOrWhiteSpace(url) && haveUrl == "1") { JuActivityInfo activity = new JuActivityInfo(); activity.JuActivityID = Convert.ToInt32(activityId); activity.ActivityName = title; activity.ActivityDescription = detail; activity.ArticleType = CommonPlatform.Helper.EnumStringHelper.ToString(ContentType.Notice); activity.CategoryId = categoryId; activity.K8 = time; activity.K12 = context.Request["url"]; activity.K13 = context.Request["haveUrl"]; activity.WebsiteOwner = bllWeixin.WebsiteOwner; if (context.Session[SessionKey.UserID] == null) { activity.UserID = activity.WebsiteOwner; } else { activity.UserID = context.Session[SessionKey.UserID].ToString(); } if (bllActivity.Add(activity)) { resp.isSuccess = true; } else { resp.errmsg = "发送成功,但记录失败"; resp.errcode = (int)APIErrCode.OperateFail; } } else { resp.isSuccess = true; } bllActivity.ContextResponse(context, resp); }
protected void Page_Load(object sender, EventArgs e) { articleId = Request["articleId"]; if (articleId == null) { Response.End(); } int articleIdint; if (!int.TryParse(articleId, out articleIdint)) { Response.End(); } currentUserInfo = DataLoadTool.GetCurrUserModel(); currWebSiteUserInfo = bll.Get <UserInfo>(string.Format("UserID='{0}'", DataLoadTool.GetWebsiteInfoModel().WebsiteOwner));// JuActivityInfo articleInfo = bll.Get <JuActivityInfo>(string.Format("JuActivityID={0}", articleIdint)); if (articleInfo == null) { Response.End(); } if (!currentUserInfo.UserType.Equals(1)) { if (!articleInfo.WebsiteOwner.Equals(currentUserInfo.WebsiteOwner)) { Response.End(); } } var articleIdHex = Convert.ToString(articleIdint, 16); //文章活动ID十六进制 string pageUrl = string.Format("http://{0}/{1}/details.chtml", Request.Url.Host, articleIdHex); var rootList = bll.GetList <WebAccessLogsInfo>(string.Format("(Ex_PreSpreadUserID is null or Ex_PreSpreadUserID='') And (Ex_PreShareTimestamp is null or Ex_PreShareTimestamp='') And Ex_SpreadUserID !='' And Ex_SpreadUserID is not null And Ex_ShareTimestamp !='' And Ex_ShareTimestamp is not null And PageUrl like '{0}%' Order by AccessDate ASC", pageUrl)); //根节点 if (rootList.Count > 0) { rootList = rootList.DistinctBy(p => p.Ex_ShareTimestamp).ToList(); System.Text.StringBuilder sbRoot = new System.Text.StringBuilder(); for (int i = 0; i < rootList.Count; i++) { var item = rootList[i]; //int count = bll.GetCount<WebAccessLogsInfo>(string.Format("Ex_PreSpreadUserID='{0}' And Ex_PreShareTimestamp='{1}' Order by AccessDate ASC", item.Ex_SpreadUserID, item.Ex_ShareTimestamp)); var subList = bll.GetList <WebAccessLogsInfo>(string.Format("Ex_PreSpreadUserID='{0}' And Ex_PreShareTimestamp='{1}' Order by AccessDate ASC ", item.Ex_SpreadUserID, item.Ex_ShareTimestamp)); subList = subList.DistinctBy(p => p.Ex_ShareTimestamp).ToList(); int count = subList.Count; var isParent = false; if (count > 0) { isParent = true; } string wxNickName = "无昵称"; string wxHeadImg = "/zTree/css/zTreeStyle/img/diy/user.png"; string icon = "/zTree/css/zTreeStyle/img/diy/user.png"; var userInfo = bll.Get <UserInfo>(string.Format("UserID='{0}'", item.Ex_SpreadUserID)); if (userInfo != null) { if (!string.IsNullOrEmpty(userInfo.WXNickname)) { wxNickName = userInfo.WXNickname; } if (!string.IsNullOrEmpty(userInfo.WXHeadimgurlLocal)) { wxHeadImg = userInfo.WXHeadimgurlLocal; } else { if (!string.IsNullOrEmpty(userInfo.WXOpenId)) { //拉取用户信息并更新数据库 ZentCloud.BLLJIMP.Model.Weixin.WeixinUserInfo weixinInfo = bllWeixin.GetWeixinUserInfo(currWebSiteUserInfo.UserID, currWebSiteUserInfo.WeixinAppId, currWebSiteUserInfo.WeixinAppSecret, userInfo.WXOpenId); if (weixinInfo != null) { if (!string.IsNullOrEmpty(weixinInfo.NickName)) { userInfo.WXNickname = weixinInfo.NickName; } if (!string.IsNullOrEmpty(weixinInfo.HeadImgUrl)) { userInfo.WXHeadimgurl = weixinInfo.HeadImgUrl; } //bll.Update(userInfo); } } } } string tip = string.Format("<img src='{0}' align='absmiddle' width='100px' height='100px'/><br/>{1}<br/>被<span style='color:red;'>{2}</span>次转发", wxHeadImg, wxNickName, count); var title = string.Format("<span style='color:blue;'>{0}</span> <span style='color:red;'>{1}</span>转发 [{2}]", wxNickName, count, string.Format("{0:f}", item.AccessDate)); sbRoot.Append("{"); sbRoot.AppendFormat("name: \"{0}\", id: \"{1}\", count:{2}, times: 1, isParent:\"{3}\",Ex_SpreadUserID:\"{4}\",Ex_ShareTimestamp:\"{5}\",icon:\"{6}\",tip:\"{7}\"", title, item.AutoID, "1", isParent.ToString().ToLower(), item.Ex_SpreadUserID, item.Ex_ShareTimestamp, icon, tip); sbRoot.Append("}"); if (i < rootList.Count - 1)//追加分隔符 { sbRoot.Append(","); } } RootNodes = sbRoot.ToString(); } else { RootNodes = "{ name: \"暂时没有转发记录\", id: \"0\", count: 0, times: 1, isParent: false }"; } }
protected void Page_Load(object sender, EventArgs e) { activityInfo = bll.GetActivity(Request["activity_id"]); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string activityId = context.Request["activity_id"]; if (string.IsNullOrEmpty(activityId)) { apiResp.code = 1; apiResp.msg = "activity_id 为必填项,请检查"; bll.ContextResponse(context, apiResp); return; } JuActivityInfo juInfo = bll.GetJuActivity(int.Parse(activityId), true); if (juInfo == null) { apiResp.code = 4; apiResp.msg = "活动不存在!"; bll.ContextResponse(context, apiResp); return; } #region 是否可以报名 if (juInfo.ActivityStatus.Equals(1)) { apiResp.code = 2; apiResp.msg = "活动已停止"; bll.ContextResponse(context, apiResp); return; } if (juInfo.MaxSignUpTotalCount > 0)//检查报名人数 { if (juInfo.SignUpTotalCount > (juInfo.MaxSignUpTotalCount - 1)) { apiResp.code = 3; apiResp.msg = "报名人数已满"; bll.ContextResponse(context, apiResp); return; } } if (juInfo.ActivityIntegral > 0) { if (CurrentUserInfo.TotalScore < juInfo.ActivityIntegral) { apiResp.code = 4; apiResp.msg = "您的积分不足"; bll.ContextResponse(context, apiResp); return; } } if (juInfo.GuaranteeCreditAcount > 0) { if (CurrentUserInfo.CreditAcount < juInfo.GuaranteeCreditAcount) { apiResp.code = 6; apiResp.msg = "您的信用金不足"; bll.ContextResponse(context, apiResp); return; } } #endregion dicPar = bll.GetRequestParameter(); //string weixinOpenID = null; string activityIdBySignUp = juInfo.SignUpActivityID; string spreadUserId = null; dicPar.TryGetValue("SpreadUserID", out spreadUserId); string strDistinctKeys = null;//检查重复的字段,多个字段用,分隔, //没有此参数默认用手机检查 dicPar.TryGetValue("DistinctKeys", out strDistinctKeys); string monitorPlanID = null; dicPar.TryGetValue("MonitorPlanID", out monitorPlanID); string name = null; dicPar.TryGetValue("Name", out name); string phone = null; dicPar.TryGetValue("Phone", out phone); ActivityInfo activity = bll.Get <ActivityInfo>(string.Format("ActivityID='{0}'", activityIdBySignUp)); #region IP限制 //获取用户IP; string userHostAddress = context.Request.UserHostAddress; var count = DataCache.GetCache(userHostAddress); if (count != null) { int newCount = int.Parse(count.ToString()) + 1; DataCache.SetCache(userHostAddress, newCount); int limitCount = 1000; if (activity != null) { limitCount = activity.LimitCount; } if (newCount >= limitCount) { apiResp.code = 5; apiResp.msg = "您的提交过于频繁,请稍后再试"; bll.ContextResponse(context, apiResp); return; } } else { DataCache.SetCache(userHostAddress, 1, DateTime.MaxValue, new TimeSpan(4, 0, 0)); } #endregion #region 活动权限验证 if (juInfo == null) { apiResp.code = 6; apiResp.msg = "活动不存在!"; bll.ContextResponse(context, apiResp); return; } if (juInfo.ActivityStatus.Equals(1)) { apiResp.code = 7; apiResp.msg = "活动已关闭!"; bll.ContextResponse(context, apiResp); return; } if (activity.IsDelete.Equals(1)) { apiResp.code = 8; apiResp.msg = "活动已删除!"; bll.ContextResponse(context, apiResp); return; } #endregion #region 判断必填项 if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(phone)) { apiResp.code = 9; apiResp.msg = "姓名和手机不能为空!"; bll.ContextResponse(context, apiResp); return; } if ((!phone.StartsWith("1")) || (!phone.Length.Equals(11))) { apiResp.code = 10; apiResp.msg = "手机号码无效!"; bll.ContextResponse(context, apiResp); return; } #endregion #region 检查自定义必填项 List <ActivityFieldMappingInfo> listRequiredField = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}' And FieldIsNull=1", activity.ActivityID)); if (listRequiredField.Count > 0) { foreach (var requiredField in listRequiredField) { if (string.IsNullOrEmpty(dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", requiredField.ExFieldIndex))).Value)) { apiResp.code = 11; apiResp.msg = string.Format(" {0} 必填", requiredField.MappingName); bll.ContextResponse(context, apiResp); return; } } } #endregion #region 检查数据格式 //检查数据格式 List <ActivityFieldMappingInfo> activityFieldMapping = bll.GetList <ActivityFieldMappingInfo>(string.Format("ActivityID='{0}'", activity.ActivityID)); foreach (var item in activityFieldMapping) { string value = dicPar.SingleOrDefault(p => p.Key.Equals(string.Format("K{0}", item.ExFieldIndex))).Value; if (string.IsNullOrWhiteSpace(value)) { continue; } //检查数据格式 if (item.FormatValiFunc == "email")//email检查 { if (!ZentCloud.Common.ValidatorHelper.EmailLogicJudge(value)) { apiResp.code = 12; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bll.ContextResponse(context, apiResp); return; } } if (item.FormatValiFunc == "url") //url检查 { System.Text.RegularExpressions.Regex regUrl = new System.Text.RegularExpressions.Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"); //网址 System.Text.RegularExpressions.Match m = regUrl.Match(value); if (!m.Success) { apiResp.code = 13; apiResp.msg = string.Format("{0}格式不正确", item.MappingName); bll.ContextResponse(context, apiResp); return; } } } #endregion #region 检查是否已经报名 if (!string.IsNullOrEmpty(strDistinctKeys)) { if (!strDistinctKeys.Equals("none"))//自定义检查重复 { System.Text.StringBuilder sb = new System.Text.StringBuilder("1=1 "); string[] distinctKeys = strDistinctKeys.Split(','); foreach (var item in distinctKeys) { sb.AppendFormat("And {0}='{1}' ", item, dicPar.Single(p => p.Key.Equals(item)).Value); } sb.Append(" and IsDelete = 0 "); if (bll.GetCount <ActivityDataInfo>(sb.ToString()) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } else//不检查重复 { } } else//默认检查 { if (bll.GetCount <ActivityDataInfo>(string.Format("ActivityID='{0}' And Phone='{1}' and IsDelete = 0 ", activityIdBySignUp, phone)) > 0) { apiResp.code = 15; apiResp.msg = "已经报过名了!"; bll.ContextResponse(context, apiResp); return; } } #endregion var newActivityUID = 1001; var lastActivityDataInfo = bll.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityIdBySignUp)); if (lastActivityDataInfo != null) { newActivityUID = lastActivityDataInfo.UID + 1; } ActivityDataInfo model = bll.ConvertRequestToModel <ActivityDataInfo>(new ActivityDataInfo()); model.UID = newActivityUID; model.SpreadUserID = spreadUserId; model.ActivityID = activityIdBySignUp; if (juInfo.GuaranteeCreditAcount > 0) { if (model.GuaranteeCreditAcount < juInfo.GuaranteeCreditAcount) { apiResp.code = 18; apiResp.msg = string.Format("担保信用金不能少于{0}!", Convert.ToDouble(juInfo.GuaranteeCreditAcount)); bll.ContextResponse(context, apiResp); return; } } if (!string.IsNullOrEmpty(monitorPlanID)) { model.MonitorPlanID = int.Parse(monitorPlanID); } model.WebsiteOwner = bll.WebsiteOwner; model.UserId = CurrentUserInfo.UserID; model.WeixinOpenID = CurrentUserInfo.WXOpenId; if (context.Request["limit_userid_signupcount"] == "1")//限制每个登录账号只能报名一次 { if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 " , model.UserId, juInfo.SignUpActivityID)) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } if (context.Request["limit_wxopenid_signupcount"] == "1")//限制每个微信只能报名一次 { if (bll.GetCount <ActivityDataInfo>(string.Format(" UserId='{0}' AND ActivityID={1} AND IsDelete=0 " , model.WeixinOpenID, juInfo.SignUpActivityID)) > 0) { apiResp.code = 14; apiResp.msg = "重复的报名!"; bll.ContextResponse(context, apiResp); return; } } model.ArticleType = juInfo.ArticleType; model.CategoryId = juInfo.CategoryId; if (bll.Add(model)) { bll.PlusNumericalCol("SignUpCount", juInfo.JuActivityID);//报名数+1 //发消息给发布约会的人 PubUser = bllUser.GetUserInfo(juInfo.UserID); if (PubUser != null && context.Request["notice_publisher"] == "1") { bllSystemNotice.SendSystemMessage("“" + bllUser.GetUserDispalyName(CurrentUserInfo) + "”报名您的约会", juInfo.ActivityName, BLLJIMP.BLLSystemNotice.NoticeType.AppointmentNotice, BLLJIMP.BLLSystemNotice.SendType.Personal, PubUser.UserID, juInfo.JuActivityID.ToString()); } //发消息给自己 if (CurrentUserInfo != null && context.Request["notice_signupuser"] == "1") { bllSystemNotice.SendSystemMessage("你报名了一个约会冻结" + Convert.ToDouble(model.GuaranteeCreditAcount) + "信用金", juInfo.ActivityName, BLLJIMP.BLLSystemNotice.NoticeType.FinancialNotice, BLLJIMP.BLLSystemNotice.SendType.Personal, CurrentUserInfo.UserID, juInfo.JuActivityID.ToString()); } apiResp.msg = "ok"; apiResp.code = 0; apiResp.status = true; #region 当ActivityIntegral>0 扣积分 if (juInfo.ActivityIntegral > 0)//扣积分 { CurrentUserInfo.TotalScore -= juInfo.ActivityIntegral; if (bll.Update(CurrentUserInfo, string.Format("TotalScore={0}", CurrentUserInfo.TotalScore), string.Format(" AutoID={0}", CurrentUserInfo.AutoID)) <= 0) { apiResp.code = 16; apiResp.msg = "扣除用户积分失败"; bll.ContextResponse(context, apiResp); return; } else { // BLLJIMP.Model.WBHScoreRecord scoreRecord = new BLLJIMP.Model.WBHScoreRecord(); scoreRecord.Nums = "b55"; scoreRecord.InsertDate = DateTime.Now; scoreRecord.WebsiteOwner = bll.WebsiteOwner; scoreRecord.UserId = CurrentUserInfo.UserID; scoreRecord.RecordType = "2"; scoreRecord.NameStr = "参加活动:" + juInfo.ActivityName; scoreRecord.ScoreNum = string.Format("-{0}", juInfo.ActivityIntegral); if (!bll.Add(scoreRecord)) { apiResp.code = 17; apiResp.msg = "插入积分记录失败"; bll.ContextResponse(context, apiResp); return; } } } #endregion #region 当ActivityIntegral>0 扣信用金 if (juInfo.GuaranteeCreditAcount > 0)//扣积分 { bllUser.AddUserCreditAcountDetails(CurrentUserInfo.UserID, "ApplyCost", bllUser.WebsiteOwner, 0 - model.GuaranteeCreditAcount , string.Format("报名【{0}】消耗{1}信用金", juInfo.ActivityName, Convert.ToDouble(model.GuaranteeCreditAcount))); } #endregion } else { apiResp.code = 1; apiResp.msg = "报名失败,请重试或联系管理员!"; } bll.ContextResponse(context, apiResp); }
protected void Page_Load(object sender, EventArgs e) { try { if (!bllJuactivity.IsLogin) { Response.End(); return; } int activityId = Convert.ToInt32(Request["activityid"]); int uid = Convert.ToInt32(Request["uid"]); UserInfo currentUser = bllUser.GetCurrentUserInfo(); if (bllJuactivity.GetCount <WXKeFu>(string.Format("WebsiteOwner='{0}' And WeiXinOpenID='{1}'", bllUser.WebsiteOwner, currentUser.WXOpenId)) == 0) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>对不起,您不能执行签到操作!</h1></body></html>"); Response.End(); return; } //查询活动是否存在 juActivity = bllJuactivity.Get <JuActivityInfo>(string.Format("SignUpActivityID={0}", activityId)); if (juActivity == null) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>对不起,您签到的活动不存在!</h1></body></html>"); Response.End(); return; } data = bllJuactivity.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' And UID={1} And IsDelete=0", activityId, uid)); if (data == null) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>请先报名再签到.</h1></body></html>"); Response.End(); return; } UserInfo signUserInfo = bllUser.GetUserInfoByOpenId(data.WeixinOpenID); if (signUserInfo == null) { signUserInfo = bllUser.GetUserInfo(data.UserId); } if (signUserInfo == null) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>不存在的报名数据!</h1></body></html>"); Response.End(); return; } if (!string.IsNullOrEmpty(data.ToUserId)) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>此活动已转赠,不能签到!</h1></body></html>"); Response.End(); return; } WXSignInInfo signInInfo = new WXSignInInfo(); signInInfo.SignInUserID = signUserInfo.UserID; signInInfo.JuActivityID = juActivity.JuActivityID; signInInfo.SignInOpenID = signUserInfo.WXOpenId; signInInfo.SignInTime = DateTime.Now; signInInfo.Name = data.Name; signInInfo.Phone = data.Phone; //判断是否已经签到过 if (this.bllJuactivity.Exists(signInInfo, new List <string>() { "SignInUserID", "JuActivityID" })) { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>已经签过到了!</h1></body></html>"); Response.End(); return; } if (this.bllJuactivity.Add(signInInfo)) { //显示信息 Mapping = bllActivity.GetActivityFieldMappingList(activityId.ToString()); bllUser.AddUserScoreDetail(signUserInfo.UserID, CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.SignIn), signUserInfo.WebsiteOwner, null, null); } else { Response.Write("<html><head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0\"/></head><body><h1>签到失败!</h1></body></html>"); Response.End(); return; } } catch (Exception ex) { //Response.Write(ex.Message); Response.End(); } }
public void ProcessRequest(HttpContext context) { string articleId = context.Request["activity_id"]; string content = context.Request["content"]; var replyId = Convert.ToInt32(context.Request["reply_id"]);//评论了文章里的哪个评论 int isHideUserName = Convert.ToInt32(context.Request["is_hide_user_name"]); resp.isSuccess = false; if (string.IsNullOrWhiteSpace(articleId) || string.IsNullOrWhiteSpace(content)) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.PrimaryKeyIncomplete; resp.errmsg = "activity_id、content 为必填项,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (bllJuActivity.GetCount <JuActivityInfo>(string.Format(" WebsiteOwner='{0}' AND JuActivityID = {1} ", bllJuActivity.WebsiteOwner, articleId)) == 0) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; resp.errmsg = "不存在活动"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } //敏感词检查 string errmsg = ""; if (!bllFilterWord.CheckFilterWord(content, this.bllJuActivity.WebsiteOwner, out errmsg, "0")) { resp.errmsg = errmsg; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } //添加评论 int reviewId = 0; JuActivityInfo article = bllJuActivity.GetJuActivity(int.Parse(articleId), true); BLLJIMP.Enums.ReviewTypeKey reviewType = BLLJIMP.Enums.ReviewTypeKey.ArticleComment; if (article.ArticleType == "Question") { reviewType = BLLJIMP.Enums.ReviewTypeKey.Answer; } if (article.ArticleType == "Appointment") { reviewType = BLLJIMP.Enums.ReviewTypeKey.AppointmentComment; } var addResult = bllReview.AddReview(reviewType, articleId, replyId, this.CurrentUserInfo.UserID, "评论", content, this.bllJuActivity.WebsiteOwner, out reviewId, isHideUserName); if (addResult) { if (reviewType == BLLJIMP.Enums.ReviewTypeKey.Answer) { bllUser.AddUserScoreDetail(this.CurrentUserInfo.UserID, EnumStringHelper.ToString(ScoreDefineType.AnswerQuestions), this.bllJuActivity.WebsiteOwner, null, null); } resp.isSuccess = true; resp.returnValue = reviewId.ToString(); 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); } } else { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; resp.isSuccess = false; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { PostModel requestModel = new PostModel();//订单模型 try { requestModel = bllJuActivity.ConvertRequestToModel <PostModel>(requestModel); } catch (Exception ex) { apiResp.msg = "提交格式错误"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } //数据检查 if (string.IsNullOrEmpty(requestModel.title)) { apiResp.msg = "名称必填"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } //if (string.IsNullOrEmpty(requestModel.city)) //{ // apiResp.msg = "城市必选"; // apiResp.code = (int)APIErrCode.OperateFail; // bllJuActivity.ContextResponse(context, apiResp); // return; //} //if (string.IsNullOrEmpty(requestModel.district)) //{ // apiResp.msg = "区域必选"; // apiResp.code = (int)APIErrCode.OperateFail; // bllJuActivity.ContextResponse(context, apiResp); // return; //} if (string.IsNullOrEmpty(requestModel.address)) { apiResp.msg = "地址必填"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.k4)) { apiResp.msg = "电话必填"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.longitude)) { apiResp.msg = "请选择坐标"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(requestModel.latitude)) { apiResp.msg = "请选择坐标"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } JuActivityInfo pInfo = new JuActivityInfo(); pInfo.JuActivityID = int.Parse(bllJuActivity.GetGUID(BLLJIMP.TransacType.ActivityAdd)); pInfo.ActivityName = requestModel.title; pInfo.ActivityAddress = requestModel.address; pInfo.ServerTimeMsg = requestModel.server_time; pInfo.ServicesMsg = requestModel.server_msg; pInfo.ThumbnailsPath = requestModel.img; pInfo.ArticleType = "Outlets"; pInfo.CategoryId = requestModel.cate_id; pInfo.Province = requestModel.province; pInfo.ProvinceCode = requestModel.province_code; pInfo.City = requestModel.city; pInfo.CityCode = requestModel.city_code; pInfo.District = requestModel.district; pInfo.DistrictCode = requestModel.district_code; pInfo.K1 = requestModel.k1; pInfo.K4 = requestModel.k4; pInfo.K5 = requestModel.k5; pInfo.Tags = requestModel.tags; pInfo.Sort = requestModel.sort; pInfo.UserLongitude = requestModel.longitude; pInfo.UserLatitude = requestModel.latitude; pInfo.IsHide = 0; pInfo.CreateDate = DateTime.Now; pInfo.LastUpdateDate = DateTime.Now; pInfo.WebsiteOwner = bllJuActivity.WebsiteOwner; pInfo.UserID = currentUserInfo.UserID; List <string> tagList = null; if (!string.IsNullOrWhiteSpace(pInfo.Tags)) { tagList = pInfo.Tags.Split(',').ToList(); } bool result = false; BLLTransaction tran = new BLLTransaction(); result = bllJuActivity.Add(pInfo, tran); if (!result) { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } result = bllJuActivity.SetJuActivityContentTags(pInfo.JuActivityID, tagList); if (result) { tran.Commit(); apiResp.status = true; apiResp.msg = "提交完成"; apiResp.code = (int)APIErrCode.IsSuccess; string polId = ""; ZentCloud.BLLJIMP.Model.Weixin.WeixinStore model = new BLLJIMP.Model.Weixin.WeixinStore(); model.business_name = pInfo.ActivityName; model.branch_name = pInfo.ActivityName; model.province = pInfo.Province; model.city = pInfo.City; model.district = pInfo.District; model.address = pInfo.ActivityAddress; model.telephone = pInfo.K4; model.categories = new List <string>(); model.categories.Add("购物,综合商场"); model.offset_type = 1; model.longitude = double.Parse(pInfo.UserLongitude); model.latitude = double.Parse(pInfo.UserLatitude); string msg = ""; if (bllWeixinCard.CreateStore(model, out polId, out msg)) { bllJuActivity.Update(pInfo, string.Format("K30='{0}'", polId), string.Format("JuActivityID={0}", pInfo.JuActivityID)); } else { apiResp.msg = msg; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } } else { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } bllJuActivity.ContextResponse(context, apiResp); }
/// <summary> /// 手动添加报名数据 /// </summary> /// <param name="context"></param> /// <returns></returns> private string AddActivityData(HttpContext context) { //接收到的实体 BLLJIMP.Model.ActivityDataInfo reqModel = bllActivity.ConvertRequestToModel <BLLJIMP.Model.ActivityDataInfo>(new BLLJIMP.Model.ActivityDataInfo()); string activityId = context.Request["ActivityID"]; var newActivityUId = 1001; var lastActivityDataInfo = bllActivity.Get <ActivityDataInfo>(string.Format("ActivityID='{0}' order by UID DESC", activityId)); if (lastActivityDataInfo != null) { newActivityUId = lastActivityDataInfo.UID + 1; } reqModel.ActivityID = activityId; reqModel.UID = newActivityUId; reqModel.InsertDate = DateTime.Now; reqModel.WebsiteOwner = bllActivity.WebsiteOwner; #region OLD //BLLJIMP.Model.ActivityDataInfo Model = new ActivityDataInfo(); //Model.UserId = context.Request["UserId"]; //Model.ActivityID = ActivityID; //Model.UID = NewActivityUID; //Model.InsertDate = DateTime.Now; //Model.Name = GetPostParm("Name"); //Model.Phone = GetPostParm("Phone"); //Model.K1 = GetPostParm("K1"); //Model.K2 = GetPostParm("K2"); //Model.K3 = GetPostParm("K3"); //Model.K4 = GetPostParm("K4"); //Model.K5 = GetPostParm("K5"); //Model.K6 = GetPostParm("K6"); //Model.K7 = GetPostParm("K7"); //Model.K8 = GetPostParm("K8"); //Model.K9 = GetPostParm("K9"); //Model.K10 = GetPostParm("K10"); //Model.K11 = GetPostParm("K11"); //Model.K12 = GetPostParm("K12"); //Model.K13 = GetPostParm("K13"); //Model.K14 = GetPostParm("K14"); //Model.K15 = GetPostParm("K15"); //Model.K16 = GetPostParm("K16"); //Model.K17 = GetPostParm("K17"); //Model.K18 = GetPostParm("K18"); //Model.K19 = GetPostParm("K19"); //Model.K20 = GetPostParm("K20"); //Model.K21 = GetPostParm("K21"); //Model.K22 = GetPostParm("K22"); //Model.K23 = GetPostParm("K23"); //Model.K24 = GetPostParm("K24"); //Model.K25 = GetPostParm("K25"); //Model.K26 = GetPostParm("K26"); //Model.K27 = GetPostParm("K27"); //Model.K28 = GetPostParm("K28"); //Model.K29 = GetPostParm("K29"); //Model.K30 = GetPostParm("K30"); //Model.K31 = GetPostParm("K31"); //Model.K32 = GetPostParm("K32"); //Model.K33 = GetPostParm("K33"); //Model.K34 = GetPostParm("K34"); //Model.K35 = GetPostParm("K35"); //Model.K36 = GetPostParm("K36"); //Model.K37 = GetPostParm("K37"); //Model.K38 = GetPostParm("K38"); //Model.K39 = GetPostParm("K39"); //Model.K40 = GetPostParm("K40"); //Model.K41 = GetPostParm("K41"); //Model.K42 = GetPostParm("K42"); //Model.K43 = GetPostParm("K43"); //Model.K44 = GetPostParm("K44"); //Model.K45 = GetPostParm("K45"); //Model.K46 = GetPostParm("K46"); //Model.K47 = GetPostParm("K47"); //Model.K48 = GetPostParm("K48"); //Model.K49 = GetPostParm("K49"); //Model.K50 = GetPostParm("K50"); //Model.K51 = GetPostParm("K51"); //Model.K52 = GetPostParm("K52"); //Model.K53 = GetPostParm("K53"); //Model.K54 = GetPostParm("K54"); //Model.K55 = GetPostParm("K55"); //Model.K56 = GetPostParm("K56"); //Model.K57 = GetPostParm("K57"); //Model.K58 = GetPostParm("K58"); //Model.K59 = GetPostParm("K59"); //Model.K60 = GetPostParm("K60"); #endregion UserInfo userInfo = bllUser.GetUserInfo(reqModel.UserId); if (!string.IsNullOrEmpty(reqModel.UserId)) { if (userInfo == null) { resp.Msg = "用户不存在,请检查"; return(Common.JSONHelper.ObjectToJson(resp)); } else { #region 自动补充信息 reqModel.WeixinOpenID = userInfo.WXOpenId; reqModel.UserId = userInfo.UserID; if (!string.IsNullOrEmpty(userInfo.TrueName)) { reqModel.Name = userInfo.TrueName; } if (!string.IsNullOrEmpty(userInfo.Phone)) { reqModel.Phone = userInfo.Phone; } var fieldMappingList = bllActivity.GetActivityFieldMappingList(reqModel.ActivityID); Type type = reqModel.GetType(); if (!string.IsNullOrEmpty(userInfo.Company)) { if (fieldMappingList.Where(p => p.MappingName.Contains("公司")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("公司")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(reqModel, userInfo.Company, null); } } if (!string.IsNullOrEmpty(userInfo.Postion)) { if (fieldMappingList.Where(p => p.MappingName.Contains("职位")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("职位")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(reqModel, userInfo.Postion, null); } } if (!string.IsNullOrEmpty(userInfo.Email)) { if (fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).Count() > 0) { PropertyInfo propertyInfo = type.GetProperty("K" + fieldMappingList.Where(p => p.MappingName.Contains("邮箱")).First().ExFieldIndex.ToString()); propertyInfo.SetValue(reqModel, userInfo.Email, null); } } #endregion } } if (string.IsNullOrEmpty(reqModel.Name)) { resp.Msg = "该用户没有填写姓名,请填写姓名"; return(Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(reqModel.Phone)) { resp.Msg = "该用户没有填写手机号,请填写手机号"; return(Common.JSONHelper.ObjectToJson(resp)); } if (bllActivity.Add(reqModel)) { resp.Status = 1; #region 扣积分 JuActivityInfo juActivityInfo = bllJuActivity.GetJuActivityByActivityID(activityId); if ((juActivityInfo != null) && (juActivityInfo.ActivityIntegral > 0)) { if (userInfo != null) { //userInfo.TotalScore -= juActivityInfo.ActivityIntegral; if (bllUser.Update(userInfo, string.Format(" TotalScore-={0}", juActivityInfo.ActivityIntegral), string.Format(" AutoID={0}", userInfo.AutoID)) > 0) { ////积分记录 //BLLJIMP.Model.WBHScoreRecord record = new BLLJIMP.Model.WBHScoreRecord() //{ // InsertDate = DateTime.Now, // ScoreNum = "-" + juActivityInfo.ActivityIntegral.ToString(), // WebsiteOwner = bllUser.WebsiteOwner, // UserId = reqModel.UserId, // NameStr = "参加" + juActivityInfo.ActivityName, // Nums = "b55", // RecordType = "1", //}; UserScoreDetailsInfo scoreRecord = new UserScoreDetailsInfo(); scoreRecord.AddTime = DateTime.Now; scoreRecord.Score = juActivityInfo.ActivityIntegral; scoreRecord.ScoreType = "ActivityUse"; scoreRecord.UserID = userInfo.UserID; scoreRecord.AddNote = "参加" + juActivityInfo.ActivityName + "使用" + juActivityInfo.ActivityIntegral + "积分"; scoreRecord.WebSiteOwner = userInfo.WebsiteOwner; //bllUser.Add(record); bllUser.Add(scoreRecord); } else { resp.Msg = "更新用户积分失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } } #endregion } else { resp.Msg = "添加失败"; return(Common.JSONHelper.ObjectToJson(resp)); } return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { Add.PostModel requestModel = new Add.PostModel();//模型 List <Add.FileModel> nFiles = new List <Add.FileModel>(); try { requestModel = bllJuActivity.ConvertRequestToModel <Add.PostModel>(requestModel); nFiles = ZentCloud.Common.JSONHelper.JsonToModel <List <Add.FileModel> >(requestModel.file_list); } catch (Exception ex) { apiResp.msg = "提交格式错误"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } //数据检查 if (string.IsNullOrEmpty(requestModel.policy_name)) { apiResp.msg = "政策名称必填"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } JuActivityInfo pInfo = bllJuActivity.GetByKey <JuActivityInfo>("JuActivityID", requestModel.id.ToString()); if (pInfo == null) { apiResp.msg = "原记录不存在"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } pInfo.ActivityName = requestModel.policy_name; pInfo.Summary = requestModel.summary; pInfo.K2 = requestModel.policy_object; pInfo.K3 = requestModel.subsidy_standard; pInfo.K4 = requestModel.subsidy_period; pInfo.K5 = requestModel.policy_number; pInfo.K6 = requestModel.policy_level; pInfo.K7 = requestModel.domicile_place; pInfo.K8 = requestModel.sex; pInfo.K9 = string.IsNullOrWhiteSpace(requestModel.male_age_min) ? null : requestModel.male_age_min; pInfo.K10 = string.IsNullOrWhiteSpace(requestModel.male_age_max) ? null : requestModel.male_age_max; pInfo.K11 = string.IsNullOrWhiteSpace(requestModel.famale_age_min) ? null : requestModel.famale_age_min; pInfo.K12 = string.IsNullOrWhiteSpace(requestModel.famale_age_max) ? null : requestModel.famale_age_max; pInfo.K13 = requestModel.education; pInfo.K14 = string.IsNullOrWhiteSpace(requestModel.graduation_year_min) ? null : requestModel.graduation_year_min; pInfo.K15 = string.IsNullOrWhiteSpace(requestModel.graduation_year_max) ? null : requestModel.graduation_year_max; pInfo.K16 = requestModel.employment_status; pInfo.K17 = string.IsNullOrWhiteSpace(requestModel.current_job_life_min) ? null : requestModel.current_job_life_min; pInfo.K18 = string.IsNullOrWhiteSpace(requestModel.current_job_life_max) ? null : requestModel.current_job_life_max; pInfo.K19 = string.IsNullOrWhiteSpace(requestModel.unemployment_period_min) ? null : requestModel.unemployment_period_min; pInfo.K20 = string.IsNullOrWhiteSpace(requestModel.unemployment_period_max) ? null : requestModel.unemployment_period_max; pInfo.K21 = requestModel.company_type; pInfo.K22 = string.IsNullOrWhiteSpace(requestModel.registered_capital_min) ? null : requestModel.registered_capital_min; pInfo.K23 = string.IsNullOrWhiteSpace(requestModel.registered_capital_max) ? null : requestModel.registered_capital_max; pInfo.K24 = string.IsNullOrWhiteSpace(requestModel.personnel_size_min) ? null : requestModel.personnel_size_min; pInfo.K25 = string.IsNullOrWhiteSpace(requestModel.personnel_size_max) ? null : requestModel.personnel_size_max; pInfo.K26 = requestModel.company_size; pInfo.K27 = requestModel.industry; pInfo.Sort = requestModel.sort; pInfo.LastUpdateDate = DateTime.Now; List <JuActivityFiles> files = new List <JuActivityFiles>(); foreach (var item in nFiles.Where(p => p.id == 0)) { files.Add(new JuActivityFiles() { AddDate = DateTime.Now, FileClass = item.file_class, JuActivityID = pInfo.JuActivityID, FileName = item.file_name, FilePath = item.file_path, UserID = currentUserInfo.UserID }); } bool result = false; BLLTransaction tran = new BLLTransaction(); result = bllJuActivity.Update(pInfo, tran); if (!result) { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; bllJuActivity.ContextResponse(context, apiResp); return; } string noDeleteFileIds = "0"; if (nFiles.Where(p => p.id != 0).Count() > 0) { noDeleteFileIds = ZentCloud.Common.MyStringHelper.ListToStr(nFiles.Where(p => p.id != 0).Select(p => p.id).ToList(), "", ","); } result = bllJuActivity.Delete(new JuActivityFiles(), string.Format(" AutoID Not In ({0}) AND JuActivityID={1}", noDeleteFileIds, pInfo.JuActivityID.ToString()), tran) >= 0; foreach (var item in files) { if (!result) { break; } result = bllJuActivity.Add(item, tran); } if (!result) { tran.Rollback(); apiResp.msg = "提交失败"; apiResp.code = (int)APIErrCode.OperateFail; } tran.Commit(); apiResp.status = true; apiResp.msg = "提交完成"; apiResp.code = (int)APIErrCode.IsSuccess; bllJuActivity.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string data = context.Request["data"]; RequestModel requestModel; try { requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(context.Request["data"]); } catch (Exception) { resp.errcode = -1; resp.errmsg = "json格式错误,请检查"; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (string.IsNullOrEmpty(requestModel.activity_id)) { resp.errmsg = "activity_id 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (requestModel.activity_uid <= 0) { resp.errmsg = "activity_uid 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (string.IsNullOrEmpty(requestModel.name)) { resp.errmsg = "name 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (string.IsNullOrEmpty(requestModel.phone)) { resp.errmsg = "phone 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } JuActivityInfo juActivity = bllJuActivity.GetJuActivity(int.Parse(requestModel.activity_id), false); if (juActivity == null) { resp.errmsg = "不存在该条活动"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } ActivityDataInfo activityInfo = new ActivityDataInfo(); activityInfo.ActivityID = juActivity.SignUpActivityID; activityInfo.UID = requestModel.activity_uid; activityInfo.Name = requestModel.name; activityInfo.Phone = requestModel.phone; activityInfo.K1 = requestModel.k1; activityInfo.K2 = requestModel.k2; activityInfo.K3 = requestModel.k3; activityInfo.K4 = requestModel.k4; activityInfo.K5 = requestModel.k5; activityInfo.K6 = requestModel.k6; activityInfo.K7 = requestModel.k7; activityInfo.K8 = requestModel.k8; activityInfo.K9 = requestModel.k9; activityInfo.K10 = requestModel.k10; activityInfo.K11 = requestModel.k11; activityInfo.K12 = requestModel.k12; activityInfo.K13 = requestModel.k13; activityInfo.K14 = requestModel.k14; activityInfo.K15 = requestModel.k15; activityInfo.K16 = requestModel.k16; activityInfo.K17 = requestModel.k17; activityInfo.K18 = requestModel.k18; activityInfo.K19 = requestModel.k19; activityInfo.K20 = requestModel.k20; activityInfo.K21 = requestModel.k21; activityInfo.K22 = requestModel.k22; activityInfo.K23 = requestModel.k23; activityInfo.K24 = requestModel.k24; activityInfo.K25 = requestModel.k25; activityInfo.K26 = requestModel.k26; activityInfo.K27 = requestModel.k27; activityInfo.K28 = requestModel.k28; activityInfo.K29 = requestModel.k29; activityInfo.K30 = requestModel.k30; activityInfo.K31 = requestModel.k31; activityInfo.K32 = requestModel.k32; activityInfo.K33 = requestModel.k33; activityInfo.K34 = requestModel.k34; activityInfo.K35 = requestModel.k35; activityInfo.K36 = requestModel.k36; activityInfo.K37 = requestModel.k37; activityInfo.K38 = requestModel.k38; activityInfo.K39 = requestModel.k39; activityInfo.K40 = requestModel.k40; activityInfo.K41 = requestModel.k41; activityInfo.K42 = requestModel.k42; activityInfo.K43 = requestModel.k43; activityInfo.K44 = requestModel.k44; activityInfo.K45 = requestModel.k45; activityInfo.K46 = requestModel.k46; activityInfo.K47 = requestModel.k47; activityInfo.K48 = requestModel.k48; activityInfo.K49 = requestModel.k49; activityInfo.K50 = requestModel.k50; activityInfo.K51 = requestModel.k51; activityInfo.K52 = requestModel.k52; activityInfo.K53 = requestModel.k53; activityInfo.K54 = requestModel.k54; activityInfo.K55 = requestModel.k55; activityInfo.K56 = requestModel.k56; activityInfo.K57 = requestModel.k57; activityInfo.K58 = requestModel.k58; activityInfo.K59 = requestModel.k59; activityInfo.K60 = requestModel.k60; if (bllJuActivity.Update(activityInfo)) { resp.isSuccess = true; resp.errmsg = "ok"; } else { resp.errmsg = "修改报名数据出错"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; } context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int pageIndex = !string.IsNullOrEmpty(context.Request["pageindex"]) ? int.Parse(context.Request["pageindex"]) : 1; int pageSize = !string.IsNullOrEmpty(context.Request["pagesize"]) ? int.Parse(context.Request["pagesize"]) : 10; int activityId = int.Parse(context.Request["activity_id"]); string keyWord = context.Request["keyword"]; string sort = context.Request["sort"]; string longitude = context.Request["longitude"]; string latitude = context.Request["latitude"]; string status = context.Request["status"]; status = string.IsNullOrWhiteSpace(status) ? "0" : status; if (string.IsNullOrWhiteSpace(longitude) || string.IsNullOrWhiteSpace(latitude)) { apiResp.code = (int)APIErrCode.PrimaryKeyIncomplete; apiResp.msg = "请传入当前经纬度"; bll.ContextResponse(context, apiResp); return; } JuActivityInfo juInfo = bll.GetJuActivity(activityId, true); ResultModel result = new ResultModel(); result.list = new List <RequestModel>(); int total = 0; List <ActivityDataInfo> sourceData = bll.GetRangeSignUpList(pageSize, pageIndex, juInfo.SignUpActivityID, bll.WebsiteOwner, longitude , latitude, status, sort, out total); result.totalcount = total; foreach (var item in sourceData) { RequestModel requestModel = new RequestModel(); requestModel.signup_uid = item.UID; requestModel.signup_status = item.Status; var userInfo = this.bllUser.GetUserInfo(item.UserId); if (userInfo == null) { userInfo = this.bllUser.GetUserInfoByOpenId(item.WeixinOpenID); } requestModel.signup_name = item.Name; requestModel.signup_time = DateTimeHelper.DateTimeToUnixTimestamp(item.InsertDate); requestModel.signup_time_str = item.InsertDate.ToString(); requestModel.signup_distance = item.Distance; requestModel.signup_headimg = bll.GetImgUrl("/img/europejobsites.png"); if (userInfo != null) { requestModel.signup_user_id = userInfo.UserID; requestModel.signup_headimg = bll.GetImgUrl(this.bllUser.GetUserDispalyAvatar(userInfo)); requestModel.signup_birthday = DateTimeHelper.DateTimeToUnixTimestamp(userInfo.Birthday); requestModel.signup_birthday_str = userInfo.Birthday.ToString(); requestModel.signup_gender = userInfo.Gender; requestModel.signup_identification = userInfo.Ex5; } if (juInfo.ShowPersonnelListType.Equals(1)) { requestModel.signup_name = requestModel.signup_name.Substring(0, 1) + "**"; } var activity = bll.GetJuActivityByActivityID(item.ActivityID); if (activity != null) { requestModel.activity_id = activity.JuActivityID; requestModel.activity_name = activity.ActivityName; } requestModel.signup_ex1 = item.K1; requestModel.guarantee_credit_acount = item.GuaranteeCreditAcount; result.list.Add(requestModel); } apiResp.code = (int)APIErrCode.IsSuccess; apiResp.result = result; apiResp.status = true; apiResp.msg = "查询完成"; bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { RequestModel requestModel = null; try { string articleId = context.Request["article_id"]; string no_score = context.Request["no_score"]; string no_pv = context.Request["no_pv"]; if (string.IsNullOrEmpty(articleId)) { resp.errmsg = "article_id 为必填项,请检查"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } JuActivityInfo model = bllJuActivity.GetJuActivity(int.Parse(articleId)); if (model == null) { resp.errmsg = "没有找到文章信息"; resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound; context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); return; } if (no_pv != "1") { bllJuActivity.Update(model, string.Format("PV=PV+1"), string.Format(" JuActivityID={0}", model.JuActivityID)); } requestModel = new RequestModel(); requestModel.article_id = model.JuActivityID; requestModel.article_name = model.ActivityName; requestModel.articel_context = model.ActivityDescription; requestModel.article_img_url = model.ThumbnailsPath; requestModel.article_pv = model.PV; requestModel.article_share_total_count = model.ShareTotalCount; requestModel.article_status = model.IsHide; requestModel.article_access_level = model.AccessLevel; requestModel.article_summary = model.Summary; requestModel.article_tags = model.Tags; requestModel.category_name = model.CategoryName; requestModel.article_sort = model.Sort; requestModel.article_time = bllJuActivity.GetTimeStamp(model.CreateDate); requestModel.k3 = model.K3; requestModel.cate_id = model.CategoryId; requestModel.article_type = model.ArticleType; if (no_score != "1") { UserInfo currentUserInfo = bllUser.GetCurrentUserInfo(); if (currentUserInfo != null) { string tempMsg = ""; bllUser.AddUserScoreDetail(currentUserInfo.UserID, "ReadType", bllUser.WebsiteOwner, out tempMsg, null, null, model.ArticleType, true, model.ArticleType); bllUser.AddUserScoreDetail(currentUserInfo.UserID, "ReadCategory", bllUser.WebsiteOwner, out tempMsg, null, null, model.CategoryId, true, model.CategoryId); bllUser.AddUserScoreDetail(currentUserInfo.UserID, "ReadArticle", bllUser.WebsiteOwner, out tempMsg, null, "《" + model.ActivityName + "》", model.JuActivityID.ToString(), true, model.JuActivityID.ToString(), model.ArticleType); } } resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; resp.errmsg = "查询完成"; resp.isSuccess = true; } catch (Exception ex) { resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail; resp.errmsg = ex.Message; } //代码莫名奇妙,上面已经加有积分,先注释 //try //{ // if (bllUser.IsLogin) // { // bllUser.AddUserScoreDetail(bllUser.GetCurrUserID(), CommonPlatform.Helper.EnumStringHelper.ToString(ZentCloud.BLLJIMP.Enums.ScoreDefineType.ReadArticle), this.bllUser.WebsiteOwner, null, null); // } //} //catch (Exception) //{ //} context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(requestModel)); }
public void ProcessRequest(HttpContext context) { string rtype = context.Request["rtype"], mainId = context.Request["mainId"], exchange = context.Request["exchange"]; //1时mainId,relationId互换 BLLJIMP.Enums.CommRelationType nType = new BLLJIMP.Enums.CommRelationType(); if (!Enum.TryParse(rtype, out nType)) { apiResp.code = 1; apiResp.msg = "类型格式不能识别"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (mainId == "0" || string.IsNullOrWhiteSpace(mainId)) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.ContentNotFound; apiResp.msg = "关联主Id错误"; bLLCommRelation.ContextResponse(context, apiResp); return; } currentUserInfo = bLLCommRelation.GetCurrentUserInfo(); if (this.currentUserInfo == null) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.UserIsNotLogin; apiResp.msg = "请先登录"; bLLCommRelation.ContextResponse(context, apiResp); return; } string relationId = this.currentUserInfo.AutoID.ToString(); if (mainId == relationId) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; apiResp.msg = "不能跟自己建立关系"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (exchange == "1") { relationId = mainId; mainId = this.currentUserInfo.AutoID.ToString(); } if (!this.bLLCommRelation.ExistRelation(nType, mainId, relationId)) { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsRepeat; apiResp.msg = "关系不存在"; bLLCommRelation.ContextResponse(context, apiResp); return; } if (this.bLLCommRelation.DelCommRelation(nType, mainId, relationId)) { if (nType == CommRelationType.FriendApply) { UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId)); //拒绝好友申请删除申请关系 bLLCommRelation.DelCommRelation(CommRelationType.FriendApply, relationId, mainId); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.RejectFriendApply, this.currentUserInfo, null, new List <UserInfo>() { toUser }, null); } else if (nType == CommRelationType.Friend) { UserInfo toUser = bllUser.GetUserInfoByAutoID(int.Parse(mainId)); //删除好友关系 bLLCommRelation.DelCommRelation(CommRelationType.Friend, mainId, relationId); bLLCommRelation.DelCommRelation(CommRelationType.Friend, relationId, mainId); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DeleteFriend, this.currentUserInfo, null, new List <UserInfo>() { toUser }, null); } else if (nType == CommRelationType.JuActivityPraise) { JuActivityInfo article = bll.GetJuActivity(int.Parse(mainId), false); //点赞数直接修改到主表 int praiseCount = bLLCommRelation.GetRelationCount(nType, mainId, null); bll.Update(article, string.Format("PraiseCount={0}", praiseCount), string.Format("JuActivityID={0}", article.JuActivityID)); bllSystemNotice.SendNotice(BLLJIMP.BLLSystemNotice.NoticeType.DisJuActivityPraise, this.currentUserInfo, article, article.UserID, null); } apiResp.status = true; apiResp.msg = "删除完成"; apiResp.code = (int)BLLJIMP.Enums.APIErrCode.IsSuccess; } else { apiResp.code = (int)BLLJIMP.Enums.APIErrCode.OperateFail; apiResp.msg = "删除失败"; } bLLCommRelation.ContextResponse(context, apiResp); }
private string EditRechargeConfig(HttpContext context) { string recharge = context.Request["Recharge"]; string vipPrice = context.Request["VIPPrice"]; string sendNoticePrice = context.Request["SendNoticePrice"]; string minScore = context.Request["MinScore"]; string minWithdrawCashScore = context.Request["MinWithdrawCashScore"]; string vipPrice0 = context.Request["VIPPrice0"]; string vipDatelong = context.Request["VIPDatelong"]; string vipInterestID = context.Request["VIPInterestID"]; string vipInterestDescription = context.Request["VIPInterestDescription"]; string websiteOwner = bllkeyValueData.WebsiteOwner; KeyVauleDataInfo rechargeKeyValue = new KeyVauleDataInfo("Recharge", "100", recharge, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo sendNoticePriceValue = new KeyVauleDataInfo("SendNoticePrice", "1", sendNoticePrice, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo minScoreValue = new KeyVauleDataInfo("MinScore", "1", minScore, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo minWithdrawCashScoreValue = new KeyVauleDataInfo("MinWithdrawCashScore", "1", minWithdrawCashScore, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPPriceKeyValue = new KeyVauleDataInfo("VIPPrice", "1", vipPrice, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPPrice0KeyValue = new KeyVauleDataInfo("VIPPrice", "0", vipPrice0, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPDatelongKeyValue = new KeyVauleDataInfo("VIPDatelong", "1", vipDatelong, websiteOwner, null, currentUserInfo.UserID); KeyVauleDataInfo VIPInterestIDKeyValue = new KeyVauleDataInfo("VIPInterestID", "1", vipInterestID, websiteOwner, null, currentUserInfo.UserID); JuActivityInfo juAct = new JuActivityInfo(); BLLJuActivity bllJuAct = new BLLJuActivity(); if (!string.IsNullOrWhiteSpace(vipInterestID) && vipInterestID != "0") { juAct = bllJuAct.GetJuActivity(Convert.ToInt32(vipInterestID)); juAct.ActivityDescription = vipInterestDescription; if (!bllJuAct.PutArticle(juAct)) { resp.Status = -1; resp.Msg = "提交VIP权益失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } else if (!string.IsNullOrWhiteSpace(vipInterestDescription)) { vipInterestID = bllJuAct.GetGUID(TransacType.CommAdd); VIPInterestIDKeyValue.DataValue = vipInterestID; juAct.JuActivityID = Convert.ToInt32(vipInterestID); juAct.ActivityName = "VIP权益"; juAct.ArticleType = "ConfigContent"; juAct.UserID = currentUserInfo.UserID; juAct.WebsiteOwner = websiteOwner; juAct.CreateDate = DateTime.Now; juAct.ActivityDescription = vipInterestDescription; if (!bllJuAct.Add(juAct)) { resp.Status = -1; resp.Msg = "提交VIP权益失败"; return(Common.JSONHelper.ObjectToJson(resp)); } } BLLTransaction tran = new BLLTransaction(); if (bllkeyValueData.PutDataValue(rechargeKeyValue, tran) && bllkeyValueData.PutDataValue(sendNoticePriceValue, tran) && bllkeyValueData.PutDataValue(minScoreValue, tran) && bllkeyValueData.PutDataValue(minWithdrawCashScoreValue, tran) && bllkeyValueData.PutDataValue(VIPPriceKeyValue, tran) && bllkeyValueData.PutDataValue(VIPPrice0KeyValue, tran) && bllkeyValueData.PutDataValue(VIPDatelongKeyValue, tran) && bllkeyValueData.PutDataValue(VIPInterestIDKeyValue, tran)) { tran.Commit(); resp.Status = 1; resp.Msg = "提交成功"; } else { tran.Rollback(); resp.Status = -1; resp.Msg = "提交失败"; } return(Common.JSONHelper.ObjectToJson(resp)); }
public void ProcessRequest(HttpContext context) { ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction(); try { string json = context.Request["data"]; ActivityModel requestModel = ZentCloud.Common.JSONHelper.JsonToModel <ActivityModel>(json);//jSON 反序 JuActivityInfo model = new JuActivityInfo(); model.JuActivityID = int.Parse(bll.GetGUID(BLLJIMP.TransacType.CommAdd)); model.ThumbnailsPath = requestModel.activity_img; model.ActivityName = requestModel.activity_name; model.ArticleType = "train"; model.ActivityDescription = requestModel.description; model.CreateDate = DateTime.Now; model.IsDelete = 0; model.IsFee = 1; model.IsPublish = 0; model.MainPoints = requestModel.main_points; model.Summary = requestModel.summary; model.WebsiteOwner = bll.WebsiteOwner; model.UserID = currentUserInfo.UserID; if (!bll.Add(model, tran)) { tran.Rollback(); apiResp.msg = "添加失败"; bll.ContextResponse(context, apiResp); return; } List <MeifanActivityItem> activityItems = new List <MeifanActivityItem>(); foreach (var item in requestModel.items) { if (string.IsNullOrEmpty(item.from_date)) { tran.Rollback(); apiResp.msg = "请输入开始时间"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(item.from_date)) { tran.Rollback(); apiResp.msg = "请输入结束时间"; bll.ContextResponse(context, apiResp); return; } if (string.IsNullOrEmpty(item.amount)) { tran.Rollback(); apiResp.msg = "请输入金额"; bll.ContextResponse(context, apiResp); return; } if (requestModel.items.Count(p => p.from_date == item.from_date && p.to_date == item.to_date && p.group_type == item.group_type && p.is_member == item.is_member) > 1) { tran.Rollback(); apiResp.msg = "时间,组别,会员类型不能重复"; bll.ContextResponse(context, apiResp); return; } MeifanActivityItem itemModel = new MeifanActivityItem(); itemModel.ActivityId = model.JuActivityID.ToString(); itemModel.Amount = decimal.Parse(item.amount); itemModel.FromDate = Convert.ToDateTime(item.from_date).ToString("yyyy/MM/dd HH:mm"); itemModel.ToDate = Convert.ToDateTime(item.to_date).ToString("yyyy/MM/dd HH:mm"); itemModel.GroupType = item.group_type; itemModel.IsMember = item.is_member; activityItems.Add(itemModel); } if (!bll.AddList <MeifanActivityItem>(activityItems)) { tran.Rollback(); apiResp.msg = "添加失败"; bll.ContextResponse(context, apiResp); return; } tran.Commit(); apiResp.status = true; } catch (Exception ex) { tran.Rollback(); apiResp.msg = ex.ToString(); bll.ContextResponse(context, apiResp); } bll.ContextResponse(context, apiResp); }
public void ProcessRequest(HttpContext context) { string id = context.Request["id"]; string response = context.Request["response"]; if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(response)) { resp.errcode = (int)APIErrCode.PrimaryKeyIncomplete; resp.errmsg = "参数不完整"; bllActivity.ContextResponse(context, resp); return; } JuActivityInfo activity = bllActivity.GetJuActivity(Convert.ToInt32(id)); activity.K10 = response; activity.K11 = DateTime.Now.ToString("yyyy-MM-dd HH:mm"); bool isSyncPass = true; #region 步账号注册检查 if (bllActivity.WebsiteOwner == "guoye" || bllActivity.WebsiteOwner == "guoyetest") { isSyncPass = false; Dictionary <string, string> param = new Dictionary <string, string>(); param.Add("dealid", activity.K7); param.Add("response", activity.K10); param.Add("openid", activity.K5); param.Add("phone", activity.K6); param.Add("time", activity.K11); using (HttpWebResponse wr = ZentCloud.Common.HttpInterFace.CreatePostHttpResponse( "http://www.chinayie.com/api/response", param, null, null, Encoding.UTF8, null)) { using (StreamReader sr = new StreamReader(wr.GetResponseStream())) { JToken jto = JToken.Parse(sr.ReadToEnd()); if (jto["result"] != null && jto["result"].ToString().ToLower() == "true") { isSyncPass = true; } else if (jto["result"] != null && jto["msg"] != null && jto["result"].ToString().ToLower() == "false") { resp.errcode = (int)APIErrCode.OperateFail; resp.errmsg = jto["msg"].ToString(); bllActivity.ContextResponse(context, resp); return; } } } } #endregion if (isSyncPass && bllActivity.Update(activity)) { resp.isSuccess = true; } else { resp.errmsg = "提交失败"; } bllActivity.ContextResponse(context, resp); }