Esempio n. 1
0
 /// <summary>
 /// 审核短信 - 成功
 /// </summary>
 /// <param name="AuditAccountLoginName"></param>
 /// <param name="SMSIDList"></param>
 /// <returns></returns>
 public RPC_Result AuditSMSSuccess(string AuditAccountLoginName, List <string> SMSIDList, string SendChannel)
 {
     try
     {
         SMS.DB.SMSDAL.AuditSMSSuccess(AuditAccountLoginName, SMSIDList, SendChannel);
         foreach (var smsid in SMSIDList)
         {
             var sms = SMSDAL.GetSMSById(smsid);
             if (sms.Message.SMSTimer != null)
             {
                 SMSDAL.AddSMSTimer(sms.Message.ID, sms.Message.SMSTimer.Value);
             }
             else
             {
                 SMSSubmit.Instance.SendSMS(sms);
             }
         }
         return(new RPC_Result(true, "操作完成!", 0));
     }
     catch (OperateException oe)
     {
         return(new RPC_Result(false, oe.Message, oe.ErrorCode));
     }
     catch (Exception ex)
     {
         MessageTools.MessageHelper.Instance.WirteError("审核时发生了异常", ex);
         return(new RPC_Result(false, "审核时发生了异常", 0));
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 获取审核失败原因列表
        /// </summary>
        /// <returns></returns>
        public RPC_Result <List <AuditFailureReason> > GetAuditFailureReasonList()
        {
            try
            {
                var list = SMSDAL.GetAuditFailureReasonList();
                return(new RPC_Result <List <AuditFailureReason> >(true, list, ""));
            }

            catch (Exception ex)
            {
                MessageTools.MessageHelper.Instance.WirteError("获取审核失败原因时发生了异常", ex);
                return(new RPC_Result <List <AuditFailureReason> >(false, null, "获取审核失败原因时发生了异常"));
            }
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        static void StartSMSTimerMonitor()
        {
            Task t = new Task(() =>
            {
                while (true)
                {
                    var list = SMSDAL.GetTimerSMS();
                    if (list != null && list.Count > 0)
                    {
                        foreach (var smsid in list)
                        {
                            var sms = SMSDAL.GetSMSById(smsid);
                            SMSSubmit.Instance.SendSMS(sms);
                        }
                    }
                    Thread.Sleep(1000 * 30);
                }
            });

            t.Start();
        }
Esempio n. 4
0
        /// <summary>
        /// 提交短信,并扣费
        /// </summary>
        /// <param name="sms"></param>
        /// <returns></returns>
        public RPC_Result <SMS.DTO.SMSDTO> SendSMS(SMS.DTO.SMSDTO sms)
        {
            try
            {
                Account account = AccountDB.GetAccount(sms.Message.AccountID);//AccountServer.Instance.GetAccount(sms.Message.AccountID);
                if (account == null)
                {
                    LogHelper.LogWarn("Pretreatment", "PretreatmentService.SendSMS", "系统中不存在此用户 -> {Account=" + sms.Message.AccountID + "}");
                    MessageTools.MessageHelper.Instance.WirteInfo("提交短信失败,PretreatmentService.SendSMS,系统中不存在此用户 -> {Account=" + sms.Message.AccountID + "}");
                    return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "用户不存在"));
                }
                if (account.SMSNumber < sms.Message.NumberCount)
                {
                    return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "总共要发 " + sms.Message.FeeTotalCount + " 条短信,账号余额不足!"));
                }

                SMS.DB.SMSDAL.AddSMS(sms);

                if (sms.Message.AuditType == AuditType.Auto || sms.Message.AuditType == AuditType.Template)
                {
                    if (sms.Message.SMSTimer != null)
                    {
                        SMSDAL.AddSMSTimer(sms.Message.ID, sms.Message.SMSTimer.Value);
                    }
                    else
                    {
                        SMSSubmit.Instance.SendSMS(sms);
                    }
                }

                account = AccountDB.GetAccount(sms.Message.AccountID);

                return(new RPC_Result <SMS.DTO.SMSDTO>(true, sms, "短信已提交成功,扣费:" + sms.Message.FeeTotalCount + "条,剩余" + account.SMSNumber + "条"));
            }
            catch (Exception ex)
            {
                MessageTools.MessageHelper.Instance.WirteError("发送短信时发生了异常", ex);
                return(new RPC_Result <SMS.DTO.SMSDTO>(false, sms, "发送短信时发生了异常"));
            }
        }