protected void Page_Load(object sender, EventArgs e) { this.MaintainScrollPositionOnPostBack = true; shopName = SellersBLL.GetSignName(Users.Nick); users.Value = shopName; if (!Page.IsPostBack) { string type = string.Empty; if (Request.QueryString["type"] != null) { type = Request.QueryString["type"].ToString(); } else { type = "notplay"; } //初始化短信发送条件配置 MsgSendConfig o = new MsgSendConfig(); o.warnType = type; mark = type; //o.SellerNick = "TestAcc001"; o.SellerNick = Users.Nick; if (MemberNotifyBLL.CheckMsgConfigTypeIsExit(o)) { InitAutoControl(o); } else { clearValue(o.warnType); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { userNick = SellersBLL.GetSignName(Users.Nick);; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; //if (RatingBLL.isBshop(Users.Nick)) //{ // HiddenField1.Value = "【天猫】"; //} //else //{ // HiddenField1.Value = "【淘宝】"; //} } //检查卖家短信账户 //if (!MsgBLL.CheckSellerMsgStatus()) //{ // msgAcountCheck.Visible = true; //} //else //{ // msgAcountCheck.Visible = false; //} GetMsgCount(); }
protected void Page_Load(object sender, EventArgs e) { this.MaintainScrollPositionOnPostBack = true; if (!Page.IsPostBack) { //初始化短信发送条件配置 MsgSendConfig o = new MsgSendConfig(); o.SellerNick = Users.Nick; if (!MemberNotifyBLL.CheckMsgConfigIsExit(o)) { o.BuyerLevel = 0; o.Amount = "0"; o.UnPayType = "0"; o.PayType = "0"; o.ShippingType = "0"; o.DelayShippingType = "0"; o.ArrivedType = "0"; o.SignType = "0"; o.ReturnGoodsType = "0"; o.UnpayMsg = rdounpayTemp1.Text.Trim(); o.PayMsg = rdoPayType1.Text.Trim(); o.ShippingNofityMsg = rdoShippingCont1.Text.Trim(); o.DelayShippingNofityMsg = rdoDelayShipping.Text.Trim(); o.ArrivedNofityMsg = RadioButton4.Text.Trim(); o.SignNofityMsg = rdoSign1.Text.Trim(); o.ReturnGoodsMsg = ""; o.ShopName = SellersBLL.GetSignName(Users.Nick); MemberNotifyBLL.AddMsgConfig(o); } else { InitAutoControl(o); } if (AppCusBLL.CheckAppCusIsExit(Users.Nick)) { btnAuothOpen.ImageUrl = "~/Images/rate/2open.png"; } lbShopSignPre.Text = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } lbMsg.Text = ""; lberror2.Text = ""; lberror.Text = ""; lbSignMsg.Text = ""; versionControl.Visible = false; if (!Utility.CheckCanSendEmail()) { msgReminder.Visible = true; } else { msgReminder.Visible = false; } msgAcountCheck.Visible = false; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GetMsgCount(); HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } cbNotSendYD.Visible = false; lbMsgTip.Text = ""; lbError.Text = ""; lbSaveMsgInfo.Text = ""; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { MsgDataBind(); //if (RatingBLL.isBshop(Users.Nick)) //{ // HiddenField1.Value = "【天猫】"; //} //else { // HiddenField1.Value = "【淘宝】"; //} HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } //this.SmartNavigation = true; this.MaintainScrollPositionOnPostBack = true; lbMsg.Text = ""; }
protected void imgBtnSetSign_Click(object sender, ImageClickEventArgs e) { if (String.IsNullOrEmpty(txtShopSign.Text.Trim())) { lbSignMsg.Text = "自定义签名不能为空!"; return; } Sellers objSell = new Sellers(); objSell.Nick = Users.Nick; objSell.SignShopName = txtShopSign.Text.Trim(); objSell.Cellphone = ""; if (SellersBLL.SetShopName(objSell)) { lbSignMsg.Text = "签名修改成功,物流提醒将使用此签名!"; lbSignMsg.ForeColor = Color.Blue; lbShopSignPre.Text = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } else { lbSignMsg.Text = "签名保存失败,联系客服!"; } }
protected void Page_Load(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("user"); cookie.Value = Users.Nick; HttpContext.Current.Response.Cookies.Add(cookie); users.Value = SellersBLL.GetSignName(Users.Nick); if (!Page.IsPostBack) { MsgDataBind(); //if (RatingBLL.isBshop(Users.Nick)) //{ // HiddenField1.Value = "【天猫】"; //} //else { // HiddenField1.Value = "【淘宝】"; //} HiddenField1.Value = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; } //this.SmartNavigation = true; this.MaintainScrollPositionOnPostBack = true; lbMsg.Text = ""; }
//发送短信 void sendMsg(HttpContext context) { string sigNames = SellersBLL.GetSignName(Users.Nick); string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; string msgContent = Convert.ToString(context.Request.Form["msgContent"]); msgContent = msgContent.Trim(); string data = context.Request.Form["data"]; JObject o = JObject.Parse(data); JArray ja = JArray.Parse(o["members"].ToString()); if (ja != null && ja.Count > 0) { foreach (var member in ja) { string name = member["nick"].ToString(); string phone = member["phone"].ToString(); string content = context.Request.Form["content"]; //控制是否过滤移动号码 string flag = context.Request.Form["falg"]; string signShopName = SellersBLL.GetSignName(Users.Nick); MsgSendHis objHis = null; //string msgContent = "【" + signShopName + "】" + content.Trim() + " 退订回N"; try { BlakList objbk = new BlakList(); objbk.SellerNick = Users.Nick; objbk.BlakName = name; //黑名单 if (!BlcakLstBLL.ChekBlaklist(objbk)) { var cellpone = phone; if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone)) { #region 短信发送 if (MsgBLL.CheckSellerMsgStatus()) { objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; objHis.Buyer_nick = name; objHis.CellPhone = cellpone; objHis.SendDate = DateTime.Now; objHis.SendType = "短信促销"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = msgContent; if (Utility.IsYiDongCellPhoneNo(cellpone)) { objHis.HelpSellerNick = "移动"; } else { objHis.HelpSellerNick = "电信联通"; } if (SmartBLL.AddMsgSendHis(objHis)) { try { //string sendStatus = Mobile.sendMsg(lstCellPhoneNo, msgContent); if (Convert.ToInt32(msgContent.Trim().Length) <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } string sendStatus = TBSendMSg.SendMsg(cellpone, sigNames, objHis.MsgContent.Trim().Replace(sigName, "")); if (Utility.IsYiDongCellPhoneNo(cellpone)) { //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent); //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao //string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent); //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else//电信联通号码全部群发 { //string sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim()); //IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } } else { //更新短信账户状态 MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false); context.Response.Write("余额不足"); context.Response.End(); break; } #endregion } } } catch (Exception ex) { continue; } } } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { if (string.IsNullOrEmpty(TextBox2.Text)) { Response.Write("<script language='javascript'>alert('请输入发送内容!');</script>"); return; } DataTable trade = null; string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; string select = drpSType.SelectedValue.ToString(); switch (select) { case "sign_notSure": trade = TradeBLL.GetTradeData(Users.Nick, "taobao_trade_TradeSellerShip"); break; case "sure_notSign": trade = TradeBLL.GetTradeDataNosign(Users.Nick, "taobao_trade_TradeSellerShip"); break; case "sure_notSucce": trade = TradeBLL.GetTradeDataNoSuccess(Users.Nick, "taobao_trade_TradeSellerShip"); break; } if (trade == null || trade.Rows.Count == 0) { Response.Write("<script language='javascript'>alert('无数据!');</script>"); return; } for (int i = 0; i < trade.Rows.Count; i++) { DataTable ds = BuyerBLL.GetBuyerInfo(trade.Rows[i]["buyer_nick"].ToString(), "all", "all", "all", "", "", "", Users.Nick, ""); if (ds == null || ds.Rows.Count == 0) { continue; } string cellPhone = ds.Rows[i]["CellPhone"].ToString(); try { //判断手机 if (Utility.IsCellPhone(cellPhone)) { if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; //objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtContent.Text.Trim();// +"退订回T"; objHis.MsgContent = sigName + TextBox2.Text + " 退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.SendMsgKeTongDX(cellPhone, objHis.MsgContent); string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); } else { string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } catch (Exception ex) { continue; } } } else { Response.Write("<script language='javascript'>alert('余额不足!');</script>"); return; } } } catch (Exception ex) { continue; } } Response.Write("<script language='javascript'>alert('发送成功!');</script>"); }
protected void btnSave_Click(object sender, ImageClickEventArgs e) { try { //检查输入项的值是否正确 if (String.IsNullOrEmpty(txtAmount.Text.Trim())) { lberror2.Text = "金额不能为空!"; return; } if (!Utility.IsINT(txtAmount.Text.Trim())) { lberror2.Text = "金额必须为正整数!"; return; } MsgSendConfig o = new MsgSendConfig(); o.SellerNick = Users.Nick; o.ShopName = SellersBLL.GetSignName(Users.Nick); string strUnpayType = "0"; string payType = "0"; string shippingType = "0"; string arrivedType = "0"; string signType = "0"; string delayShipType = "0"; string huiZJType = "0"; DataTable tb = MemberNotifyBLL.GetMsgConfigByBuyerSellerNick(o); if (tb != null && tb.Rows.Count > 0) { strUnpayType = tb.Rows[0]["unPayType"].ToString(); payType = tb.Rows[0]["payType"].ToString(); shippingType = tb.Rows[0]["shippingType"].ToString(); arrivedType = tb.Rows[0]["arrivedType"].ToString(); signType = tb.Rows[0]["signType"].ToString(); delayShipType = tb.Rows[0]["delayShippingType"].ToString(); huiZJType = tb.Rows[0]["huiZJType"].ToString(); } #region 催款 string strUnpayMsg = ""; string unpayMsgCus = ""; string isUnpayMsgCus = "0"; if (rdounpayTemp1.Checked) { strUnpayMsg = rdounpayTemp1.Text.Trim(); } if (rdounpayTemp2.Checked) { strUnpayMsg = rdounpayTemp2.Text.Trim(); } if (rdounpayTemp3.Checked) { strUnpayMsg = rdounpayTemp3.Text.Trim(); } if (rdoUnpayCus.Checked) { unpayMsgCus = txtUnpayCusContent.Text.Trim(); isUnpayMsgCus = "1"; } else { unpayMsgCus = ""; isUnpayMsgCus = "0"; } o.UnpayMsg = strUnpayMsg; o.UnPayType = strUnpayType; o.UnpayMsgCus = unpayMsgCus; o.IsUnpayMsgCus = isUnpayMsgCus; #endregion #region 付款 string payMsg = ""; string payMsgCus = ""; string isPayMsgCus = "0"; if (rdoPayType1.Checked) { payMsg = rdoPayType1.Text.Trim(); } if (rdoPayType2.Checked) { payMsg = rdoPayType2.Text.Trim(); } if (rdoPayType3.Checked) { payMsg = rdoPayType3.Text.Trim(); } if (rdoPayTypeCus.Checked) { payMsgCus = txtPayCus.Text.Trim(); isPayMsgCus = "1"; } else { payMsgCus = ""; isPayMsgCus = "0"; } o.PayMsg = payMsg; o.PayType = payType; o.PayMsgCus = payMsgCus; o.IsPayMsgCus = isPayMsgCus; #endregion #region 发货 string shippingNofityMsg = ""; string shippingNofityMsgCus = ""; string isShippingMsgCus = "0"; if (rdoShippingCont1.Checked) { shippingNofityMsg = rdoShippingCont1.Text.Trim(); } if (rdoShippingCont2.Checked) { shippingNofityMsg = rdoShippingCont2.Text.Trim(); } if (rdoShippingCont3.Checked) { shippingNofityMsg = rdoShippingCont3.Text.Trim(); } if (rdoShiping.Checked) { shippingNofityMsgCus = txtShippingContent.Text.Trim(); isShippingMsgCus = "1"; } else { shippingNofityMsgCus = ""; isShippingMsgCus = "0"; } o.ShippingNofityMsg = shippingNofityMsg; o.ShippingType = shippingType; o.ShippingNofityMsgCus = shippingNofityMsgCus; o.IsShippingMsgCus = isShippingMsgCus; #endregion #region 延时发货 string delayShippingNofityMsg = ""; string delayShippingNofityMsgCus = ""; string isDelayShippingMsgCus = "0"; if (rdoDelayShipping.Checked) { delayShippingNofityMsg = rdoDelayShipping.Text.Trim(); } if (rdoDelayShipCus.Checked) { delayShippingNofityMsgCus = txtDelayShippingCus.Text.Trim(); isDelayShippingMsgCus = "1"; } else { delayShippingNofityMsgCus = ""; isDelayShippingMsgCus = "0"; } o.DelayShippingNofityMsg = delayShippingNofityMsg; o.DelayShippingType = delayShipType; o.DelayShippingNofityMsgCus = delayShippingNofityMsgCus; o.IsDelayShippingMsgCus = isDelayShippingMsgCus; #endregion #region 达到 string arrivedNofityMsg = ""; string arrivedNofityMsgCus = ""; string isArrivedMsgCus = "0"; if (RadioButton4.Checked) { arrivedNofityMsg = RadioButton4.Text.Trim(); } if (RadioButton5.Checked) { arrivedNofityMsg = RadioButton5.Text.Trim(); } if (RadioButton6.Checked) { arrivedNofityMsg = RadioButton6.Text.Trim(); } if (RadioButton7.Checked) { arrivedNofityMsgCus = txtArrivedContent.Text.Trim(); isArrivedMsgCus = "1"; } else { arrivedNofityMsgCus = ""; isArrivedMsgCus = "0"; } o.ArrivedNofityMsg = arrivedNofityMsg; o.ArrivedType = arrivedType; o.ArrivedNofityMsgCus = arrivedNofityMsgCus; o.IsArrivedMsgCus = isArrivedMsgCus; #endregion #region 签收 string signNofityMsg = ""; string signNotifyMsgCus = ""; string isSignMsgCus = "0"; if (rdoSign1.Checked) { signNofityMsg = rdoSign1.Text.Trim(); } if (rdoSign2.Checked) { signNofityMsg = rdoSign2.Text.Trim(); } if (rdoSign3.Checked) { signNofityMsg = rdoSign3.Text.Trim(); } if (rdoSignCus.Checked) { signNotifyMsgCus = txtSignCus.Text.Trim(); isSignMsgCus = "1"; } else { signNotifyMsgCus = ""; isSignMsgCus = "0"; } o.SignNofityMsg = signNofityMsg; o.SignType = signType; o.SignNotifyMsgCus = signNotifyMsgCus; o.IsSignMsgCus = isSignMsgCus; #endregion #region 回款 string huiZJNofityMsg = ""; string huiZJNotifyMsgCus = ""; string isHuiZJMsgCus = "0"; if (rdoHuiZJCont.Checked) { huiZJNofityMsg = rdoHuiZJCont.Text.Trim(); } if (rdoHuiZJCus.Checked) { huiZJNotifyMsgCus = txtHuiZJContent.Text.Trim(); isHuiZJMsgCus = "1"; } else { huiZJNotifyMsgCus = ""; isHuiZJMsgCus = "0"; } o.HuiZJNofityMsg = huiZJNofityMsg; o.HuiZJType = huiZJType; o.HuiZJNofityMsgCus = huiZJNotifyMsgCus; o.IsHuiZJMsgCus = isHuiZJMsgCus; #endregion //if (tb != null && tb.Rows.Count > 0) //{ o.Amount = txtAmount.Text.Trim().ToString(); o.BuyerLevel = 0; if (MemberNotifyBLL.UpdateMsgConfig(o)) { lbMsg.Text = "条件保存成功!"; lbMsg.ForeColor = Color.Blue; } else { lbMsg.Text = "条件保存失败,请联系客服"; } //} } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); lbMsg.Text = "条件保存失败,请联系客服"; } }
protected void btnByhand_Click(object sender, ImageClickEventArgs e) { if (!CheckIsOpenMsgAcount()) { return; } string cellPhone = txtCellPhone.Text.Trim(); if (string.IsNullOrEmpty(cellPhone)) { lbMsg2.Text = "请填写手机号码内容!"; txtCellPhone.Focus(); return; } if (!Utility.IsCellPhone(cellPhone)) { lbMsg2.Text = "请填写正确的手机号码内容!"; txtCellPhone.Focus(); return; } if (string.IsNullOrEmpty(txtByHandContent.Text.Trim())) { lbMsg.Text = "提醒内容不能为空!"; txtByHandContent.Focus(); return; } if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + cellPhone;//手机号码 objHis.SellerNick = Users.Nick; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工退货提醒发送"; objHis.SendStatus = "0"; objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtByHandContent.Text.Trim(); objHis.HelpSellerNick = ""; if (SmartBLL.AddMsgSendHis(objHis)) { try { List <string> lstCellPhoneNo = new List <string>(); lstCellPhoneNo.Add(cellPhone.ToString()); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } string sendStatus = Mobile.sendMsgReminder(lstCellPhoneNo, objHis.MsgContent); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } } lbmsg5.Text = "提醒发送成功"; txtCellPhone.Text = ""; txtCellPhone.Focus(); } }
protected void Page_Load(object sender, EventArgs e) { lbSignPrv.Text = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string sigNames = SellersBLL.GetSignName(Users.Nick); string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; //string sigName = "【澄腾科技01】"; HttpFileCollection files = context.Request.Files; if (files.Count > 0) { HttpPostedFile file = files[0]; string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼" , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" }; string content = context.Request.QueryString["msgContent"]; for (int s = 0; s < noWenmings.Length - 1; s++) { if (content.IndexOf(noWenmings[s]) > 0) { context.Response.Write("6"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } List <string> phones = new List <string>(); if (!String.IsNullOrEmpty(file.FileName)) { #region 文件上传 //文件扩展名 string fileExtend = ""; string filePath = ""; //文件大小 int fileSize = 0; filePath = file.FileName.ToLower().Trim(); //取得上传前的文件(存在于客户端)的文件或文件夹的名称 string[] names = filePath.Split('\\'); //取得文件名 string name = names[names.Length - 1]; //获得服务器端的根目录 string serverPath = context.Server.MapPath("~/SellerReport"); //判断是否有该目录 if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } filePath = serverPath + "\\" + name; var fileImprtPath = serverPath + "\\"; //如果存在,删除文件 if (File.Exists(filePath)) { File.Delete(filePath); } // 上传文件 file.SaveAs(filePath); //得到扩展名 fileExtend = filePath.Substring(filePath.LastIndexOf(".")); if (fileExtend != ".txt" && fileExtend != ".csv") { context.Response.Write("1"); context.Response.End(); } #endregion // 获得给卖家设置的发送百分之几 int i = 100; DataTable dtPrecent = MsgBLL.GetSellerMsgSendPrecent(Users.Nick); if (dtPrecent == null || dtPrecent.Rows.Count == 0 || dtPrecent.Rows[0]["sendPrecent"] == DBNull.Value) { i = 100; } else { try { i = Convert.ToInt32(dtPrecent.Rows[0]["sendPrecent"]); } catch (Exception es) { i = 100; } } //短信发送开始记录 msgSendingBLL.update(Users.Nick, 1); //CSV格式 if (fileExtend == ".csv") { System.IO.FileInfo f = new FileInfo(filePath); CSVHelper obj = new CSVHelper(serverPath + "\\", name); DataTable tb = obj.Read(); //将订单交易信息写入到DB,同时更新买家表信息 if (tb != null && tb.Rows.Count > 0) { float ftemp = (float)i / 100; //可以发送的短信条数 int cansendCount = Convert.ToInt32(tb.Rows.Count * ftemp); int sendedCount = 1; for (int t = 0; t < tb.Rows.Count; t++) { string cellPhone = tb.Rows[t]["联系手机"].ToString(); if (string.IsNullOrEmpty(cellPhone) == true) { continue; } string num_char = cellPhone.Substring(0, 1); if (Utility.IsINT(num_char) == false) { cellPhone = cellPhone.Substring(1, cellPhone.Length - 1); } if (phones.Contains(cellPhone) || cellPhone == "") { continue; } cellPhone = cellPhone.Replace("\'", ""); phones.Add(cellPhone); try { //判断手机 if (Utility.IsCellPhone(cellPhone.Replace("\'", ""))) { //if(true) if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone; //手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; //objHis.MsgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + txtContent.Text.Trim();// +"退订回T"; objHis.MsgContent = sigName + content.Trim() + "退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } //File.AppendAllText(@"D:\log\1.txt", "sendedCount:" + t + " cansendCount:" + cansendCount + "\n"); if (t >= cansendCount) { SmartBLL.UpdateSendStatus("99", objHis.TransNumber); } else { string sendStatus = TBSendMSg.SendMsg(cellPhone, sigNames, objHis.MsgContent.Replace(sigName, "")); //SendMsg(cellPhone, sigName, objHis.MsgContent.Trim()); if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c //IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else { //string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } } catch (Exception ex) { continue; } } } else { context.Response.Write("3"); //余额不足 //context.Response.End();//使用 Response.End方法,将出现 ThreadAbortException 异常。 HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } } catch (Exception ex) { continue; } sendedCount++; } } //短信发送成功记录 msgSendingBLL.update(Users.Nick, 2, phones.Count); context.Response.Write("2"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); } else if (fileExtend == ".txt") { using (StreamReader Sr = new StreamReader(filePath, true)) { /*读取到的每行内容*/ string cellPhone1 = String.Empty; while (Sr.EndOfStream != true) { cellPhone1 = Sr.ReadLine().Trim(); if (phones.Contains(cellPhone1) || cellPhone1 == "") { continue; } cellPhone1 = cellPhone1.Replace("\'", ""); phones.Add(cellPhone1); } float ftemp = (float)i / 100; //可以发送的短信条数 int cansendCount = Convert.ToInt32(phones.Count * ftemp); int sendedCount = 0; #region 发短信 foreach (string cellPhone in phones) { int j = 0; try { //判断手机 if (Utility.IsCellPhone(cellPhone)) { if (MsgBLL.CheckSellerMsgStatus()) { MsgSendHis objHis = new MsgSendHis(); objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellPhone;//手机号码 2016 yao c objHis.SellerNick = Users.Nick; //objHis.SellerNick = "澄腾科技"; objHis.Buyer_nick = "*****"; objHis.CellPhone = cellPhone; objHis.SendDate = DateTime.Now; objHis.SendType = "手工发送"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = sigName + content.Trim() + " 退订回N"; if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { objHis.HelpSellerNick = "电信联通"; } else { objHis.HelpSellerNick = "移动"; } //if (true) test if (SmartBLL.AddMsgSendHis(objHis)) { try { objHis.MsgContent = objHis.MsgContent.Replace(" ", ""); if (objHis.MsgContent.Length <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (objHis.MsgContent.Length > 70 && objHis.MsgContent.Length <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (objHis.MsgContent.Length > 134 && objHis.MsgContent.Length <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (objHis.MsgContent.Length > 195 && objHis.MsgContent.Length <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (sendedCount >= cansendCount) { SmartBLL.UpdateSendStatus("99", objHis.TransNumber); } else { string sendStatus = TBSendMSg.SendMsg(cellPhone, sigNames, objHis.MsgContent.Replace("退订回N", "").Replace(sigName, "")); if (!Utility.IsYiDongCellPhoneNo(cellPhone)) { //string sendStatus = Mobile.SendMsgKeTongDX(cellPhone, objHis.MsgContent); //string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim());//20160626 yao c //IDictionary resultDic = TopUtils.ParseJson(sendStatus); //SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else { //string sendStatus = Mobile.SendMsgHubeiYDPost(cellPhone, objHis.MsgContent);//\r\n\r\n\r\n\r\n0 //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } } sendedCount++; j++; //} //else //{ // if (!Utility.IsYiDongCellPhoneNo(cellPhone)) // { // string sendStatus = Mobile.PostDataToMyServer(cellPhone, objHis.MsgContent.Trim(), ""); // } // else // { // Mobile.SendMsgKeTongYD(cellPhone, objHis.MsgContent); // } //} } catch (Exception ex) { continue; } } } else { context.Response.Write("3");//余额不足 //context.Response.End();//使用 Response.End方法,将出现 ThreadAbortException 异常。 HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } } catch (Exception ex) { continue; } } #endregion //短信发送成功记录 msgSendingBLL.update(Users.Nick, 2, phones.Count); context.Response.Write("2"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); } } } else { context.Response.Write("0"); //context.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); msgSendingBLL.update(Users.Nick, 2, phones.Count); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var command = context.Request.Form["command"]; if (!string.IsNullOrEmpty(command)) { switch (command) { #region msgConSave case "msgConSave": { string content = context.Request.Form["msgContent"]; if (MsgBLL.UpdateSellerCusMsgContent(Users.Nick, content)) { context.Response.Write("1"); } else { context.Response.Write("0"); } context.Response.End(); } break; #endregion #region getConSave case "getConSave": { string content = MsgBLL.GetSellerSendMsgCusContent(Users.Nick); context.Response.Write(content); context.Response.End(); } break; #endregion #region sendTestMsg case "sendTestMsg": { string sigNames = SellersBLL.GetSignName(Users.Nick); string sigName = "【" + SellersBLL.GetSignName(Users.Nick) + "】"; string phoneNo = context.Request.Form["phone"]; string content = context.Request.Form["content"]; string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼", "卧草", "我日", "我擦" , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" }; for (int s = 0; s < noWenmings.Length - 1; s++) { if (content.IndexOf(noWenmings[s]) > 0) { context.Response.Write("6"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } if (Utility.IsCellPhone(phoneNo)) { if (MsgBLL.CheckSellerMsgStatus()) { string msgContent = content.Trim() + " 退订回N"; //string msgContent = ""; //if (RatingBLL.isBshop(Users.Nick)) //{ // msgContent = "【天猫】"+ content.Trim() + " 退订N"; //} //else //{ // msgContent = "【淘宝】"+ content.Trim() + " 退订N"; //} MsgSendHis objHis = new MsgSendHis(); //objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + phoneNo;//手机号码 objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + phoneNo; //手机号码 2016 yao c objHis.SellerNick = Users.Nick; objHis.Buyer_nick = "*****"; objHis.CellPhone = phoneNo; objHis.SendDate = DateTime.Now; objHis.SendType = "自测短信"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = sigName + msgContent; if (Utility.IsYiDongCellPhoneNo(phoneNo)) { objHis.HelpSellerNick = "移动"; } if (SmartBLL.AddMsgSendHis(objHis)) { //把号码添加到测试池 SmartBLL.AddMsgSendHisIntoTestTable(Users.Nick, phoneNo); if (Convert.ToInt32(msgContent.Trim().Length) <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } string sendStatus = "0"; if (Utility.IsYiDongCellPhoneNo(phoneNo)) { sendStatus = TBSendMSg.SendMsg(phoneNo, sigNames, objHis.MsgContent.Replace(sigName, "")); //sendStatus = Mobile.SendMsgHubeiYDPost(phoneNo, msgContent); //sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } //sendStatus = Mobile.sendMsgJiuFang(phoneNo, msgContent,"100057", "c9bf7c4cb27c5527c4d757765514498e");//20160621 yao //更新发送状态 SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); //sendStatus = Mobile.SendMsgZhuTongYD(phoneNo, msgContent); } else { sendStatus = TBSendMSg.SendMsg(phoneNo, sigNames, objHis.MsgContent.Replace(sigName, "")); //sendStatus = Mobile.PostDataToMyServer(phoneNo, msgContent); //IDictionary resultDic = null; //resultDic = TopUtils.ParseJson(sendStatus); //string realStaus = resultDic["status"].ToString(); //更新发送状态 SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); //sendStatus = Mobile.SendMsgKeTongDX(phoneNo, msgContent); } context.Response.Write("发送成功"); } else { context.Response.Write("发送阻塞"); } } else { context.Response.Write("余额不足"); //更新短信账户状态 MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false); } } else { context.Response.Write("手机号码格式不正确"); } context.Response.End(); } break; #endregion #region sendMsg case "sendMsg": { string content = context.Request.Form["content"]; string[] noWenmings = new string[] { "傻逼", "草", "靠", "黄片", "尼玛", "你妈", "屌丝", "逗比", "你妹", "装逼", "妈蛋", "逼格", "撕逼" , "滚粗", "蛋疼", "婊砸", "跪舔", "婊", "碧池", "土肥圆", "矮穷挫" }; for (int s = 0; s < noWenmings.Length - 1; s++) { if (content.IndexOf(noWenmings[s]) > 0) { context.Response.Write("6"); HttpContext.Current.ApplicationInstance.CompleteRequest(); return; } } //控制是否过滤移动号码 string flag = context.Request.Form["falg"]; string signShopName = SellersBLL.GetSignName(Users.Nick); MsgSendHis objHis = null; string msgContent = "【" + signShopName + "】" + content.Trim() + " 退订回N"; DataTable tb = HttpContext.Current.Session["MsgData"] as DataTable; if (tb != null && tb.Rows.Count > 0) { for (int i = 0; i < tb.Rows.Count; i++) { try { BlakList objbk = new BlakList(); objbk.SellerNick = Users.Nick; objbk.BlakName = tb.Rows[i]["buyer_nick"].ToString(); //黑名单 if (!BlcakLstBLL.ChekBlaklist(objbk)) { var cellpone = tb.Rows[i]["cellPhone"].ToString(); if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone)) { #region 短信发送 if (MsgBLL.CheckSellerMsgStatus()) { objHis = new MsgSendHis(); //objHis.TransNumber = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() // + DateTime.Now.Day.ToString() + cellpone; objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone; //手机号码 2016 yao c objHis.SellerNick = Users.Nick; objHis.Buyer_nick = tb.Rows[i]["buyer_nick"].ToString(); objHis.CellPhone = cellpone; objHis.SendDate = DateTime.Now; objHis.SendType = "短信促销"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = msgContent; if (Utility.IsYiDongCellPhoneNo(cellpone)) { objHis.HelpSellerNick = "移动"; } else { objHis.HelpSellerNick = "电信联通"; } if (SmartBLL.AddMsgSendHis(objHis)) { try { //string sendStatus = Mobile.sendMsg(lstCellPhoneNo, msgContent); if (Convert.ToInt32(msgContent.Trim().Length) <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (Utility.IsYiDongCellPhoneNo(cellpone)) { //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent); //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent); sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else //电信联通号码全部群发 { string sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim()); IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } } else { //更新短信账户状态 MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false); context.Response.Write("余额不足"); context.Response.End(); break; } #endregion } } } catch (Exception ex) { continue; } } HttpContext.Current.Session["MsgData"] = null; //发送成功 context.Response.Write("发送成功"); context.Response.End(); } else { context.Response.Write("没有会员"); context.Response.End(); } } break; #endregion #region sendSmartMsg case "sendSmartMsg": { string content = context.Request.Form["content"]; string sendType = context.Request.Form["sendType"]; string province = context.Request.Form["provinces"]; MsgSendHis objHis = null; string msgContent = "【" + SellersBLL.GetSignName(Users.Nick) + "】" + content.Trim() + " 退订回N"; //if (RatingBLL.isBshop(Users.Nick)) //{ // msgContent = "【天猫】" + content.Trim() + " 退订N"; //} //else //{ // msgContent = "【淘宝】" + content.Trim() + " 退订N"; //} DataTable tb = null; #region 新会员 if (sendType.Equals("10")) { tb = SmartBLL.GetNewBuyer10Days(Users.SellerId); } if (sendType.Equals("30")) { tb = SmartBLL.GetNewBuyer30Days(Users.SellerId); } #endregion #region 会员等级 if (sendType.Equals("puTongBuyer")) { tb = SmartBLL.GetBuyersCount(1, Users.SellerId); } if (sendType.Equals("gaoJiBuyer")) { tb = SmartBLL.GetBuyersCount(2, Users.SellerId); } if (sendType.Equals("vipBuyer")) { tb = SmartBLL.GetBuyersCount(3, Users.SellerId); } if (sendType.Equals("gaoJiVIPBuyer")) { tb = SmartBLL.GetBuyersCount(4, Users.SellerId); } #endregion #region 活跃度 if (sendType.Equals("HuoYueDiGouMaiQiang")) { tb = SmartBLL.GetHuoYueDiGouMaiQiangBuyersCount(Users.SellerId); } if (sendType.Equals("HuoYueBanGouMaiBan")) { tb = SmartBLL.GetHuoYueBanGouMaiBanBuyersCount(Users.SellerId); } if (sendType.Equals("HuoYueGaoGouMaiBan")) { tb = SmartBLL.GetHuoYueGaoGouMaiBanBuyersCount(Users.SellerId); } if (sendType.Equals("HuoYueGaoGouMaiGao")) { tb = SmartBLL.GetHuoYueGaoGouMaiGaoBuyersCount(Users.SellerId); } #endregion #region 节假日 if (sendType.Equals("yuandan")) { string date = DateTime.Now.AddYears(-1).Year.ToString() + "-01-01"; string date2 = DateTime.Now.Year.ToString() + "-01-01"; tb = SmartBLL.GetHuoDongBuyersCount(date, Users.SellerId, date2); } if (sendType.Equals("qinren")) { string date2 = DateTime.Now.AddYears(-1).Year.ToString() + "-02-14"; string date22 = DateTime.Now.Year.ToString() + "-02-14"; tb = SmartBLL.GetHuoDongBuyersCount(date2, Users.SellerId, date22); } if (sendType.Equals("funv")) { string date3 = DateTime.Now.AddYears(-1).Year.ToString() + "-03-18"; string date33 = DateTime.Now.Year.ToString() + "-03-18"; tb = SmartBLL.GetHuoDongBuyersCount(date3, Users.SellerId, date33); } if (sendType.Equals("wuyi")) { string date4 = DateTime.Now.AddYears(-1).Year.ToString() + "-05-01"; string date44 = DateTime.Now.Year.ToString() + "-05-01"; tb = SmartBLL.GetHuoDongBuyersCount(date4, Users.SellerId, date44); } if (sendType.Equals("fuqin")) { string date5 = DateTime.Now.AddYears(-1).Year.ToString() + "-06-17"; string date55 = DateTime.Now.Year.ToString() + "-06-17"; tb = SmartBLL.GetHuoDongBuyersCount(date5, Users.SellerId, date55); } if (sendType.Equals("qixi")) { string date6 = DateTime.Now.AddYears(-1).Year.ToString() + "-08-23"; string date66 = DateTime.Now.Year.ToString() + "-08-23"; tb = SmartBLL.GetHuoDongBuyersCount(date6, Users.SellerId, date66); } if (sendType.Equals("zhongqiu")) { string date7 = DateTime.Now.AddYears(-1).Year.ToString() + "-09-30"; string date77 = DateTime.Now.Year.ToString() + "-09-30"; tb = SmartBLL.GetHuoDongBuyersCount(date7, Users.SellerId, date77); } if (sendType.Equals("guoqing")) { string date8 = DateTime.Now.AddYears(-1).Year.ToString() + "-10-01"; string date88 = DateTime.Now.Year.ToString() + "-10-01"; tb = SmartBLL.GetHuoDongBuyersCount(date8, Users.SellerId, date88); } if (sendType.Equals("11")) { string date9 = DateTime.Now.AddYears(-1).Year.ToString() + "-11-11"; string date99 = DateTime.Now.Year.ToString() + "-11-11"; tb = SmartBLL.GetHuoDongBuyersCount(date9, Users.SellerId, date99); } if (sendType.Equals("12")) { string date10 = DateTime.Now.AddYears(-1).Year.ToString() + "-12-12"; string date1010 = DateTime.Now.Year.ToString() + "-12-12"; tb = SmartBLL.GetHuoDongBuyersCount(date10, Users.SellerId, date1010); } if (sendType.Equals("shengdan")) { string date11 = DateTime.Now.AddYears(-1).Year.ToString() + "-12-25"; string date1111 = DateTime.Now.Year.ToString() + "-12-25"; tb = SmartBLL.GetHuoDongBuyersCount(date11, Users.SellerId, date1111); } #endregion #region 未交易客户营销 if (sendType.Equals("unpay")) { tb = SmartBLL.GetUnPayBuyersCount(Users.SellerId); } if (sendType.Equals("unpay7days")) { tb = SmartBLL.GetUnPay7DaysBuyersCount(Users.SellerId); } #endregion #region 地区营销 if (sendType.Equals("baifang")) { tb = SmartBLL.GetBaiFangBuyersCount(Users.SellerId); } if (sendType.Equals("nanfang")) { tb = SmartBLL.GetNanFangBuyersCount(Users.SellerId); } if (sendType.Equals("province")) { List <string> list = new List <string>(province.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); tb = SmartBLL.GetProvinceBuyersCount(Users.SellerId, list); } #endregion if (tb != null && tb.Rows.Count > 0) { for (int i = 0; i < tb.Rows.Count; i++) { try { BlakList objbk = new BlakList(); objbk.SellerNick = Users.Nick; objbk.BlakName = tb.Rows[i]["buyer_nick"].ToString(); //黑名单 if (!BlcakLstBLL.ChekBlaklist(objbk)) { var cellpone = tb.Rows[i]["cellPhone"].ToString(); if (Utility.IsCellPhone(cellpone) && !string.IsNullOrEmpty(cellpone)) { #region 短信发送 if (MsgBLL.CheckSellerMsgStatus()) { objHis = new MsgSendHis(); //objHis.TransNumber = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() // + DateTime.Now.Day.ToString() + cellpone; objHis.TransNumber = DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + cellpone; //手机号码 2016 yao c objHis.SellerNick = Users.Nick; objHis.Buyer_nick = tb.Rows[i]["buyer_nick"].ToString(); objHis.CellPhone = cellpone; objHis.SendDate = DateTime.Now; objHis.SendType = "智能营销"; objHis.SendStatus = "0"; objHis.Count = "1"; objHis.MsgContent = msgContent; if (Utility.IsYiDongCellPhoneNo(cellpone)) { objHis.HelpSellerNick = "移动"; } else { objHis.HelpSellerNick = "电信联通"; } if (SmartBLL.AddMsgSendHis(objHis)) { try { if (Convert.ToInt32(msgContent.Trim().Length) <= 70) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 1); } else if (Convert.ToInt32(msgContent.Trim().Length) > 70 && Convert.ToInt32(msgContent.Trim().Length) <= 134) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 2); } else if (Convert.ToInt32(msgContent.Trim().Length) > 134 && Convert.ToInt32(msgContent.Trim().Length) <= 195) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 3); } else if (Convert.ToInt32(msgContent.Trim().Length) > 195 && Convert.ToInt32(msgContent.Trim().Length) <= 260) { MsgBLL.UpdateMsgTransUseCount(Users.Nick, 4); } if (Utility.IsYiDongCellPhoneNo(cellpone)) { //string sendStatus = Mobile.SendMsgHuBeiYD(cellpone, msgContent); //string sendStatus = Mobile.sendMsgJiuFang(cellpone, msgContent, "100057", "c9bf7c4cb27c5527c4d757765514498e");//20160625 yao string sendStatus = Mobile.SendMsgHubeiYDPost(cellpone, msgContent); sendStatus = sendStatus.Replace("\r", "").Replace("\n", ""); if (sendStatus.Equals("0")) { sendStatus = "100"; } SmartBLL.UpdateSendStatus(sendStatus, objHis.TransNumber); } else { string sendStatus = Mobile.PostDataToMyServer(cellpone, msgContent.Trim()); IDictionary resultDic = TopUtils.ParseJson(sendStatus); SmartBLL.UpdateSendStatus(resultDic["status"].ToString(), objHis.TransNumber); } } catch (Exception ex) { //ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); continue; } } } else { //更新短信账户状态 MsgBLL.UpdateMsgTransServiceStatus(Users.Nick, false); context.Response.Write("余额不足"); context.Response.End(); break; } #endregion } } } catch (Exception ex) { continue; } } //发送成功 context.Response.Write("发送成功"); context.Response.End(); } else { context.Response.Write("没有会员"); context.Response.End(); } } break; #endregion #region getMsgCount case "getMsgCount": { DataTable tb = MsgBLL.GetSellerMsgStatus(Users.Nick); string count = "0"; if (tb != null && tb.Rows.Count > 0) { count = "剩余短信:" + tb.Rows[0]["msgCanUseCount"].ToString() + "条"; } else { count = "剩余短信:0条"; } context.Response.Write(count); context.Response.End(); } break; #endregion } } }