Exemple #1
0
        public ActionResult CheckMsg()
        {
            //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.auditSms     = Convert.ToInt32(Request["needAudit"] ?? "1");
            sms.issms        = 1;

            //1:APP短信,2:平台短信
            SmsReturn smsret = SmsDataProxy.CheckSmsValid(sms);

            //1成功,2短信不足,3待审核
            return(this.Json(smsret, JsonRequestBehavior.AllowGet));
        }
Exemple #2
0
        public JsonResult CheckSMS()
        {
            int uid = 0;

            if (Request.Form["uid"] != null)
            {
                uid = int.Parse(Request.Form["uid"]);
            }
            int type = 1;

            if (Request.Form["type"] != null)
            {
                type = int.Parse(Request.Form["type"]);
            }
            int issms = type == 2 ? 1 : 0;
            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"]);
            }
            int auditSms = 0;

            if (Request.Form["auditSms"] != null)
            {
                auditSms = int.Parse(Request.Form["auditSms"]);
            }
            string recteaids = tlist.Replace('$', ',');
            string recuserid = GetSendUserList(kid, ulist, ref sendtype);

            if (recteaids != "" && recuserid == "")
            {
                //转为按老师发送
                recuserid = recteaids;
                sendtype  = 1;
                recteaids = "";
            }
            SmsInfo sms = new SmsInfo();

            sms.content      = content.Trim();
            sms.senderuserId = uid;
            sms.sendtype     = sendtype;
            sms.reccid       = "";
            sms.recteaids    = recteaids;
            sms.recuserId    = recuserid;
            sms.kid          = kid;
            sms.auditSms     = auditSms;
            sms.issms        = issms;

            //判断是否已发送和存在非法关键字。
            SmsReturn smsret = SmsDataProxy.CheckSmsValid(sms);

            //SmsReturn smsret = new SmsReturn();
            //smsret.result = -2;
            //smsret.info = "法轮功";

            return(this.Json(smsret, JsonRequestBehavior.AllowGet));
        }