Ejemplo n.º 1
0
        public async Task <ExcutedResult> SendAsync(string phoneNumber, string content, int client, String countryNumber = "", string templateCode = "")
        {
            var result = await Send(phoneNumber, content, client, countryNumber, templateCode);

            IHttpContextAccessor httpContextAccessor = AspectCoreContainer.Resolve <IHttpContextAccessor>();
            var clientIp = httpContextAccessor.HttpContext.GetRequestIp4Address().ToString();

            var smsSend = new SmsSend
            {
                Id           = Guid.NewGuid(),
                Mobile       = result.PhoneNumber,
                Content      = result.Content,
                CreateTime   = DateTime.UtcNow,
                SmsProxy     = Name,
                SmsProxyResp = result.ResponseStr,
                IsSuccess    = result.IsSuccess,
                Client       = client,
                LoginIp      = clientIp
            };

            ISmsSendRepository smsSendRepository = AspectCoreContainer.Resolve <ISmsSendRepository>();

            smsSendRepository.Insert(smsSend);

            if (result.IsSuccess)
            {
                return(ExcutedResult.SuccessResult());
            }

            return(ExcutedResult.FailedResult(BusinessResultCode.SmsSendFail, "短信发送失败"));
        }
Ejemplo n.º 2
0
 public SmsSendLogic(ISmsSendRepository smsSendRepository)
 {
     _smsSendRepository = smsSendRepository;
 }