Esempio n. 1
0
        /// <summary>
        /// 更新短信设置
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        internal bool UpdateAccountSMS(SMS.Model.EnterpriseUser user)
        {
            try
            {
                var rc = SMSProxy.GetPretreatmentService().GetChannel(user.Channel);
                if (rc.Success)
                {
                    Channel c = rc.Value;
                    user.SMSType = c.SMSType;
                }
                else
                {
                    return(false);
                }

                bool ok = DAL.EnterpriseUser.UpdateAccountSMS(user);
                if (ok)
                {
                    SMS.Model.EnterpriseUser account = GetAccountFromDB(user.AccountCode);

                    CacheManager <SMS.Model.EnterpriseUser> .Instance.Set(account.AccountCode, account);
                }
                return(ok);
            }
            catch (Exception ex)
            {
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加企业
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public SMS.Model.RPCResult ISMPAddEnterprise(SMS.Model.EnterpriseUser user)
        {
            try
            {
                if (user.AccountCode == "-1")
                {
                    return(new SMS.Model.RPCResult(false, "已存在此企业帐号"));
                }
                SMS.Model.EnterpriseUser a = AccountServer.Instance.GetAccount(user.AccountCode);
                if (a != null)
                {
                    return(new SMS.Model.RPCResult(false, "已存在此企业帐号"));
                }
                if (string.IsNullOrEmpty(user.Signature))
                {
                    return(new SMS.Model.RPCResult(false, "企业签名不能为空"));
                }
                SMS.Model.Account account = new SMS.Model.Account();

                account.AccountID = "";
                account.SMSNumber = 0;
                if (!string.IsNullOrWhiteSpace(user.AccountID))
                {
                    account.AccountID = user.AccountID;
                }
                SMS.Model.RPCResult <Guid> r = SMSProxy.GetPretreatmentService().CreateAccount(account);
                if (!r.Success)
                {
                    return(new SMS.Model.RPCResult(false, r.Message));
                }
                user.AccountID   = r.Value.ToString();
                user.Signature   = "【" + user.Signature + "】";
                user.Channel     = user.Channel == "-1-" ? "" : user.Channel;
                user.SecretKey   = "";
                user.AppPassword = DESEncrypt.Encrypt(user.Password, user.AccountID);
                user.Password    = DESEncrypt.Encrypt(user.Password);
                bool ok = AccountServer.Instance.CreateAccount(user);
                if (ok)
                {
                    return(new SMS.Model.RPCResult(true, "创建成功"));
                }
                return(new SMS.Model.RPCResult(false, "创建失败"));
            }
            catch
            {
                return(new SMS.Model.RPCResult(false, "创建失败"));
            }
        }
Esempio n. 3
0
        public RPC_Result <SMS.DTO.SMSDTO> SendSMS(string LoginName, string Password, SMS.DTO.SMSDTO sms, string Source)
        {
            if (string.IsNullOrWhiteSpace(LoginName))
            {
                return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "用户名不能为空"));
            }
            //权限验证
            var account = AccountServer.Instance.GetAccount(LoginName);

            if (account == null)
            {
                return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "用户不存在"));
            }

            if (Password != account.Password)
            {
                return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "密码不正确"));
            }
            sms.Message.Source           = Source;
            sms.Message.AccountID        = account.AccountID;
            sms.Message.Channel          = account.Channel;
            sms.Message.SMSLevel         = sms.Message.SMSLevel + account.SMSLevel;
            sms.Message.SPNumber         = account.SPNumber;
            sms.Message.StatusReportType = (int)account.StatusReport;
            if (account.Audit == SMS.Model.AccountAuditType.Auto)
            {
                sms.Message.AuditType = AuditType.Auto;
                sms.Message.Status    = "待发送";
            }
            else
            {
                //判断是否匹配模板
                bool match = SMSTempletMatching(LoginName, sms.Message.Content);
                if (match)
                {
                    sms.Message.AuditType = AuditType.Template;
                    sms.Message.Status    = "待发送";
                }
                else
                {
                    sms.Message.AuditType = AuditType.Manual;
                    sms.Message.Status    = "待审核";
                }
            }

            return(SMSProxy.GetPretreatmentService().SendSMS(sms));
        }
