feat(security): 完善超管平台订阅守卫拦截与移动端高意向访客提醒
这个提交包含在:
@@ -12,6 +12,7 @@ import { TeamQuotaService } from '../../service/quota';
|
||||
import { TeamInvoiceService } from '../../service/invoice';
|
||||
import { TeamStripeService } from '../../service/stripe';
|
||||
import { TeamFinanceAnalyticsService } from '../../service/finance-analytics';
|
||||
import { assertSuperAdmin } from '../../../../comm/guard/super-admin';
|
||||
import {
|
||||
CalculateProrationDTO,
|
||||
CreateInvoiceDTO,
|
||||
@@ -88,6 +89,7 @@ export class AdminTeamBillingController extends BaseController {
|
||||
async postAnalytics(
|
||||
@Body() body?: FinanceAnalyticsQueryDTO
|
||||
): Promise<CoolAdminResponse<FinanceAnalyticsResult>> {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.teamFinanceAnalyticsService.getOverviewAnalytics(body || {});
|
||||
return this.ok(result) as unknown as CoolAdminResponse<FinanceAnalyticsResult>;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Body, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { Context } from '@midwayjs/koa';
|
||||
import { CoolController, BaseController } from '@cool-midway/core';
|
||||
import { PlatformSubscriptionService } from '../../service/platform-subscription';
|
||||
import { assertSuperAdmin } from '../../../../comm/guard/super-admin';
|
||||
import {
|
||||
ManualRenewDTO,
|
||||
PlanConfigItem,
|
||||
@@ -44,6 +45,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
*/
|
||||
@Post('/overview', { summary: '平台会员与订阅整体概览' })
|
||||
async overview() {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result: PlatformOverviewResult =
|
||||
await this.platformSubscriptionService.getOverview();
|
||||
return this.ok(result);
|
||||
@@ -64,6 +66,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
keyword?: string;
|
||||
}
|
||||
) {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.getSubscribers(body);
|
||||
return this.ok(result);
|
||||
}
|
||||
@@ -74,6 +77,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
*/
|
||||
@Post('/subscribers/update', { summary: '超管修改会员套餐/配额/延期' })
|
||||
async subscribersUpdate(@Body() body: UpdateSubscriberDTO) {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.updateSubscriber(body);
|
||||
return this.ok(result);
|
||||
}
|
||||
@@ -92,6 +96,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
keyword?: string;
|
||||
}
|
||||
) {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.getRenewals(body);
|
||||
return this.ok(result);
|
||||
}
|
||||
@@ -102,6 +107,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
*/
|
||||
@Post('/renewals/manual-renew', { summary: '超管手动代续费与补录订单' })
|
||||
async manualRenew(@Body() body: ManualRenewDTO) {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.manualRenew(body);
|
||||
return this.ok(result);
|
||||
}
|
||||
@@ -112,6 +118,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
*/
|
||||
@Post('/plans/list', { summary: 'SaaS 套餐方案矩阵列表' })
|
||||
async plansList() {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.getPlans();
|
||||
return this.ok(result);
|
||||
}
|
||||
@@ -128,6 +135,7 @@ export class AdminPlatformSubscriptionController extends BaseController {
|
||||
params: Partial<PlanConfigItem>;
|
||||
}
|
||||
) {
|
||||
assertSuperAdmin(this.ctx);
|
||||
const result = await this.platformSubscriptionService.updatePlan(
|
||||
body.planType,
|
||||
body.params
|
||||
|
||||
在新工单中引用
屏蔽一个用户