forked from xiongyuxing/tiku-backend.net
- Added tags to BrowserAuthController for browser authentication endpoints. - Added tags to CatalogController for public catalog access. - Added tags to CommerceController for student transaction operations. - Added tags to CommissionController for tenant commission management. - Added tags to CrmController for tenant CRM functionalities. - Added tags to HealthController for system health checks. - Added tags to LearningController for student learning resources. - Added tags to MeController for current user information. - Added tags to PlatformAdminController for platform management. - Introduced PlatformBackofficeController for backend permissions management. - Added tags to PlatformBillingCallbackController for billing callbacks. - Added tags to PlatformPaymentSettingsController for payment settings management. - Added tags to PlatformSaasController for SaaS package management. - Added tags to PlatformTenantCapabilitiesController for tenant capabilities. - Added tags to PointsController for student points management. - Added tags to ProfileController for student profile management. - Added tags to QuestionVideosController for question video resources. - Added tags to ReferralController for referral growth management. - Added tags to RuntimeController for runtime configurations. - Added tags to ScorelineController for scoreline management. - Added tags to TaxonomyController for category management. - Added tags to TenantAdminDirectController for tenant operations management. - Introduced TenantBackofficeController for tenant backend permissions. - Added tags to TenantBillingController for tenant billing operations. - Added tags to TenantCommerceController for tenant commerce operations. - Added tags to TenantContentController for tenant content management. - Added tags to TenantContentDirectController for direct content management. - Added tags to TenantFrontendConfigController for frontend configurations. - Added tags to TenantOnboardingController for onboarding guidance. - Added tags to TenantPublicController for public tenant configurations. - Added tags to TenantsController for current tenant information. - Added tags to VideosController for student video resources.
65 lines
3.3 KiB
C#
65 lines
3.3 KiB
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Tiku.Api.Contracts;
|
|
using Tiku.Application.PlatformAdmin;
|
|
using Tiku.Application.Security;
|
|
using Tiku.Domain.Platform;
|
|
|
|
namespace Tiku.Api.Controllers;
|
|
|
|
[ApiController]
|
|
[Tags("平台端-支付设置")]
|
|
[Authorize(Policy = TikuPolicies.PlatformBackofficeBootstrap)]
|
|
[Produces("application/json")]
|
|
[Route("api/platform-admin/payment-settings")]
|
|
public sealed class PlatformPaymentSettingsController(
|
|
IPlatformPaymentSettingsService paymentSettingsService,
|
|
ICurrentUser currentUser) : ControllerBase
|
|
{
|
|
[HttpGet("apps")]
|
|
[EndpointSummary("查询平台支付应用")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentRead)]
|
|
public Task<IReadOnlyCollection<PlatformPaymentApp>> Apps(string? status, int limit = 100, CancellationToken cancellationToken = default) =>
|
|
paymentSettingsService.GetAppsAsync(Actor(), status, limit, cancellationToken);
|
|
|
|
[HttpPut("apps")]
|
|
[EndpointSummary("新增或更新平台支付应用")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentWrite)]
|
|
public Task<PlatformPaymentApp> UpsertApp(UpsertPlatformPaymentAppDto request, CancellationToken cancellationToken) =>
|
|
paymentSettingsService.UpsertAppAsync(Actor(), request.ToCommand(), cancellationToken);
|
|
|
|
[HttpGet("channels")]
|
|
[EndpointSummary("查询平台支付渠道")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentRead)]
|
|
public Task<IReadOnlyCollection<PlatformPaymentChannel>> Channels(Guid? appId, string? status, int limit = 100, CancellationToken cancellationToken = default) =>
|
|
paymentSettingsService.GetChannelsAsync(Actor(), appId, status, limit, cancellationToken);
|
|
|
|
[HttpPut("channels")]
|
|
[EndpointSummary("新增或更新平台支付渠道")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentWrite)]
|
|
public Task<PlatformPaymentChannel> UpsertChannel(UpsertPlatformPaymentChannelDto request, CancellationToken cancellationToken) =>
|
|
paymentSettingsService.UpsertChannelAsync(Actor(), request.ToCommand(), cancellationToken);
|
|
|
|
[HttpPost("channels/{id:guid}/disable")]
|
|
[EndpointSummary("禁用平台支付渠道")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentWrite)]
|
|
public Task<PlatformPaymentChannel> DisableChannel(Guid id, CancellationToken cancellationToken) =>
|
|
paymentSettingsService.DisableChannelAsync(Actor(), id, cancellationToken);
|
|
|
|
[HttpGet("events")]
|
|
[EndpointSummary("查询平台支付事件")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentRead)]
|
|
public Task<IReadOnlyCollection<PlatformBillingPaymentEvent>> Events(string? status, int limit = 100, CancellationToken cancellationToken = default) =>
|
|
paymentSettingsService.GetEventsAsync(Actor(), status, limit, cancellationToken);
|
|
|
|
[HttpGet("rebates/summary")]
|
|
[EndpointSummary("查询平台返佣汇总")]
|
|
[Authorize(Policy = BackendPermissions.PlatformPaymentRead)]
|
|
public Task<PlatformRebateSummary> RebateSummary(CancellationToken cancellationToken) =>
|
|
paymentSettingsService.GetRebateSummaryAsync(Actor(), cancellationToken);
|
|
|
|
private PlatformCapabilityActor Actor() => currentUser.UserId is { } userId
|
|
? new PlatformCapabilityActor(userId)
|
|
: throw new PlatformCapabilityException("Platform actor was not resolved.", "platform_access_denied");
|
|
}
|