public void SmsSendTest() { string msisdns = "13426086182"; string smsContent = string.Format("尊敬的用户,您好:您的{0}交易流水号已于{1}已支付成功,投保单号为{2},特此通知。" , "f088a1b28e5c4a5dabf81d4f96702b60", DateTime.Now.ToString("yy年MM月dd日HH时mm分"), "20170925002242"); string result = SmsHelper.DoSend(msisdns, null, smsContent, null, string.Empty); }
public void GetValidCode(HttpRequest Request, HttpResponse Response, HttpContext context) { string moblie = UtilityHelper.BWJSCommonHelper.SafeString(Request["moblie"], ""); //1.随即生成4位数字(及1000到9999之间的数字) Random rdm = new Random(); int number = rdm.Next(1000, 10000); context.Session["ValidCode"] = number.ToString(); SmsHelper.DoSend(moblie, null, "您的验证码:" + number.ToString() + " 如非本人操作,请勿将验证码告诉他人。 【牛牛通宝】 ", null, string.Empty); context.Response.Write("{\"isSend\":\"ok\",\"number\":" + number + ",\"moblie\":" + moblie + "}"); }
protected void btnSmsSend_Click(object sender, EventArgs e) { string msisdns = txtMsisdns.Text.Trim(); string smsContent = txtSmsContent.Text.Trim(); if (string.IsNullOrEmpty(smsContent)) { smsContent = string.Format("尊敬的用户,您好:您的{0}交易流水号于{1}支付成功,投保单号为{2},特此通知。【{3}】" , "f088a1b28e5c4a5dabf81d4f96702b60", DateTime.Now.ToString("yy年MM月dd日HH时mm分"), "20170925002242", "闪速快贷"); smsContent = string.Format("验证码:{0} 【{1}】", new Random().Next(6, 6), "闪速快贷"); } string result = string.Empty; if (!string.IsNullOrEmpty(msisdns) && !string.IsNullOrEmpty(smsContent)) { result = SmsHelper.DoSend(msisdns, null, smsContent, null, string.Empty); } else { result = "接收号码或发送内容不能为空"; } litSendResult.Text = result; }