protected void btnSend_Click(object sender, EventArgs e) { lock (ManualPush.objLock) { string text = this.txtURL.Text.Trim(); string str = string.Empty; string text2 = this.txtPushContent.Text.Trim(); string text3 = this.txtPushTitle.Text.Trim(); string value = this.ddlPushTag.SelectedItem.Value; string pushTagText = this.ddlPushTag.SelectedItem.Text.Trim(); EnumPushSendType pushSendType = (EnumPushSendType)this.rblPushSendType.SelectedValue.ToInt(0); if (string.IsNullOrEmpty(text3)) { this.ShowMsg("请填写推送标题", false); } else if (string.IsNullOrEmpty(text2)) { this.ShowMsg("请填写推送内容", false); } else if (pushSendType.Equals(EnumPushSendType.Timer) && !this.calendarSendDate.SelectedDate.HasValue) { this.ShowMsg("请填写定时的时间", false); } else { EnumPushType enumPushType = (EnumPushType)this.rblPushType.SelectedValue.ToInt(0); switch (enumPushType) { case EnumPushType.Link: if (string.IsNullOrEmpty(text)) { this.ShowMsg("请填写链接", false); return; } if (!Regex.IsMatch(text, "(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&:/~\\+#]*[\\w\\-\\@?^=%&/~\\+#])?")) { this.ShowMsg("请输入正确的链接,比如 https://www.huz.com.cn", false); return; } str = string.Format("url{1}{0}{2}", this.txtURL.Text.Trim(), VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); break; case EnumPushType.ProductTopic: if (string.IsNullOrEmpty(this.topicId)) { this.ShowMsg("请选择专题", false); return; } str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/Topics?TopicId=" + this.topicId, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); break; case EnumPushType.Activity: switch (this.rblActivity.SelectedValue.ToInt(0)) { case 2: str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/CountDownProducts.aspx", VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); break; case 1: str = string.Format("url{1}{0}{2}", Globals.HostPath(HttpContext.Current.Request.Url) + "/appshop/GroupBuyList.aspx", VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); break; } break; case EnumPushType.Product: if (string.IsNullOrEmpty(this.productId)) { this.ShowMsg("请选择商品", false); return; } str = string.Format("productid{1}{0}{2}", this.productId, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); break; } DateTime pushSendDate = DateTime.Now; if (pushSendType.Equals(EnumPushSendType.Timer)) { if (!this.calendarSendDate.SelectedDate.HasValue) { this.ShowMsg("请选择推送时间", false); goto end_IL_0009; } DateTime value2 = this.calendarSendDate.SelectedDate.Value; if (value2 <= DateTime.Now) { this.ShowMsg("请选择大于当前的时间", false); goto end_IL_0009; } pushSendDate = this.calendarSendDate.SelectedDate.Value; } int num = 14; int num2 = 20; if (text3.Length > num) { this.ShowMsg($"推送标题不能超过{num}", false); } else if (text2.Length > num2) { this.ShowMsg($"推送内容不能超过{num2}个字", false); } else { str += string.Format("type{1}{0}{2}", (int)enumPushType, VShopHelper.SEPARATORCONTEXT, VShopHelper.SEPARATOREVERY); AppPushRecordInfo appPushRecordInfo = new AppPushRecordInfo { PushType = (int)enumPushType, PushContent = text2, PushTitle = text3, PushTag = value, PushTagText = pushTagText, PushStatus = 1, PushSendType = (int)pushSendType, PushSendDate = pushSendDate, ToAll = (this.ddlPushTag.SelectedIndex == 0), Extras = str }; if (VShopHelper.CheckAppPushRecordDuplicate(appPushRecordInfo)) { this.ShowMsg("不能在一小时内推送重复的信息", false); } else { if (pushSendType.Equals(EnumPushSendType.AtOnce)) { VShopHelper.AppPushRecordSendAboutAtOnce(appPushRecordInfo); } VShopHelper.AddAppPushRecord(appPushRecordInfo); if (appPushRecordInfo.PushStatus.Equals(EnumPushStatus.PushFailure)) { this.ShowMsg("推送失败", false); } else { this.ShowMsg("推送成功", true, "PushRecords.aspx"); } } } } end_IL_0009 :; } }