Esempio n. 4
0
        /// <summary>
        /// 获取短信统计
        /// </summary>
        /// <param name="BeginDate"></param>
        /// <param name="EndDate"></param>
        /// <returns></returns>
        public SMS.Model.RPCResult <List <string> > GetSMSStatisticsAll(DateTime BeginDate, DateTime EndDate)
        {
            var Enterprises = AccountServer.Instance.GetAccounts();
            //取当前余额
            var Balance = SMSProxy.GetPretreatmentService().GetAccounts().Value;
            //获取指定时间范围内,充值金额
            var ChargeStatics = DAL.ChargeRecord.GetChargeStatics(BeginDate.Date, EndDate.AddDays(1).Date);
            //获取
            var ReportStatistics = SMSProxy.GetPretreatmentService().GetStatisticsReportAll(BeginDate.Date, EndDate.Date).Value;

            var qry = from e in Enterprises
                      join b in Balance
                      on e.AccountID equals b.AccountID into EnterpriseBalance
                      from eb in EnterpriseBalance.DefaultIfEmpty()
                      join r in
                      (from t in ReportStatistics group t by new { t.AccountID, t.Channel } into g select new { Account = g.Key.AccountID, Channel = g.Key.Channel, SendCount = g.Sum(t => t.SendCount), Succeed = g.Sum(t => t.SuccessCount) })
                      on e.AccountID equals r.Account into EnterpriseReport
                      from er in EnterpriseReport.DefaultIfEmpty()
                      join c in ChargeStatics
                      on e.AccountCode equals c.Enterprese into EnterpriseCharge
                      from ec in EnterpriseCharge.DefaultIfEmpty()
                      select Newtonsoft.Json.JsonConvert.SerializeObject(
                new
            {
                EnterpriseCode = e.AccountCode,
                AccountId      = e.AccountID,
                Channel        = e.Channel,
                ChargeCount    = ec == null ? 0 : ec.SMSCount,
                ChargeMoney    = ec == null ? 0 : ec.TotalMoney,
                SendCount      = er == null ? 0 : er.SendCount,
                Succeed        = er == null ? 0 : er.Succeed,
                Balance        = eb == null ? 0 : eb.SMSNumber
            });

            return(new SMS.Model.RPCResult <List <string> >(true, qry.ToList(), ""));
        }
Esempio n. 5
0
        public SMS.Model.RPCResult <List <SMS.Model.Keywords> > GetAllKeywords()
        {
            var list = SMSProxy.GetPretreatmentService().GetAllKeywords(0, 100000000);

            return(new SMS.Model.RPCResult <List <SMS.Model.Keywords> >(true, list.Value.Values.FirstOrDefault(), ""));
        }
Esempio n. 6
0
 /// <summary>
 /// 审核短信 - 成功
 /// </summary>
 /// <param name="AuditAccountLoginName"></param>
 /// <param name="SMSIDList"></param>
 /// <returns></returns>
 public RPC_Result AuditSMSSuccess(string AuditAccountLoginName, List <string> SMSIDList, string SendChannel)
 {
     return(SMSProxy.GetPretreatmentService().AuditSMSSuccess(AuditAccountLoginName, SMSIDList, SendChannel));
 }
Esempio n. 7
0
 /// <summary>
 /// 审核短信 -失败
 /// </summary>
 /// <param name="AuditAccountLoginName"></param>
 /// <param name="SMSIDList"></param>
 /// <param name="FailureCase"></param>
 /// <returns></returns>
 public RPC_Result AuditSMSFailure(string AuditAccountLoginName, List <string> SMSIDList, string FailureCase)
 {
     return(SMSProxy.GetPretreatmentService().AuditSMSFailure(AuditAccountLoginName, SMSIDList, FailureCase));
 }
Esempio n. 8
0
 /// <summary>
 /// 获取待审核短信
 /// </summary>
 /// <param name="qp"></param>
 /// <returns></returns>
 public RPC_Result <QueryResult <SMSMessage> > GetSMSForAudit(QueryParams qp)
 {
     return(SMSProxy.GetPretreatmentService().GetSMSForAudit(qp));
 }
Esempio n. 9
0
 /// <summary>
 /// 获取审核失败原因列表
 /// </summary>
 /// <returns></returns>
 public RPC_Result <List <AuditFailureReason> > GetAuditFailureReasonList()
 {
     return(SMSProxy.GetPretreatmentService().GetAuditFailureReasonList());
 }
Esempio n. 10
0
 public RPC_Result <List <NumSect> > GetNumSect()
 {
     return(SMSProxy.GetPretreatmentService().GetNumSect());
 }
Esempio n. 11
0
 /// <summary>
 /// 查询短信发送记录
 /// </summary>
 /// <param name="qp"></param>
 /// <returns></returns>
 public RPC_Result <QueryResult <SMSMessage> > GetSMSListByAccountID(string AccountID, QueryParams qp)
 {
     qp.add("AccountID", AccountID);
     return(SMSProxy.GetPretreatmentService().GetSMSList(qp));
 }