v4.0.17企业微信API插件优化

This commit is contained in:
2026-09-06 09:36:49 +08:00
parent 0e711be6c6
commit 192a401227
36 changed files with 2416 additions and 103 deletions
@@ -2,7 +2,8 @@ import { Controller, Get, Param, Query, Req, UseGuards } from '@nestjs/common';
import type { Request } from 'express';
import { WecomPluginGuard } from './wecom-plugin.guard';
import { WecomPluginQueryService } from './wecom-plugin-query.service';
import { WECOM_PLUGIN_OPENAPI } from './wecom-plugin.openapi';
import { CurrentWecomPlugin } from './wecom-plugin.decorators';
import type { WecomPluginRuntime } from './wecom-plugin.types';
@Controller('wecom/plugin')
@UseGuards(WecomPluginGuard)
@@ -10,73 +11,212 @@ export class WecomPluginController {
constructor(private readonly query: WecomPluginQueryService) {}
@Get()
info() {
return this.query.info();
info(@CurrentWecomPlugin() plugin: WecomPluginRuntime) {
return this.query.info(plugin);
}
@Get('openapi.json')
openapi() {
return WECOM_PLUGIN_OPENAPI;
openapi(@CurrentWecomPlugin() plugin: WecomPluginRuntime) {
return this.query.openapi(plugin);
}
@Get('orders')
orders(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryOrders(pluginCaller(req), q, page, pageSize);
return this.query.queryOrders(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('users')
users(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryUsers(pluginCaller(req), q, page, pageSize);
return this.query.queryUsers(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('stores')
stores(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryStores(pluginCaller(req), q, page, pageSize);
return this.query.queryStores(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('store-audits')
storeAudits(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('status') status?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryStoreAudits(plugin, pluginCaller(req), q, status, page, pageSize);
}
@Get('store-info-audits')
storeInfoAudits(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('status') status?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryStoreInfoAudits(plugin, pluginCaller(req), status, page, pageSize);
}
@Get('store-info-audits/:id')
storeInfoAuditDetail(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('id') id: string,
) {
return this.query.queryStoreInfoAuditDetail(plugin, pluginCaller(req), id);
}
@Get('store-package-audits')
storePackageAudits(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('status') status?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryStorePackageAudits(plugin, pluginCaller(req), status, page, pageSize);
}
@Get('store-package-audits/:id')
storePackageAuditDetail(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('id') id: string,
) {
return this.query.queryStorePackageAuditDetail(plugin, pluginCaller(req), id);
}
@Get('redeems')
redeems(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryRedeems(pluginCaller(req), q, page, pageSize);
return this.query.queryRedeems(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('promo-codes')
promoCodes(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryPromoCodes(pluginCaller(req), q, page, pageSize);
return this.query.queryPromoCodes(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('promo-codes/:code/stats')
promoStats(@Req() req: Request, @Param('code') code: string) {
return this.query.queryPromoCodeStats(pluginCaller(req), code);
promoStats(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('code') code: string,
) {
return this.query.queryPromoCodeStats(plugin, pluginCaller(req), code);
}
@Get('partners')
partners(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('q') q?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryPartners(plugin, pluginCaller(req), q, page, pageSize);
}
@Get('partners/:partnerId/users')
partnerUsers(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('partnerId') partnerId: string,
@Query('from') from?: string,
@Query('to') to?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryPartnerUsers(
plugin,
pluginCaller(req),
partnerId,
from,
to,
page,
pageSize,
);
}
@Get('partners/:partnerId/stores')
partnerStores(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('partnerId') partnerId: string,
@Query('from') from?: string,
@Query('to') to?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryPartnerStores(
plugin,
pluginCaller(req),
partnerId,
from,
to,
page,
pageSize,
);
}
@Get('partners/:partnerId/orders')
partnerOrders(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Param('partnerId') partnerId: string,
@Query('from') from?: string,
@Query('to') to?: string,
@Query('page') page?: string,
@Query('pageSize') pageSize?: string,
) {
return this.query.queryPartnerOrders(
plugin,
pluginCaller(req),
partnerId,
from,
to,
page,
pageSize,
);
}
@Get('metrics')
metrics(@Req() req: Request, @Query('kind') kind?: string) {
return this.query.queryMetrics(pluginCaller(req), kind);
metrics(
@CurrentWecomPlugin() plugin: WecomPluginRuntime,
@Req() req: Request,
@Query('kind') kind?: string,
) {
return this.query.queryMetrics(plugin, pluginCaller(req), kind);
}
}