返回 AiToEarn
adminFinance.controller.ts
根目录 / project / aitoearn-electron / server / src / modules / finance / adminFinance.controller.ts
1 /*
2 * @Author: nevin
3 * @Date: 2025-02-15 20:59:55
4 * @LastEditTime: 2025-03-02 23:45:48
5 * @LastEditors: nevin
6 * @Description: 管理员-财务
7 */
8 import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
9 import { FinanceService } from './finance.service';
10 import {
11 GetUserWalletRecordListByAdminDto,
12 UpUserWalletRecordPul,
13 } from './dto/userWalletRecord.dto';
14 import { ObjectId } from 'mongodb';
15 import { UserService } from 'src/user/user.service';
16
17 @Controller('adminFinance')
18 export class AdminFinanceController {
19 constructor(
20 private readonly financeService: FinanceService,
21 private readonly userService: UserService,
22 ) {}
23
24 // 获取用户账户信息
25 @Get('userWallet/info/:userId')
26 async getUserWalletInfoByUserId(@Param() param: { userId: string }) {
27 const user = await this.userService.getUserInfoById(param.userId);
28 if (!user) return null;
29
30 return this.financeService.getUserWalletByUserId(
31 new ObjectId(param.userId),
32 );
33 }
34
35 // --------- userWalletRecord STR ---------
36 // 获取用户账户记录列表
37 @Get('userWalletRecord/list')
38 async getUserWalletRecordList(
39 @Query() query: GetUserWalletRecordListByAdminDto,
40 ) {
41 return this.financeService.getWalletRecordList(query);
42 }
43
44 // 提交记录发放
45 @Post('userWalletRecord/submit/:id')
46 async submitUserWalletRecord(
47 @Param('id') id: string,
48 @Body() body: UpUserWalletRecordPul,
49 ) {
50 return this.financeService.submitUserWalletRecord(id, body);
51 }
52
53 // 打款拒绝
54 @Post('userWalletRecord/reject/:id')
55 async rejectUserWalletRecord(
56 @Param('id') id: string,
57 @Body() body: UpUserWalletRecordPul,
58 ) {
59 return this.financeService.rejectUserWalletRecord(id, body);
60 }
61 // --------- userWalletRecord END ---------
62 }
63
63 lines TYPESCRIPT