123456789101112131415161718192021222324252627282930313233343536 |
- import { Controller, Get, Inject, Param } from "@midwayjs/core";
- import { Page, Query } from "../decorator/page.decorator";
- import { RF } from "../response/CustomerResponse";
- import { PartsService } from "../service/parts.service";
- @Controller('/gsxx', { tagName: '供水信息' })
- export class GsxxController {
- @Inject()
- service: PartsService;
- @Get('/list/:type', { routerName: '供水信息各列表' })
- async list(@Param('type') type: string, @Query() query: object, @Page() page: object) {
- const configList = [
- // 水务公告
- { channel_id: 156, type: 'swggz' },
- // 水质报告
- { channel_id: 157, type: 'szbgz' },
- // 停水信息
- { channel_id: 158, type: 'tsxxz' },
- // 管网压力
- { channel_id: 159, type: 'gwylz' },
- // 采购价格信息发布
- { channel_id: 163, type: 'cgjgxxgbz' },
- ]
- const config = configList.find(f => f.type === type)
- if (!config) return { data: null, total: 0 }
- const { channel_id } = config
- const data = await this.service.contentList(channel_id, query, page)
- return RF.success(data);
- }
- @Get('/detail/:content_id', { routerName: '供水信息各详情' })
- async detail(@Param('content_id') content_id: string) {
- const data = await this.service.contentDetail(content_id)
- return RF.success(data);
- }
- }
|