feat: gravity transaction logging + user-facing history popup

- New GravityTransaction schema tracks all gravity changes (registration,
  interview/optimize/download deduction, purchase, monthly topup, migration)
- GravityTopUpService: bulk log for monthly VIP topup
- PaymentController.activateMembership: log plan_set transactions
- QuotaService: add logTransaction, wire into all gravity-modifying methods
- UserService: log registration grants (phone/wx/email/password)
- GET /user/gravity-transactions?page=&limit= API
- Frontend: user.vue '明细' button + paginated popup
- Docs: update PROJECT-STATUS v4.10, FEATURE-LIST, DEPLOYMENT
This commit is contained in:
yuzhiran
2026-07-04 11:12:55 +08:00
parent d8a7872cd2
commit 2230a95b45
14 changed files with 268 additions and 38 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
import { Controller, Post, Get, Put, Body, Req, HttpCode, HttpStatus, UseGuards } from '@nestjs/common'
import { Controller, Post, Get, Put, Query, Body, Req, HttpCode, HttpStatus, UseGuards } from '@nestjs/common'
import { UserService } from './user.service'
import { Public } from '../../common/decorators/public.decorator'
import { CurrentUser } from '../../common/decorators/current-user.decorator'
@@ -88,4 +88,13 @@ export class UserController {
async setPassword(@CurrentUser('userId') userId: string, @Body('password') password: string) {
return this.userService.setPassword(userId, password)
}
@Get('gravity-transactions')
async getGravityTransactions(
@CurrentUser('userId') userId: string,
@Query('page') page = '1',
@Query('limit') limit = '20',
) {
return this.userService.getGravityTransactions(userId, parseInt(page), parseInt(limit))
}
}