public ActionResult SendSMS() { //1:APP消息,2:平台短信 int type = 2; //发送方式(0按小朋友,1按老师,2按年级,3按班级,4按部门,5按职位) SmsInfo sms = new SmsInfo(); sms.content = Request["content"] ?? ""; sms.senderuserId = UserID; //sms.reccid = ""; sms.recteaids = Request["teachers"] ?? ""; sms.recuserId = Request["students"] ?? ""; sms.sendtype = Convert.ToInt32(string.IsNullOrWhiteSpace(Request["students"]) ? 1 : 0); sms.kid = Convert.ToInt32(Request["kid"] ?? "0"); sms.smstype = Convert.ToInt32(Request["smstype"] ?? "1"); sms.smstitle = Request["title"] ?? "幼儿园通知"; sms.istime = Convert.ToInt32(Request["istime"] ?? "0"); sms.sendtime = Convert.ToDateTime(string.IsNullOrWhiteSpace(Request["sendtime"]) ? DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") : Request["sendtime"]); sms.issms = 1; //sms.img_url = ""; SmsReturn smsret = new SmsReturn(); //smsret.result = 1; //1:APP短信,2:平台短信 if (Request["needAudit"] == "1" && Request["role"] != "0")//园长、管理员不需要审核 { //审核后再发送 smsret = SmsDataProxy.audit_SendSMS(sms); if (smsret.result > 2) { smsret.result = 3; } } else { if (type == 2) { smsret = SmsDataProxy.class_sms_ADD_V3_mobile(sms); } } //1成功,2短信不足,3待审核 return(this.Json(smsret, JsonRequestBehavior.AllowGet)); }
public JsonResult Send_SMS() { int uid = 0; if (Request.Form["uid"] != null) { uid = int.Parse(Request.Form["uid"]); } int usertype = 1; if (Request.Form["usertype"] != null) { usertype = int.Parse(Request.Form["usertype"]); } //1:APP短信,2:平台短信 int type = 1; if (Request.Form["type"] != null) { type = int.Parse(Request.Form["type"]); } int kid = 0; if (Request.Form["kid"] != null) { kid = int.Parse(Request.Form["kid"]); } //发送方式(0按小朋友,1按老师,2按年级,3按班级,4按部门,5按职位) int sendtype = 0; if (Request.Form["sendtype"] != null) { sendtype = int.Parse(Request.Form["sendtype"]); } string tlist = ""; if (Request.Form["tlist"] != null) { tlist = Request.Form["tlist"]; } string ulist = ""; if (Request.Form["ulist"] != null) { ulist = Request.Form["ulist"]; } string content = ""; if (Request.Form["content"] != null) { content = System.Web.HttpUtility.UrlDecode(Request.Form["content"]); } string smstitle = ""; if (Request.Form["smstitle"] != null) { smstitle = System.Web.HttpUtility.UrlDecode(Request.Form["smstitle"]); } int receipttype = -1; if (Request.Form["receipttype"] != null) { receipttype = int.Parse(Request.Form["receipttype"]); } int auditSms = 0; if (Request.Form["auditSms"] != null) { auditSms = int.Parse(Request.Form["auditSms"]); } int istime = 0; if (Request.Form["istime"] != null) { istime = int.Parse(Request.Form["istime"]); } DateTime sendtime = DateTime.Now; if (istime == 1 && Request.Form["sendtime"] != null) { sendtime = DateTime.Parse(Request.Form["sendtime"]); } string img_url = ""; if (Request.Form["img_url"] != null) { img_url = System.Web.HttpUtility.UrlDecode(Request.Form["img_url"]); } string recteaids = tlist.Replace('$', ','); string recuserid = GetSendUserList(kid, ulist, ref sendtype /*, type, out reccid*/); if (recteaids != "" && recuserid == "") { //转为按老师发送 recuserid = recteaids; sendtype = 1; recteaids = ""; } SmsInfo sms = new SmsInfo(); sms.content = content.Trim(); sms.senderuserId = uid; sms.reccid = ""; sms.recteaids = recteaids; sms.recuserId = recuserid; sms.sendtype = sendtype; sms.kid = kid; sms.smstype = usertype > 1 ? 2 : 1; sms.smstitle = smstitle; sms.receipttype = receipttype; sms.istime = istime; sms.sendtime = sendtime; sms.issms = type == 2 ? 1 : 0; sms.img_url = img_url; SmsReturn smsret = new SmsReturn(); //smsret.result = 1; //1:APP短信,2:平台短信 if (auditSms == 1 && usertype <= 1)//园长、管理员不需要审核 { //审核后再发送 smsret = SmsDataProxy.audit_SendSMS(sms); if (smsret.result > 2) { smsret.result = 3; } } else { if (type == 2) { smsret = SmsDataProxy.class_sms_ADD_V3_mobile(sms); } else { smsret.result = SmsDataProxy.SendAppSms(sms); } } return(this.Json(smsret, JsonRequestBehavior.AllowGet)); }