Exemplo n.º 1
0
        public void SendSms(string mobile)
        {
            var code = GetCode();
            var msg  = new Message()
            {
                OpenID   = mobile,
                Content  = code,
                MsgType  = EnumMessageType.SMS,
                Status   = 1,
                SendTime = DateTime.Now
            };

            _messageRep.Add(msg);

            var cntemp_id = System.Configuration.ConfigurationManager.AppSettings["__juhe_cn_tempId"];
            var app       = System.Configuration.ConfigurationManager.AppSettings["__juhe_cn_appName"];
            var tplvalue  = "#app#=" + app + "&#code#=" + code;
            var res       = Lib.JuheSMS.JuheSendSms.SendSms(mobile, cntemp_id, tplvalue);

            _logsrv.Add(new Log()
            {
                Action    = "SendSms",
                Message   = (res.result == null ? "" : LitJson.JsonMapper.ToJson(res.result)) + res.reason,
                CreatedAt = DateTime.Now,
                Operator  = mobile,
                UserID    = 0
            });
            _uow.Commit();
            if (res.IsSuccess)
            {//send success
            }
            else
            {//send error
                throw new Exception(res.reason);
            }
        }
Exemplo n.º 2
0
 public void Add(Log log)
 {
     _logRep.Add(log);
     _uow.Commit();
 }