26 lines
595 B
TypeScript
26 lines
595 B
TypeScript
import { Config, Controller, Get } from '@midwayjs/core';
|
|
import { ApiOkResponse } from '@midwayjs/swagger';
|
|
import { WpSitesResponse } from '../dto/reponse.dto';
|
|
import { successResponse } from '../utils/response.util';
|
|
import { WpSite } from '../interface';
|
|
|
|
@Controller('/site')
|
|
export class SiteController {
|
|
@Config('wpSite')
|
|
sites: WpSite[];
|
|
|
|
@ApiOkResponse({
|
|
description: '关联网站',
|
|
type: WpSitesResponse,
|
|
})
|
|
@Get('/all')
|
|
async all() {
|
|
return successResponse(
|
|
this.sites.map(v => ({
|
|
id: v.id,
|
|
siteName: v.siteName,
|
|
}))
|
|
);
|
|
}
|
|
}
|