小编Dev*_*Ara的帖子

dotnet 核心 2.1 中的 JWT 令牌返回失败

我想将 jwt 令牌发送到客户端。但是当返回 jwt 令牌时,它显示一些错误。当我尝试登录时,会发生此错误。最初我将我的项目 db 设置为 sqlite,然后将其设置为 mysql。我认为这个问题是在更改 db 后发生的,这里是代码

创业班

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<DataContext>(s => s.UseMySql(Configuration.GetConnectionString("DefaultConnection")));

        IdentityBuilder builder = services.AddIdentityCore<User>(opt =>
        {
            opt.Password.RequireDigit = false;
            opt.Password.RequiredLength = 4;
            opt.Password.RequireNonAlphanumeric = false;
            opt.Password.RequireUppercase = false;
        });

        builder = new IdentityBuilder(builder.UserType, typeof(Role), builder.Services); …
Run Code Online (Sandbox Code Playgroud)

.net-core

2
推荐指数
1
解决办法
1125
查看次数

在 postgresql 中不使用 typescript 和 typeorm 工作之间的日期时间

我想检索给定日期时间范围内的数据。当我尝试从 DBeaver 工具检索数据时,它将返回所有数据。这是我尝试过的查询

SELECT id, "vehicleNo", "vehicleClass",  "issuedOn", "modifiedOn", "paidOn","ticketStatusId"
FROM public.ticket where "paidOn" >= '2019-04-16 02:30:00 AM' and "paidOn" <= '2019-04-16 11:30:00 AM';
Run Code Online (Sandbox Code Playgroud)

但是当我使用 typeorm 时,它不会返回所有数据,这是我的 typeorm 代码

const records = await getConnection().getRepository(Ticket)
                .createQueryBuilder("ticket")
                .innerJoinAndSelect("ticket.ticketStatus", "ticketStatus")
                .where(`ticket.paidOn >= :startDate AND ticket.paidOn <= :endDate
                AND ticket.modifiedBy = :email AND ticketStatus.title = :status `,
                    { startDate: fromDate, endDate: toDate, email: uemail, status: "Paid"})
                .orderBy("ticket.paidOn", "DESC")
                .getMany();
Run Code Online (Sandbox Code Playgroud)

这是必须返回的正确数据集。(8条记录) 在此输入图像描述

但它只返回 4 条记录 在此输入图像描述

postgresql typescript typeorm

2
推荐指数
1
解决办法
2万
查看次数

如何使用angular 2+中的click事件动态创建按钮

我想动态创建一个按钮。我使用innerHtml 来做到这一点。我可以创建按钮。但它的点击事件不起作用。请告诉我如何解决这个问题?

这是我的 html 代码

<div  [innerHTML]="answerPanelContent"></div>
Run Code Online (Sandbox Code Playgroud)

这是我的打字稿代码

 answerPanelContent: any;

   constructor(private sanitizer: DomSanitizer){

   }
ngOnInit() {
 this.answerPanelContent =  this.sanitizer.bypassSecurityTrustHtml(`<button type="button" class="btn                                                    btn-primary float-left"
                                           (click)="removeAnswer()" title="Remove Answer"
                                           aria-label="Close">
                                          Remove</button>`);

  }
    removeAnswer(){
      alert('clicked');
    }
Run Code Online (Sandbox Code Playgroud)

这是 stackblitz 网址:https ://stackblitz.com/edit/angular-nka4w9

typescript angular angular8

1
推荐指数
1
解决办法
6273
查看次数

标签 统计

typescript ×2

.net-core ×1

angular ×1

angular8 ×1

postgresql ×1

typeorm ×1