///<summary> /// 验证用户是否登陆 ///</summary> private void CheckAdminLogin() { if (Cookies.Admin.GetAdminID(true) == 0) { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } else { if (CookiesHelper.ReadCookie("AdminSign") != null) { AdminInfo admin = AdminBLL.Read(Cookies.Admin.GetAdminID(true)); string signvalue = FormsAuthentication.HashPasswordForStoringInConfigFile(admin.Id.ToString() + admin.Name + admin.GroupId.ToString() + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent + admin.Password, "MD5"); if (signvalue != CookiesHelper.ReadCookieValue("AdminSign")) { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } } else { ResponseHelper.Write("<script language='javascript'>window.parent.location.href='/Admin/Login.aspx';</script>"); ResponseHelper.End(); } } }
/// <summary> /// 修改手机号码 /// </summary> protected void UpdateUserMobile() { string msg = string.Empty; try { UserInfo user = UserBLL.Read(base.UserId); user.Mobile = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); string safeCode = RequestHelper.GetForm <string>("phoneVer"); //手机短信验证码 if (CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(user.Mobile)) == null) { msg = "error|校验码失效,请重新获取"; } else { string mobileCode = CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(user.Mobile)).Value.ToString(); if (safeCode.ToLower() != mobileCode.ToLower()) { msg = "error|校验码错误"; } else { CookiesHelper.DeleteCookie("MobileCode" + StringHelper.AddSafe(user.Mobile)); } } if (msg == string.Empty) { if (string.IsNullOrEmpty(user.Mobile)) { msg = "error|请填写手机号码"; } if (!ShopCommon.CheckMobile(user.Mobile)) { msg = "error|手机号码错误"; } if (!UserBLL.CheckMobile(user.Mobile, base.UserId)) { msg = "error|手机号码已被其他会员注册"; } else { UserBLL.Update(user); msg = "ok|修改成功"; } } Response.Clear(); Response.Write(msg); } catch (Exception ex) { Response.Clear(); Response.Write("error|系统忙,请稍后重试"); } finally { Response.End(); } }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "Submit" && Request.HttpMethod == "POST") { this.Submit(); } redirectUrl = RequestHelper.GetQueryString <string>("RedirectUrl"); if (base.UserId > 0) { ResponseHelper.Redirect(string.IsNullOrEmpty(redirectUrl) ? "/user/index.html" : redirectUrl); } var auto = CookiesHelper.ReadCookie("auto"); cookieUserName = auto != null ? auto.Value : ""; }
/// <summary> /// 检查cookies /// </summary> /// <returns></returns> private void ReadUserCookies() { string cookiesName = ShopConfig.ReadConfigInfo().UserCookies; if (CookiesHelper.ReadCookie(cookiesName) != null) { string cookiesValue = CookiesHelper.ReadCookieValue(cookiesName); if (!string.IsNullOrEmpty(cookiesValue)) { try { string[] strArray = cookiesValue.Split(new char[] { '|' }); string sign = strArray[0]; string userID = strArray[1]; string userName = strArray[2]; string gradeID = strArray[3]; if (FormsAuthentication.HashPasswordForStoringInConfigFile(userID + userName + gradeID.ToString() + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == sign.ToLower()) { UserId = Convert.ToInt32(userID); UserName = HttpContext.Current.Server.UrlDecode(userName); GradeID = Convert.ToInt32(gradeID); } else { CookiesHelper.DeleteCookie(cookiesName); } } catch { CookiesHelper.DeleteCookie(cookiesName); } } } if (GradeID == 0) { GradeID = UserGradeBLL.ReadByMoney(0).Id; } UserGrade = UserGradeBLL.Read(GradeID).Name; UserGrade = string.IsNullOrEmpty(UserGrade) ? "游客" : UserGrade; }
/// <summary> /// 提交数据 /// </summary> protected void Post() { string userName = StringHelper.SearchSafe(Server.UrlDecode(RequestHelper.GetForm <string>("UserName"))); string email = StringHelper.SearchSafe(HttpUtility.HtmlDecode(RequestHelper.GetForm <string>("Email"))); string safeCode = StringHelper.AddSafe(HttpUtility.HtmlDecode(RequestHelper.GetForm <string>("SafeCode"))); int checkType = RequestHelper.GetForm <int>("checkType"); string mobile = StringHelper.AddSafe(HttpUtility.HtmlDecode(RequestHelper.GetForm <string>("Mobile"))); string mobileCode = StringHelper.AddSafe(HttpUtility.HtmlDecode(RequestHelper.GetForm <string>("phoneVer"))); UserInfo user = new UserInfo(); //检查用户名 if (userName == string.Empty) { errorMessage = "账户名不能为空"; } if (errorMessage == string.Empty) { user = UserBLL.Read(userName); if (user.Id <= 0) { errorMessage = "账户不存在"; } } //检查验证码 if (errorMessage == string.Empty) { if (safeCode.ToLower() != Cookies.Common.CheckCode.ToLower()) { errorMessage = "验证码错误"; } } switch (checkType) { case 1: //邮箱验证 //检查Email if (errorMessage == string.Empty) { if (email == string.Empty) { errorMessage = "Email不能为空"; } } if (errorMessage == string.Empty) { if (UserBLL.CheckEmail(email)) { errorMessage = "不存在该Email"; } } //检查用户和Email是否匹配 if (errorMessage == string.Empty) { if (user.Email != email) { errorMessage = "账户名和Email不匹配"; } } //记录找回密码信息 if (errorMessage == string.Empty) { string tempSafeCode = Guid.NewGuid().ToString(); UserBLL.ChangeUserSafeCode(user.Id, tempSafeCode, RequestHelper.DateNow); string url = "http://" + Request.ServerVariables["HTTP_HOST"] + "/mobile/User/ResetPassword.html?CheckCode=" + StringHelper.Encode(user.Id + "|" + email + "|" + userName + "|" + user.Mobile + "|" + tempSafeCode, ShopConfig.ReadConfigInfo().SecureKey); EmailContentInfo emailContent = EmailContentHelper.ReadSystemEmailContent("FindPassword"); EmailSendRecordInfo emailSendRecord = new EmailSendRecordInfo(); emailSendRecord.Title = emailContent.EmailTitle; emailSendRecord.Content = emailContent.EmailContent.Replace("$Url$", url); emailSendRecord.IsSystem = (int)BoolType.True; emailSendRecord.EmailList = email; emailSendRecord.IsStatisticsOpendEmail = (int)BoolType.False; emailSendRecord.SendStatus = (int)SendStatus.No; emailSendRecord.AddDate = RequestHelper.DateNow; emailSendRecord.SendDate = RequestHelper.DateNow; emailSendRecord.ID = EmailSendRecordBLL.AddEmailSendRecord(emailSendRecord); EmailSendRecordBLL.SendEmail(emailSendRecord); result = "您的申请已提交,请登录邮箱重设你的密码!<a href=\"http://mail." + email.Substring(email.IndexOf("@") + 1) + "\" target=\"_blank\">马上登录</a>"; Response.Clear(); Response.Write("ok|/mobile/User/FindPassword.html?Result=" + Server.UrlEncode(result)); Response.End(); //ResponseHelper.Redirect("/User/FindPassword.aspx?Result=" + Server.UrlEncode(result)); } else { Response.Clear(); Response.Write("error|" + errorMessage); Response.End(); //ResponseHelper.Redirect("/User/FindPassword.aspx?ErrorMessage=" + Server.UrlEncode(errorMessage)); } break; case 0: //手机验证 //检查Mobile if (string.IsNullOrEmpty(errorMessage) && string.IsNullOrEmpty(mobile)) { errorMessage = "请填写手机号"; } //检查手机号是否匹配 if (string.IsNullOrEmpty(errorMessage) && !string.Equals(user.Mobile, mobile)) { errorMessage = "请填写正确有效的手机号"; } //检查校验码 if (string.IsNullOrEmpty(errorMessage) && string.IsNullOrEmpty(mobileCode)) { errorMessage = "请填写短信校验码"; } //手机短信校验码 if (CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(mobile)) == null) { errorMessage = "校验码失效,请重新获取"; } else { string cookieMobileCode = CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(mobile)).Value.ToString(); if (cookieMobileCode.ToLower() != mobileCode.ToLower()) { errorMessage = "校验码错误"; } else { CookiesHelper.DeleteCookie("MobileCode" + StringHelper.AddSafe(mobile)); } } //找回密码 if (errorMessage == string.Empty) { string tempSafeCode = Guid.NewGuid().ToString(); UserBLL.ChangeUserSafeCode(user.Id, tempSafeCode, RequestHelper.DateNow); string url = "http://" + Request.ServerVariables["HTTP_HOST"] + "/mobile/User/ResetPassword.html?CheckCode=" + StringHelper.Encode(user.Id + "|" + user.Email + "|" + userName + "|" + mobile + "|" + tempSafeCode, ShopConfig.ReadConfigInfo().SecureKey); Response.Clear(); Response.Write("ok|" + url); Response.End(); //ResponseHelper.Redirect("/User/FindPassword.aspx?Result=" + Server.UrlEncode(result)); } else { Response.Clear(); Response.Write("error|" + errorMessage); Response.End(); //ResponseHelper.Redirect("/User/FindPassword.aspx?ErrorMessage=" + Server.UrlEncode(errorMessage)); } break; } }
/// <summary> /// 提交数据 /// </summary> protected override void PostBack() { string userName = StringHelper.SearchSafe(StringHelper.AddSafe(RequestHelper.GetForm <string>("UserName"))); string email = StringHelper.SearchSafe(StringHelper.AddSafe(RequestHelper.GetForm <string>("Email"))); string userPassword1 = RequestHelper.GetForm <string>("UserPassword1"); string userPassword2 = RequestHelper.GetForm <string>("UserPassword2"); string safeCode = RequestHelper.GetForm <string>("SafeCode"); string Phone = StringHelper.SearchSafe(StringHelper.AddSafe(RequestHelper.GetForm <string>("Phone"))); string phoneCode = RequestHelper.GetForm <string>("PhoneCode"); //检查用户名 if (userName == string.Empty) { errorMessage = "用户名不能为空"; } if (errorMessage == string.Empty) { string forbiddinName = ShopConfig.ReadConfigInfo().ForbiddenName; if (forbiddinName != string.Empty) { foreach (string TempName in forbiddinName.Split('|')) { if (userName.IndexOf(TempName.Trim()) != -1) { errorMessage = "用户名含有非法字符"; break; } } } } if (errorMessage == string.Empty) { if (!UserBLL.UniqueUser(userName)) { errorMessage = "用户名已经被占用"; } } if (errorMessage == string.Empty) { Regex rg = new Regex("^([a-zA-Z0-9_\u4E00-\u9FA5])+$"); if (!rg.IsMatch(userName)) { errorMessage = "用户名只能包含字母、数字、下划线、中文"; } } //检查密码 if (errorMessage == string.Empty) { if (userPassword1 == string.Empty || userPassword2 == string.Empty) { errorMessage = "密码不能为空"; } } if (errorMessage == string.Empty) { if (userPassword1 != userPassword2) { errorMessage = "两次密码不一致"; } } //检查手机 邮箱 验证码 if (ShopConfig.ReadConfigInfo().RegisterCheck == 1) {//短信验证 if (errorMessage == string.Empty) { if (!ShopCommon.CheckMobile(Phone)) { errorMessage = "手机号码错误"; } } if (errorMessage == string.Empty) { if (!UserBLL.CheckMobile(Phone, 0)) { errorMessage = "手机号码已经被注册"; } } if (errorMessage == string.Empty) { if (CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(Phone)) == null) { errorMessage = "验证码失效,请重新获取验证码"; } else { string mobileCode = CookiesHelper.ReadCookie("MobileCode" + StringHelper.AddSafe(Phone)).Value.ToString(); if (phoneCode.ToLower() != mobileCode.ToLower()) { errorMessage = "验证码错误"; } else { CookiesHelper.DeleteCookie("MobileCode" + StringHelper.AddSafe(Phone)); } } } } else {//邮件验证 if (errorMessage == string.Empty) { if (errorMessage == string.Empty) { if (!UserBLL.CheckEmail(email)) { errorMessage = "Email已被注册"; } } if (safeCode.ToLower() != Cookies.Common.CheckCode.ToLower()) { errorMessage = "验证码错误"; } } } //注册用户 if (errorMessage == string.Empty) { UserInfo user = new UserInfo(); user.UserName = userName; user.UserPassword = StringHelper.Password(userPassword1, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); user.Mobile = Phone; user.Email = email; user.RegisterIP = ClientHelper.IP; user.RegisterDate = RequestHelper.DateNow; user.LastLoginIP = ClientHelper.IP; user.LastLoginDate = RequestHelper.DateNow; user.FindDate = RequestHelper.DateNow; user.Sex = (int)SexType.Secret; if (ShopConfig.ReadConfigInfo().RegisterCheck == 1) {//短信验证,用户状态为已验证,可直接登录 user.Status = (int)UserStatus.Normal; } else {//邮件验证,用户状态为未验证,需登录邮件手动激活后再登录 user.Status = (int)UserStatus.NoCheck; } int userID = UserBLL.Add(user); if (ShopConfig.ReadConfigInfo().RegisterCheck == 1) { //短信验证,直接登录 HttpCookie cookie = new HttpCookie(ShopConfig.ReadConfigInfo().UserCookies); cookie["User"] = StringHelper.Encode(userName, ShopConfig.ReadConfigInfo().SecureKey); cookie["Password"] = StringHelper.Encode(userPassword1, ShopConfig.ReadConfigInfo().SecureKey); cookie["Key"] = StringHelper.Encode(ClientHelper.Agent, ShopConfig.ReadConfigInfo().SecureKey); HttpContext.Current.Response.Cookies.Add(cookie); user = UserBLL.Read(userID); UserBLL.UserLoginInit(user); ResponseHelper.Redirect("/Mobile/User/Index.html"); } else if (ShopConfig.ReadConfigInfo().RegisterCheck == 2) { try { //邮件验证 string url = "http://" + Request.ServerVariables["HTTP_HOST"] + "/Mobile/User/ActiveUser.html?CheckCode=" + StringHelper.Encode(userID + "|" + email + "|" + userName, ShopConfig.ReadConfigInfo().SecureKey); EmailContentInfo emailContent = EmailContentHelper.ReadSystemEmailContent("Register"); EmailSendRecordInfo emailSendRecord = new EmailSendRecordInfo(); emailSendRecord.Title = emailContent.EmailTitle; emailSendRecord.Content = emailContent.EmailContent.Replace("$UserName$", user.UserName).Replace("$Url$", url); emailSendRecord.IsSystem = (int)BoolType.True; emailSendRecord.EmailList = email; emailSendRecord.IsStatisticsOpendEmail = (int)BoolType.False; emailSendRecord.SendStatus = (int)SendStatus.No; emailSendRecord.AddDate = RequestHelper.DateNow; emailSendRecord.SendDate = RequestHelper.DateNow; emailSendRecord.ID = EmailSendRecordBLL.AddEmailSendRecord(emailSendRecord); EmailSendRecordBLL.SendEmail(emailSendRecord); result = "恭喜您,注册成功,请登录邮箱激活!<a href=\"http://mail." + email.Substring(email.IndexOf("@") + 1) + "\" target=\"_blank\">马上激活</a>"; } catch (Exception ex) { ScriptHelper.AlertFront("激活邮件发送失败,请联系网站客服"); } } else { //人工审核 result = "恭喜您,注册成功,请等待我们的审核!"; } ResponseHelper.Redirect("/Mobile/User/Register.html?Result=" + Server.UrlEncode(result)); } else { ScriptHelper.AlertFront(errorMessage); //ResponseHelper.Redirect("/Mobile/User/Register.html?ErrorMessage=" + Server.UrlEncode(errorMessage)); } }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int count = int.MinValue; topNav = 2; int id = RequestHelper.GetQueryString <int>("ID"); string fromwhere = RequestHelper.GetQueryString <string>("fw"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False) { if (fromwhere.ToLower() != "admin") { ScriptHelper.AlertFront("该产品未上市,不能查看"); } else { if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录 { ScriptHelper.AlertFront("该产品未上市,不能查看"); } } } navList = ProductClassBLL.ProductClassNameList(product.ClassId); //更新查看数量 if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null) { ProductBLL.ChangeViewCount(id, 1); CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString()); } //会员等级 userGradeList = UserGradeBLL.ReadList(); //产品价格 currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, base.GradeID); //产品图片 ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo; productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); // 关联产品,配件,浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct; tempStrProductID = tempStrProductID.Replace(",,", ","); if (tempStrProductID.StartsWith(",")) { tempStrProductID = tempStrProductID.Substring(1); } if (tempStrProductID.EndsWith(",")) { tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = tempStrProductID; tempProductList = ProductBLL.SearchList(productSearch); //属性 attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id); //产品文章 if (product.RelationArticle != string.Empty) { ArticleSearchInfo articleSearch = new ArticleSearchInfo(); articleSearch.InArticleId = product.RelationArticle; productArticleList = ArticleBLL.SearchList(articleSearch); } //产品规格 standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } //计算剩余库存量 if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem) { leftStorageCount = product.TotalStorageCount - product.OrderCount; } else { leftStorageCount = product.ImportVirtualStorageCount; } //搜索优化 Title = (product.SubTitle == string.Empty) ? product.Name : product.SubTitle; Keywords = (product.Keywords == string.Empty) ? product.Name : product.Keywords; Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
public ActionResult Detail(int id) { int userGrade = UserGradeBLL.ReadByMoney(0).Id; int uid = RequestHelper.GetForm <int>("uid"); var user = UserBLL.ReadUserMore(uid); if (user.Id > 0) { userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id; user.UserName = HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8); } if (id <= 0) { return(Json(new { ok = false, error = "该产品未上市" })); } string fromwhere = RequestHelper.GetQueryString <string>("fw"); ProductInfo product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { return(Json(new { ok = false, error = "该产品未上市" })); } #region 如果商品没有小程序码 则生成并保存 if (string.IsNullOrWhiteSpace(product.Qrcode)) { string product_miniProramCode = string.Empty; CreateMiniProgramCode(product.Id, ref product_miniProramCode, product.Qrcode); if (!string.IsNullOrWhiteSpace(product_miniProramCode)) {//如果调用接口成功生成小程序码(因为只有发布后才能使用此微信接口) Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("[Qrcode]", product_miniProramCode); ProductBLL.UpdatePart("[Product]", dict, product.Id); product.Qrcode = product_miniProramCode; } } #endregion //更新查看数量 if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null) { ProductBLL.ChangeViewCount(id, 1); CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString()); } ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo(); var proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo { ProductId = product.Id, Status = (int)CommentStatus.Show }); var procomlist = new List <VirtualProductCommend>(); foreach (var item in proComm) { VirtualProductCommend vpc = new VirtualProductCommend() { id = item.Id, name = HttpUtility.UrlDecode(item.UserName, Encoding.UTF8), avator = ShopCommon.ShowImage(UserBLL.Read(item.UserId).Photo), lv = item.Rank, date = item.PostDate, content = item.Content, imglist = ProductPhotoBLL.ReadList(item.Id, 3), adminreply = item.AdminReplyContent, replydate = item.AdminReplyDate }; procomlist.Add(vpc); } //产品价格 int hotCount = 0; var currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, userGrade); var prorecommend = ProductBLL.SearchList(1, 8, new ProductSearchInfo { IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString() }, ref hotCount); var prorelist = new List <ProductVirtualModel>(); foreach (var item in prorecommend) { var vp = new ProductVirtualModel() { id = item.Id, name = item.Name, img = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")), imgbig = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")), imgorg = ShopCommon.ShowImage(item.Photo), price = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade), marketprice = item.MarketPrice, click = item.ViewCount, like = item.LikeNum, totalstore = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount, //ordercount = item.OrderCount //是否启用不限库存,分别计算销量 ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount }; prorelist.Add(vp); } //产品图片 List <ProductPhotoInfo> productPhotoList = new List <ProductPhotoInfo>(); ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo; productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); productPhotoList.ForEach(k => k.ImageUrl = k.ImageUrl.Replace("75-75", "Original")); //属性 var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id); #region 产品规格 List <ProductTypeStandardInfo> standardList = new List <ProductTypeStandardInfo>(); string standardRecordValueList = "|"; var standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); decimal maxPrice = product.SalePrice; if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { if (standardRecord.MarketPrice > maxPrice) { maxPrice = standardRecord.MarketPrice; } string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } #endregion #region 正在开的团(进行中,排除本人开的团) GroupBuySearchInfo gpsearch = new GroupBuySearchInfo { ProductId = product.Id, //NotLeader = user.Id, Status = (int)GroupBuyStatus.Going }; List <GroupBuyInfo> gpList = GroupBuyBLL.SearchList(gpsearch); gpList.ForEach(k => k.groupSignList = GroupSignBLL.ReadListByGroupId(k.Id)); gpList.ForEach(k => k.GroupUserName = System.Web.HttpUtility.UrlDecode(k.GroupUserName, Encoding.UTF8)); #endregion return(Json(new { ok = true, product = new { id = product.Id, img = ShopCommon.ShowImage(product.Photo.Replace("Original", "350-350")), imgorg = ShopCommon.ShowImage(product.Photo), title = product.Name, summary = product.Summary, price = currentMemberPrice, marketprice = product.MarketPrice, intro = string.IsNullOrEmpty(product.Introduction1_Mobile) ? product.Introduction1 : product.Introduction1_Mobile, remark = product.Remark, totalstore = product.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(product.Id) : product.TotalStorageCount, ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now) : product.OrderCount, unlimitedstorage = product.UnlimitedStorage, virtualordercount = product.VirtualOrderCount, usevirtualorder = product.UseVirtualOrder, opengroup = product.OpenGroup, groupprice = product.GroupPrice, groupquantity = product.GroupQuantity, qrcode = product.Qrcode, groupphoto = string.IsNullOrWhiteSpace(product.GroupPhoto) ? product.Photo : product.GroupPhoto }, standardList = standardList, standardRecordValueList = standardRecordValueList, attributeRecordList = attributeRecordList, productPhotoList = productPhotoList, prorecommend = prorelist, proComm = procomlist, maxPrice = maxPrice, groupList = gpList }, JsonRequestBehavior.AllowGet)); }