/// <summary> /// 发送短息 /// </summary> /// <param name="arg"></param> /// <returns></returns> private dynamic SendMsg(dynamic arg) { try { //得到请求参数 string mobile = base.GetValue <string>("MOBILE"); if (string.IsNullOrEmpty(mobile)) { return(ResponseJson(false, "手机号不能是空")); } Random r = new Random(); int num = r.Next(100000, 999999); //string message = string.Format("本次微信平台获取的验证码是:" + num); //【上海家化】您的验证码为:620384。 //此验证码10分钟内有效,如非本人操作,请联系Jahwa华美家微信后台。 string message = string.Format("您的验证码为:" + num + "此验证码10分钟内有效,如非本人操作,请联系上海家化华美家微信后台。"); dt_SMSInsert_req req = new dt_SMSInsert_req { SMS_ITEM = new SMS_ITEM[] { new SMS_ITEM() { CONTENT = message, MESSAGEID = "0000001", MESSAGETYPE = "BC_WX_SMS", MOBILE = mobile, MSGFORMAT = "8", SRCNUMBER = "1069048560003" } } }; dt_SMSInsert_res res = WebHmjApiHelp.SMSInsert(req, true); if (res.zstatus == "1") { return(ResponseJson(true, "发送成功", num)); } return(ResponseJson(false, "发送失败")); } catch (Exception ex) { WriteLog("发送验证码", ex); return(ResponseJsonError(false, error_message, ex)); } }
/// <summary> /// 发送短信 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button15_Click(object sender, EventArgs e) { Random r = new Random(); int num = r.Next(100000, 999999); //string message = string.Format("本次微信平台获取的验证码是:" + num); string message = string.Format("本次微信平台获取的验证码是:" + num + "。如非本人操作,请致电400-821-6188"); dt_SMSInsert_req req = new dt_SMSInsert_req(); req.SMS_ITEM = new SMS_ITEM[] { new SMS_ITEM() { CONTENT = message, MESSAGEID = "0000001", MESSAGETYPE = "BC_WX_SMS", MOBILE = "18721170080", MSGFORMAT = "8", SRCNUMBER = "1069048560003" } }; dt_SMSInsert_res res = WebHmjApiHelp.SMSInsert(req, true); }