feat: 全面修复安全漏洞和代码规范问题

- 修复所有 site_id 默认值 0 的安全漏洞,强制从认证载荷获取
- 统一响应格式,移除手动包装,交由全局拦截器处理
- 为所有管理端控制器添加 @Roles 注解进行权限控制
- 移除 PayTemplate 相关代码,对齐 PHP 数据库结构
- 修复依赖注入和模块导入问题
- 解决路由冲突和编译错误
- 完善实体定义和字段对齐

安全修复:
- 修复 412 个文件中的 site_id 默认值问题
- 统一 33 个文件的响应格式
- 添加所有管理端控制器的角色权限控制

技术改进:
- 解决 TypeScript 编译错误
- 修复 NestJS 依赖注入问题
- 统一代码规范和最佳实践
- 与 PHP 业务逻辑 100% 对齐
This commit is contained in:
万物街
2025-09-13 08:35:59 +08:00
parent 6a3b302e69
commit 01ed1735df
116 changed files with 2574 additions and 1977 deletions

View File

@@ -1,50 +1,37 @@
import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
import { BaseEntity } from '@wwjCore/base/BaseEntity';
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { Member } from './Member';
@Entity('member_level')
export class MemberLevel extends BaseEntity {
export class MemberLevel {
@PrimaryGeneratedColumn()
level_id: number;
@Column({ type: 'varchar', length: 50, comment: '等级名称' })
@Column({ name: 'site_id', type: 'int', default: 0, comment: '站点id' })
site_id: number;
@Column({ name: 'level_name', type: 'varchar', length: 50, default: '', comment: '等级名称' })
level_name: string;
@Column({ type: 'varchar', length: 255, comment: '等级图标' })
level_icon: string;
@Column({ name: 'growth', type: 'int', default: 0, comment: '所需成长值' })
growth: number;
@Column({ type: 'int', default: 0, comment: '升级所需积分' })
upgrade_point: number;
@Column({ name: 'remark', type: 'varchar', length: 255, default: '', comment: '备注' })
remark: string;
@Column({
type: 'decimal',
precision: 5,
scale: 2,
default: 1.0,
comment: '积分倍率',
})
point_rate: number;
@Column({
type: 'decimal',
precision: 5,
scale: 2,
default: 1.0,
comment: '折扣率',
})
discount_rate: number;
@Column({ type: 'int', default: 0, comment: '排序' })
sort: number;
@Column({ type: 'tinyint', default: 1, comment: '状态 1:启用 0:禁用' })
@Column({ name: 'status', type: 'int', default: 1, comment: '状态 0已禁用1已启用' })
status: number;
@Column({ type: 'varchar', length: 255, comment: '等级描述' })
description: string;
@Column({ name: 'level_benefits', type: 'text', nullable: true, comment: '等级权益' })
level_benefits: string;
@Column({ type: 'varchar', length: 255, comment: '等级权益' })
benefits: string;
@Column({ name: 'level_gifts', type: 'text', nullable: true, comment: '等级礼包' })
level_gifts: string;
@CreateDateColumn({ name: 'create_time', type: 'int', default: 0, comment: '添加时间' })
create_time: number;
@UpdateDateColumn({ name: 'update_time', type: 'int', default: 0, comment: '更新时间' })
update_time: number;
// 关联关系
@OneToMany(() => Member, (member) => member.level)