| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2024-06-17 19:19:20 |
| 4 | * @LastEditTime: 2025-04-14 17:11:23 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: adminGzh AdminGzh |
| 7 | */ |
| 8 | import { Body, Controller, Get, Post } from '@nestjs/common'; |
| 9 | import { ApiOperation } from '@nestjs/swagger'; |
| 10 | import { ParamsValidationPipe } from 'src/validation.pipe'; |
| 11 | import { Manager } from 'src/auth/manager.guard'; |
| 12 | import { CreateGzhMenuDto } from './dto/gzh.dto'; |
| 13 | import { PlatAuthWxGzhService } from 'src/lib/platAuth/wxGzh.service'; |
| 14 | |
| 15 | @Manager() |
| 16 | @Controller('admin/gzh') |
| 17 | export class AdminGzhController { |
| 18 | constructor(private readonly platAuthWxGzhService: PlatAuthWxGzhService) {} |
| 19 | |
| 20 | @ApiOperation({ |
| 21 | description: 'body是JSON对象', |
| 22 | summary: '创建菜单', |
| 23 | }) |
| 24 | @Post('menu') |
| 25 | async createMenu(@Body(new ParamsValidationPipe()) body: CreateGzhMenuDto) { |
| 26 | const menuData = JSON.parse(body.menuStr); |
| 27 | const res = await this.platAuthWxGzhService.createWxGzhMenu(menuData); |
| 28 | return res; |
| 29 | } |
| 30 | |
| 31 | @ApiOperation({ |
| 32 | description: '获取菜单', |
| 33 | summary: '获取菜单', |
| 34 | }) |
| 35 | @Get('menu') |
| 36 | async getMenu() { |
| 37 | const res = await this.platAuthWxGzhService.getMenu(); |
| 38 | return res; |
| 39 | } |
| 40 | } |
| 41 |