| | |
| | | using MediatR; |
| | | using Microsoft.EntityFrameworkCore; |
| | | using Microsoft.Extensions.Hosting; |
| | | using Microsoft.Extensions.Options; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | public class SmsUtils |
| | | { |
| | | private readonly IRepository<SmsLog, LogDbContextLocator> rep; |
| | | private readonly IOptions<AliyunOptions> options; |
| | | private readonly AliyunSmsUtils aliyunSmsUtils; |
| | | |
| | | public SmsUtils( |
| | | IRepository<SmsLog, LogDbContextLocator> rep, |
| | | IOptions<AliyunOptions> options, |
| | | AliyunSmsUtils aliyunSmsUtils) |
| | | { |
| | | this.rep = rep; |
| | | this.options = options; |
| | | this.aliyunSmsUtils = aliyunSmsUtils; |
| | | } |
| | | |
| | |
| | | entity.TemplateParam = new { code }.ToJson(); |
| | | await aliyunSmsUtils.SendAsync(model.PhoneNumber, model.TemplateCode, entity.TemplateParam, cancellationToken); |
| | | await rep.InsertAsync(entity); |
| | | if (App.HostEnvironment.IsDevelopment()) |
| | | if (options.Value.SMS.WithoutVerifyCode) |
| | | { |
| | | UnifyContext.Fill(new |
| | | { |