自定义用户票据

This commit is contained in:
FalconFly 2024-05-06 17:24:29 +08:00
parent e06576fa46
commit d4345e311c
2 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ namespace Falcon.SugarApi.ClaimTicket
} }
Task IModelBinder.BindModelAsync(ModelBindingContext bindingContext) { Task IModelBinder.BindModelAsync(ModelBindingContext bindingContext) {
if(bindingContext.ModelType != typeof(UserTicket)) { if(!bindingContext.ModelType.IsAssignableTo(typeof(UserTicket))) {
return FailBind(bindingContext); return FailBind(bindingContext);
} }
var token = bindingContext.ValueProvider.GetValue(this.Options.HttpHeaderKey).ToString(); var token = bindingContext.ValueProvider.GetValue(this.Options.HttpHeaderKey).ToString();

View File

@ -14,7 +14,7 @@ namespace Falcon.SugarApi.ClaimTicket
throw new ArgumentNullException(nameof(context)); throw new ArgumentNullException(nameof(context));
} }
if(context.Metadata.ModelType == typeof(UserTicket)) { if(context.Metadata.ModelType.IsAssignableTo(typeof(UserTicket))) {
return new BinderTypeModelBinder(typeof(ClaimTicketModelBinding)); return new BinderTypeModelBinder(typeof(ClaimTicketModelBinding));
} }