/// <summary> /// 提交订单留言 /// </summary> public void OrderComment_Edit() { string comment = RequestTool.RequestSafeString("comment"); int order_id = RequestTool.RequestInt("order_id", 0); Lebi_Order order = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.Content = comment; model.Keyid = order_id; model.TableName = "Order"; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(model); //发送邮件 Email.SendEmail_ordercomment(CurrentUser, model); //发送短信 SMS.SendSMS_ordercomment(CurrentUser, model); Response.Write("{\"msg\":\"OK\"}"); }
public Lebi_Product GetProduct(int id) { Lebi_Product model = B_Lebi_Product.GetModel(id); if (model == null) { model = new Lebi_Product(); } return(model); }
/// <summary> /// 晒单评论 /// </summary> public void Comment_reply() { int id = RequestTool.RequestInt("id", 0); int Product_id = 0; Lebi_Product product = B_Lebi_Product.GetModel(id); if (product != null) { Product_id = product.Product_id; } Lebi_Comment pmodel = B_Lebi_Comment.GetModel(id); if (pmodel == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } string Content = RequestTool.RequestSafeString("comment"); if (Content == "") { Response.Write("{\"msg\":\"" + Tag("内容不能为空") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product"; model.Keyid = id; //model.Admin_UserName = CurrentUser.NickName; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.NickName; model.Content = Content; model.Parentid = id; model.Status = 280; model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Product_id = Product_id; model.IsRead = 0; model.Supplier_id = product.Supplier_id; if (!Comment.CheckSafeWord(model.Content)) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } B_Lebi_Comment.Add(model); //发送邮件 if (ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("comment")) { Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_comment(user, model); } Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 订单留言 /// </summary> /// <param name="user"></param> public static void SendSMS_ordercomment(Lebi_User user, Lebi_Comment model) { BaseConfig conf = ShopCache.GetBaseConfig(); int IsAdminSms = 0; int IsSupplierSms = 0; if (conf.SMS_sendmode.Contains("SMSTPL_Admin_ordercomment")) { IsAdminSms = 1; } Lebi_Order order = B_Lebi_Order.GetModel(model.Keyid); if (order == null) { order = new Lebi_Order(); } if (order.Supplier_id > 0) { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(order.Supplier_id); if (supplier.IsSupplierTransport == 0) //商家发货 { if (ShopCache.GetBaseConfig_Supplier(order.Supplier_id).SMS_sendmode.Contains("SMSTPL_Admin_ordercomment")) { IsSupplierSms = 1; } } } if (IsAdminSms == 0 && IsSupplierSms == 0) { return; } if (user.Language == "") { user.Language = Language.Languages().FirstOrDefault().Code; } string Admin_content = Language.Content(conf.SMSTPL_Admin_ordercomment, user.Language); Admin_content = ReplaceSMSTag(Admin_content, user, conf); Admin_content = Admin_content.Replace("{$Content}", model.Content); Admin_content = Admin_content.Replace("{$OrderNO}", order.Code); if (IsAdminSms == 1) { Send(conf.SMS_reciveno, Admin_content); } if (IsSupplierSms == 1) { BaseConfig_Supplier config_supplier = ShopCache.GetBaseConfig_Supplier(order.Supplier_id); Send(config_supplier.SMS_reciveno, Admin_content); } }
/// <summary> /// 商品咨询 /// </summary> /// <param name="user"></param> /// <param name="model"></param> public static void SendSMS_ask(Lebi_User user, Lebi_Comment model) { BaseConfig conf = ShopCache.GetBaseConfig(); int IsAdminSms = 0; int IsSupplierSms = 0; if (conf.SMS_sendmode.Contains("SMSTPL_ask")) { IsAdminSms = 1; } Lebi_Product product = B_Lebi_Product.GetModel(model.Product_id); if (product == null) { product = new Lebi_Product(); } if (product.Supplier_id > 0) { Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(product.Supplier_id); if (supplier.IsSupplierTransport == 0) //商家发货 { if (ShopCache.GetBaseConfig_Supplier(product.Supplier_id).SMS_sendmode.Contains("SMSTPL_ask")) { IsSupplierSms = 1; } } } if (IsAdminSms == 0 && IsSupplierSms == 0) { return; } if (user.Language == "") { user.Language = Language.Languages().FirstOrDefault().Code; } string list = "" + Language.Tag("商品名称", user.Language) + ":" + Language.Content(product.Name, user.Language) + ";" + Language.Tag("内容", user.Language) + ":" + model.Content + ";"; string Admin_content = Language.Content(conf.SMSTPL_Admin_ask, user.Language); Admin_content = ReplaceSMSTag(Admin_content, user, conf); Admin_content = Admin_content.Replace("{$Content}", list); if (IsAdminSms == 1) { Send(conf.SMS_reciveno, Admin_content); } if (IsSupplierSms == 1) { BaseConfig_Supplier config_supplier = ShopCache.GetBaseConfig_Supplier(product.Supplier_id); Send(config_supplier.SMS_reciveno, Admin_content); } }
protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode) { LoadTheme(themecode, siteid, languagecode, pcode); int id = Rint_Para("0"); comment = B_Lebi_Comment.GetModel(id); if (comment.id == 0) { Response.Redirect(URL("P_404", "")); Response.End(); } product = GetProduct(comment.Keyid); string where = "Parentid =" + id; comments = B_Lebi_Comment.GetList(where, "id desc", PageSize, pageindex); int recordCount = B_Lebi_Comment.Counts(where); PageString = Shop.Bussiness.Pager.GetPaginationStringForWeb("?page={0}&id=" + id, pageindex, PageSize, recordCount, CurrentLanguage); ProductStar = Convert.ToInt32(product.Star_Comment); if (ProductStar > 5) { ProductStar = 5; } if (ProductStar < 0) { ProductStar = 0; } pro_type = B_Lebi_Pro_Type.GetModel(product.Pro_Type_id); path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">»</em>"; if (pro_type != null) { string[,] parr = Categorypath(pro_type.id); for (int i = 0; i <= parr.GetUpperBound(0); i++) { path += "<a href=\"" + URL("P_ProductCategory", "" + parr[i, 0] + "") + "\"><span>" + parr[i, 1] + "</span></a><em>»</em>"; } } path += "<a href=\"" + URL("P_Product", product.id) + "\"><span>" + Lang(product.Name) + "</span></a><em>»</em>"; path += "<a><span>" + Tag("晒单") + "</span></a>"; //path += "<a href=\"" + URL("P_Product", id) + "\"><span>" + Lang(product.Name) + "</span></a>"; smalls = comment.ImagesSmall.Split('@'); bigs = comment.Images.Split('@'); if (bigs.Count() > 1) { DefaultImage = bigs[1]; } productcomments = B_Lebi_Comment.GetList("TableName='Product' and Keyid=" + comment.Keyid + " and id!=" + comment.id + "", "id desc", 5, 1); }
/// <summary> /// 取消订单 /// </summary> public void OrderCancal() { int id = RequestTool.RequestInt("id", 0); string Remark = RequestTool.RequestSafeString("Remark"); Lebi_Order order = B_Lebi_Order.GetModel("User_id=" + CurrentUser.id + " and id = " + id + ""); //增加未审核判断 by lebi.kingdge 2015-04-21 if (order == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (!Shop.Bussiness.Order.CancelOrder(order)) { Response.Write("{\"msg\":\"" + Tag("已取消") + "\"}"); return; } if (order.IsShipped == 1 || order.IsShipped_All == 1 || order.IsCompleted == 1 || order.IsReceived == 1 || order.IsReceived_All == 1) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); if (Remark != "") { model.Content = Tag("取消订单") + ":" + Remark; } else { model.Content = Tag("取消订单"); } model.Keyid = order.id; model.TableName = "Order"; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(model); if (order.IsPaid == 0) { Shop.Bussiness.Order.Order_Cancal(order); } else { order.IsRefund = 2; order.Time_Refund = System.DateTime.Now; B_Lebi_Order.Update(order); } Log.Add("取消订单", "Order", order.id.ToString(), CurrentUser); Response.Write("{\"msg\":\"OK\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("ask_edit", "编辑商品咨询")) { WindowNoPower(); } int id = RequestTool.RequestInt("id", 0); model = B_Lebi_Comment.GetModel(id); if (model == null) { model = new Lebi_Comment(); } models = B_Lebi_Comment.GetList("Parentid = " + id, "id desc", PageSize, page); }
protected void Page_Load(object sender, EventArgs e) { if (!Power("supplier_ask", "商品咨询")) { WindowNoPower(); } int id = RequestTool.RequestInt("id", 0); model = B_Lebi_Comment.GetModel("id = " + id + " and Supplier_id = " + CurrentSupplier.id); if (model == null) { model = new Lebi_Comment(); } models = B_Lebi_Comment.GetList("Parentid = " + id, "id desc", PageSize, page); }
/// <summary> /// 商品咨询管理员回复 /// </summary> /// <param name="model"></param> public static void SendSMS_askreply(Lebi_Comment model) { BaseConfig conf = ShopCache.GetBaseConfig(); if (conf.SMS_sendmode.Contains("SMSTPL_ask")) { Lebi_User user = B_Lebi_User.GetModel(model.User_id); if (user.Language == "") { user.Language = Language.Languages().FirstOrDefault().Code; } string content = Language.Content(conf.SMSTPL_ask, user.Language); content = ReplaceSMSTag(content, user, conf); content = content.Replace("{$Content}", model.Content); Send(user.MobilePhone, content); } }
/// <summary> /// 商品咨询管理员回复 /// </summary> /// <param name="model"></param> public static void Push_askreply(Lebi_Comment model) { BaseConfig conf = ShopCache.GetBaseConfig(); if (conf.APPPush_sendmode.Contains("ask")) { Lebi_User user = B_Lebi_User.GetModel(model.User_id); if (user.Language == "") { user.Language = Language.Languages().FirstOrDefault().Code; } string content = Language.Content(conf.SMSTPL_ask, user.Language); content = ReplaceSMSTag(content, user, conf); content = content.Replace("{$Content}", model.Content); Push(user.Device_system, user.Device_id, content); } }
/// <summary> /// 发表商品咨询 /// </summary> public void Ask_Write() { int id = RequestTool.RequestInt("id", 0); int Product_id = 0; Lebi_Product product = B_Lebi_Product.GetModel(id); if (product != null) { Product_id = product.Product_id; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product_Ask"; model.Keyid = id; model.Admin_UserName = "******"; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; model.Content = RequestTool.RequestSafeString("Content"); model.Star = 0; model.Parentid = 0; model.Status = 282; //283已回复 model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Product_id = Product_id; model.IsRead = 1; model.Supplier_id = product.Supplier_id; if (!Comment.CheckSafeWord(model.Content)) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } B_Lebi_Comment.Add(model); //发送邮件 Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_ask(user, model); //发送短信 SMS.SendSMS_ask(user, model); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 生成退货单 /// </summary> public void torder_save() { int order_id = RequestTool.RequestInt("order_id", 0); string opid = RequestTool.RequestSafeString("opid"); if (opid == "") { Response.Write("{\"msg\":\"" + Tag("未选择任何商品") + "\"}"); return; } int count = 0; Lebi_Order order = B_Lebi_Order.GetModel(order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } if (order.User_id != CurrentUser.id) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } List <Lebi_Order_Product> ops = B_Lebi_Order_Product.GetList("id in (lbsql{" + opid + "}) and Order_id=" + order.id + "", ""); foreach (Lebi_Order_Product op in ops) { int rcount = RequestTool.RequestInt("product_" + op.id, 0); if (rcount > (op.Count_Received - op.Count_Return)) { Response.Write("{\"msg\":\"" + Tag("退货数量不能大于收货数量") + "\"}"); return; } if (rcount < 1) { Response.Write("{\"msg\":\"" + Tag("退货数量不能小于1") + "\"}"); return; } count = count + rcount; } if (count == 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } //CurrentUser.Count_Order = CurrentUser.Count_Order + 1; //B_Lebi_User.Update(CurrentUser); //foreach (Lebi_Order_Product op in ops) //{ // op.Count_Return = op.Count_Return + RequestTool.RequestInt("product_" + op.id, 0); // B_Lebi_Order_Product.Update(op); //} Lebi_Order model = new Lebi_Order(); model.Order_id = order.id; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; model.T_Name = order.T_Name; model.T_Address = order.T_Address; model.T_Area_id = order.T_Area_id; model.T_MobilePhone = order.T_MobilePhone; model.T_Phone = order.T_Phone; model.T_Postalcode = order.T_Postalcode; model.Weight = 0; model.Money_Product = 0; model.Type_id_OrderType = 212; model.Code = Shop.Bussiness.Order.CreateOrderCode(); model.Supplier_id = order.Supplier_id; model.Site_id = CurrentSite.id; model.Language_id = CurrentLanguage.id; B_Lebi_Order.Add(model); model.id = B_Lebi_Order.GetMaxId(); foreach (Lebi_Order_Product op in ops) { count = RequestTool.RequestInt("product_" + op.id, 0); op.Count_Return = op.Count_Return + count; B_Lebi_Order_Product.Update(op); op.Count = count; op.Count_Shipped = 0; op.Count_Received = 0; op.Order_Code = model.Code; op.Order_id = model.id; op.Money = op.Price * op.Count; B_Lebi_Order_Product.Add(op); model.Money_Product = model.Money_Product + (op.Price - op.Money_Give_one - op.Money_Card312_one) * count; model.Weight = model.Weight + op.Weight * count; model.Volume = model.Weight + op.Volume * count; model.Point = model.Point + op.Point_Give_one; } model.Money_Product = 0 - model.Money_Product; model.Money_Order = model.Money_Product; model.Money_Pay = model.Money_Product; model.Money_Give = 0 - model.Money_Order; model.Point = 0 - model.Point; B_Lebi_Order.Update(model); //处理留言 Lebi_Comment com = new Lebi_Comment(); com.Content = RequestTool.RequestSafeString("say"); com.Keyid = model.id; com.TableName = "Order"; com.User_id = CurrentUser.id; com.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(com); Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Lebi_Order ordermodel = B_Lebi_Order.GetModel("Order_id=" + order_id + ""); //发送邮件 if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("dingdantijiao") || ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("ordersubmit")) { Email.SendEmail_ordersubmit(user, ordermodel); } //发送短信 if (ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_ordersubmit") || ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_Admin_ordersubmit")) { SMS.SendSMS_ordersubmit(user, order); } Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 生成新订单 /// </summary> public void order_save() { if (CurrentUserLevel.BuyRight != 1) { Response.Write("{\"msg\":\"" + Tag("您所在的分组不允许下单") + "\"}"); return; } int pay_id = RequestTool.RequestInt("pay_id", 0); int sid = RequestTool.RequestInt("sid", 0);//结算供应商ID int onlinepay_id = RequestTool.RequestInt("onlinepay_id", 0); decimal Money_UserCut = RequestTool.RequestDecimal("Money_UserCut", 0); int usermoneytype = RequestTool.RequestInt("usermoneytype", 0); string Pay_Password = RequestTool.RequestSafeString("Pay_Password"); Lebi_PickUp pick = null; DateTime pickdate = System.DateTime.Now; if (usermoneytype == 3) { if (Pay_Password == "") { Response.Write("{\"msg\":\"" + Tag("请输入支付密码") + "\"}"); return; } else { if (EX_User.MD5(Pay_Password) != CurrentUser.Pay_Password) { Response.Write("{\"msg\":\"" + Tag("支付密码不正确") + "\"}"); return; } } if (Money_UserCut > 0 && Money_UserCut > CurrentUser.Money) { Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}"); return; } } Lebi_Pay pay = B_Lebi_Pay.GetModel(pay_id); if (pay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } Basket basket = new Basket(sid); int CustomOfflineMoney = RequestTool.RequestInt("CustomOfflineMoney" + pay.id, 0); decimal OfflineMoney = RequestTool.RequestDecimal("OfflineMoney" + pay.id, 0); if (CustomOfflineMoney == 1) { if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 if (OfflineMoney < basket.Money_Product) { Response.Write("{\"msg\":\"" + Tag("打款金额不能少于订单金额") + "\"}"); return; } } } if (pay.Code == "OnlinePay") { Lebi_OnlinePay onpay = B_Lebi_OnlinePay.GetModel(onlinepay_id); if (onpay == null) { Response.Write("{\"msg\":\"" + Tag("请设置付款方式") + "\"}"); return; } } if (basket.Products.Count == 0) { Response.Write("{\"msg\":\"" + Tag("购物车为空") + "\"}"); return; } foreach (Lebi_User_Product up in basket.Products) { if (up.count < 1) { Response.Write("{\"msg\":\"" + Tag("购物车异常") + "\"}"); return; } } if (basket.Point_Buy > 0 && (basket.Point_Buy > CurrentUser.Point)) { Response.Write("{\"msg\":\"" + Tag("积分不足") + "\"}"); return; } int ProductCount = 0; foreach (Lebi_User_Product up in basket.Products) { Lebi_Product pro = B_Lebi_Product.GetModel(up.Product_id); if (pro.Type_id_ProductType != 323) { ProductCount += up.count; } //<-{ 判断是否上架状态 by lebi.kingdge 2015-02-10 if (pro.Type_id_ProductStatus != 101) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("该商品已经下架") + "\"}"); return; } //}-> if (pro.Type_id_ProductType != 324) { int levelcount = ProductLevelCount(pro); if (up.count < levelcount) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + " " + Tag("起订量") + " " + levelcount + "\"}"); return; } } if (pro.Type_id_ProductType != 320 && pro.Time_Expired > System.DateTime.Now) { if (pro.Count_Limit < up.count && pro.Count_Limit > 0) { Response.Write("{\"msg\":\"" + Tag("购买数量大于限购数量") + "\"}"); return; } } if (SYS.IsNullStockSale != "1") { if (pro.Count_Stock - pro.Count_Freeze < up.count && pro.Type_id_ProductType != 324) { Response.Write("{\"msg\":\"" + Lang(pro.Name) + "" + Tag("库存不足") + "\"}"); return; } } } //验证当前分组允许的最低订单提交金额 if (CurrentUserLevel.OrderSubmit > 0) { if (basket.Money_Product < CurrentUserLevel.OrderSubmit) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低金额为:") + FormatMoney(CurrentUserLevel.OrderSubmit) + "\"}"); return; } } //验证当前分组允许的最低订单提交数量 if (CurrentUserLevel.OrderSubmitCount > 0 && ProductCount > 0) { if (ProductCount < CurrentUserLevel.OrderSubmitCount) { Response.Write("{\"msg\":\"" + Tag("单笔订单最低数量为:") + CurrentUserLevel.OrderSubmitCount + "\"}"); return; } } Lebi_User_Address shouhuo = B_Lebi_User_Address.GetModel(CurrentUser.User_Address_id); if (shouhuo == null) { Response.Write("{\"msg\":\"" + Tag("未设置收获地址") + "\"}"); return; } if (CurrentUser.Transport_Price_id == "") { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } foreach (BasketShop shop in basket.Shops) { Lebi_Transport_Price tprice = B_Lebi_Transport_Price.GetModel("id in (lbsql{" + CurrentUser.Transport_Price_id + "}) and Supplier_id=" + shop.Shop.id + ""); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } Lebi_Transport transport = B_Lebi_Transport.GetModel(tprice.Transport_id); if (tprice == null) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } //检查运费设置是否正确 if (!EX_Area.CheckAreaPrice(tprice, shouhuo.Area_id)) { Response.Write("{\"msg\":\"" + Tag("运费设置错误") + "\"}"); return; } if (transport.Type_id_TransportType == 332)//自提检查 { int pickup_id = RequestTool.RequestInt("pickup_id" + shop.Shop.id); string pickdate_ = RequestTool.RequestString("pickupdate_" + pickup_id); try { pickdate = Convert.ToDateTime(pickdate_); } catch { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } pick = B_Lebi_PickUp.GetModel(pickup_id); if (pick == null) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (pick.IsCanWeekend == 0 && (pickdate.DayOfWeek == DayOfWeek.Saturday || pickdate.DayOfWeek == DayOfWeek.Sunday)) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } if (System.DateTime.Now.Date.AddDays(pick.BeginDays) > pickdate) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } string NoServiceDays = pick.NoServiceDays.TrimStart('0').Replace(".0", "."); string nowday = pickdate.ToString("M.d"); if (("," + NoServiceDays + ",").Contains("," + nowday + ",")) { Response.Write("{\"msg\":\"" + Tag("配送方式设置错误") + "\"}"); return; } } } //检查代金券 string pay312 = RequestTool.RequestSafeString("pay312"); if (pay312 != "") { List <Lebi_Card> cs = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and id in (lbsql{" + pay312 + "})", "id asc"); int flag = cs.FirstOrDefault().IsCanOtherUse; if (flag == 0 && cs.Count > 1) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } foreach (Lebi_Card c in cs) { if (flag != c.IsCanOtherUse) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } if (!Basket.CheckCard(basket, c)) { Response.Write("{\"msg\":\"" + Tag("代金券异常") + "\"}"); return; } } } //检查代金券结束 //检查发票信息 int billtype_id = RequestTool.RequestInt("billtype_id", 0); Lebi_BillType billtype = B_Lebi_BillType.GetModel(billtype_id); if (ShopCache.GetBaseConfig().BillFlag == "1") { if (billtype == null) { Response.Write("{\"msg\":\"" + Tag("请设置发票内容") + "\"}"); return; } } CurrentUser.Pay_id = pay.id; CurrentUser.OnlinePay_id = onlinepay_id; Lebi_Order ordergroup; List <Lebi_Order> orders = Shop.Bussiness.Order.CreateOrder(CurrentUser, basket, shouhuo, billtype, CurrentCurrency, CurrentSite, CurrentLanguage, out ordergroup); CurrentUser.Count_Order = CurrentUser.Count_Order + orders.Count; B_Lebi_User.Update(CurrentUser); List <Lebi_Order> ordermodel = B_Lebi_Order.GetList("User_id=" + CurrentUser.id + "", "id desc"); ordergroup = ordermodel.FirstOrDefault(); if (OfflineMoney == 0) { OfflineMoney = ordergroup.Money_Order; } string remark = RequestTool.RequestSafeString("remark"); ordergroup.Remark_User = remark; bool needupdate = false; if (remark != "") { Lebi_Comment model = new Lebi_Comment(); model.Content = remark; model.Keyid = ordergroup.id; model.TableName = "Order"; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.UserName; B_Lebi_Comment.Add(model); needupdate = true; } if (pick != null) { ordergroup.PickUp_Date = pickdate; ordergroup.PickUp_id = pick.id; ordergroup.PickUp_Name = pick.Name; needupdate = true; } if (needupdate) { B_Lebi_Order.Update(ordergroup); } if (pay.Code != "OfflinePay" && pay.Code != "OnlinePay") { //订单如果选择了线下支付,并且非货到付款 //生成一笔充值单 //OfflineMoney Lebi_Currency DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1"); if (DefaultCurrency == null) { DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault(); } Lebi_Order order = new Lebi_Order(); order.Code = "M" + Shop.Bussiness.Order.CreateOrderCode(); order.Money_Order = OfflineMoney; order.Money_Pay = OfflineMoney; order.User_id = CurrentUser.id; order.User_UserName = CurrentUser.UserName; order.IsPaid = 0; order.Currency_Code = ordergroup.Currency_Code; order.Currency_ExchangeRate = ordergroup.Currency_ExchangeRate; order.Currency_id = ordergroup.Currency_id; order.Currency_Msige = ordergroup.Currency_Msige; order.Type_id_OrderType = 214; order.Pay_id = pay.id; order.Pay = pay.Name; order.Site_id = CurrentSite.id; order.Language_id = CurrentLanguage.id; order.Remark_Admin = ""; order.Order_id = ordergroup.id; B_Lebi_Order.Add(order); } //if (orders.Count == 1) // ordergroup = orders.FirstOrDefault(); //Shop.Bussiness.Order.SupplierOrder(order);//根据商品供应商分单 Response.Write("{\"msg\":\"OK\",\"id\":\"" + ordergroup.id + "\"}"); return; }
/// <summary> /// 安全方式绑定表单数据 /// </summary> public static Lebi_Comment SafeBindForm(Lebi_Comment model) { return(D_Lebi_Comment.Instance.SafeBindForm(model)); }
/// <summary> /// 发表商品评价 /// </summary> public void Comment_Write() { int id = RequestTool.RequestInt("id", 0); //int Product_id = 0; if (!Comment.CheckSafeWord(RequestTool.RequestSafeString("Content"))) { Response.Write("{\"msg\":\"" + Tag("内容中包含敏感词") + "\"}"); return; } Lebi_Order_Product Order_Product = B_Lebi_Order_Product.GetModel("User_id=" + CurrentUser.id + " and id = " + id); if (Order_Product == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } else { Lebi_Order order = B_Lebi_Order.GetModel(Order_Product.Order_id); if (order == null) { Response.Write("{\"msg\":\"" + Tag("无效订单") + "\"}"); return; } else { if (order.IsReceived == 0) { Response.Write("{\"msg\":\"" + Tag("已购买商品在已收货之后才可以发表评价") + "\"}"); return; } } Order_Product.IsCommented = 1; B_Lebi_Order_Product.Update(Order_Product); } Lebi_Product checkproduct = B_Lebi_Product.GetModel(Order_Product.Product_id); if (checkproduct == null) { Response.Write("{\"msg\":\"" + Tag("该商品已经下架") + "\"}"); return; } Lebi_Comment model = new Lebi_Comment(); model.TableName = "Product"; model.Keyid = Order_Product.Product_id; model.Admin_UserName = "******"; model.Admin_id = 0; model.User_id = CurrentUser.id; model.User_UserName = CurrentUser.NickName; model.Content = RequestTool.RequestSafeString("Content"); model.Star = RequestTool.RequestInt("Star", 5); model.Parentid = 0; model.Status = 280; model.Time_Add = System.DateTime.Now; model.Language_Code = CurrentLanguage.Code; model.Images = RequestTool.RequestSafeString("Images"); model.ImagesSmall = RequestTool.RequestSafeString("ImagesSmall"); model.Product_id = Order_Product.Product_id; model.IsRead = 1; model.Supplier_id = checkproduct.Supplier_id; B_Lebi_Comment.Add(model); //List<Lebi_Order_Product> modelproducts = B_Lebi_Order_Product.GetList("User_id=" + CurrentUser.id + " and id = " + id + "", ""); //foreach (Lebi_Order_Product modelproduct in modelproducts) //{ // modelproduct.IsCommented = 1; // B_Lebi_Order_Product.Update(modelproduct); //} Lebi_Product product = B_Lebi_Product.GetModel(Order_Product.Product_id); if (product != null) { EX_Product.UpdateStar(product); } model.id = B_Lebi_Comment.GetMaxId(); //处理图片 ImageHelper.LebiImagesUsed(model.Images, "comment", model.id); //发送邮件 Lebi_User user = B_Lebi_User.GetModel(CurrentUser.id); Email.SendEmail_comment(user, model); //发送短信 SMS.SendSMS_comment(user, model); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// 更新一条数据 /// </summary> public static void Update(Lebi_Comment model) { D_Lebi_Comment.Instance.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(Lebi_Comment model) { return(D_Lebi_Comment.Instance.Add(model)); }