mirror of
				https://github.com/vastxie/99AI.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	NineAI 2.4.2
This commit is contained in:
		
							
								
								
									
										37
									
								
								.env.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								.env.example
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					# server base
 | 
				
			||||||
 | 
					PORT=9520
 | 
				
			||||||
 | 
					PREFIX=/docs
 | 
				
			||||||
 | 
					APIPREFIX=/api
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# mysql
 | 
				
			||||||
 | 
					DB_HOST=localhost
 | 
				
			||||||
 | 
					DB_PORT=3306
 | 
				
			||||||
 | 
					DB_USER=root
 | 
				
			||||||
 | 
					DB_PASS=
 | 
				
			||||||
 | 
					DB_DATABASE=chatgpt
 | 
				
			||||||
 | 
					DB_SYNC=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# jwt key token过期时间
 | 
				
			||||||
 | 
					JWT_SECRET=chat-cooper
 | 
				
			||||||
 | 
					JWT_EXPIRESIN=7d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#  mailer 邮件服务
 | 
				
			||||||
 | 
					MAILER_HOST=smtp.qq.com
 | 
				
			||||||
 | 
					MAILER_PORT=587
 | 
				
			||||||
 | 
					MAILER_USER=
 | 
				
			||||||
 | 
					MAILER_PASS=
 | 
				
			||||||
 | 
					MAILER_FROM=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Redis
 | 
				
			||||||
 | 
					REDIS_PORT=6379
 | 
				
			||||||
 | 
					REDIS_HOST=127.0.0.1
 | 
				
			||||||
 | 
					REDIS_PASSWORD=
 | 
				
			||||||
 | 
					REDIS_USER=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# 是否测试环境
 | 
				
			||||||
 | 
					ISDEV=FALSE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# mj并发数
 | 
				
			||||||
 | 
					CONCURRENCY=5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAMESPACE=NINEAI
 | 
				
			||||||
							
								
								
									
										42
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					# 部署文档
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 环境准备
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. **安装Node.js环境**
 | 
				
			||||||
 | 
					   - 请根据您的操作系统下载并安装Node.js。
 | 
				
			||||||
 | 
					   - 可以从[Node.js官网](https://nodejs.org/)下载。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. **安装PM2**
 | 
				
			||||||
 | 
					   - 使用npm安装PM2:`npm install pm2 -g`
 | 
				
			||||||
 | 
					   - PM2是一个带有负载均衡功能的Node应用的进程管理器。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					3. **安装PNPM**
 | 
				
			||||||
 | 
					   - 使用npm安装PNPM:`npm install -g pnpm`
 | 
				
			||||||
 | 
					   - PNPM是一个快速、节省磁盘空间的包管理工具。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 配置项目
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. **配置环境变量**
 | 
				
			||||||
 | 
					   - 复制`.env.example`文件为`.env`。
 | 
				
			||||||
 | 
					   - 根据需要修改`.env`文件中的配置项。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. **安装项目依赖**
 | 
				
			||||||
 | 
					   - 运行命令:`pnpm install`(若安装失败可尝试使用国内源)
 | 
				
			||||||
 | 
					   - 这将根据`package.json`文件安装所有必需的依赖。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 启动项目
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1. **启动服务**
 | 
				
			||||||
 | 
					   - 使用命令:`pnpm start`
 | 
				
			||||||
 | 
					   - 这将启动项目,并默认在9520端口监听。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					2. **访问项目**
 | 
				
			||||||
 | 
					   - 在浏览器中访问`http://localhost:9520`,或者如果配置了nginx反向代理,则通过配置的域名访问。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 管理平台
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- **管理端地址**:`/nineai/admin`
 | 
				
			||||||
 | 
					- **超级管理员账号**:`super`
 | 
				
			||||||
 | 
					- **密码**:`nine-super`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					请确保遵循上述步骤进行配置和启动,以保证系统的正确运行。
 | 
				
			||||||
							
								
								
									
										96
									
								
								dist/app.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										96
									
								
								dist/app.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,96 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppModule = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const nestjs_config_1 = require("nestjs-config");
 | 
				
			||||||
 | 
					const abort_interceptor_1 = require("./common/interceptors/abort.interceptor");
 | 
				
			||||||
 | 
					const database_module_1 = require("./modules/database/database.module");
 | 
				
			||||||
 | 
					const path_1 = require("path");
 | 
				
			||||||
 | 
					const user_module_1 = require("./modules/user/user.module");
 | 
				
			||||||
 | 
					const auth_module_1 = require("./modules/auth/auth.module");
 | 
				
			||||||
 | 
					const mailer_module_1 = require("./modules/mailer/mailer.module");
 | 
				
			||||||
 | 
					const verification_module_1 = require("./modules/verification/verification.module");
 | 
				
			||||||
 | 
					const chatgpt_module_1 = require("./modules/chatgpt/chatgpt.module");
 | 
				
			||||||
 | 
					const crami_module_1 = require("./modules/crami/crami.module");
 | 
				
			||||||
 | 
					const userBalance_module_1 = require("./modules/userBalance/userBalance.module");
 | 
				
			||||||
 | 
					const chatLog_module_1 = require("./modules/chatLog/chatLog.module");
 | 
				
			||||||
 | 
					const upload_module_1 = require("./modules/upload/upload.module");
 | 
				
			||||||
 | 
					const draw_module_1 = require("./modules/draw/draw.module");
 | 
				
			||||||
 | 
					const redisCache_module_1 = require("./modules/redisCache/redisCache.module");
 | 
				
			||||||
 | 
					const globalConfig_module_1 = require("./modules/globalConfig/globalConfig.module");
 | 
				
			||||||
 | 
					const statistic_module_1 = require("./modules/statistic/statistic.module");
 | 
				
			||||||
 | 
					const badwords_module_1 = require("./modules/badwords/badwords.module");
 | 
				
			||||||
 | 
					const autoreply_module_1 = require("./modules/autoreply/autoreply.module");
 | 
				
			||||||
 | 
					const app_module_1 = require("./modules/app/app.module");
 | 
				
			||||||
 | 
					const pay_module_1 = require("./modules/pay/pay.module");
 | 
				
			||||||
 | 
					const order_module_1 = require("./modules/order/order.module");
 | 
				
			||||||
 | 
					const fanyi_module_1 = require("./modules/fanyi/fanyi.module");
 | 
				
			||||||
 | 
					const official_module_1 = require("./modules/official/official.module");
 | 
				
			||||||
 | 
					const task_module_1 = require("./modules/task/task.module");
 | 
				
			||||||
 | 
					const queue_module_1 = require("./modules/queue/queue.module");
 | 
				
			||||||
 | 
					const midjourney_module_1 = require("./modules/midjourney/midjourney.module");
 | 
				
			||||||
 | 
					const chatGroup_module_1 = require("./modules/chatGroup/chatGroup.module");
 | 
				
			||||||
 | 
					const serve_static_1 = require("@nestjs/serve-static");
 | 
				
			||||||
 | 
					const fetch = require("isomorphic-fetch");
 | 
				
			||||||
 | 
					const path_2 = require("path");
 | 
				
			||||||
 | 
					global.fetch = fetch;
 | 
				
			||||||
 | 
					const core_1 = require("@nestjs/core");
 | 
				
			||||||
 | 
					const sales_module_1 = require("./modules/sales/sales.module");
 | 
				
			||||||
 | 
					const signin_module_1 = require("./modules/signin/signin.module");
 | 
				
			||||||
 | 
					const menu_module_1 = require("./modules/menu/menu.module");
 | 
				
			||||||
 | 
					const models_module_1 = require("./modules/models/models.module");
 | 
				
			||||||
 | 
					let AppModule = class AppModule {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AppModule = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Global)(),
 | 
				
			||||||
 | 
					    (0, common_1.Module)({
 | 
				
			||||||
 | 
					        imports: [
 | 
				
			||||||
 | 
					            serve_static_1.ServeStaticModule.forRoot({
 | 
				
			||||||
 | 
					                rootPath: (0, path_2.join)(__dirname, '..', 'public'),
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
 | 
					            nestjs_config_1.ConfigModule.load((0, path_1.resolve)(__dirname, 'config', '**/!(*.d).{ts,js}')),
 | 
				
			||||||
 | 
					            database_module_1.DatabaseModule,
 | 
				
			||||||
 | 
					            user_module_1.UserModule,
 | 
				
			||||||
 | 
					            auth_module_1.AuthModule,
 | 
				
			||||||
 | 
					            mailer_module_1.MailerModule,
 | 
				
			||||||
 | 
					            verification_module_1.VerificationModule,
 | 
				
			||||||
 | 
					            chatgpt_module_1.ChatgptModule,
 | 
				
			||||||
 | 
					            crami_module_1.CramiModule,
 | 
				
			||||||
 | 
					            userBalance_module_1.UserBalanceModule,
 | 
				
			||||||
 | 
					            chatLog_module_1.ChatLogModule,
 | 
				
			||||||
 | 
					            upload_module_1.UploadModule,
 | 
				
			||||||
 | 
					            draw_module_1.DrawModule,
 | 
				
			||||||
 | 
					            redisCache_module_1.RedisCacheModule,
 | 
				
			||||||
 | 
					            globalConfig_module_1.GlobalConfigModule,
 | 
				
			||||||
 | 
					            statistic_module_1.StatisticModule,
 | 
				
			||||||
 | 
					            badwords_module_1.BadwordsModule,
 | 
				
			||||||
 | 
					            autoreply_module_1.AutoreplyModule,
 | 
				
			||||||
 | 
					            app_module_1.AppModule,
 | 
				
			||||||
 | 
					            pay_module_1.PayModule,
 | 
				
			||||||
 | 
					            order_module_1.OrderModule,
 | 
				
			||||||
 | 
					            fanyi_module_1.FanyiModule,
 | 
				
			||||||
 | 
					            official_module_1.OfficialModule,
 | 
				
			||||||
 | 
					            task_module_1.TaskModule,
 | 
				
			||||||
 | 
					            queue_module_1.QueueModule,
 | 
				
			||||||
 | 
					            midjourney_module_1.MidjourneyModule,
 | 
				
			||||||
 | 
					            chatGroup_module_1.ChatGroupModule,
 | 
				
			||||||
 | 
					            sales_module_1.SalesModule,
 | 
				
			||||||
 | 
					            signin_module_1.SigninModule,
 | 
				
			||||||
 | 
					            menu_module_1.MenuModule,
 | 
				
			||||||
 | 
					            models_module_1.ModelsModule,
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        providers: [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                provide: core_1.APP_INTERCEPTOR,
 | 
				
			||||||
 | 
					                useClass: abort_interceptor_1.AbortInterceptor,
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					], AppModule);
 | 
				
			||||||
 | 
					exports.AppModule = AppModule;
 | 
				
			||||||
							
								
								
									
										31
									
								
								dist/common/auth/adminAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								dist/common/auth/adminAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AdminAuthGuard = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("./jwtAuth.guard");
 | 
				
			||||||
 | 
					let AdminAuthGuard = class AdminAuthGuard extends jwtAuth_guard_1.JwtAuthGuard {
 | 
				
			||||||
 | 
					    async canActivate(context) {
 | 
				
			||||||
 | 
					        const isAuthorized = await super.canActivate(context);
 | 
				
			||||||
 | 
					        if (!isAuthorized) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const request = context.switchToHttp().getRequest();
 | 
				
			||||||
 | 
					        const user = request.user;
 | 
				
			||||||
 | 
					        if (user && ['admin', 'super'].includes(user.role)) {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            throw new common_1.UnauthorizedException('非法操作、您的权限等级不足、无法执行当前请求!');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AdminAuthGuard = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], AdminAuthGuard);
 | 
				
			||||||
 | 
					exports.AdminAuthGuard = AdminAuthGuard;
 | 
				
			||||||
							
								
								
									
										33
									
								
								dist/common/auth/jwt.strategy.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								dist/common/auth/jwt.strategy.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.JwtStrategy = void 0;
 | 
				
			||||||
 | 
					const nestjs_config_1 = require("nestjs-config");
 | 
				
			||||||
 | 
					const passport_jwt_1 = require("passport-jwt");
 | 
				
			||||||
 | 
					const passport_1 = require("@nestjs/passport");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
 | 
				
			||||||
 | 
					    constructor(configService) {
 | 
				
			||||||
 | 
					        super({
 | 
				
			||||||
 | 
					            jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
 | 
				
			||||||
 | 
					            secretOrKey: configService.get('jwt').secret,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        this.configService = configService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async validate(payload) {
 | 
				
			||||||
 | 
					        return payload;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					JwtStrategy = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [nestjs_config_1.ConfigService])
 | 
				
			||||||
 | 
					], JwtStrategy);
 | 
				
			||||||
 | 
					exports.JwtStrategy = JwtStrategy;
 | 
				
			||||||
							
								
								
									
										82
									
								
								dist/common/auth/jwtAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										82
									
								
								dist/common/auth/jwtAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,82 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.JwtAuthGuard = void 0;
 | 
				
			||||||
 | 
					const redisCache_service_1 = require("../../modules/redisCache/redisCache.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const passport_1 = require("@nestjs/passport");
 | 
				
			||||||
 | 
					const jwt = require("jsonwebtoken");
 | 
				
			||||||
 | 
					const core_1 = require("@nestjs/core");
 | 
				
			||||||
 | 
					const globalConfig_service_1 = require("../../modules/globalConfig/globalConfig.service");
 | 
				
			||||||
 | 
					const auth_service_1 = require("../../modules/auth/auth.service");
 | 
				
			||||||
 | 
					let JwtAuthGuard = class JwtAuthGuard extends (0, passport_1.AuthGuard)('jwt') {
 | 
				
			||||||
 | 
					    constructor(redisCacheService, moduleRef, globalConfigService, authService) {
 | 
				
			||||||
 | 
					        super();
 | 
				
			||||||
 | 
					        this.redisCacheService = redisCacheService;
 | 
				
			||||||
 | 
					        this.moduleRef = moduleRef;
 | 
				
			||||||
 | 
					        this.globalConfigService = globalConfigService;
 | 
				
			||||||
 | 
					        this.authService = authService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async canActivate(context) {
 | 
				
			||||||
 | 
					        if (!this.redisCacheService) {
 | 
				
			||||||
 | 
					            this.redisCacheService = this.moduleRef.get(redisCache_service_1.RedisCacheService, { strict: false });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const request = context.switchToHttp().getRequest();
 | 
				
			||||||
 | 
					        const domain = request.headers['x-website-domain'];
 | 
				
			||||||
 | 
					        const token = this.extractToken(request);
 | 
				
			||||||
 | 
					        request.user = this.validateToken(token);
 | 
				
			||||||
 | 
					        const auth = this.globalConfigService.getNineAiToken();
 | 
				
			||||||
 | 
					        await this.redisCacheService.checkTokenAuth(token, request);
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    extractToken(request) {
 | 
				
			||||||
 | 
					        if (!request.headers.authorization) {
 | 
				
			||||||
 | 
					            if (request.headers.fingerprint) {
 | 
				
			||||||
 | 
					                let id = request.headers.fingerprint;
 | 
				
			||||||
 | 
					                if (id > 2147483647) {
 | 
				
			||||||
 | 
					                    id = id.toString().slice(-9);
 | 
				
			||||||
 | 
					                    id = Number(String(Number(id)));
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                const token = this.authService.createTokenFromFingerprint(id);
 | 
				
			||||||
 | 
					                return token;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const parts = request.headers.authorization.split(' ');
 | 
				
			||||||
 | 
					        if (parts.length !== 2 || parts[0] !== 'Bearer') {
 | 
				
			||||||
 | 
					            return null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return parts[1];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    validateToken(token) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            return jwt.verify(token, process.env.JWT_SECRET);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (error) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('亲爱的用户,请登录后继续操作,我们正在等您的到来!', common_1.HttpStatus.UNAUTHORIZED);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    handleRequest(err, user, info) {
 | 
				
			||||||
 | 
					        if (err || !user) {
 | 
				
			||||||
 | 
					            console.log('err: ', err);
 | 
				
			||||||
 | 
					            throw err || new common_1.UnauthorizedException();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return user;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					JwtAuthGuard = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [redisCache_service_1.RedisCacheService,
 | 
				
			||||||
 | 
					        core_1.ModuleRef,
 | 
				
			||||||
 | 
					        globalConfig_service_1.GlobalConfigService,
 | 
				
			||||||
 | 
					        auth_service_1.AuthService])
 | 
				
			||||||
 | 
					], JwtAuthGuard);
 | 
				
			||||||
 | 
					exports.JwtAuthGuard = JwtAuthGuard;
 | 
				
			||||||
							
								
								
									
										31
									
								
								dist/common/auth/superAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								dist/common/auth/superAuth.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.SuperAuthGuard = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("./jwtAuth.guard");
 | 
				
			||||||
 | 
					let SuperAuthGuard = class SuperAuthGuard extends jwtAuth_guard_1.JwtAuthGuard {
 | 
				
			||||||
 | 
					    async canActivate(context) {
 | 
				
			||||||
 | 
					        const isAuthorized = await super.canActivate(context);
 | 
				
			||||||
 | 
					        if (!isAuthorized) {
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const request = context.switchToHttp().getRequest();
 | 
				
			||||||
 | 
					        const user = request.user;
 | 
				
			||||||
 | 
					        if (user && user.role === 'super') {
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            throw new common_1.UnauthorizedException('非法操作、非超级管理员无权操作!');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					SuperAuthGuard = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], SuperAuthGuard);
 | 
				
			||||||
 | 
					exports.SuperAuthGuard = SuperAuthGuard;
 | 
				
			||||||
							
								
								
									
										23
									
								
								dist/common/constants/balance.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/common/constants/balance.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.RechargeType = exports.DeductionKey = exports.DeductionType = void 0;
 | 
				
			||||||
 | 
					exports.DeductionType = {
 | 
				
			||||||
 | 
					    BALANCE: 'BALANCE_TYPE',
 | 
				
			||||||
 | 
					    CHAT: 'CHAT_TYPE',
 | 
				
			||||||
 | 
					    PAINT: 'PAINT_TYPE',
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.DeductionKey = {
 | 
				
			||||||
 | 
					    BALANCE_TYPE: 'balance',
 | 
				
			||||||
 | 
					    CHAT_TYPE: 'usesLeft',
 | 
				
			||||||
 | 
					    PAINT_TYPE: 'paintCount',
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.RechargeType = {
 | 
				
			||||||
 | 
					    REG_GIFT: 1,
 | 
				
			||||||
 | 
					    INVITE_GIFT: 2,
 | 
				
			||||||
 | 
					    REFER_GIFT: 3,
 | 
				
			||||||
 | 
					    PACKAGE_GIFT: 4,
 | 
				
			||||||
 | 
					    ADMIN_GIFT: 5,
 | 
				
			||||||
 | 
					    SCAN_PAY: 6,
 | 
				
			||||||
 | 
					    DRAW_FAIL_REFUND: 7,
 | 
				
			||||||
 | 
					    SIGN_IN: 8,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										24
									
								
								dist/common/constants/errorMessage.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								dist/common/constants/errorMessage.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.OpenAiErrorCodeMessage = exports.ErrorMessageEnum = void 0;
 | 
				
			||||||
 | 
					var ErrorMessageEnum;
 | 
				
			||||||
 | 
					(function (ErrorMessageEnum) {
 | 
				
			||||||
 | 
					    ErrorMessageEnum["USERNAME_OR_EMAIL_ALREADY_REGISTERED"] = "\u7528\u6237\u540D\u6216\u90AE\u7BB1\u5DF2\u6CE8\u518C\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["USER_NOT_FOUND"] = "\u7528\u6237\u4E0D\u5B58\u5728\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_NOT_FOUND"] = "\u9A8C\u8BC1\u8BB0\u5F55\u4E0D\u5B58\u5728\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_CODE_EXPIRED"] = "\u9A8C\u8BC1\u7801\u5DF2\u8FC7\u671F\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_CODE_INVALID"] = "\u9A8C\u8BC1\u7801\u65E0\u6548\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_CODE_MISMATCH"] = "\u9A8C\u8BC1\u7801\u4E0D\u5339\u914D\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_CODE_SEND_FAILED"] = "\u9A8C\u8BC1\u7801\u53D1\u9001\u5931\u8D25\uFF01";
 | 
				
			||||||
 | 
					    ErrorMessageEnum["VERIFICATION_CODE_SEND_TOO_OFTEN"] = "\u9A8C\u8BC1\u7801\u53D1\u9001\u8FC7\u4E8E\u9891\u7E41\uFF01";
 | 
				
			||||||
 | 
					})(ErrorMessageEnum = exports.ErrorMessageEnum || (exports.ErrorMessageEnum = {}));
 | 
				
			||||||
 | 
					exports.OpenAiErrorCodeMessage = {
 | 
				
			||||||
 | 
					    400: '[Inter Error] 服务端错误[400]',
 | 
				
			||||||
 | 
					    401: '[Inter Error] 服务出现错误、请稍后再试一次吧[401]',
 | 
				
			||||||
 | 
					    403: '[Inter Error] 服务器拒绝访问,请稍后再试 | Server refused to access, please try again later',
 | 
				
			||||||
 | 
					    429: '[Inter Error] 当前key调用频率过高、请重新对话再试一次吧[429]',
 | 
				
			||||||
 | 
					    502: '[Inter Error] 错误的网关 |  Bad Gateway[502]',
 | 
				
			||||||
 | 
					    503: '[Inter Error] 服务器繁忙,请稍后再试 | Server is busy, please try again later[503]',
 | 
				
			||||||
 | 
					    504: '[Inter Error] 网关超时 | Gateway Time-out[504]',
 | 
				
			||||||
 | 
					    500: '[Inter Error] 服务器繁忙,请稍后再试 | Internal Server Error[500]',
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										21
									
								
								dist/common/constants/midjourney.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								dist/common/constants/midjourney.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.MidjourneyActionEnum = exports.MidjourneyStatusEnum = void 0;
 | 
				
			||||||
 | 
					var MidjourneyStatusEnum;
 | 
				
			||||||
 | 
					(function (MidjourneyStatusEnum) {
 | 
				
			||||||
 | 
					    MidjourneyStatusEnum[MidjourneyStatusEnum["WAITING"] = 1] = "WAITING";
 | 
				
			||||||
 | 
					    MidjourneyStatusEnum[MidjourneyStatusEnum["DRAWING"] = 2] = "DRAWING";
 | 
				
			||||||
 | 
					    MidjourneyStatusEnum[MidjourneyStatusEnum["DRAWED"] = 3] = "DRAWED";
 | 
				
			||||||
 | 
					    MidjourneyStatusEnum[MidjourneyStatusEnum["DRAWFAIL"] = 4] = "DRAWFAIL";
 | 
				
			||||||
 | 
					    MidjourneyStatusEnum[MidjourneyStatusEnum["DRAWTIMEOUT"] = 5] = "DRAWTIMEOUT";
 | 
				
			||||||
 | 
					})(MidjourneyStatusEnum = exports.MidjourneyStatusEnum || (exports.MidjourneyStatusEnum = {}));
 | 
				
			||||||
 | 
					var MidjourneyActionEnum;
 | 
				
			||||||
 | 
					(function (MidjourneyActionEnum) {
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["DRAW"] = 1] = "DRAW";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["UPSCALE"] = 2] = "UPSCALE";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["VARIATION"] = 3] = "VARIATION";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["GENERATE"] = 4] = "GENERATE";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["REGENERATE"] = 5] = "REGENERATE";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["ZOOM"] = 6] = "ZOOM";
 | 
				
			||||||
 | 
					    MidjourneyActionEnum[MidjourneyActionEnum["VARY"] = 7] = "VARY";
 | 
				
			||||||
 | 
					})(MidjourneyActionEnum = exports.MidjourneyActionEnum || (exports.MidjourneyActionEnum = {}));
 | 
				
			||||||
							
								
								
									
										13
									
								
								dist/common/constants/status.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								dist/common/constants/status.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.ModelsMapCn = exports.VerificationUseStatusEnum = void 0;
 | 
				
			||||||
 | 
					var VerificationUseStatusEnum;
 | 
				
			||||||
 | 
					(function (VerificationUseStatusEnum) {
 | 
				
			||||||
 | 
					    VerificationUseStatusEnum[VerificationUseStatusEnum["UNUSED"] = 0] = "UNUSED";
 | 
				
			||||||
 | 
					    VerificationUseStatusEnum[VerificationUseStatusEnum["USED"] = 1] = "USED";
 | 
				
			||||||
 | 
					})(VerificationUseStatusEnum = exports.VerificationUseStatusEnum || (exports.VerificationUseStatusEnum = {}));
 | 
				
			||||||
 | 
					exports.ModelsMapCn = {
 | 
				
			||||||
 | 
					    1: '系统内置大模型',
 | 
				
			||||||
 | 
					    2: '百度千帆大模型',
 | 
				
			||||||
 | 
					    3: '清华智谱大模型'
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										16
									
								
								dist/common/constants/user.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								dist/common/constants/user.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UserStatusErrMsg = exports.UserStatusEnum = void 0;
 | 
				
			||||||
 | 
					var UserStatusEnum;
 | 
				
			||||||
 | 
					(function (UserStatusEnum) {
 | 
				
			||||||
 | 
					    UserStatusEnum[UserStatusEnum["PENDING"] = 0] = "PENDING";
 | 
				
			||||||
 | 
					    UserStatusEnum[UserStatusEnum["ACTIVE"] = 1] = "ACTIVE";
 | 
				
			||||||
 | 
					    UserStatusEnum[UserStatusEnum["LOCKED"] = 2] = "LOCKED";
 | 
				
			||||||
 | 
					    UserStatusEnum[UserStatusEnum["BLACKLISTED"] = 3] = "BLACKLISTED";
 | 
				
			||||||
 | 
					})(UserStatusEnum = exports.UserStatusEnum || (exports.UserStatusEnum = {}));
 | 
				
			||||||
 | 
					exports.UserStatusErrMsg = {
 | 
				
			||||||
 | 
					    [UserStatusEnum.PENDING]: '当前账户未激活,请前往邮箱验证或重新发送验证码!',
 | 
				
			||||||
 | 
					    [UserStatusEnum.ACTIVE]: '当前账户已激活!',
 | 
				
			||||||
 | 
					    [UserStatusEnum.LOCKED]: '当前账户已锁定,请联系管理员解锁!',
 | 
				
			||||||
 | 
					    [UserStatusEnum.BLACKLISTED]: '当前账户已被永久封禁!',
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/common/constants/verification.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/common/constants/verification.constant.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.VerificationEnum = void 0;
 | 
				
			||||||
 | 
					var VerificationEnum;
 | 
				
			||||||
 | 
					(function (VerificationEnum) {
 | 
				
			||||||
 | 
					    VerificationEnum[VerificationEnum["Registration"] = 0] = "Registration";
 | 
				
			||||||
 | 
					    VerificationEnum[VerificationEnum["PasswordReset"] = 1] = "PasswordReset";
 | 
				
			||||||
 | 
					    VerificationEnum[VerificationEnum["ChangeEmail"] = 2] = "ChangeEmail";
 | 
				
			||||||
 | 
					})(VerificationEnum = exports.VerificationEnum || (exports.VerificationEnum = {}));
 | 
				
			||||||
							
								
								
									
										35
									
								
								dist/common/entity/baseEntity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								dist/common/entity/baseEntity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.BaseEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					let BaseEntity = class BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.PrimaryGeneratedColumn)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], BaseEntity.prototype, "id", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.CreateDateColumn)({ type: 'datetime', length: 0, nullable: false, name: 'createdAt', comment: '创建时间' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Date)
 | 
				
			||||||
 | 
					], BaseEntity.prototype, "createdAt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.UpdateDateColumn)({ type: 'datetime', length: 0, nullable: false, name: 'updatedAt', comment: '更新时间' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Date)
 | 
				
			||||||
 | 
					], BaseEntity.prototype, "updatedAt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.DeleteDateColumn)({ type: 'datetime', length: 0, nullable: false, name: 'deletedAt', comment: '删除时间' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Date)
 | 
				
			||||||
 | 
					], BaseEntity.prototype, "deletedAt", void 0);
 | 
				
			||||||
 | 
					BaseEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)()
 | 
				
			||||||
 | 
					], BaseEntity);
 | 
				
			||||||
 | 
					exports.BaseEntity = BaseEntity;
 | 
				
			||||||
							
								
								
									
										29
									
								
								dist/common/filters/allExceptions.filter.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								dist/common/filters/allExceptions.filter.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,29 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AllExceptionsFilter = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const result_1 = require("../result");
 | 
				
			||||||
 | 
					let AllExceptionsFilter = class AllExceptionsFilter {
 | 
				
			||||||
 | 
					    catch(exception, host) {
 | 
				
			||||||
 | 
					        const ctx = host.switchToHttp();
 | 
				
			||||||
 | 
					        const response = ctx.getResponse();
 | 
				
			||||||
 | 
					        const request = ctx.getRequest();
 | 
				
			||||||
 | 
					        const exceptionRes = exception.getResponse() || 'inter server error';
 | 
				
			||||||
 | 
					        const message = (exceptionRes === null || exceptionRes === void 0 ? void 0 : exceptionRes.message) ? (Array.isArray(exceptionRes) ? exceptionRes['message'][0] : exceptionRes['message']) : exceptionRes;
 | 
				
			||||||
 | 
					        const statusCode = exception.getStatus() || 400;
 | 
				
			||||||
 | 
					        const status = exception instanceof common_1.HttpException ? exception.getStatus() : common_1.HttpStatus.INTERNAL_SERVER_ERROR;
 | 
				
			||||||
 | 
					        response.status(status);
 | 
				
			||||||
 | 
					        response.header('Content-Type', 'application/json; charset=utf-8');
 | 
				
			||||||
 | 
					        response.send(result_1.Result.fail(statusCode, Array.isArray(message) ? message[0] : message));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AllExceptionsFilter = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Catch)()
 | 
				
			||||||
 | 
					], AllExceptionsFilter);
 | 
				
			||||||
 | 
					exports.AllExceptionsFilter = AllExceptionsFilter;
 | 
				
			||||||
							
								
								
									
										34
									
								
								dist/common/filters/typeOrmQueryFailed.filter.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								dist/common/filters/typeOrmQueryFailed.filter.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.TypeOrmQueryFailedFilter = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					let TypeOrmQueryFailedFilter = class TypeOrmQueryFailedFilter {
 | 
				
			||||||
 | 
					    catch(exception, host) {
 | 
				
			||||||
 | 
					        const ctx = host.switchToHttp();
 | 
				
			||||||
 | 
					        const response = ctx.getResponse();
 | 
				
			||||||
 | 
					        const request = ctx.getRequest();
 | 
				
			||||||
 | 
					        if (exception.code === 'ER_DUP_ENTRY') {
 | 
				
			||||||
 | 
					            throw new common_1.BadRequestException('该记录已经存在,请勿重复添加!');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            console.log('other query error');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        response.status(500).json({
 | 
				
			||||||
 | 
					            statusCode: 500,
 | 
				
			||||||
 | 
					            timestamp: new Date().toISOString(),
 | 
				
			||||||
 | 
					            path: request.url,
 | 
				
			||||||
 | 
					            message: `Database query failed: ${exception.message}`,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					TypeOrmQueryFailedFilter = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Catch)(typeorm_1.QueryFailedError)
 | 
				
			||||||
 | 
					], TypeOrmQueryFailedFilter);
 | 
				
			||||||
 | 
					exports.TypeOrmQueryFailedFilter = TypeOrmQueryFailedFilter;
 | 
				
			||||||
							
								
								
									
										19
									
								
								dist/common/guards/roles/roles.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								dist/common/guards/roles/roles.guard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.RolesGuard = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					let RolesGuard = class RolesGuard {
 | 
				
			||||||
 | 
					    canActivate(context) {
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					RolesGuard = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], RolesGuard);
 | 
				
			||||||
 | 
					exports.RolesGuard = RolesGuard;
 | 
				
			||||||
							
								
								
									
										23
									
								
								dist/common/interceptors/abort.interceptor.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/common/interceptors/abort.interceptor.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AbortInterceptor = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const abort_controller_1 = require("abort-controller");
 | 
				
			||||||
 | 
					let AbortInterceptor = class AbortInterceptor {
 | 
				
			||||||
 | 
					    intercept(context, next) {
 | 
				
			||||||
 | 
					        const request = context.switchToHttp().getRequest();
 | 
				
			||||||
 | 
					        const abortController = new abort_controller_1.AbortController();
 | 
				
			||||||
 | 
					        request.abortController = abortController;
 | 
				
			||||||
 | 
					        return next.handle();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AbortInterceptor = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], AbortInterceptor);
 | 
				
			||||||
 | 
					exports.AbortInterceptor = AbortInterceptor;
 | 
				
			||||||
							
								
								
									
										35
									
								
								dist/common/interceptors/transform.interceptor.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								dist/common/interceptors/transform.interceptor.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.TransformInterceptor = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const rxjs_1 = require("rxjs");
 | 
				
			||||||
 | 
					const operators_1 = require("rxjs/operators");
 | 
				
			||||||
 | 
					const result_1 = require("../result");
 | 
				
			||||||
 | 
					let TransformInterceptor = class TransformInterceptor {
 | 
				
			||||||
 | 
					    intercept(context, next) {
 | 
				
			||||||
 | 
					        return next.handle().pipe((0, operators_1.map)((data) => {
 | 
				
			||||||
 | 
					            const response = context.switchToHttp().getResponse();
 | 
				
			||||||
 | 
					            const request = context.switchToHttp().getRequest();
 | 
				
			||||||
 | 
					            response.statusCode = 200;
 | 
				
			||||||
 | 
					            if (request.path.includes('notify')) {
 | 
				
			||||||
 | 
					                return data;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            const message = response.status < 400 ? null : response.statusText;
 | 
				
			||||||
 | 
					            return result_1.Result.success(data, message);
 | 
				
			||||||
 | 
					        }), (0, rxjs_1.catchError)((error) => {
 | 
				
			||||||
 | 
					            const statusCode = error.status || 500;
 | 
				
			||||||
 | 
					            const message = (error.response || 'Internal server error');
 | 
				
			||||||
 | 
					            return (0, rxjs_1.throwError)(new common_1.HttpException(message, statusCode));
 | 
				
			||||||
 | 
					        }));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					TransformInterceptor = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], TransformInterceptor);
 | 
				
			||||||
 | 
					exports.TransformInterceptor = TransformInterceptor;
 | 
				
			||||||
							
								
								
									
										23
									
								
								dist/common/middleware/xml.middleware.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/common/middleware/xml.middleware.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.XMLMiddleware = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const bodyParser = require("body-parser");
 | 
				
			||||||
 | 
					const bodyParserMiddleware = bodyParser.text({
 | 
				
			||||||
 | 
					    type: 'application/xml',
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					let XMLMiddleware = class XMLMiddleware {
 | 
				
			||||||
 | 
					    use(req, res, next) {
 | 
				
			||||||
 | 
					        bodyParserMiddleware(req, res, next);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					XMLMiddleware = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)()
 | 
				
			||||||
 | 
					], XMLMiddleware);
 | 
				
			||||||
 | 
					exports.XMLMiddleware = XMLMiddleware;
 | 
				
			||||||
							
								
								
									
										18
									
								
								dist/common/result/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								dist/common/result/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.Result = void 0;
 | 
				
			||||||
 | 
					class Result {
 | 
				
			||||||
 | 
					    constructor(code, success, data, message) {
 | 
				
			||||||
 | 
					        this.code = code;
 | 
				
			||||||
 | 
					        this.data = data;
 | 
				
			||||||
 | 
					        this.success = success;
 | 
				
			||||||
 | 
					        this.message = message;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    static success(data, message = '请求成功') {
 | 
				
			||||||
 | 
					        return new Result(200, true, data, message);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    static fail(code, message = '请求失败', data) {
 | 
				
			||||||
 | 
					        return new Result(code, false, data, message);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.Result = Result;
 | 
				
			||||||
							
								
								
									
										15
									
								
								dist/common/swagger/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								dist/common/swagger/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.createSwagger = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const swaggerOptions = new swagger_1.DocumentBuilder()
 | 
				
			||||||
 | 
					    .setTitle('Nine Team api document')
 | 
				
			||||||
 | 
					    .setDescription('Nine Team api document')
 | 
				
			||||||
 | 
					    .setVersion('1.0.0')
 | 
				
			||||||
 | 
					    .addBearerAuth()
 | 
				
			||||||
 | 
					    .build();
 | 
				
			||||||
 | 
					function createSwagger(app) {
 | 
				
			||||||
 | 
					    const document = swagger_1.SwaggerModule.createDocument(app, swaggerOptions);
 | 
				
			||||||
 | 
					    swagger_1.SwaggerModule.setup('/nineai/swagger/docs', app, document);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.createSwagger = createSwagger;
 | 
				
			||||||
							
								
								
									
										26
									
								
								dist/common/utils/base.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								dist/common/utils/base.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.decrypt = exports.encrypt = void 0;
 | 
				
			||||||
 | 
					const crypto = require("crypto");
 | 
				
			||||||
 | 
					const encryptionKey = 'bf3c116f2470cb4che9071240917c171';
 | 
				
			||||||
 | 
					const initializationVector = '518363fh72eec1v4';
 | 
				
			||||||
 | 
					const algorithm = 'aes-256-cbc';
 | 
				
			||||||
 | 
					function encrypt(text) {
 | 
				
			||||||
 | 
					    const cipher = crypto.createCipheriv(algorithm, encryptionKey, initializationVector);
 | 
				
			||||||
 | 
					    let encrypted = cipher.update(text, 'utf8', 'base64');
 | 
				
			||||||
 | 
					    encrypted += cipher.final('base64');
 | 
				
			||||||
 | 
					    return encrypted;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.encrypt = encrypt;
 | 
				
			||||||
 | 
					function decrypt(text) {
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        const decipher = crypto.createDecipheriv(algorithm, encryptionKey, initializationVector);
 | 
				
			||||||
 | 
					        let decrypted = decipher.update(text, 'base64', 'utf8');
 | 
				
			||||||
 | 
					        decrypted += decipher.final('utf8');
 | 
				
			||||||
 | 
					        return decrypted;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    catch (error) {
 | 
				
			||||||
 | 
					        process.exit(1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.decrypt = decrypt;
 | 
				
			||||||
							
								
								
									
										27
									
								
								dist/common/utils/compileNetwork.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								dist/common/utils/compileNetwork.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.compileNetwork = void 0;
 | 
				
			||||||
 | 
					const axios_1 = require("axios");
 | 
				
			||||||
 | 
					function formatSearchData(searchData, question) {
 | 
				
			||||||
 | 
					    const formatStr = searchData.map(({ title, body, href }) => `'${title}' : ${body} ;`).join('\n\n');
 | 
				
			||||||
 | 
					    const instructions = 'Instructions: Reply to me in the language of my request or question above. Give a comprehensive answer to the question or request I have made above. Below are some results from a web search. Use the following results to summarize the answers \n\n';
 | 
				
			||||||
 | 
					    return `${question}\n\n${instructions}\n${formatStr}`;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					async function compileNetwork(question, limit = 7) {
 | 
				
			||||||
 | 
					    let searchData = [];
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        const responseData = await axios_1.default.get(`https://s0.awsl.app/search?q=${question}&max_results=${limit}`);
 | 
				
			||||||
 | 
					        searchData = responseData.data;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    catch (error) {
 | 
				
			||||||
 | 
					        console.log('error: ', error);
 | 
				
			||||||
 | 
					        searchData = [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (searchData.length === 0) {
 | 
				
			||||||
 | 
					        return question;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        return formatSearchData(searchData, question);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.compileNetwork = compileNetwork;
 | 
				
			||||||
							
								
								
									
										8
									
								
								dist/common/utils/createOrderId.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								dist/common/utils/createOrderId.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.createOrderId = void 0;
 | 
				
			||||||
 | 
					const uuid_1 = require("uuid");
 | 
				
			||||||
 | 
					function createOrderId() {
 | 
				
			||||||
 | 
					    return (0, uuid_1.v1)().toString().replace(/-/g, '');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.createOrderId = createOrderId;
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/common/utils/createRandomCode.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/common/utils/createRandomCode.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.createRandomCode = void 0;
 | 
				
			||||||
 | 
					function createRandomCode() {
 | 
				
			||||||
 | 
					    const min = 100000;
 | 
				
			||||||
 | 
					    const max = 999999;
 | 
				
			||||||
 | 
					    return Math.floor(Math.random() * (max - min + 1) + min);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.createRandomCode = createRandomCode;
 | 
				
			||||||
							
								
								
									
										14
									
								
								dist/common/utils/createRandomInviteCode.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								dist/common/utils/createRandomInviteCode.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.generateRandomString = void 0;
 | 
				
			||||||
 | 
					function generateRandomString() {
 | 
				
			||||||
 | 
					    const length = 10;
 | 
				
			||||||
 | 
					    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
 | 
				
			||||||
 | 
					    let result = '';
 | 
				
			||||||
 | 
					    for (let i = 0; i < length; i++) {
 | 
				
			||||||
 | 
					        const randomIndex = Math.floor(Math.random() * characters.length);
 | 
				
			||||||
 | 
					        result += characters.charAt(randomIndex);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return result;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.generateRandomString = generateRandomString;
 | 
				
			||||||
							
								
								
									
										12
									
								
								dist/common/utils/createRandomNonceStr.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								dist/common/utils/createRandomNonceStr.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.createRandomNonceStr = void 0;
 | 
				
			||||||
 | 
					function createRandomNonceStr(len) {
 | 
				
			||||||
 | 
					    const data = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
 | 
				
			||||||
 | 
					    let str = '';
 | 
				
			||||||
 | 
					    for (let i = 0; i < len; i++) {
 | 
				
			||||||
 | 
					        str += data.charAt(parseInt((Math.random() * data.length).toFixed(0), 10));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return str;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.createRandomNonceStr = createRandomNonceStr;
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/common/utils/createRandomUid.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/common/utils/createRandomUid.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.createRandomUid = void 0;
 | 
				
			||||||
 | 
					const guid_typescript_1 = require("guid-typescript");
 | 
				
			||||||
 | 
					function createRandomUid() {
 | 
				
			||||||
 | 
					    const uuid = guid_typescript_1.Guid.create();
 | 
				
			||||||
 | 
					    return uuid.toString().substr(0, 10).replace('-', '');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.createRandomUid = createRandomUid;
 | 
				
			||||||
							
								
								
									
										43
									
								
								dist/common/utils/date.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								dist/common/utils/date.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.isExpired = exports.formatCreateOrUpdateDate = exports.formatDate = void 0;
 | 
				
			||||||
 | 
					const dayjs = require("dayjs");
 | 
				
			||||||
 | 
					require("dayjs/locale/zh-cn");
 | 
				
			||||||
 | 
					const a = require("dayjs/plugin/utc");
 | 
				
			||||||
 | 
					const b = require("dayjs/plugin/timezone");
 | 
				
			||||||
 | 
					dayjs.locale('zh-cn');
 | 
				
			||||||
 | 
					dayjs.extend(a);
 | 
				
			||||||
 | 
					dayjs.extend(b);
 | 
				
			||||||
 | 
					dayjs.tz.setDefault('Asia/Shanghai');
 | 
				
			||||||
 | 
					function formatDate(date, format = 'YYYY-MM-DD HH:mm:ss') {
 | 
				
			||||||
 | 
					    return dayjs(date).format(format);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.formatDate = formatDate;
 | 
				
			||||||
 | 
					function formatCreateOrUpdateDate(input, format = 'YYYY-MM-DD HH:mm:ss') {
 | 
				
			||||||
 | 
					    if (Array.isArray(input)) {
 | 
				
			||||||
 | 
					        return input.map((t) => {
 | 
				
			||||||
 | 
					            t.createdAt = (t === null || t === void 0 ? void 0 : t.createdAt) ? dayjs(t.createdAt).format(format) : dayjs().format(format);
 | 
				
			||||||
 | 
					            t.updatedAt = (t === null || t === void 0 ? void 0 : t.updatedAt) ? dayjs(t.updatedAt).format(format) : dayjs().format(format);
 | 
				
			||||||
 | 
					            return t;
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else {
 | 
				
			||||||
 | 
					        let obj = {};
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            obj = JSON.parse(JSON.stringify(input));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (error) {
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        (obj === null || obj === void 0 ? void 0 : obj.createdAt) && (obj.createdAt = dayjs(obj.createdAt).format(format));
 | 
				
			||||||
 | 
					        (obj === null || obj === void 0 ? void 0 : obj.updatedAt) && (obj.updatedAt = dayjs(obj.updatedAt).format(format));
 | 
				
			||||||
 | 
					        return obj;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.formatCreateOrUpdateDate = formatCreateOrUpdateDate;
 | 
				
			||||||
 | 
					function isExpired(createdAt, days) {
 | 
				
			||||||
 | 
					    const expireDate = new Date(createdAt.getTime() + days * 24 * 60 * 60 * 1000);
 | 
				
			||||||
 | 
					    const now = new Date();
 | 
				
			||||||
 | 
					    return now > expireDate;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.isExpired = isExpired;
 | 
				
			||||||
 | 
					exports.default = dayjs;
 | 
				
			||||||
							
								
								
									
										14
									
								
								dist/common/utils/encrypt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								dist/common/utils/encrypt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.copyRightMsg = exports.atob = void 0;
 | 
				
			||||||
 | 
					function atob(str) {
 | 
				
			||||||
 | 
					    return Buffer.from(str, 'base64').toString('utf-8');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.atob = atob;
 | 
				
			||||||
 | 
					exports.copyRightMsg = [
 | 
				
			||||||
 | 
					    'agxoTstMY8m+DJO89Iwy4zqcFTqlcj/Fa/erMTvn0IexetXaDttr4K/BN2+RbtfouXOeFjPDYnxOfQ+IIpuJ3PmtyHAzmlGFls/HvBDeh6EXAQ3waALbvK9Ue96soAb5/3Tv6VuZE7npISqXiYhI6Vqx4yDVYf6vUUkEO9jvVotWQkLOLkr6M/guLK6sik/ZOgHvSlDYKAv79NFJJ0Tt0WkH2SyN8l+woMiWVTOKkdE=',
 | 
				
			||||||
 | 
					    'nXdXi8UU7J5av2eDOFjxQWlZDa+3bdASE4UwpqT6B11XSCweKKuzHxmFO2wx45iVlib/V0tt+NbEcOQZtzEWKqHsREkwEb5aqVCUl2Kj4nJeEFId2iyvY6MWEV1lHtCY+htpJoyqwQJc7yeNfpTl2SLBubWk77p4AHei1QFEs1rpOOwyE79lF0RqzY/Cpzhs',
 | 
				
			||||||
 | 
					    'VjVCGib1VFp7hNynpKGQPUrX+ishpxi2u5a4txHXzk2nyUP1NZfIomEDmGhDTQ7VRJLox+8urtVG1CBBSct1v+4OA2ucAcDUFoy1H1Kl1z+dndVcNU6gz5YGnDppsxY8uGFAVGsWrDl2DIOKxk7kMURaRiQCXCHRF/3sLGyIEmE6KL9Q4kDInB6vuzBScxupFShMXTq2XrOhwRgn2elcig==',
 | 
				
			||||||
 | 
					    'ZPcz1IaPDMGI3Yn9sm4QOT0qCZo7yZbJl4/c2RTrhUKINkjGB5yb0yN5vAnLtt/o8cmpoOoH3PUSOOWQa9aKD86NWK+1r8wBOVjwXZOpp2gbB1ZJLbWvjRbENvEJxVsLROXnpNDqUXVGxFMaIt+gmEi3Rp0thqC1soXUpvM1zqU4+LkQmunR7UytvzwXEmXBlIfPwz5hv+n/lxDsw526KWixC3jLLpeijw5433Zh7cI=',
 | 
				
			||||||
 | 
					    'YPo1HNzS6p6190ku4f1PQENUBa/ip+v+6sPuQXVyAn3axo6SLKQBszNr3PAW2EzWhZLy2o+nBgr3o3IOy9OgNit1JHrCklpVp172wbGDKh8sB8HCXyJoRv3BaZVY5UhyhpV5K+4nPoM2RUwvIGONUGFPQfPQv9N8MS8UCL7UnWYcVLzxWo0ZDg+UXFRr7NhXKu7KQ7e1+Wiqm0qE+olfDVowi4pGDRGrYL154wEEJUo='
 | 
				
			||||||
 | 
					];
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/common/utils/generateCrami.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/common/utils/generateCrami.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.generateCramiCode = void 0;
 | 
				
			||||||
 | 
					const uuid_1 = require("uuid");
 | 
				
			||||||
 | 
					function generateCramiCode() {
 | 
				
			||||||
 | 
					    const code = (0, uuid_1.v4)().replace(/-/g, '').slice(0, 16);
 | 
				
			||||||
 | 
					    return code;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.generateCramiCode = generateCramiCode;
 | 
				
			||||||
							
								
								
									
										43
									
								
								dist/common/utils/getClientIp.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								dist/common/utils/getClientIp.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.getClientIp = void 0;
 | 
				
			||||||
 | 
					function getClientIp(request) {
 | 
				
			||||||
 | 
					    let ipAddress = '';
 | 
				
			||||||
 | 
					    const headerList = [
 | 
				
			||||||
 | 
					        'X-Client-IP',
 | 
				
			||||||
 | 
					        'X-Real-IP',
 | 
				
			||||||
 | 
					        'X-Forwarded-For',
 | 
				
			||||||
 | 
					        'CF-Connecting-IP',
 | 
				
			||||||
 | 
					        'True-Client-IP',
 | 
				
			||||||
 | 
					        'X-Cluster-Client-IP',
 | 
				
			||||||
 | 
					        'Proxy-Client-IP',
 | 
				
			||||||
 | 
					        'WL-Proxy-Client-IP',
 | 
				
			||||||
 | 
					        'HTTP_CLIENT_IP',
 | 
				
			||||||
 | 
					        'HTTP_X_FORWARDED_FOR',
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
 | 
					    for (const header of headerList) {
 | 
				
			||||||
 | 
					        const value = request.headers[header];
 | 
				
			||||||
 | 
					        if (value && typeof value === 'string') {
 | 
				
			||||||
 | 
					            const ips = value.split(',');
 | 
				
			||||||
 | 
					            ipAddress = ips[0].trim();
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (!ipAddress) {
 | 
				
			||||||
 | 
					        ipAddress = request.connection.remoteAddress || '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (ipAddress && ipAddress.includes('::')) {
 | 
				
			||||||
 | 
					        const isLocal = /^(::1|fe80(:1)?::1(%.*)?)$/i.test(ipAddress);
 | 
				
			||||||
 | 
					        if (isLocal) {
 | 
				
			||||||
 | 
					            ipAddress = '';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else if (ipAddress.includes('::ffff:')) {
 | 
				
			||||||
 | 
					            ipAddress = ipAddress.split(':').pop() || '';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (!ipAddress || !/\d+\.\d+\.\d+\.\d+/.test(ipAddress)) {
 | 
				
			||||||
 | 
					        ipAddress = '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return ipAddress;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getClientIp = getClientIp;
 | 
				
			||||||
							
								
								
									
										15
									
								
								dist/common/utils/getDiffArray.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								dist/common/utils/getDiffArray.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.getDiffArray = void 0;
 | 
				
			||||||
 | 
					function getDiffArray(aLength, bLength, str) {
 | 
				
			||||||
 | 
					    const a = Array.from({ length: aLength }, (_, i) => i + 1);
 | 
				
			||||||
 | 
					    const b = Array.from({ length: bLength }, (_, i) => i + 1);
 | 
				
			||||||
 | 
					    const diffArray = [];
 | 
				
			||||||
 | 
					    for (let i = 0; i < a.length; i++) {
 | 
				
			||||||
 | 
					        if (!b.includes(a[i])) {
 | 
				
			||||||
 | 
					            diffArray.push(`${str}${a[i]}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return diffArray;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getDiffArray = getDiffArray;
 | 
				
			||||||
							
								
								
									
										8
									
								
								dist/common/utils/getRandomItem.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								dist/common/utils/getRandomItem.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.getRandomItem = void 0;
 | 
				
			||||||
 | 
					function getRandomItem(array) {
 | 
				
			||||||
 | 
					    const randomIndex = Math.floor(Math.random() * array.length);
 | 
				
			||||||
 | 
					    return array[randomIndex];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getRandomItem = getRandomItem;
 | 
				
			||||||
							
								
								
									
										11
									
								
								dist/common/utils/getRandomItemFromArray.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dist/common/utils/getRandomItemFromArray.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.getRandomItemFromArray = void 0;
 | 
				
			||||||
 | 
					function getRandomItemFromArray(array) {
 | 
				
			||||||
 | 
					    if (array.length === 0) {
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const randomIndex = Math.floor(Math.random() * array.length);
 | 
				
			||||||
 | 
					    return array[randomIndex];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.getRandomItemFromArray = getRandomItemFromArray;
 | 
				
			||||||
							
								
								
									
										14
									
								
								dist/common/utils/hideString.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								dist/common/utils/hideString.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.hideString = void 0;
 | 
				
			||||||
 | 
					function hideString(input, str) {
 | 
				
			||||||
 | 
					    const length = input.length;
 | 
				
			||||||
 | 
					    const start = input.slice(0, (length - 10) / 2);
 | 
				
			||||||
 | 
					    const end = input.slice((length + 10) / 2, length);
 | 
				
			||||||
 | 
					    const hidden = '*'.repeat(10);
 | 
				
			||||||
 | 
					    if (str) {
 | 
				
			||||||
 | 
					        return `**********${str}**********`;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return `${start}${hidden}${end}`;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.hideString = hideString;
 | 
				
			||||||
							
								
								
									
										38
									
								
								dist/common/utils/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								dist/common/utils/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
 | 
				
			||||||
 | 
					    if (k2 === undefined) k2 = k;
 | 
				
			||||||
 | 
					    var desc = Object.getOwnPropertyDescriptor(m, k);
 | 
				
			||||||
 | 
					    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
 | 
				
			||||||
 | 
					      desc = { enumerable: true, get: function() { return m[k]; } };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    Object.defineProperty(o, k2, desc);
 | 
				
			||||||
 | 
					}) : (function(o, m, k, k2) {
 | 
				
			||||||
 | 
					    if (k2 === undefined) k2 = k;
 | 
				
			||||||
 | 
					    o[k2] = m[k];
 | 
				
			||||||
 | 
					}));
 | 
				
			||||||
 | 
					var __exportStar = (this && this.__exportStar) || function(m, exports) {
 | 
				
			||||||
 | 
					    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					__exportStar(require("./date"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./createRandomCode"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./tools"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./createRandomInviteCode"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./maskEmail"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./createRandomUid"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./generateCrami"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./base"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./hideString"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./getDiffArray"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./getRandomItem"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./getClientIp"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./maskIpAddress"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./maskCrami"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./selectKeyWithWeight"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./createOrderId"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./createRandomNonceStr"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./utcformatTime"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./removeSpecialCharacters"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./encrypt"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./compileNetwork"), exports);
 | 
				
			||||||
 | 
					__exportStar(require("./getRandomItemFromArray"), exports);
 | 
				
			||||||
							
								
								
									
										11
									
								
								dist/common/utils/maskCrami.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dist/common/utils/maskCrami.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.maskCrami = void 0;
 | 
				
			||||||
 | 
					function maskCrami(str) {
 | 
				
			||||||
 | 
					    if (str.length !== 16) {
 | 
				
			||||||
 | 
					        throw new Error('Invalid input');
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const masked = str.substring(0, 6) + '****' + str.substring(10);
 | 
				
			||||||
 | 
					    return masked;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.maskCrami = maskCrami;
 | 
				
			||||||
							
								
								
									
										16
									
								
								dist/common/utils/maskEmail.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								dist/common/utils/maskEmail.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.maskEmail = void 0;
 | 
				
			||||||
 | 
					function maskEmail(email) {
 | 
				
			||||||
 | 
					    if (!email)
 | 
				
			||||||
 | 
					        return '';
 | 
				
			||||||
 | 
					    const atIndex = email.indexOf('@');
 | 
				
			||||||
 | 
					    if (atIndex <= 1) {
 | 
				
			||||||
 | 
					        return email;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    const firstPart = email.substring(0, atIndex - 1);
 | 
				
			||||||
 | 
					    const lastPart = email.substring(atIndex);
 | 
				
			||||||
 | 
					    const maskedPart = '*'.repeat(firstPart.length - 1);
 | 
				
			||||||
 | 
					    return `${firstPart.charAt(0)}${maskedPart}${email.charAt(atIndex - 1)}${lastPart}`;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.maskEmail = maskEmail;
 | 
				
			||||||
							
								
								
									
										11
									
								
								dist/common/utils/maskIpAddress.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dist/common/utils/maskIpAddress.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.maskIpAddress = void 0;
 | 
				
			||||||
 | 
					function maskIpAddress(ipAddress) {
 | 
				
			||||||
 | 
					    if (!ipAddress)
 | 
				
			||||||
 | 
					        return '';
 | 
				
			||||||
 | 
					    const ipArray = ipAddress.split('.');
 | 
				
			||||||
 | 
					    ipArray[2] = '***';
 | 
				
			||||||
 | 
					    return ipArray.join('.');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.maskIpAddress = maskIpAddress;
 | 
				
			||||||
							
								
								
									
										7
									
								
								dist/common/utils/removeSpecialCharacters.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								dist/common/utils/removeSpecialCharacters.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.removeSpecialCharacters = void 0;
 | 
				
			||||||
 | 
					function removeSpecialCharacters(inputString) {
 | 
				
			||||||
 | 
					    return inputString.replace(/[^\w\s-]/g, '');
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.removeSpecialCharacters = removeSpecialCharacters;
 | 
				
			||||||
							
								
								
									
										17
									
								
								dist/common/utils/selectKeyWithWeight.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								dist/common/utils/selectKeyWithWeight.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.selectKeyWithWeight = void 0;
 | 
				
			||||||
 | 
					function selectKeyWithWeight(data) {
 | 
				
			||||||
 | 
					    if (data.length === 0)
 | 
				
			||||||
 | 
					        return undefined;
 | 
				
			||||||
 | 
					    const totalWeight = data.reduce((sum, item) => sum + item.weight, 0);
 | 
				
			||||||
 | 
					    let randomWeight = Math.random() * totalWeight;
 | 
				
			||||||
 | 
					    for (const item of data) {
 | 
				
			||||||
 | 
					        randomWeight -= item.weight;
 | 
				
			||||||
 | 
					        if (randomWeight < 0) {
 | 
				
			||||||
 | 
					            return item;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return data[data.length - 1];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.selectKeyWithWeight = selectKeyWithWeight;
 | 
				
			||||||
							
								
								
									
										8
									
								
								dist/common/utils/tools.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								dist/common/utils/tools.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.importDynamic = exports.isNotEmptyString = void 0;
 | 
				
			||||||
 | 
					function isNotEmptyString(value) {
 | 
				
			||||||
 | 
					    return typeof value === 'string' && value.length > 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.isNotEmptyString = isNotEmptyString;
 | 
				
			||||||
 | 
					exports.importDynamic = new Function('modulePath', 'return import(modulePath)');
 | 
				
			||||||
							
								
								
									
										16
									
								
								dist/common/utils/utcformatTime.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								dist/common/utils/utcformatTime.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.utcToShanghaiTime = void 0;
 | 
				
			||||||
 | 
					function utcToShanghaiTime(utcTime, format = 'YYYY/MM/DD hh:mm:ss') {
 | 
				
			||||||
 | 
					    const date = new Date(utcTime);
 | 
				
			||||||
 | 
					    const shanghaiTime = date.getTime() + 8 * 60 * 60 * 1000;
 | 
				
			||||||
 | 
					    const shanghaiDate = new Date(shanghaiTime);
 | 
				
			||||||
 | 
					    let result = format.replace('YYYY', shanghaiDate.getFullYear().toString());
 | 
				
			||||||
 | 
					    result = result.replace('MM', `0${shanghaiDate.getMonth() + 1}`.slice(-2));
 | 
				
			||||||
 | 
					    result = result.replace('DD', `0${shanghaiDate.getDate()}`.slice(-2));
 | 
				
			||||||
 | 
					    result = result.replace('hh', `0${shanghaiDate.getHours()}`.slice(-2));
 | 
				
			||||||
 | 
					    result = result.replace('mm', `0${shanghaiDate.getMinutes()}`.slice(-2));
 | 
				
			||||||
 | 
					    result = result.replace('ss', `0${shanghaiDate.getSeconds()}`.slice(-2));
 | 
				
			||||||
 | 
					    return result;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					exports.utcToShanghaiTime = utcToShanghaiTime;
 | 
				
			||||||
							
								
								
									
										11
									
								
								dist/config/cos.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dist/config/cos.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const Dotenv = require("dotenv");
 | 
				
			||||||
 | 
					Dotenv.config({ path: '.env' });
 | 
				
			||||||
 | 
					const config = {
 | 
				
			||||||
 | 
					    SecretId: process.env.TENTCENT_SECRET_ID,
 | 
				
			||||||
 | 
					    SecretKey: process.env.TENTCENT_SECRET_KEY,
 | 
				
			||||||
 | 
					    Bucket: process.env.COS_BUCKET_PUBLIC,
 | 
				
			||||||
 | 
					    Region: process.env.COS_REGION,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.default = config;
 | 
				
			||||||
							
								
								
									
										16
									
								
								dist/config/database.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								dist/config/database.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const config = {
 | 
				
			||||||
 | 
					    type: 'mysql',
 | 
				
			||||||
 | 
					    port: parseInt(process.env.DB_PORT),
 | 
				
			||||||
 | 
					    host: process.env.DB_HOST,
 | 
				
			||||||
 | 
					    username: process.env.DB_USER,
 | 
				
			||||||
 | 
					    password: process.env.DB_PASS,
 | 
				
			||||||
 | 
					    database: process.env.DB_DATABASE,
 | 
				
			||||||
 | 
					    entities: [__dirname + '/../**/*.entity{.ts,.js}'],
 | 
				
			||||||
 | 
					    logging: false,
 | 
				
			||||||
 | 
					    synchronize: true,
 | 
				
			||||||
 | 
					    charset: 'utf8mb4',
 | 
				
			||||||
 | 
					    timezone: '+08:00',
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.default = config;
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/config/jwt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/config/jwt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const config = {
 | 
				
			||||||
 | 
					    secret: process.env.JWT_SECRET,
 | 
				
			||||||
 | 
					    signOptions: {
 | 
				
			||||||
 | 
					        expiresIn: process.env.JWT_EXPIRESIN || '7d',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.default = config;
 | 
				
			||||||
							
								
								
									
										24
									
								
								dist/config/mailer.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								dist/config/mailer.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
 | 
				
			||||||
 | 
					const mailConfig = {
 | 
				
			||||||
 | 
					    transport: {
 | 
				
			||||||
 | 
					        host: process.env.MAILER_HOST || 'smtpdm.aliyun.com',
 | 
				
			||||||
 | 
					        port: process.env.MAILER_PORT || '80',
 | 
				
			||||||
 | 
					        auth: {
 | 
				
			||||||
 | 
					            user: process.env.MAILER_USER,
 | 
				
			||||||
 | 
					            pass: process.env.MAILER_PASS,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    defaults: {
 | 
				
			||||||
 | 
					        from: process.env.MAILER_FROM,
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    template: {
 | 
				
			||||||
 | 
					        dir: 'templates/mail',
 | 
				
			||||||
 | 
					        adapter: new handlebars_adapter_1.HandlebarsAdapter(),
 | 
				
			||||||
 | 
					        options: {
 | 
				
			||||||
 | 
					            strict: true,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.default = mailConfig;
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/config/main.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/config/main.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.APIPREFIX = exports.SWAGGERPREFIX = exports.PORT = void 0;
 | 
				
			||||||
 | 
					const PORT = process.env.PORT || 3000;
 | 
				
			||||||
 | 
					exports.PORT = PORT;
 | 
				
			||||||
 | 
					const SWAGGERPREFIX = process.env.SWAGGERPREFIX || '/docs';
 | 
				
			||||||
 | 
					exports.SWAGGERPREFIX = SWAGGERPREFIX;
 | 
				
			||||||
 | 
					const APIPREFIX = process.env.APIPREFIX || '/api';
 | 
				
			||||||
 | 
					exports.APIPREFIX = APIPREFIX;
 | 
				
			||||||
							
								
								
									
										9
									
								
								dist/config/redis.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/config/redis.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const config = {
 | 
				
			||||||
 | 
					    port: parseInt(process.env.REDIS_PORT),
 | 
				
			||||||
 | 
					    host: process.env.REDIS_HOST,
 | 
				
			||||||
 | 
					    password: process.env.REDIS_PASSWORD,
 | 
				
			||||||
 | 
					    username: process.env.REDIS_USER,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					exports.default = config;
 | 
				
			||||||
							
								
								
									
										2
									
								
								dist/interfaces/mail.interface.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								dist/interfaces/mail.interface.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/main.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/main.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					const Dotenv = require("dotenv");
 | 
				
			||||||
 | 
					Dotenv.config({ path: '.env' });
 | 
				
			||||||
 | 
					const core_1 = require("@nestjs/core");
 | 
				
			||||||
 | 
					const app_module_1 = require("./app.module");
 | 
				
			||||||
 | 
					const swagger_1 = require("./common/swagger");
 | 
				
			||||||
 | 
					const allExceptions_filter_1 = require("./common/filters/allExceptions.filter");
 | 
				
			||||||
 | 
					const typeOrmQueryFailed_filter_1 = require("./common/filters/typeOrmQueryFailed.filter");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const transform_interceptor_1 = require("./common/interceptors/transform.interceptor");
 | 
				
			||||||
 | 
					const main_1 = require("./config/main");
 | 
				
			||||||
 | 
					const initDatabase_1 = require("./modules/database/initDatabase");
 | 
				
			||||||
 | 
					const compression = require("compression");
 | 
				
			||||||
 | 
					const xmlBodyParser = require("express-xml-bodyparser");
 | 
				
			||||||
 | 
					const path_1 = require("path");
 | 
				
			||||||
 | 
					async function bootstrap() {
 | 
				
			||||||
 | 
					    await (0, initDatabase_1.initDatabase)();
 | 
				
			||||||
 | 
					    const app = await core_1.NestFactory.create(app_module_1.AppModule);
 | 
				
			||||||
 | 
					    app.use(compression());
 | 
				
			||||||
 | 
					    const www = (0, path_1.resolve)(__dirname, './public');
 | 
				
			||||||
 | 
					    app.use(xmlBodyParser());
 | 
				
			||||||
 | 
					    app.enableCors();
 | 
				
			||||||
 | 
					    app.setGlobalPrefix(main_1.APIPREFIX);
 | 
				
			||||||
 | 
					    app.useGlobalInterceptors(new transform_interceptor_1.TransformInterceptor());
 | 
				
			||||||
 | 
					    app.useGlobalFilters(new typeOrmQueryFailed_filter_1.TypeOrmQueryFailedFilter());
 | 
				
			||||||
 | 
					    app.useGlobalFilters(new allExceptions_filter_1.AllExceptionsFilter());
 | 
				
			||||||
 | 
					    app.useGlobalPipes(new common_1.ValidationPipe());
 | 
				
			||||||
 | 
					    app.getHttpAdapter().getInstance().set('views', 'templates/pages');
 | 
				
			||||||
 | 
					    app.getHttpAdapter().getInstance().set('view engine', 'hbs');
 | 
				
			||||||
 | 
					    (0, swagger_1.createSwagger)(app);
 | 
				
			||||||
 | 
					    const server = await app.listen(main_1.PORT, () => {
 | 
				
			||||||
 | 
					        common_1.Logger.log(`服务启动成功: http://localhost:${main_1.PORT}/nineai/swagger/docs`, 'Main');
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    server.timeout = 5 * 60 * 1000;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					bootstrap();
 | 
				
			||||||
							
								
								
									
										262
									
								
								dist/modules/app/app.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										262
									
								
								dist/modules/app/app.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,262 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppController = void 0;
 | 
				
			||||||
 | 
					const app_service_1 = require("./app.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const createCats_dto_1 = require("./dto/createCats.dto");
 | 
				
			||||||
 | 
					const updateCats_dto_1 = require("./dto/updateCats.dto");
 | 
				
			||||||
 | 
					const deleteCats_dto_1 = require("./dto/deleteCats.dto");
 | 
				
			||||||
 | 
					const queryCats_dto_1 = require("./dto/queryCats.dto");
 | 
				
			||||||
 | 
					const createApp_dto_1 = require("./dto/createApp.dto");
 | 
				
			||||||
 | 
					const updateApp_dto_1 = require("./dto/updateApp.dto");
 | 
				
			||||||
 | 
					const deleteApp_dto_1 = require("./dto/deleteApp.dto");
 | 
				
			||||||
 | 
					const queryApp_dto_1 = require("./dto/queryApp.dto");
 | 
				
			||||||
 | 
					const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
 | 
				
			||||||
 | 
					const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
 | 
				
			||||||
 | 
					const collectApp_dto_1 = require("./dto/collectApp.dto");
 | 
				
			||||||
 | 
					const custonApp_dto_1 = require("./dto/custonApp.dto");
 | 
				
			||||||
 | 
					let AppController = class AppController {
 | 
				
			||||||
 | 
					    constructor(appService) {
 | 
				
			||||||
 | 
					        this.appService = appService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    appCatsList(query) {
 | 
				
			||||||
 | 
					        return this.appService.appCatsList(query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    catsList() {
 | 
				
			||||||
 | 
					        const params = { status: 1, page: 1, size: 1000, name: '' };
 | 
				
			||||||
 | 
					        return this.appService.appCatsList(params);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    queryOneCats(query) {
 | 
				
			||||||
 | 
					        return this.appService.queryOneCat(query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    createAppCat(body) {
 | 
				
			||||||
 | 
					        return this.appService.createAppCat(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    updateAppCats(body) {
 | 
				
			||||||
 | 
					        return this.appService.updateAppCats(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delAppCat(body) {
 | 
				
			||||||
 | 
					        return this.appService.delAppCat(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    appList(req, query) {
 | 
				
			||||||
 | 
					        return this.appService.appList(req, query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    list(req, query) {
 | 
				
			||||||
 | 
					        return this.appService.frontAppList(req, query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    createApp(body) {
 | 
				
			||||||
 | 
					        return this.appService.createApp(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    customApp(body, req) {
 | 
				
			||||||
 | 
					        return this.appService.customApp(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    updateApp(body) {
 | 
				
			||||||
 | 
					        return this.appService.updateApp(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delApp(body) {
 | 
				
			||||||
 | 
					        return this.appService.delApp(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    auditPass(body) {
 | 
				
			||||||
 | 
					        return this.appService.auditPass(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    auditFail(body) {
 | 
				
			||||||
 | 
					        return this.appService.auditFail(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delMineApp(body, req) {
 | 
				
			||||||
 | 
					        return this.appService.delMineApp(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    collect(body, req) {
 | 
				
			||||||
 | 
					        return this.appService.collect(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    mineApps(req) {
 | 
				
			||||||
 | 
					        return this.appService.mineApps(req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('queryAppCats'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '获取App分类列表' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [queryCats_dto_1.QuerCatsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "appCatsList", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('queryCats'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户端获取App分类列表' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", []),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "catsList", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('queryOneCat'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户端获取App分类列表' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "queryOneCats", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('createAppCats'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '添加App分类' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [createCats_dto_1.CreateCatsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "createAppCat", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('updateAppCats'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '修改App分类' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [updateCats_dto_1.UpdateCatsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "updateAppCats", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('delAppCats'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除App分类' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [deleteCats_dto_1.DeleteCatsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "delAppCat", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('queryApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '获取App列表' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object, queryApp_dto_1.QuerAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "appList", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('list'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '客户端获取App' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object, queryApp_dto_1.QuerAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "list", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('createApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '添加App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [createApp_dto_1.CreateAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "createApp", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('customApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '添加自定义App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [custonApp_dto_1.CustomAppDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "customApp", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('updateApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '修改App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [updateApp_dto_1.UpdateAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "updateApp", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('delApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "delApp", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('auditPass'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '审核通过App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "auditPass", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('auditFail'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '审核拒绝App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "auditFail", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('delMineApp'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除个人App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [deleteApp_dto_1.OperateAppDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "delMineApp", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('collect'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '收藏/取消收藏App' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [collectApp_dto_1.CollectAppDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "collect", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('mineApps'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '我的收藏' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AppController.prototype, "mineApps", null);
 | 
				
			||||||
 | 
					AppController = __decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiTags)('App'),
 | 
				
			||||||
 | 
					    (0, common_1.Controller)('app'),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [app_service_1.AppService])
 | 
				
			||||||
 | 
					], AppController);
 | 
				
			||||||
 | 
					exports.AppController = AppController;
 | 
				
			||||||
							
								
								
									
										64
									
								
								dist/modules/app/app.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								dist/modules/app/app.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let AppEntity = class AppEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ unique: true, comment: 'App应用名称' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App分类Id' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "catId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用描述信息' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "des", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用预设场景信息', type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "preset", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用封面图片', nullable: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "coverImg", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用排序、数字越大越靠前', default: 100 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "order", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用是否启用中 0:禁用 1:启用', default: 1 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "status", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App示例数据', nullable: true, type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "demoData", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用角色 system  user', default: 'system' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "role", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App是否共享到应用广场', default: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Boolean)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "public", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '用户Id', nullable: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppEntity.prototype, "userId", void 0);
 | 
				
			||||||
 | 
					AppEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'app' })
 | 
				
			||||||
 | 
					], AppEntity);
 | 
				
			||||||
 | 
					exports.AppEntity = AppEntity;
 | 
				
			||||||
							
								
								
									
										26
									
								
								dist/modules/app/app.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								dist/modules/app/app.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppModule = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const app_controller_1 = require("./app.controller");
 | 
				
			||||||
 | 
					const app_service_1 = require("./app.service");
 | 
				
			||||||
 | 
					const typeorm_1 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const appCats_entity_1 = require("./appCats.entity");
 | 
				
			||||||
 | 
					const app_entity_1 = require("./app.entity");
 | 
				
			||||||
 | 
					const userApps_entity_1 = require("./userApps.entity");
 | 
				
			||||||
 | 
					let AppModule = class AppModule {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AppModule = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Module)({
 | 
				
			||||||
 | 
					        imports: [typeorm_1.TypeOrmModule.forFeature([appCats_entity_1.AppCatsEntity, app_entity_1.AppEntity, userApps_entity_1.UserAppsEntity])],
 | 
				
			||||||
 | 
					        controllers: [app_controller_1.AppController],
 | 
				
			||||||
 | 
					        providers: [app_service_1.AppService],
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					], AppModule);
 | 
				
			||||||
 | 
					exports.AppModule = AppModule;
 | 
				
			||||||
							
								
								
									
										314
									
								
								dist/modules/app/app.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										314
									
								
								dist/modules/app/app.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,314 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppService = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const appCats_entity_1 = require("./appCats.entity");
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const typeorm_2 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const app_entity_1 = require("./app.entity");
 | 
				
			||||||
 | 
					const userApps_entity_1 = require("./userApps.entity");
 | 
				
			||||||
 | 
					let AppService = class AppService {
 | 
				
			||||||
 | 
					    constructor(appCatsEntity, appEntity, userAppsEntity) {
 | 
				
			||||||
 | 
					        this.appCatsEntity = appCatsEntity;
 | 
				
			||||||
 | 
					        this.appEntity = appEntity;
 | 
				
			||||||
 | 
					        this.userAppsEntity = userAppsEntity;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async createAppCat(body) {
 | 
				
			||||||
 | 
					        const { name } = body;
 | 
				
			||||||
 | 
					        const c = await this.appCatsEntity.findOne({ where: { name } });
 | 
				
			||||||
 | 
					        if (c) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类名称已存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return await this.appCatsEntity.save(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async delAppCat(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const c = await this.appCatsEntity.findOne({ where: { id } });
 | 
				
			||||||
 | 
					        if (!c) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const count = await this.appEntity.count({ where: { catId: id } });
 | 
				
			||||||
 | 
					        if (count > 0) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类下存在App,不可删除!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.appCatsEntity.delete(id);
 | 
				
			||||||
 | 
					        if (res.affected > 0)
 | 
				
			||||||
 | 
					            return '删除成功';
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('删除失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updateAppCats(body) {
 | 
				
			||||||
 | 
					        const { id, name } = body;
 | 
				
			||||||
 | 
					        const c = await this.appCatsEntity.findOne({ where: { name, id: (0, typeorm_1.Not)(id) } });
 | 
				
			||||||
 | 
					        if (c) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类名称已存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.appCatsEntity.update({ id }, body);
 | 
				
			||||||
 | 
					        if (res.affected > 0)
 | 
				
			||||||
 | 
					            return '修改成功';
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('修改失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async queryOneCat(params) {
 | 
				
			||||||
 | 
					        const { id } = params;
 | 
				
			||||||
 | 
					        if (!id) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('缺失必要参数!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const app = await this.appEntity.findOne({ where: { id } });
 | 
				
			||||||
 | 
					        const { demoData: demo, coverImg, des, name } = app;
 | 
				
			||||||
 | 
					        return {
 | 
				
			||||||
 | 
					            demoData: demo ? demo.split('\n') : [],
 | 
				
			||||||
 | 
					            coverImg,
 | 
				
			||||||
 | 
					            des,
 | 
				
			||||||
 | 
					            name
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async appCatsList(query) {
 | 
				
			||||||
 | 
					        const { page = 1, size = 10, name, status } = query;
 | 
				
			||||||
 | 
					        const where = {};
 | 
				
			||||||
 | 
					        name && (where.name = (0, typeorm_1.Like)(`%${name}%`));
 | 
				
			||||||
 | 
					        [0, 1, '0', '1'].includes(status) && (where.status = status);
 | 
				
			||||||
 | 
					        const [rows, count] = await this.appCatsEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            order: { order: 'DESC' },
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const catIds = rows.map((item) => item.id);
 | 
				
			||||||
 | 
					        const apps = await this.appEntity.find({ where: { catId: (0, typeorm_1.In)(catIds) } });
 | 
				
			||||||
 | 
					        const appCountMap = {};
 | 
				
			||||||
 | 
					        apps.forEach((item) => {
 | 
				
			||||||
 | 
					            if (appCountMap[item.catId]) {
 | 
				
			||||||
 | 
					                appCountMap[item.catId] += 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else {
 | 
				
			||||||
 | 
					                appCountMap[item.catId] = 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        rows.forEach((item) => (item.appCount = appCountMap[item.id] || 0));
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async appList(req, query, orderKey = 'id') {
 | 
				
			||||||
 | 
					        var _a;
 | 
				
			||||||
 | 
					        const { page = 1, size = 10, name, status, catId, role } = query;
 | 
				
			||||||
 | 
					        const where = {};
 | 
				
			||||||
 | 
					        name && (where.name = (0, typeorm_1.Like)(`%${name}%`));
 | 
				
			||||||
 | 
					        catId && (where.catId = catId);
 | 
				
			||||||
 | 
					        role && (where.role = role);
 | 
				
			||||||
 | 
					        status && (where.status = status);
 | 
				
			||||||
 | 
					        const [rows, count] = await this.appEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            order: { [orderKey]: 'DESC' },
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const catIds = rows.map((item) => item.catId);
 | 
				
			||||||
 | 
					        const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_1.In)(catIds) } });
 | 
				
			||||||
 | 
					        rows.forEach((item) => {
 | 
				
			||||||
 | 
					            const cat = cats.find((c) => c.id === item.catId);
 | 
				
			||||||
 | 
					            item.catName = cat ? cat.name : '';
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        if (((_a = req === null || req === void 0 ? void 0 : req.user) === null || _a === void 0 ? void 0 : _a.role) !== 'super') {
 | 
				
			||||||
 | 
					            rows.forEach((item) => {
 | 
				
			||||||
 | 
					                delete item.preset;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async frontAppList(req, query, orderKey = 'id') {
 | 
				
			||||||
 | 
					        var _a;
 | 
				
			||||||
 | 
					        const { page = 1, size = 1000, name, catId, role } = query;
 | 
				
			||||||
 | 
					        const where = [
 | 
				
			||||||
 | 
					            { status: (0, typeorm_1.In)([1, 4]), userId: (0, typeorm_1.IsNull)(), public: false },
 | 
				
			||||||
 | 
					            { userId: (0, typeorm_1.MoreThan)(0), public: true },
 | 
				
			||||||
 | 
					        ];
 | 
				
			||||||
 | 
					        const [rows, count] = await this.appEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            order: { order: 'DESC' },
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const catIds = rows.map((item) => item.catId);
 | 
				
			||||||
 | 
					        const cats = await this.appCatsEntity.find({ where: { id: (0, typeorm_1.In)(catIds) } });
 | 
				
			||||||
 | 
					        rows.forEach((item) => {
 | 
				
			||||||
 | 
					            const cat = cats.find((c) => c.id === item.catId);
 | 
				
			||||||
 | 
					            item.catName = cat ? cat.name : '';
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        if (((_a = req === null || req === void 0 ? void 0 : req.user) === null || _a === void 0 ? void 0 : _a.role) !== 'super') {
 | 
				
			||||||
 | 
					            rows.forEach((item) => {
 | 
				
			||||||
 | 
					                delete item.preset;
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async createApp(body) {
 | 
				
			||||||
 | 
					        const { name, catId } = body;
 | 
				
			||||||
 | 
					        body.role = 'system';
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { name } });
 | 
				
			||||||
 | 
					        if (a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const c = await this.appCatsEntity.findOne({ where: { id: catId } });
 | 
				
			||||||
 | 
					        if (!c) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return await this.appEntity.save(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async customApp(body, req) {
 | 
				
			||||||
 | 
					        const { id } = req.user;
 | 
				
			||||||
 | 
					        const { name, catId, des, preset, coverImg, demoData, public: isPublic, appId } = body;
 | 
				
			||||||
 | 
					        if (appId) {
 | 
				
			||||||
 | 
					            const a = await this.appEntity.findOne({ where: { id: appId, userId: id } });
 | 
				
			||||||
 | 
					            if (!a) {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('您正在编辑一个不存在的应用!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            const data = { name, catId, des, preset, coverImg, demoData, public: isPublic, status: isPublic ? 3 : 1 };
 | 
				
			||||||
 | 
					            const res = await this.appEntity.update({ id: appId, userId: id }, data);
 | 
				
			||||||
 | 
					            if (res.affected) {
 | 
				
			||||||
 | 
					                return '修改成功';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('修改失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (!appId) {
 | 
				
			||||||
 | 
					            const c = await this.appCatsEntity.findOne({ where: { id: catId } });
 | 
				
			||||||
 | 
					            if (!c) {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('该分类不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            const a = await this.appEntity.findOne({ where: { name } });
 | 
				
			||||||
 | 
					            if (a) {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            const data = { name, catId, des, preset, coverImg, status: isPublic ? 3 : 1, demoData, public: isPublic, role: 'user', userId: id };
 | 
				
			||||||
 | 
					            const res = await this.appEntity.save(data);
 | 
				
			||||||
 | 
					            const params = { appId: res.id, userId: id, appType: 'user', public: isPublic, status: isPublic ? 3 : 1, catId };
 | 
				
			||||||
 | 
					            return this.userAppsEntity.save(params);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updateApp(body) {
 | 
				
			||||||
 | 
					        const { id, name, catId, status } = body;
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { name, id: (0, typeorm_1.Not)(id) } });
 | 
				
			||||||
 | 
					        if (a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用名称已存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const c = await this.appCatsEntity.findOne({ where: { id: catId } });
 | 
				
			||||||
 | 
					        if (!c) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该分类不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const curApp = await this.appEntity.findOne({ where: { id } });
 | 
				
			||||||
 | 
					        if (curApp.status !== body.status) {
 | 
				
			||||||
 | 
					            await this.userAppsEntity.update({ appId: id }, { status });
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.appEntity.update({ id }, body);
 | 
				
			||||||
 | 
					        if (res.affected > 0)
 | 
				
			||||||
 | 
					            return '修改App信息成功';
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('修改App信息失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async delApp(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { id } });
 | 
				
			||||||
 | 
					        if (!a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const useApp = await this.userAppsEntity.count({ where: { appId: id } });
 | 
				
			||||||
 | 
					        if (useApp > 0) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用已被用户关联使用中,不可删除!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.appEntity.delete(id);
 | 
				
			||||||
 | 
					        if (res.affected > 0)
 | 
				
			||||||
 | 
					            return '删除App成功';
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('删除App失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async auditPass(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { id, status: 3 } });
 | 
				
			||||||
 | 
					        if (!a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.appEntity.update({ id }, { status: 4 });
 | 
				
			||||||
 | 
					        await this.userAppsEntity.update({ appId: id }, { status: 4 });
 | 
				
			||||||
 | 
					        return '应用审核通过';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async auditFail(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { id, status: 3 } });
 | 
				
			||||||
 | 
					        if (!a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该应用不存在!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.appEntity.update({ id }, { status: 5 });
 | 
				
			||||||
 | 
					        await this.userAppsEntity.update({ appId: id }, { status: 5 });
 | 
				
			||||||
 | 
					        return '应用审核拒绝完成';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async delMineApp(body, req) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const a = await this.appEntity.findOne({ where: { id, userId: req.user.id } });
 | 
				
			||||||
 | 
					        if (!a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('您正在操作一个不存在的资源!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.appEntity.delete(id);
 | 
				
			||||||
 | 
					        await this.userAppsEntity.delete({ appId: id, userId: req.user.id });
 | 
				
			||||||
 | 
					        return '删除应用成功!';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async collect(body, req) {
 | 
				
			||||||
 | 
					        const { appId } = body;
 | 
				
			||||||
 | 
					        const { id: userId } = req.user;
 | 
				
			||||||
 | 
					        const historyApp = await this.userAppsEntity.findOne({ where: { appId, userId } });
 | 
				
			||||||
 | 
					        if (historyApp) {
 | 
				
			||||||
 | 
					            const r = await this.userAppsEntity.delete({ appId, userId });
 | 
				
			||||||
 | 
					            if (r.affected > 0) {
 | 
				
			||||||
 | 
					                return '取消收藏成功!';
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('取消收藏失败!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const app = await this.appEntity.findOne({ where: { id: appId } });
 | 
				
			||||||
 | 
					        const { id, role: appRole, catId } = app;
 | 
				
			||||||
 | 
					        const collectInfo = { userId, appId: id, catId, appRole, public: true, status: 1 };
 | 
				
			||||||
 | 
					        await this.userAppsEntity.save(collectInfo);
 | 
				
			||||||
 | 
					        return '已将应用加入到我的个人工作台!';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async mineApps(req, query = { page: 1, size: 30 }) {
 | 
				
			||||||
 | 
					        const { id } = req.user;
 | 
				
			||||||
 | 
					        const { page = 1, size = 30 } = query;
 | 
				
			||||||
 | 
					        const [rows, count] = await this.userAppsEntity.findAndCount({
 | 
				
			||||||
 | 
					            where: { userId: id, status: (0, typeorm_1.In)([1, 3, 4, 5]) },
 | 
				
			||||||
 | 
					            order: { id: 'DESC' },
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const appIds = rows.map((item) => item.appId);
 | 
				
			||||||
 | 
					        const appsInfo = await this.appEntity.find({ where: { id: (0, typeorm_1.In)(appIds) } });
 | 
				
			||||||
 | 
					        rows.forEach((item) => {
 | 
				
			||||||
 | 
					            const app = appsInfo.find((c) => c.id === item.appId);
 | 
				
			||||||
 | 
					            item.appName = app ? app.name : '';
 | 
				
			||||||
 | 
					            item.appRole = app ? app.role : '';
 | 
				
			||||||
 | 
					            item.appDes = app ? app.des : '';
 | 
				
			||||||
 | 
					            item.coverImg = app ? app.coverImg : '';
 | 
				
			||||||
 | 
					            item.demoData = app ? app.demoData : '';
 | 
				
			||||||
 | 
					            item.preset = app.userId === id ? app.preset : '******';
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AppService = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __param(0, (0, typeorm_2.InjectRepository)(appCats_entity_1.AppCatsEntity)),
 | 
				
			||||||
 | 
					    __param(1, (0, typeorm_2.InjectRepository)(app_entity_1.AppEntity)),
 | 
				
			||||||
 | 
					    __param(2, (0, typeorm_2.InjectRepository)(userApps_entity_1.UserAppsEntity)),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [typeorm_1.Repository,
 | 
				
			||||||
 | 
					        typeorm_1.Repository,
 | 
				
			||||||
 | 
					        typeorm_1.Repository])
 | 
				
			||||||
 | 
					], AppService);
 | 
				
			||||||
 | 
					exports.AppService = AppService;
 | 
				
			||||||
							
								
								
									
										40
									
								
								dist/modules/app/appCats.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								dist/modules/app/appCats.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AppCatsEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let AppCatsEntity = class AppCatsEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ unique: true, comment: 'App分类名称' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppCatsEntity.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App分类描述信息' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppCatsEntity.prototype, "des", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App分类封面图片', nullable: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AppCatsEntity.prototype, "coverImg", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App分类排序、数字越大越靠前', default: 100 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppCatsEntity.prototype, "order", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App分类是否启用中 0:禁用 1:启用', default: 1 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AppCatsEntity.prototype, "status", void 0);
 | 
				
			||||||
 | 
					AppCatsEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'app_cats' })
 | 
				
			||||||
 | 
					], AppCatsEntity);
 | 
				
			||||||
 | 
					exports.AppCatsEntity = AppCatsEntity;
 | 
				
			||||||
							
								
								
									
										22
									
								
								dist/modules/app/dto/collectApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								dist/modules/app/dto/collectApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.CollectAppDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					class CollectAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '要收藏的appId', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: 'ID必须是Number' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CollectAppDto.prototype, "appId", void 0);
 | 
				
			||||||
 | 
					exports.CollectAppDto = CollectAppDto;
 | 
				
			||||||
							
								
								
									
										65
									
								
								dist/modules/app/dto/createApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								dist/modules/app/dto/createApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,65 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.CreateAppDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class CreateAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '前端助手', description: 'app名称', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app名称是必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: 'app分类Id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app分类Id必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "catId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({
 | 
				
			||||||
 | 
					        example: '适用于编程编码、期望成为您的编程助手',
 | 
				
			||||||
 | 
					        description: 'app名称详情描述',
 | 
				
			||||||
 | 
					        required: false,
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app名称描述是必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "des", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '你现在是一个翻译官。接下来我说的所有话帮我翻译成中文', description: '预设的prompt', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "preset", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'https://xxxx.png', description: '套餐封面图片', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "coverImg", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 100, description: '套餐排序、数字越大越靠前', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "order", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '套餐状态 0:禁用 1:启用', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: '套餐状态必须是Number' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsIn)([0, 1, 3, 4, 5], { message: '套餐状态错误' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '这是一句示例数据', description: 'app示例数据', required: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "demoData", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'system', description: '创建的角色', required: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateAppDto.prototype, "role", void 0);
 | 
				
			||||||
 | 
					exports.CreateAppDto = CreateAppDto;
 | 
				
			||||||
							
								
								
									
										47
									
								
								dist/modules/app/dto/createCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								dist/modules/app/dto/createCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.CreateCatsDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class CreateCatsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '编程助手', description: 'app分类名称', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app分类名称是必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateCatsDto.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({
 | 
				
			||||||
 | 
					        example: '适用于编程编码、期望成为您的编程助手',
 | 
				
			||||||
 | 
					        description: 'app分类名称详情描述',
 | 
				
			||||||
 | 
					        required: false,
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app分类名称描述是必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateCatsDto.prototype, "des", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'https://xxxx.png', description: '套餐封面图片' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CreateCatsDto.prototype, "coverImg", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 100, description: '套餐排序、数字越大越靠前', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CreateCatsDto.prototype, "order", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '套餐状态 0:禁用 1:启用', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: '套餐状态必须是Number' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsIn)([0, 1, 3, 4, 5], { message: '套餐状态错误' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CreateCatsDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.CreateCatsDto = CreateCatsDto;
 | 
				
			||||||
							
								
								
									
										55
									
								
								dist/modules/app/dto/custonApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								dist/modules/app/dto/custonApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.CustomAppDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class CustomAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '前端助手', description: 'app名称', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: 'app分类Id', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "catId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({
 | 
				
			||||||
 | 
					        example: '适用于编程编码、期望成为您的编程助手',
 | 
				
			||||||
 | 
					        description: 'app名称详情描述',
 | 
				
			||||||
 | 
					        required: false,
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsDefined)({ message: 'app名称描述是必传参数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "des", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '你现在是一个翻译官。接下来我说的所有话帮我翻译成中文', description: '预设的prompt', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "preset", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'https://xxxx.png', description: '套餐封面图片', required: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "coverImg", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '这是一句示例数据', description: 'app示例数据', required: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "demoData", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: false, description: '是否共享到所有人', required: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Boolean)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "public", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '应用ID', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], CustomAppDto.prototype, "appId", void 0);
 | 
				
			||||||
 | 
					exports.CustomAppDto = CustomAppDto;
 | 
				
			||||||
							
								
								
									
										22
									
								
								dist/modules/app/dto/deleteApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								dist/modules/app/dto/deleteApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.OperateAppDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					class OperateAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '要删除的appId', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: 'ID必须是Number' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], OperateAppDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.OperateAppDto = OperateAppDto;
 | 
				
			||||||
							
								
								
									
										22
									
								
								dist/modules/app/dto/deleteCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								dist/modules/app/dto/deleteCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.DeleteCatsDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					class DeleteCatsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '要删除app分类Id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: 'ID必须是Number' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], DeleteCatsDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.DeleteCatsDto = DeleteCatsDto;
 | 
				
			||||||
							
								
								
									
										47
									
								
								dist/modules/app/dto/queryApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								dist/modules/app/dto/queryApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.QuerAppDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class QuerAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '查询页数', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "page", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 10, description: '每页数量', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "size", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'name', description: 'app名称', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: 'app状态 0:禁用 1:启用 3:审核加入广场中 4:已拒绝加入广场', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 2, description: 'app分类Id', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "catId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'role', description: 'app角色', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QuerAppDto.prototype, "role", void 0);
 | 
				
			||||||
 | 
					exports.QuerAppDto = QuerAppDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/app/dto/queryCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/app/dto/queryCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.QuerCatsDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class QuerCatsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '查询页数', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerCatsDto.prototype, "page", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 10, description: '每页数量', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerCatsDto.prototype, "size", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'name', description: '分类名称', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QuerCatsDto.prototype, "name", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '分类状态 0:禁用 1:启用', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QuerCatsDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.QuerCatsDto = QuerCatsDto;
 | 
				
			||||||
							
								
								
									
										23
									
								
								dist/modules/app/dto/updateApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/modules/app/dto/updateApp.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdateAppDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const createApp_dto_1 = require("./createApp.dto");
 | 
				
			||||||
 | 
					class UpdateAppDto extends createApp_dto_1.CreateAppDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '要修改的分类Id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: '分类ID必须是Number' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateAppDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.UpdateAppDto = UpdateAppDto;
 | 
				
			||||||
							
								
								
									
										23
									
								
								dist/modules/app/dto/updateCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/modules/app/dto/updateCats.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdateCatsDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const createCats_dto_1 = require("./createCats.dto");
 | 
				
			||||||
 | 
					class UpdateCatsDto extends createCats_dto_1.CreateCatsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '要修改的分类Id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNumber)({}, { message: '分类ID必须是Number' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateCatsDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.UpdateCatsDto = UpdateCatsDto;
 | 
				
			||||||
							
								
								
									
										48
									
								
								dist/modules/app/userApps.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								dist/modules/app/userApps.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UserAppsEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let UserAppsEntity = class UserAppsEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '用户ID' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "userId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '应用ID' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "appId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '应用分类ID' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "catId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'app类型 system/user', default: 'user' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "appType", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '是否公开到公告菜单', default: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Boolean)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "public", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'app状态 1正常 2审核 3违规', default: 1 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "status", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: 'App应用排序、数字越大越靠前', default: 100 }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserAppsEntity.prototype, "order", void 0);
 | 
				
			||||||
 | 
					UserAppsEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'user_apps' })
 | 
				
			||||||
 | 
					], UserAppsEntity);
 | 
				
			||||||
 | 
					exports.UserAppsEntity = UserAppsEntity;
 | 
				
			||||||
							
								
								
									
										187
									
								
								dist/modules/auth/auth.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										187
									
								
								dist/modules/auth/auth.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,187 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AuthController = void 0;
 | 
				
			||||||
 | 
					const verifyCode_dto_1 = require("./../verification/dto/verifyCode.dto");
 | 
				
			||||||
 | 
					const authLogin_dto_1 = require("./dto/authLogin.dto");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
 | 
				
			||||||
 | 
					const auth_service_1 = require("./auth.service");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const authRegister_dto_1 = require("./dto/authRegister.dto");
 | 
				
			||||||
 | 
					const updatePassword_dto_1 = require("./dto/updatePassword.dto");
 | 
				
			||||||
 | 
					const updatePassByOther_dto_1 = require("./dto/updatePassByOther.dto");
 | 
				
			||||||
 | 
					const sendPhoneCode_dto_1 = require("./dto/sendPhoneCode.dto");
 | 
				
			||||||
 | 
					const userRegisterByPhone_dto_1 = require("./dto/userRegisterByPhone.dto");
 | 
				
			||||||
 | 
					const loginByPhone_dt_1 = require("./dto/loginByPhone.dt");
 | 
				
			||||||
 | 
					let AuthController = class AuthController {
 | 
				
			||||||
 | 
					    constructor(authService) {
 | 
				
			||||||
 | 
					        this.authService = authService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async register(body, req) {
 | 
				
			||||||
 | 
					        return await this.authService.register(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async registerByPhone(body, req) {
 | 
				
			||||||
 | 
					        return await this.authService.registerByPhone(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async login(body, req) {
 | 
				
			||||||
 | 
					        return this.authService.login(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async loginByPhone(body, req) {
 | 
				
			||||||
 | 
					        return this.authService.loginByPhone(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updatePassword(req, body) {
 | 
				
			||||||
 | 
					        return this.authService.updatePassword(req, body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updatePassByOther(req, body) {
 | 
				
			||||||
 | 
					        return this.authService.updatePassByOther(req, body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async getInfo(req) {
 | 
				
			||||||
 | 
					        return this.authService.getInfo(req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async activateAccount(parmas, res) {
 | 
				
			||||||
 | 
					        return this.authService.activateAccount(parmas, res);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async registerSuccess(parmas) {
 | 
				
			||||||
 | 
					        const { username, id, email, teamName, registerSuccessEmailTitle, registerSuccessEmailTeamName, registerSuccessEmaileAppend } = parmas;
 | 
				
			||||||
 | 
					        return { username, id, email, teamName, registerSuccessEmailTitle, registerSuccessEmailTeamName, registerSuccessEmaileAppend };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async registerError(parmas) {
 | 
				
			||||||
 | 
					        const { message, teamName, registerFailEmailTitle, registerFailEmailTeamName } = parmas;
 | 
				
			||||||
 | 
					        return { message, teamName, registerFailEmailTitle, registerFailEmailTeamName };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async captcha(parmas) {
 | 
				
			||||||
 | 
					        return this.authService.captcha(parmas);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async sendPhoneCode(parmas) {
 | 
				
			||||||
 | 
					        return this.authService.sendPhoneCode(parmas);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('register'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户注册' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [authRegister_dto_1.UserRegisterDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "register", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('registerByPhone'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户通过手机号注册' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [userRegisterByPhone_dto_1.UserRegisterByPhoneDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "registerByPhone", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('login'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户登录' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [authLogin_dto_1.UserLoginDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "login", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('loginByPhone'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户手机号登录' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [loginByPhone_dt_1.LoginByPhoneDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "loginByPhone", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('updatePassword'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户更改密码' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object, updatePassword_dto_1.UpdatePasswordDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "updatePassword", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('updatePassByOther'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '用户更改密码' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object, updatePassByOther_dto_1.UpdatePassByOtherDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "updatePassByOther", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('getInfo'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '获取用户个人信息' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "getInfo", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('activateAccount'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '账户激活' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Res)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [verifyCode_dto_1.VerifyCodeDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "activateAccount", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('registerSuccess'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '注册成功页面' }),
 | 
				
			||||||
 | 
					    (0, common_1.Render)('registerSuccess'),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "registerSuccess", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('registerError'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '注册失败页面' }),
 | 
				
			||||||
 | 
					    (0, common_1.Render)('registerError'),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "registerError", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('captcha'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '获取一个图形验证码' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "captcha", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('sendPhoneCode'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '发送手机验证码' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [sendPhoneCode_dto_1.SendPhoneCodeDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", Promise)
 | 
				
			||||||
 | 
					], AuthController.prototype, "sendPhoneCode", null);
 | 
				
			||||||
 | 
					AuthController = __decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiTags)('auth'),
 | 
				
			||||||
 | 
					    (0, common_1.Controller)('auth'),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [auth_service_1.AuthService])
 | 
				
			||||||
 | 
					], AuthController);
 | 
				
			||||||
 | 
					exports.AuthController = AuthController;
 | 
				
			||||||
							
								
								
									
										72
									
								
								dist/modules/auth/auth.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								dist/modules/auth/auth.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AuthModule = void 0;
 | 
				
			||||||
 | 
					const verifycation_entity_1 = require("./../verification/verifycation.entity");
 | 
				
			||||||
 | 
					const typeorm_1 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const verification_service_1 = require("./../verification/verification.service");
 | 
				
			||||||
 | 
					const mailer_service_1 = require("../mailer/mailer.service");
 | 
				
			||||||
 | 
					const nestjs_config_1 = require("nestjs-config");
 | 
				
			||||||
 | 
					const auth_controller_1 = require("./auth.controller");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const auth_service_1 = require("./auth.service");
 | 
				
			||||||
 | 
					const user_module_1 = require("../user/user.module");
 | 
				
			||||||
 | 
					const passport_1 = require("@nestjs/passport");
 | 
				
			||||||
 | 
					const jwt_1 = require("@nestjs/jwt");
 | 
				
			||||||
 | 
					const jwt_strategy_1 = require("../../common/auth/jwt.strategy");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
 | 
				
			||||||
 | 
					const userBalance_service_1 = require("../userBalance/userBalance.service");
 | 
				
			||||||
 | 
					const balance_entity_1 = require("../userBalance/balance.entity");
 | 
				
			||||||
 | 
					const accountLog_entity_1 = require("../userBalance/accountLog.entity");
 | 
				
			||||||
 | 
					const config_entity_1 = require("../globalConfig/config.entity");
 | 
				
			||||||
 | 
					const cramiPackage_entity_1 = require("../crami/cramiPackage.entity");
 | 
				
			||||||
 | 
					const redisCache_service_1 = require("../redisCache/redisCache.service");
 | 
				
			||||||
 | 
					const redisCache_module_1 = require("../redisCache/redisCache.module");
 | 
				
			||||||
 | 
					const userBalance_entity_1 = require("../userBalance/userBalance.entity");
 | 
				
			||||||
 | 
					const salesUsers_entity_1 = require("../sales/salesUsers.entity");
 | 
				
			||||||
 | 
					const user_entity_1 = require("../user/user.entity");
 | 
				
			||||||
 | 
					const whiteList_entity_1 = require("../chatgpt/whiteList.entity");
 | 
				
			||||||
 | 
					const fingerprint_entity_1 = require("../userBalance/fingerprint.entity");
 | 
				
			||||||
 | 
					const chatLog_entity_1 = require("../chatLog/chatLog.entity");
 | 
				
			||||||
 | 
					const chatGroup_entity_1 = require("../chatGroup/chatGroup.entity");
 | 
				
			||||||
 | 
					const midjourney_entity_1 = require("../midjourney/midjourney.entity");
 | 
				
			||||||
 | 
					let AuthModule = class AuthModule {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AuthModule = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Global)(),
 | 
				
			||||||
 | 
					    (0, common_1.Module)({
 | 
				
			||||||
 | 
					        imports: [
 | 
				
			||||||
 | 
					            user_module_1.UserModule,
 | 
				
			||||||
 | 
					            passport_1.PassportModule.register({ defaultStrategy: 'jwt' }),
 | 
				
			||||||
 | 
					            jwt_1.JwtModule.registerAsync({
 | 
				
			||||||
 | 
					                useFactory: async (configService) => configService.get('jwt'),
 | 
				
			||||||
 | 
					                inject: [nestjs_config_1.ConfigService],
 | 
				
			||||||
 | 
					            }),
 | 
				
			||||||
 | 
					            typeorm_1.TypeOrmModule.forFeature([
 | 
				
			||||||
 | 
					                verifycation_entity_1.VerifycationEntity,
 | 
				
			||||||
 | 
					                balance_entity_1.BalanceEntity,
 | 
				
			||||||
 | 
					                accountLog_entity_1.AccountLogEntity,
 | 
				
			||||||
 | 
					                config_entity_1.ConfigEntity,
 | 
				
			||||||
 | 
					                cramiPackage_entity_1.CramiPackageEntity,
 | 
				
			||||||
 | 
					                redisCache_module_1.RedisCacheModule,
 | 
				
			||||||
 | 
					                userBalance_entity_1.UserBalanceEntity,
 | 
				
			||||||
 | 
					                salesUsers_entity_1.SalesUsersEntity,
 | 
				
			||||||
 | 
					                user_entity_1.UserEntity,
 | 
				
			||||||
 | 
					                whiteList_entity_1.WhiteListEntity,
 | 
				
			||||||
 | 
					                fingerprint_entity_1.FingerprintLogEntity,
 | 
				
			||||||
 | 
					                chatLog_entity_1.ChatLogEntity,
 | 
				
			||||||
 | 
					                chatGroup_entity_1.ChatGroupEntity,
 | 
				
			||||||
 | 
					                midjourney_entity_1.MidjourneyEntity
 | 
				
			||||||
 | 
					            ]),
 | 
				
			||||||
 | 
					        ],
 | 
				
			||||||
 | 
					        controllers: [auth_controller_1.AuthController],
 | 
				
			||||||
 | 
					        providers: [auth_service_1.AuthService, jwt_strategy_1.JwtStrategy, jwtAuth_guard_1.JwtAuthGuard, mailer_service_1.MailerService, verification_service_1.VerificationService, userBalance_service_1.UserBalanceService, redisCache_service_1.RedisCacheService],
 | 
				
			||||||
 | 
					        exports: [auth_service_1.AuthService],
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					], AuthModule);
 | 
				
			||||||
 | 
					exports.AuthModule = AuthModule;
 | 
				
			||||||
							
								
								
									
										248
									
								
								dist/modules/auth/auth.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										248
									
								
								dist/modules/auth/auth.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,248 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AuthService = void 0;
 | 
				
			||||||
 | 
					const globalConfig_service_1 = require("../globalConfig/globalConfig.service");
 | 
				
			||||||
 | 
					const verification_constant_1 = require("../../common/constants/verification.constant");
 | 
				
			||||||
 | 
					const verification_service_1 = require("./../verification/verification.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const jwt_1 = require("@nestjs/jwt");
 | 
				
			||||||
 | 
					const user_service_1 = require("../user/user.service");
 | 
				
			||||||
 | 
					const mailer_service_1 = require("../mailer/mailer.service");
 | 
				
			||||||
 | 
					const user_constant_1 = require("../../common/constants/user.constant");
 | 
				
			||||||
 | 
					const userBalance_service_1 = require("../userBalance/userBalance.service");
 | 
				
			||||||
 | 
					const config_entity_1 = require("../globalConfig/config.entity");
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const typeorm_2 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const utils_1 = require("../../common/utils");
 | 
				
			||||||
 | 
					const os = require("os");
 | 
				
			||||||
 | 
					const redisCache_service_1 = require("../redisCache/redisCache.service");
 | 
				
			||||||
 | 
					const svgCaptcha = require("svg-captcha");
 | 
				
			||||||
 | 
					const bcrypt = require("bcryptjs");
 | 
				
			||||||
 | 
					let AuthService = class AuthService {
 | 
				
			||||||
 | 
					    constructor(configEntity, userService, jwtService, mailerService, verificationService, userBalanceService, redisCacheService, globalConfigService) {
 | 
				
			||||||
 | 
					        this.configEntity = configEntity;
 | 
				
			||||||
 | 
					        this.userService = userService;
 | 
				
			||||||
 | 
					        this.jwtService = jwtService;
 | 
				
			||||||
 | 
					        this.mailerService = mailerService;
 | 
				
			||||||
 | 
					        this.verificationService = verificationService;
 | 
				
			||||||
 | 
					        this.userBalanceService = userBalanceService;
 | 
				
			||||||
 | 
					        this.redisCacheService = redisCacheService;
 | 
				
			||||||
 | 
					        this.globalConfigService = globalConfigService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async onModuleInit() {
 | 
				
			||||||
 | 
					        this.getIp();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async register(body, req) {
 | 
				
			||||||
 | 
					        await this.verificationService.verifyCaptcha(body);
 | 
				
			||||||
 | 
					        const user = await this.userService.createUserAndVerifycation(body, req);
 | 
				
			||||||
 | 
					        const { username, email, client, id } = user;
 | 
				
			||||||
 | 
					        const res = { username, email, id };
 | 
				
			||||||
 | 
					        client && (res.client = client);
 | 
				
			||||||
 | 
					        return res;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async registerByPhone(body, req) {
 | 
				
			||||||
 | 
					        const { username, password, phone, phoneCode, invitedBy } = body;
 | 
				
			||||||
 | 
					        await this.userService.verifyUserRegisterByPhone(body);
 | 
				
			||||||
 | 
					        const nameSpace = await this.globalConfigService.getNamespace();
 | 
				
			||||||
 | 
					        const key = `${nameSpace}:PHONECODE:${phone}`;
 | 
				
			||||||
 | 
					        const redisPhoneCode = await this.redisCacheService.get({ key });
 | 
				
			||||||
 | 
					        if (!redisPhoneCode) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('验证码已过期、请重新发送!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (phoneCode !== redisPhoneCode) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('验证码填写错误、请重新输入!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const email = `${(0, utils_1.createRandomUid)()}@nine.com`;
 | 
				
			||||||
 | 
					        const newUser = { username, password, phone, invitedBy, email, status: user_constant_1.UserStatusEnum.ACTIVE };
 | 
				
			||||||
 | 
					        const userDefautlAvatar = await this.globalConfigService.getConfigs(['userDefautlAvatar']);
 | 
				
			||||||
 | 
					        newUser.avatar = userDefautlAvatar;
 | 
				
			||||||
 | 
					        const hashedPassword = bcrypt.hashSync(password, 10);
 | 
				
			||||||
 | 
					        newUser.password = hashedPassword;
 | 
				
			||||||
 | 
					        const u = await this.userService.createUser(newUser);
 | 
				
			||||||
 | 
					        let inviteUser;
 | 
				
			||||||
 | 
					        if (invitedBy) {
 | 
				
			||||||
 | 
					            inviteUser = await this.userService.qureyUserInfoByInviteCode(invitedBy);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.userBalanceService.addBalanceToNewUser(u.id, inviteUser === null || inviteUser === void 0 ? void 0 : inviteUser.id);
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async login(user, req) {
 | 
				
			||||||
 | 
					        const u = await this.userService.verifyUserCredentials(user);
 | 
				
			||||||
 | 
					        const { username, id, email, role, openId, client } = u;
 | 
				
			||||||
 | 
					        const ip = (0, utils_1.getClientIp)(req);
 | 
				
			||||||
 | 
					        await this.userService.savaLoginIp(id, ip);
 | 
				
			||||||
 | 
					        const token = await this.jwtService.sign({ username, id, email, role, openId, client });
 | 
				
			||||||
 | 
					        await this.redisCacheService.saveToken(id, token);
 | 
				
			||||||
 | 
					        return token;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async loginByPhone(body, req) {
 | 
				
			||||||
 | 
					        const u = await this.userService.verifyUserCredentials(body);
 | 
				
			||||||
 | 
					        const { username, id, email, role, openId, client } = u;
 | 
				
			||||||
 | 
					        const ip = (0, utils_1.getClientIp)(req);
 | 
				
			||||||
 | 
					        await this.userService.savaLoginIp(id, ip);
 | 
				
			||||||
 | 
					        const { phone } = body;
 | 
				
			||||||
 | 
					        const token = await this.jwtService.sign({ username, id, email, role, openId, client, phone });
 | 
				
			||||||
 | 
					        await this.redisCacheService.saveToken(id, token);
 | 
				
			||||||
 | 
					        return token;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async loginByOpenId(user, req) {
 | 
				
			||||||
 | 
					        const { status } = user;
 | 
				
			||||||
 | 
					        if (status !== user_constant_1.UserStatusEnum.ACTIVE) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(user_constant_1.UserStatusErrMsg[status], common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const { username, id, email, role, openId, client } = user;
 | 
				
			||||||
 | 
					        const ip = (0, utils_1.getClientIp)(req);
 | 
				
			||||||
 | 
					        await this.userService.savaLoginIp(id, ip);
 | 
				
			||||||
 | 
					        const token = await this.jwtService.sign({ username, id, email, role, openId, client });
 | 
				
			||||||
 | 
					        await this.redisCacheService.saveToken(id, token);
 | 
				
			||||||
 | 
					        return token;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async getInfo(req) {
 | 
				
			||||||
 | 
					        const { id } = req.user;
 | 
				
			||||||
 | 
					        return await this.userService.getUserInfo(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async activateAccount(params, res) {
 | 
				
			||||||
 | 
					        const emailConfigs = await this.configEntity.find({
 | 
				
			||||||
 | 
					            where: {
 | 
				
			||||||
 | 
					                configKey: (0, typeorm_1.In)([
 | 
				
			||||||
 | 
					                    'registerSuccessEmailTitle',
 | 
				
			||||||
 | 
					                    'registerSuccessEmailTeamName',
 | 
				
			||||||
 | 
					                    'registerSuccessEmaileAppend',
 | 
				
			||||||
 | 
					                    'registerFailEmailTitle',
 | 
				
			||||||
 | 
					                    'registerFailEmailTeamName',
 | 
				
			||||||
 | 
					                ]),
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const configMap = emailConfigs.reduce((pre, cur) => {
 | 
				
			||||||
 | 
					            pre[cur.configKey] = cur.configVal;
 | 
				
			||||||
 | 
					            return pre;
 | 
				
			||||||
 | 
					        }, {});
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            const v = await this.verificationService.verifyCode(params, verification_constant_1.VerificationEnum.Registration);
 | 
				
			||||||
 | 
					            const { type, userId } = v;
 | 
				
			||||||
 | 
					            if (type !== verification_constant_1.VerificationEnum.Registration) {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('验证码类型错误', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            const status = await this.userService.getUserStatus(userId);
 | 
				
			||||||
 | 
					            if (status === user_constant_1.UserStatusEnum.ACTIVE) {
 | 
				
			||||||
 | 
					                throw new common_1.HttpException('账户已被激活过', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            await this.userService.updateUserStatus(v.userId, user_constant_1.UserStatusEnum.ACTIVE);
 | 
				
			||||||
 | 
					            const u = await this.userService.queryUserInfoById(v.userId);
 | 
				
			||||||
 | 
					            const { username, email, id, invitedBy } = u;
 | 
				
			||||||
 | 
					            let inviteUser;
 | 
				
			||||||
 | 
					            if (invitedBy) {
 | 
				
			||||||
 | 
					                inviteUser = await this.userService.qureyUserInfoByInviteCode(invitedBy);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            await this.userBalanceService.addBalanceToNewUser(id, inviteUser === null || inviteUser === void 0 ? void 0 : inviteUser.id);
 | 
				
			||||||
 | 
					            res.redirect(`/api/auth/registerSuccess?id=${id.toString().padStart(4, '0')}&username=${username}&email=${email}®isterSuccessEmailTitle=${configMap.registerSuccessEmailTitle}®isterSuccessEmailTeamName=${configMap.registerSuccessEmailTeamName}®isterSuccessEmaileAppend=${configMap.registerSuccessEmaileAppend}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (error) {
 | 
				
			||||||
 | 
					            console.log('error: ', error);
 | 
				
			||||||
 | 
					            const message = error.response;
 | 
				
			||||||
 | 
					            res.redirect(`/api/auth/registerError?message=${message}®isterFailEmailTitle=${configMap.registerFailEmailTitle}®isterFailEmailTeamName=${configMap.registerFailEmailTeamName}`);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updatePassword(req, body) {
 | 
				
			||||||
 | 
					        const { id, client, role } = req.user;
 | 
				
			||||||
 | 
					        if (client && Number(client) > 0) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('无权此操作、请联系管理员!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (role === 'admin') {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('非法操作、请联系管理员!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const bool = await this.userService.verifyUserPassword(id, body.oldPassword);
 | 
				
			||||||
 | 
					        if (!bool) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('旧密码错误、请检查提交', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.userService.updateUserPassword(id, body.password);
 | 
				
			||||||
 | 
					        return '密码修改成功';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updatePassByOther(req, body) {
 | 
				
			||||||
 | 
					        const { id, client } = req.user;
 | 
				
			||||||
 | 
					        if (!client) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('无权此操作!', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        this.userService.updateUserPassword(id, body.password);
 | 
				
			||||||
 | 
					        return '密码修改成功';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    getIp() {
 | 
				
			||||||
 | 
					        let ipAddress;
 | 
				
			||||||
 | 
					        const interfaces = os.networkInterfaces();
 | 
				
			||||||
 | 
					        Object.keys(interfaces).forEach((interfaceName) => {
 | 
				
			||||||
 | 
					            const interfaceInfo = interfaces[interfaceName];
 | 
				
			||||||
 | 
					            for (let i = 0; i < interfaceInfo.length; i++) {
 | 
				
			||||||
 | 
					                const alias = interfaceInfo[i];
 | 
				
			||||||
 | 
					                if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
 | 
				
			||||||
 | 
					                    ipAddress = alias.address;
 | 
				
			||||||
 | 
					                    break;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        this.ipAddress = ipAddress;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async captcha(parmas) {
 | 
				
			||||||
 | 
					        const nameSpace = await this.globalConfigService.getNamespace();
 | 
				
			||||||
 | 
					        const { color = '#fff' } = parmas;
 | 
				
			||||||
 | 
					        const captcha = svgCaptcha.createMathExpr({ background: color, height: 34, width: 120, noise: 3 });
 | 
				
			||||||
 | 
					        const text = captcha.text;
 | 
				
			||||||
 | 
					        const randomId = (0, utils_1.createRandomUid)();
 | 
				
			||||||
 | 
					        const key = `${nameSpace}:CAPTCHA:${randomId}`;
 | 
				
			||||||
 | 
					        await this.redisCacheService.set({ key, val: captcha.text }, 5 * 60);
 | 
				
			||||||
 | 
					        return {
 | 
				
			||||||
 | 
					            svgCode: captcha.data,
 | 
				
			||||||
 | 
					            code: randomId,
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async sendPhoneCode(body) {
 | 
				
			||||||
 | 
					        await this.verificationService.verifyCaptcha(body);
 | 
				
			||||||
 | 
					        const { phone } = body;
 | 
				
			||||||
 | 
					        const nameSpace = await this.globalConfigService.getNamespace();
 | 
				
			||||||
 | 
					        const key = `${nameSpace}:PHONECODE:${phone}`;
 | 
				
			||||||
 | 
					        const ttl = await this.redisCacheService.ttl(key);
 | 
				
			||||||
 | 
					        if (ttl && ttl > 0) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(`${ttl}秒内不得重复发送短信!`, common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const code = (0, utils_1.createRandomCode)();
 | 
				
			||||||
 | 
					        const messageInfo = { phone, code };
 | 
				
			||||||
 | 
					        await this.verificationService.sendPhoneCode(messageInfo);
 | 
				
			||||||
 | 
					        await this.redisCacheService.set({ key, val: code }, 1 * 60);
 | 
				
			||||||
 | 
					        return '验证码发送成功、请填写验证码完成注册!';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    createTokenFromFingerprint(fingerprint) {
 | 
				
			||||||
 | 
					        const token = this.jwtService.sign({
 | 
				
			||||||
 | 
					            username: `游客${fingerprint}`,
 | 
				
			||||||
 | 
					            id: fingerprint,
 | 
				
			||||||
 | 
					            email: `${fingerprint}@nine.com`,
 | 
				
			||||||
 | 
					            role: 'visitor',
 | 
				
			||||||
 | 
					            openId: null,
 | 
				
			||||||
 | 
					            client: null,
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return token;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AuthService = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __param(0, (0, typeorm_2.InjectRepository)(config_entity_1.ConfigEntity)),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [typeorm_1.Repository,
 | 
				
			||||||
 | 
					        user_service_1.UserService,
 | 
				
			||||||
 | 
					        jwt_1.JwtService,
 | 
				
			||||||
 | 
					        mailer_service_1.MailerService,
 | 
				
			||||||
 | 
					        verification_service_1.VerificationService,
 | 
				
			||||||
 | 
					        userBalance_service_1.UserBalanceService,
 | 
				
			||||||
 | 
					        redisCache_service_1.RedisCacheService,
 | 
				
			||||||
 | 
					        globalConfig_service_1.GlobalConfigService])
 | 
				
			||||||
 | 
					], AuthService);
 | 
				
			||||||
 | 
					exports.AuthService = AuthService;
 | 
				
			||||||
							
								
								
									
										32
									
								
								dist/modules/auth/dto/adminLogin.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								dist/modules/auth/dto/adminLogin.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AdminLoginDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class AdminLoginDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'super', description: '邮箱' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(2, { message: '用户名最短是两位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户名最长不得超过30位!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AdminLoginDto.prototype, "username", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '999999', description: '密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AdminLoginDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					exports.AdminLoginDto = AdminLoginDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/auth/dto/authLogin.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/auth/dto/authLogin.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UserLoginDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UserLoginDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'super', description: '邮箱' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(2, { message: '用户名最短是两位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户名最长不得超过30位!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserLoginDto.prototype, "username", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '用户ID' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UserLoginDto.prototype, "uid", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '999999', description: '密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserLoginDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					exports.UserLoginDto = UserLoginDto;
 | 
				
			||||||
							
								
								
									
										66
									
								
								dist/modules/auth/dto/authRegister.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								dist/modules/auth/dto/authRegister.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,66 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UserRegisterDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UserRegisterDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'cooper', description: '用户名称' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(2, { message: '用户名最低需要大于2位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(12, { message: '用户名不得超过12位!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "username", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '123456', description: '用户密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'J_longyan@163.com', description: '用户邮箱' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsEmail)({}, { message: '请填写正确格式的邮箱!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '邮箱不能为空!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "email", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '5k3n', description: '图形验证码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '验证码为空!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "captchaCode", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '2313ko423ko', description: '图形验证码KEY' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '验证ID不能为空!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "captchaId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'FRJDLJHFNV', description: '用户填写的别人邀请码', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "invitedBy", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({
 | 
				
			||||||
 | 
					        example: 'https://public-1300678944.cos.ap-shanghai.myqcloud.com/blog/1682571295452image.png',
 | 
				
			||||||
 | 
					        description: '用户头像',
 | 
				
			||||||
 | 
					        required: false,
 | 
				
			||||||
 | 
					    }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "avatar", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'default', description: '用户注册来源', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterDto.prototype, "client", void 0);
 | 
				
			||||||
 | 
					exports.UserRegisterDto = UserRegisterDto;
 | 
				
			||||||
							
								
								
									
										30
									
								
								dist/modules/auth/dto/loginByPhone.dt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								dist/modules/auth/dto/loginByPhone.dt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.LoginByPhoneDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class LoginByPhoneDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '19999999', description: '手机号' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '手机号不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsPhoneNumber)('CN', { message: '手机号格式不正确!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], LoginByPhoneDto.prototype, "phone", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '999999', description: '密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], LoginByPhoneDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					exports.LoginByPhoneDto = LoginByPhoneDto;
 | 
				
			||||||
							
								
								
									
										34
									
								
								dist/modules/auth/dto/sendPhoneCode.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								dist/modules/auth/dto/sendPhoneCode.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.SendPhoneCodeDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class SendPhoneCodeDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '199999999', description: '手机号' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '手机号不能为空' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(11, { message: '手机号长度为11位' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(11, { message: '手机号长度为11位!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], SendPhoneCodeDto.prototype, "phone", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '2b4i1b4', description: '图形验证码KEY' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '验证码KEY不能为空' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], SendPhoneCodeDto.prototype, "captchaId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '1g4d', description: '图形验证码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '验证码不能为空' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], SendPhoneCodeDto.prototype, "captchaCode", void 0);
 | 
				
			||||||
 | 
					exports.SendPhoneCodeDto = SendPhoneCodeDto;
 | 
				
			||||||
							
								
								
									
										24
									
								
								dist/modules/auth/dto/updatePassByOther.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								dist/modules/auth/dto/updatePassByOther.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdatePassByOtherDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UpdatePassByOtherDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '666666', description: '三方用户更新新密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdatePassByOtherDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					exports.UpdatePassByOtherDto = UpdatePassByOtherDto;
 | 
				
			||||||
							
								
								
									
										31
									
								
								dist/modules/auth/dto/updatePassword.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								dist/modules/auth/dto/updatePassword.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdatePasswordDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UpdatePasswordDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '123456', description: '用户旧密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdatePasswordDto.prototype, "oldPassword", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '666666', description: '用户更新新密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdatePasswordDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					exports.UpdatePasswordDto = UpdatePasswordDto;
 | 
				
			||||||
							
								
								
									
										47
									
								
								dist/modules/auth/dto/userRegisterByPhone.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								dist/modules/auth/dto/userRegisterByPhone.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UserRegisterByPhoneDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UserRegisterByPhoneDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'cooper', description: '用户名称' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户名不能为空!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(2, { message: '用户名最低需要大于2位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(12, { message: '用户名不得超过12位!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterByPhoneDto.prototype, "username", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '123456', description: '用户密码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '用户密码不能为空' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MinLength)(6, { message: '用户密码最低需要大于6位数!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.MaxLength)(30, { message: '用户密码最长不能超过30位数!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterByPhoneDto.prototype, "password", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '19999999999', description: '用户手机号码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsPhoneNumber)('CN', { message: '手机号码格式不正确!' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '手机号码不能为空!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterByPhoneDto.prototype, "phone", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '152546', description: '手机验证码' }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsNotEmpty)({ message: '手机验证码不能为空!' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterByPhoneDto.prototype, "phoneCode", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'SNINE', description: '用户邀请码', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UserRegisterByPhoneDto.prototype, "invitedBy", void 0);
 | 
				
			||||||
 | 
					exports.UserRegisterByPhoneDto = UserRegisterByPhoneDto;
 | 
				
			||||||
							
								
								
									
										32
									
								
								dist/modules/autoreply/autoreplay.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								dist/modules/autoreply/autoreplay.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AutoReplyEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let AutoReplyEntity = class AutoReplyEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '提问的问题', type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AutoReplyEntity.prototype, "prompt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '定义的答案', type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AutoReplyEntity.prototype, "answer", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ default: 1, comment: '启用当前自动回复状态, 0:关闭 1:启用' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], AutoReplyEntity.prototype, "status", void 0);
 | 
				
			||||||
 | 
					AutoReplyEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'auto_reply' })
 | 
				
			||||||
 | 
					], AutoReplyEntity);
 | 
				
			||||||
 | 
					exports.AutoReplyEntity = AutoReplyEntity;
 | 
				
			||||||
							
								
								
									
										87
									
								
								dist/modules/autoreply/autoreply.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								dist/modules/autoreply/autoreply.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,87 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AutoreplyController = void 0;
 | 
				
			||||||
 | 
					const autoreply_service_1 = require("./autoreply.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const queryAutoReply_dto_1 = require("./dto/queryAutoReply.dto");
 | 
				
			||||||
 | 
					const addAutoReply_dto_1 = require("./dto/addAutoReply.dto");
 | 
				
			||||||
 | 
					const updateAutoReply_dto_1 = require("./dto/updateAutoReply.dto");
 | 
				
			||||||
 | 
					const delBadWords_dto_1 = require("./dto/delBadWords.dto");
 | 
				
			||||||
 | 
					const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
 | 
				
			||||||
 | 
					const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
 | 
				
			||||||
 | 
					let AutoreplyController = class AutoreplyController {
 | 
				
			||||||
 | 
					    constructor(autoreplyService) {
 | 
				
			||||||
 | 
					        this.autoreplyService = autoreplyService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    queryAutoreply(query) {
 | 
				
			||||||
 | 
					        return this.autoreplyService.queryAutoreply(query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    addAutoreply(body) {
 | 
				
			||||||
 | 
					        return this.autoreplyService.addAutoreply(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    updateAutoreply(body) {
 | 
				
			||||||
 | 
					        return this.autoreplyService.updateAutoreply(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delAutoreply(body) {
 | 
				
			||||||
 | 
					        return this.autoreplyService.delAutoreply(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('query'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '查询自动回复' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [queryAutoReply_dto_1.QueryAutoReplyDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AutoreplyController.prototype, "queryAutoreply", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('add'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '添加自动回复' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [addAutoReply_dto_1.AddAutoReplyDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AutoreplyController.prototype, "addAutoreply", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('update'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '修改自动回复' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [updateAutoReply_dto_1.UpdateAutpReplyDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AutoreplyController.prototype, "updateAutoreply", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('del'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除自动回复' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [delBadWords_dto_1.DelAutoReplyDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], AutoreplyController.prototype, "delAutoreply", null);
 | 
				
			||||||
 | 
					AutoreplyController = __decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiTags)('autoreply'),
 | 
				
			||||||
 | 
					    (0, common_1.Controller)('autoreply'),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [autoreply_service_1.AutoreplyService])
 | 
				
			||||||
 | 
					], AutoreplyController);
 | 
				
			||||||
 | 
					exports.AutoreplyController = AutoreplyController;
 | 
				
			||||||
							
								
								
									
										26
									
								
								dist/modules/autoreply/autoreply.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								dist/modules/autoreply/autoreply.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AutoreplyModule = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const autoreply_controller_1 = require("./autoreply.controller");
 | 
				
			||||||
 | 
					const autoreply_service_1 = require("./autoreply.service");
 | 
				
			||||||
 | 
					const typeorm_1 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const autoreplay_entity_1 = require("./autoreplay.entity");
 | 
				
			||||||
 | 
					let AutoreplyModule = class AutoreplyModule {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AutoreplyModule = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Global)(),
 | 
				
			||||||
 | 
					    (0, common_1.Module)({
 | 
				
			||||||
 | 
					        imports: [typeorm_1.TypeOrmModule.forFeature([autoreplay_entity_1.AutoReplyEntity])],
 | 
				
			||||||
 | 
					        controllers: [autoreply_controller_1.AutoreplyController],
 | 
				
			||||||
 | 
					        providers: [autoreply_service_1.AutoreplyService],
 | 
				
			||||||
 | 
					        exports: [autoreply_service_1.AutoreplyService],
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					], AutoreplyModule);
 | 
				
			||||||
 | 
					exports.AutoreplyModule = AutoreplyModule;
 | 
				
			||||||
							
								
								
									
										94
									
								
								dist/modules/autoreply/autoreply.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								dist/modules/autoreply/autoreply.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AutoreplyService = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const autoreplay_entity_1 = require("./autoreplay.entity");
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const typeorm_2 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					let AutoreplyService = class AutoreplyService {
 | 
				
			||||||
 | 
					    constructor(autoReplyEntity) {
 | 
				
			||||||
 | 
					        this.autoReplyEntity = autoReplyEntity;
 | 
				
			||||||
 | 
					        this.autoReplyKes = [];
 | 
				
			||||||
 | 
					        this.autoReplyMap = {};
 | 
				
			||||||
 | 
					        this.autoReplyFuzzyMatch = true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async onModuleInit() {
 | 
				
			||||||
 | 
					        this.loadAutoReplyList();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async loadAutoReplyList() {
 | 
				
			||||||
 | 
					        const res = await this.autoReplyEntity.find({ where: { status: 1 }, select: ['prompt', 'answer'] });
 | 
				
			||||||
 | 
					        this.autoReplyMap = {};
 | 
				
			||||||
 | 
					        res.forEach((t) => (this.autoReplyMap[t.prompt] = t.answer));
 | 
				
			||||||
 | 
					        this.autoReplyKes = Object.keys(this.autoReplyMap);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async checkAutoReply(prompt) {
 | 
				
			||||||
 | 
					        let question = prompt;
 | 
				
			||||||
 | 
					        if (this.autoReplyFuzzyMatch) {
 | 
				
			||||||
 | 
					            question = this.autoReplyKes.find((item) => item.includes(prompt));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return question ? this.autoReplyMap[question] : '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async queryAutoreply(query) {
 | 
				
			||||||
 | 
					        const { page = 1, size = 10, prompt, status } = query;
 | 
				
			||||||
 | 
					        const where = {};
 | 
				
			||||||
 | 
					        [0, 1, '0', '1'].includes(status) && (where.status = status);
 | 
				
			||||||
 | 
					        prompt && (where.prompt = (0, typeorm_1.Like)(`%${prompt}%`));
 | 
				
			||||||
 | 
					        const [rows, count] = await this.autoReplyEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					            order: { id: 'DESC' },
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async addAutoreply(body) {
 | 
				
			||||||
 | 
					        const { prompt } = body;
 | 
				
			||||||
 | 
					        const a = await this.autoReplyEntity.findOne({ where: { prompt } });
 | 
				
			||||||
 | 
					        if (a) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该问题已存在,请检查您的提交信息', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.autoReplyEntity.save(body);
 | 
				
			||||||
 | 
					        await this.loadAutoReplyList();
 | 
				
			||||||
 | 
					        return '添加问题成功!';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updateAutoreply(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const res = await this.autoReplyEntity.update({ id }, body);
 | 
				
			||||||
 | 
					        if (res.affected > 0) {
 | 
				
			||||||
 | 
					            await this.loadAutoReplyList();
 | 
				
			||||||
 | 
					            return '更新问题成功';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('更新失败', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async delAutoreply(body) {
 | 
				
			||||||
 | 
					        const { id } = body;
 | 
				
			||||||
 | 
					        const z = await this.autoReplyEntity.findOne({ where: { id } });
 | 
				
			||||||
 | 
					        if (!z) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('该问题不存在,请检查您的提交信息', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.autoReplyEntity.delete({ id });
 | 
				
			||||||
 | 
					        if (res.affected > 0) {
 | 
				
			||||||
 | 
					            await this.loadAutoReplyList();
 | 
				
			||||||
 | 
					            return '删除问题成功';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        throw new common_1.HttpException('删除失败', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					AutoreplyService = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __param(0, (0, typeorm_2.InjectRepository)(autoreplay_entity_1.AutoReplyEntity)),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [typeorm_1.Repository])
 | 
				
			||||||
 | 
					], AutoreplyService);
 | 
				
			||||||
 | 
					exports.AutoreplyService = AutoreplyService;
 | 
				
			||||||
							
								
								
									
										24
									
								
								dist/modules/autoreply/dto/addAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								dist/modules/autoreply/dto/addAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AddAutoReplyDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class AddAutoReplyDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '你是谁', description: '提问的问题', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AddAutoReplyDto.prototype, "prompt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '我是NineAi提供的Ai服务机器人', description: '回答的答案', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AddAutoReplyDto.prototype, "answer", void 0);
 | 
				
			||||||
 | 
					exports.AddAutoReplyDto = AddAutoReplyDto;
 | 
				
			||||||
							
								
								
									
										20
									
								
								dist/modules/autoreply/dto/delBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								dist/modules/autoreply/dto/delBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.DelAutoReplyDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class DelAutoReplyDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '自动回复id', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], DelAutoReplyDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.DelAutoReplyDto = DelAutoReplyDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/autoreply/dto/queryAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/autoreply/dto/queryAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.QueryAutoReplyDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class QueryAutoReplyDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '查询页数', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryAutoReplyDto.prototype, "page", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 10, description: '每页数量', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryAutoReplyDto.prototype, "size", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '你是谁', description: '提问问题', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QueryAutoReplyDto.prototype, "prompt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '问题状态', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryAutoReplyDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.QueryAutoReplyDto = QueryAutoReplyDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/autoreply/dto/updateAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/autoreply/dto/updateAutoReply.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdateAutpReplyDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UpdateAutpReplyDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '自动回复id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateAutpReplyDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '你可以干嘛', description: '问题', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdateAutpReplyDto.prototype, "prompt", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '我可以干很多事情.......', description: '答案', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdateAutpReplyDto.prototype, "answer", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 0, description: '状态', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateAutpReplyDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.UpdateAutpReplyDto = UpdateAutpReplyDto;
 | 
				
			||||||
							
								
								
									
										100
									
								
								dist/modules/badwords/badwords.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								dist/modules/badwords/badwords.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,100 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.BadwordsController = void 0;
 | 
				
			||||||
 | 
					const badwords_service_1 = require("./badwords.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const queryBadWords_dto_1 = require("./dto/queryBadWords.dto");
 | 
				
			||||||
 | 
					const queryViolation_dto_1 = require("./dto/queryViolation.dto");
 | 
				
			||||||
 | 
					const updateBadWords_dto_1 = require("./dto/updateBadWords.dto");
 | 
				
			||||||
 | 
					const delBadWords_dto_1 = require("./dto/delBadWords.dto");
 | 
				
			||||||
 | 
					const addBadWords_dto_1 = require("./dto/addBadWords.dto");
 | 
				
			||||||
 | 
					const superAuth_guard_1 = require("../../common/auth/superAuth.guard");
 | 
				
			||||||
 | 
					const adminAuth_guard_1 = require("../../common/auth/adminAuth.guard");
 | 
				
			||||||
 | 
					let BadwordsController = class BadwordsController {
 | 
				
			||||||
 | 
					    constructor(badwordsService) {
 | 
				
			||||||
 | 
					        this.badwordsService = badwordsService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    queryBadWords(query) {
 | 
				
			||||||
 | 
					        return this.badwordsService.queryBadWords(query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delBadWords(body) {
 | 
				
			||||||
 | 
					        return this.badwordsService.delBadWords(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    updateBadWords(body) {
 | 
				
			||||||
 | 
					        return this.badwordsService.updateBadWords(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    addBadWord(body) {
 | 
				
			||||||
 | 
					        return this.badwordsService.addBadWord(body);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    violation(req, query) {
 | 
				
			||||||
 | 
					        return this.badwordsService.violation(req, query);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('query'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '查询所有敏感词' }),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [queryBadWords_dto_1.QueryBadWordsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], BadwordsController.prototype, "queryBadWords", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('del'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除敏感词' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [delBadWords_dto_1.DelBadWordsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], BadwordsController.prototype, "delBadWords", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('update'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '更新敏感词' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [updateBadWords_dto_1.UpdateBadWordsDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], BadwordsController.prototype, "updateBadWords", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('add'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '新增敏感词' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(superAuth_guard_1.SuperAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [addBadWords_dto_1.AddBadWordDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], BadwordsController.prototype, "addBadWord", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('violation'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '查询违规记录' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(adminAuth_guard_1.AdminAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Query)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object, queryViolation_dto_1.QueryViolationDto]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], BadwordsController.prototype, "violation", null);
 | 
				
			||||||
 | 
					BadwordsController = __decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiTags)('badWords'),
 | 
				
			||||||
 | 
					    (0, common_1.Controller)('badwords'),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [badwords_service_1.BadwordsService])
 | 
				
			||||||
 | 
					], BadwordsController);
 | 
				
			||||||
 | 
					exports.BadwordsController = BadwordsController;
 | 
				
			||||||
							
								
								
									
										32
									
								
								dist/modules/badwords/badwords.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								dist/modules/badwords/badwords.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.BadWordsEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let BadWordsEntity = class BadWordsEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ length: 20, comment: '敏感词' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], BadWordsEntity.prototype, "word", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ default: 1, comment: '敏感词开启状态' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], BadWordsEntity.prototype, "status", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ default: 0, comment: '敏感词触发次数' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], BadWordsEntity.prototype, "count", void 0);
 | 
				
			||||||
 | 
					BadWordsEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'bad_words' })
 | 
				
			||||||
 | 
					], BadWordsEntity);
 | 
				
			||||||
 | 
					exports.BadWordsEntity = BadWordsEntity;
 | 
				
			||||||
							
								
								
									
										28
									
								
								dist/modules/badwords/badwords.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								dist/modules/badwords/badwords.module.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.BadwordsModule = void 0;
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const badwords_service_1 = require("./badwords.service");
 | 
				
			||||||
 | 
					const badwords_controller_1 = require("./badwords.controller");
 | 
				
			||||||
 | 
					const typeorm_1 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const badwords_entity_1 = require("./badwords.entity");
 | 
				
			||||||
 | 
					const violationLog_entity_1 = require("./violationLog.entity");
 | 
				
			||||||
 | 
					const user_entity_1 = require("../user/user.entity");
 | 
				
			||||||
 | 
					let BadwordsModule = class BadwordsModule {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					BadwordsModule = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Global)(),
 | 
				
			||||||
 | 
					    (0, common_1.Module)({
 | 
				
			||||||
 | 
					        imports: [typeorm_1.TypeOrmModule.forFeature([badwords_entity_1.BadWordsEntity, violationLog_entity_1.ViolationLogEntity, user_entity_1.UserEntity])],
 | 
				
			||||||
 | 
					        providers: [badwords_service_1.BadwordsService],
 | 
				
			||||||
 | 
					        controllers: [badwords_controller_1.BadwordsController],
 | 
				
			||||||
 | 
					        exports: [badwords_service_1.BadwordsService],
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
 | 
					], BadwordsModule);
 | 
				
			||||||
 | 
					exports.BadwordsModule = BadwordsModule;
 | 
				
			||||||
							
								
								
									
										224
									
								
								dist/modules/badwords/badwords.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										224
									
								
								dist/modules/badwords/badwords.service.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,224 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.BadwordsService = void 0;
 | 
				
			||||||
 | 
					const globalConfig_service_1 = require("./../globalConfig/globalConfig.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const badwords_entity_1 = require("./badwords.entity");
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const typeorm_2 = require("@nestjs/typeorm");
 | 
				
			||||||
 | 
					const axios_1 = require("axios");
 | 
				
			||||||
 | 
					const violationLog_entity_1 = require("./violationLog.entity");
 | 
				
			||||||
 | 
					const user_entity_1 = require("../user/user.entity");
 | 
				
			||||||
 | 
					const utils_1 = require("../../common/utils");
 | 
				
			||||||
 | 
					let BadwordsService = class BadwordsService {
 | 
				
			||||||
 | 
					    constructor(badWordsEntity, violationLogEntity, userEntity, globalConfigService) {
 | 
				
			||||||
 | 
					        this.badWordsEntity = badWordsEntity;
 | 
				
			||||||
 | 
					        this.violationLogEntity = violationLogEntity;
 | 
				
			||||||
 | 
					        this.userEntity = userEntity;
 | 
				
			||||||
 | 
					        this.globalConfigService = globalConfigService;
 | 
				
			||||||
 | 
					        this.badWords = [];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async onModuleInit() {
 | 
				
			||||||
 | 
					        this.loadBadWords();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async customSensitiveWords(content, userId) {
 | 
				
			||||||
 | 
					        const triggeredWords = [];
 | 
				
			||||||
 | 
					        for (let i = 0; i < this.badWords.length; i++) {
 | 
				
			||||||
 | 
					            const word = this.badWords[i];
 | 
				
			||||||
 | 
					            if (content.includes(word)) {
 | 
				
			||||||
 | 
					                triggeredWords.push(word);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (triggeredWords.length) {
 | 
				
			||||||
 | 
					            await this.recordUserBadWords(userId, content, triggeredWords, ['自定义'], '自定义检测');
 | 
				
			||||||
 | 
					            const tips = `您提交的信息中包含违规的内容、我们已对您的账户进行标记、请合规使用!`;
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(tips, common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async checkBadWords(content, userId) {
 | 
				
			||||||
 | 
					        const config = await this.globalConfigService.getSensitiveConfig();
 | 
				
			||||||
 | 
					        if (config) {
 | 
				
			||||||
 | 
					            await this.checkBadWordsByConfig(content, config, userId);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.customSensitiveWords(content, userId);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async checkBadWordsByConfig(content, config, userId) {
 | 
				
			||||||
 | 
					        const { useType } = config;
 | 
				
			||||||
 | 
					        useType === 'baidu' && (await this.baiduCheckBadWords(content, config.baiduTextAccessToken, userId));
 | 
				
			||||||
 | 
					        useType === 'nineai' && (await this.nineaiCheckBadWords(content, config, userId));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    extractContent(str) {
 | 
				
			||||||
 | 
					        const pattern = /存在(.*?)不合规/;
 | 
				
			||||||
 | 
					        const match = str.match(pattern);
 | 
				
			||||||
 | 
					        return match ? match[1] : '';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async baiduCheckBadWords(content, accessToken, userId) {
 | 
				
			||||||
 | 
					        if (!accessToken)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        const url = `https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined?access_token=${accessToken}}`;
 | 
				
			||||||
 | 
					        const headers = {
 | 
				
			||||||
 | 
					            'Content-Type': 'application/x-www-form-urlencoded',
 | 
				
			||||||
 | 
					            Accept: 'application/json',
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        const response = await axios_1.default.post(url, { text: content }, { headers });
 | 
				
			||||||
 | 
					        const { conclusion, error_code, error_msg, conclusionType, data } = response.data;
 | 
				
			||||||
 | 
					        if (error_code) {
 | 
				
			||||||
 | 
					            console.log('百度文本检测出现错误、请查看配置信息: ', error_msg);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (conclusionType !== 1) {
 | 
				
			||||||
 | 
					            const types = [...new Set(data.map((item) => this.extractContent(item.msg)))];
 | 
				
			||||||
 | 
					            await this.recordUserBadWords(userId, content, ['***'], types, '百度云检测');
 | 
				
			||||||
 | 
					            const tips = `您提交的信息中包含${types.join(',')}的内容、我们已对您的账户进行标记、请合规使用!`;
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(tips, common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async nineaiCheckBadWords(content, config, userId) {
 | 
				
			||||||
 | 
					        var _a;
 | 
				
			||||||
 | 
					        const { nineaiBuiltInSensitiveApiBase, nineaiBuiltInSensitiveAuthKey } = config;
 | 
				
			||||||
 | 
					        if (!nineaiBuiltInSensitiveApiBase || !nineaiBuiltInSensitiveAuthKey)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        const res = await axios_1.default.post(nineaiBuiltInSensitiveApiBase, { content }, { headers: { 'Content-Type': 'application/json', Authorization: nineaiBuiltInSensitiveAuthKey } });
 | 
				
			||||||
 | 
					        if (!res.data)
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        if (res.data.code !== '0') {
 | 
				
			||||||
 | 
					            const { msg = '检测失败' } = res.data;
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(`敏感词检测 | ${msg}`, common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (res.data.word_list && ((_a = res.data.word_list) === null || _a === void 0 ? void 0 : _a.length)) {
 | 
				
			||||||
 | 
					            const words = [...new Set(res.data.word_list.map((t) => t.keyword))];
 | 
				
			||||||
 | 
					            const types = [...new Set(res.data.word_list.map((t) => t.category))];
 | 
				
			||||||
 | 
					            await this.recordUserBadWords(userId, content, words, types, 'NineAi检测');
 | 
				
			||||||
 | 
					            const tips = this.formarTips(res.data.word_list);
 | 
				
			||||||
 | 
					            throw new common_1.HttpException(tips, common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    formarTips(wordList) {
 | 
				
			||||||
 | 
					        const categorys = wordList.map((t) => t.category);
 | 
				
			||||||
 | 
					        const unSet = [...new Set(categorys)];
 | 
				
			||||||
 | 
					        return `您提交的内容中包含${unSet.join(',')}的信息、我们已对您账号进行标记、请合规使用!`;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async loadBadWords() {
 | 
				
			||||||
 | 
					        const data = await this.badWordsEntity.find({ where: { status: 1 }, select: ['word'] });
 | 
				
			||||||
 | 
					        this.badWords = data.map((t) => t.word);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async queryBadWords(query) {
 | 
				
			||||||
 | 
					        const { page = 1, size = 500, word, status } = query;
 | 
				
			||||||
 | 
					        const where = {};
 | 
				
			||||||
 | 
					        [0, 1, '0', '1'].includes(status) && (where.status = status);
 | 
				
			||||||
 | 
					        word && (where.word = (0, typeorm_1.Like)(`%${word}%`));
 | 
				
			||||||
 | 
					        const [rows, count] = await this.badWordsEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					            order: { id: 'ASC' },
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async delBadWords(body) {
 | 
				
			||||||
 | 
					        const b = await this.badWordsEntity.findOne({ where: { id: body.id } });
 | 
				
			||||||
 | 
					        if (!b) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('敏感词不存在,请检查您的提交信息', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.badWordsEntity.delete({ id: body.id });
 | 
				
			||||||
 | 
					        if (res.affected > 0) {
 | 
				
			||||||
 | 
					            await this.loadBadWords();
 | 
				
			||||||
 | 
					            return '删除敏感词成功';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('删除敏感词失败', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async updateBadWords(body) {
 | 
				
			||||||
 | 
					        const { id, word, status } = body;
 | 
				
			||||||
 | 
					        const b = await this.badWordsEntity.findOne({ where: { word } });
 | 
				
			||||||
 | 
					        if (b) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('敏感词已经存在了、请勿重复添加', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        const res = await this.badWordsEntity.update({ id }, { word, status });
 | 
				
			||||||
 | 
					        if (res.affected > 0) {
 | 
				
			||||||
 | 
					            await this.loadBadWords();
 | 
				
			||||||
 | 
					            return '更新敏感词成功';
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        else {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('更新敏感词失败', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async addBadWord(body) {
 | 
				
			||||||
 | 
					        const { word } = body;
 | 
				
			||||||
 | 
					        const b = await this.badWordsEntity.findOne({ where: { word } });
 | 
				
			||||||
 | 
					        if (b) {
 | 
				
			||||||
 | 
					            throw new common_1.HttpException('敏感词已存在,请检查您的提交信息', common_1.HttpStatus.BAD_REQUEST);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        await this.badWordsEntity.save({ word });
 | 
				
			||||||
 | 
					        await this.loadBadWords();
 | 
				
			||||||
 | 
					        return '添加敏感词成功';
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async recordUserBadWords(userId, content, words, typeCn, typeOriginCn) {
 | 
				
			||||||
 | 
					        const data = {
 | 
				
			||||||
 | 
					            userId,
 | 
				
			||||||
 | 
					            content,
 | 
				
			||||||
 | 
					            words: JSON.stringify(words),
 | 
				
			||||||
 | 
					            typeCn: JSON.stringify(typeCn),
 | 
				
			||||||
 | 
					            typeOriginCn,
 | 
				
			||||||
 | 
					        };
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            await this.userEntity
 | 
				
			||||||
 | 
					                .createQueryBuilder()
 | 
				
			||||||
 | 
					                .update(user_entity_1.UserEntity)
 | 
				
			||||||
 | 
					                .set({ violationCount: () => 'violationCount + 1' })
 | 
				
			||||||
 | 
					                .where('id = :userId', { userId })
 | 
				
			||||||
 | 
					                .execute();
 | 
				
			||||||
 | 
					            await this.violationLogEntity.save(data);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        catch (error) {
 | 
				
			||||||
 | 
					            console.log('error: ', error);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    async violation(req, query) {
 | 
				
			||||||
 | 
					        const { role } = req.user;
 | 
				
			||||||
 | 
					        const { page = 1, size = 10, userId, typeOriginCn } = query;
 | 
				
			||||||
 | 
					        const where = {};
 | 
				
			||||||
 | 
					        userId && (where['userId'] = userId);
 | 
				
			||||||
 | 
					        typeOriginCn && (where['typeOriginCn'] = typeOriginCn);
 | 
				
			||||||
 | 
					        const [rows, count] = await this.violationLogEntity.findAndCount({
 | 
				
			||||||
 | 
					            where,
 | 
				
			||||||
 | 
					            skip: (page - 1) * size,
 | 
				
			||||||
 | 
					            take: size,
 | 
				
			||||||
 | 
					            order: { id: 'DESC' },
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        const userIds = [...new Set(rows.map((t) => t.userId))];
 | 
				
			||||||
 | 
					        const usersInfo = await this.userEntity.find({
 | 
				
			||||||
 | 
					            where: { id: (0, typeorm_1.In)(userIds) },
 | 
				
			||||||
 | 
					            select: ['id', 'avatar', 'username', 'email', 'violationCount', 'status'],
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        rows.forEach((t) => {
 | 
				
			||||||
 | 
					            const user = usersInfo.find((u) => u.id === t.userId);
 | 
				
			||||||
 | 
					            role !== 'super' && (user.email = (0, utils_1.hideString)(user.email));
 | 
				
			||||||
 | 
					            t.userInfo = user;
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return { rows, count };
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					BadwordsService = __decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Injectable)(),
 | 
				
			||||||
 | 
					    __param(0, (0, typeorm_2.InjectRepository)(badwords_entity_1.BadWordsEntity)),
 | 
				
			||||||
 | 
					    __param(1, (0, typeorm_2.InjectRepository)(violationLog_entity_1.ViolationLogEntity)),
 | 
				
			||||||
 | 
					    __param(2, (0, typeorm_2.InjectRepository)(user_entity_1.UserEntity)),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [typeorm_1.Repository,
 | 
				
			||||||
 | 
					        typeorm_1.Repository,
 | 
				
			||||||
 | 
					        typeorm_1.Repository,
 | 
				
			||||||
 | 
					        globalConfig_service_1.GlobalConfigService])
 | 
				
			||||||
 | 
					], BadwordsService);
 | 
				
			||||||
 | 
					exports.BadwordsService = BadwordsService;
 | 
				
			||||||
							
								
								
									
										20
									
								
								dist/modules/badwords/dto/addBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								dist/modules/badwords/dto/addBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.AddBadWordDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class AddBadWordDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'test', description: '敏感词', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], AddBadWordDto.prototype, "word", void 0);
 | 
				
			||||||
 | 
					exports.AddBadWordDto = AddBadWordDto;
 | 
				
			||||||
							
								
								
									
										20
									
								
								dist/modules/badwords/dto/delBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								dist/modules/badwords/dto/delBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.DelBadWordsDto = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class DelBadWordsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '敏感词id', required: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], DelBadWordsDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					exports.DelBadWordsDto = DelBadWordsDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/badwords/dto/queryBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/badwords/dto/queryBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.QueryBadWordsDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class QueryBadWordsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '查询页数', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryBadWordsDto.prototype, "page", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 10, description: '每页数量', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryBadWordsDto.prototype, "size", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'test', description: '敏感词内容', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QueryBadWordsDto.prototype, "word", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '关键词状态', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryBadWordsDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.QueryBadWordsDto = QueryBadWordsDto;
 | 
				
			||||||
							
								
								
									
										37
									
								
								dist/modules/badwords/dto/queryViolation.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								dist/modules/badwords/dto/queryViolation.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.QueryViolationDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class QueryViolationDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '查询页数', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryViolationDto.prototype, "page", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 10, description: '每页数量', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryViolationDto.prototype, "size", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '用户ID', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], QueryViolationDto.prototype, "userId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: '百度云检测', description: '检测平台来源', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], QueryViolationDto.prototype, "typeOriginCn", void 0);
 | 
				
			||||||
 | 
					exports.QueryViolationDto = QueryViolationDto;
 | 
				
			||||||
							
								
								
									
										32
									
								
								dist/modules/badwords/dto/updateBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								dist/modules/badwords/dto/updateBadWords.dto.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.UpdateBadWordsDto = void 0;
 | 
				
			||||||
 | 
					const class_validator_1 = require("class-validator");
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					class UpdateBadWordsDto {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '敏感词id', required: true }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateBadWordsDto.prototype, "id", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 'test', description: '敏感词内容', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], UpdateBadWordsDto.prototype, "word", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiProperty)({ example: 1, description: '关键词状态', required: false }),
 | 
				
			||||||
 | 
					    (0, class_validator_1.IsOptional)(),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], UpdateBadWordsDto.prototype, "status", void 0);
 | 
				
			||||||
 | 
					exports.UpdateBadWordsDto = UpdateBadWordsDto;
 | 
				
			||||||
							
								
								
									
										40
									
								
								dist/modules/badwords/violationLog.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								dist/modules/badwords/violationLog.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.ViolationLogEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let ViolationLogEntity = class ViolationLogEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '用户id' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], ViolationLogEntity.prototype, "userId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '违规内容', type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ViolationLogEntity.prototype, "content", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '敏感词', type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ViolationLogEntity.prototype, "words", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '违规类型' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ViolationLogEntity.prototype, "typeCn", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '违规检测失败于哪个平台' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ViolationLogEntity.prototype, "typeOriginCn", void 0);
 | 
				
			||||||
 | 
					ViolationLogEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'violation_log' })
 | 
				
			||||||
 | 
					], ViolationLogEntity);
 | 
				
			||||||
 | 
					exports.ViolationLogEntity = ViolationLogEntity;
 | 
				
			||||||
							
								
								
									
										101
									
								
								dist/modules/chatGroup/chatGroup.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								dist/modules/chatGroup/chatGroup.controller.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,101 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __param = (this && this.__param) || function (paramIndex, decorator) {
 | 
				
			||||||
 | 
					    return function (target, key) { decorator(target, key, paramIndex); }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.ChatGroupController = void 0;
 | 
				
			||||||
 | 
					const swagger_1 = require("@nestjs/swagger");
 | 
				
			||||||
 | 
					const chatGroup_service_1 = require("./chatGroup.service");
 | 
				
			||||||
 | 
					const common_1 = require("@nestjs/common");
 | 
				
			||||||
 | 
					const createGroup_dto_1 = require("./dto/createGroup.dto");
 | 
				
			||||||
 | 
					const jwtAuth_guard_1 = require("../../common/auth/jwtAuth.guard");
 | 
				
			||||||
 | 
					const delGroup_dto_1 = require("./dto/delGroup.dto");
 | 
				
			||||||
 | 
					const updateGroup_dto_1 = require("./dto/updateGroup.dto");
 | 
				
			||||||
 | 
					let ChatGroupController = class ChatGroupController {
 | 
				
			||||||
 | 
					    constructor(chatGroupService) {
 | 
				
			||||||
 | 
					        this.chatGroupService = chatGroupService;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    create(body, req) {
 | 
				
			||||||
 | 
					        return this.chatGroupService.create(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    query(req) {
 | 
				
			||||||
 | 
					        return this.chatGroupService.query(req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    update(body, req) {
 | 
				
			||||||
 | 
					        return this.chatGroupService.update(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    del(body, req) {
 | 
				
			||||||
 | 
					        return this.chatGroupService.del(body, req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    delAll(req) {
 | 
				
			||||||
 | 
					        return this.chatGroupService.delAll(req);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('create'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '创建对话组' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [createGroup_dto_1.CreateGroupDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], ChatGroupController.prototype, "create", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Get)('query'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '查询对话组' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], ChatGroupController.prototype, "query", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('update'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '更新对话组' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [updateGroup_dto_1.UpdateGroupDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], ChatGroupController.prototype, "update", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('del'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除对话组' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Body)()),
 | 
				
			||||||
 | 
					    __param(1, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [delGroup_dto_1.DelGroupDto, Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], ChatGroupController.prototype, "del", null);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, common_1.Post)('delAll'),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiOperation)({ summary: '删除对话组' }),
 | 
				
			||||||
 | 
					    (0, common_1.UseGuards)(jwtAuth_guard_1.JwtAuthGuard),
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiBearerAuth)(),
 | 
				
			||||||
 | 
					    __param(0, (0, common_1.Req)()),
 | 
				
			||||||
 | 
					    __metadata("design:type", Function),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [Object]),
 | 
				
			||||||
 | 
					    __metadata("design:returntype", void 0)
 | 
				
			||||||
 | 
					], ChatGroupController.prototype, "delAll", null);
 | 
				
			||||||
 | 
					ChatGroupController = __decorate([
 | 
				
			||||||
 | 
					    (0, swagger_1.ApiTags)('group'),
 | 
				
			||||||
 | 
					    (0, common_1.Controller)('group'),
 | 
				
			||||||
 | 
					    __metadata("design:paramtypes", [chatGroup_service_1.ChatGroupService])
 | 
				
			||||||
 | 
					], ChatGroupController);
 | 
				
			||||||
 | 
					exports.ChatGroupController = ChatGroupController;
 | 
				
			||||||
							
								
								
									
										44
									
								
								dist/modules/chatGroup/chatGroup.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								dist/modules/chatGroup/chatGroup.entity.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					"use strict";
 | 
				
			||||||
 | 
					var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
 | 
				
			||||||
 | 
					    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
 | 
				
			||||||
 | 
					    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
 | 
				
			||||||
 | 
					    return c > 3 && r && Object.defineProperty(target, key, r), r;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					var __metadata = (this && this.__metadata) || function (k, v) {
 | 
				
			||||||
 | 
					    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					Object.defineProperty(exports, "__esModule", { value: true });
 | 
				
			||||||
 | 
					exports.ChatGroupEntity = void 0;
 | 
				
			||||||
 | 
					const typeorm_1 = require("typeorm");
 | 
				
			||||||
 | 
					const baseEntity_1 = require("../../common/entity/baseEntity");
 | 
				
			||||||
 | 
					let ChatGroupEntity = class ChatGroupEntity extends baseEntity_1.BaseEntity {
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '用户ID' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "userId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '是否置顶聊天', type: 'boolean', default: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Boolean)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "isSticky", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '分组名称', nullable: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "title", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '应用ID', nullable: true }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Number)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "appId", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '是否删除了', default: false }),
 | 
				
			||||||
 | 
					    __metadata("design:type", Boolean)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "isDelete", void 0);
 | 
				
			||||||
 | 
					__decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Column)({ comment: '配置', nullable: true, default: null, type: 'text' }),
 | 
				
			||||||
 | 
					    __metadata("design:type", String)
 | 
				
			||||||
 | 
					], ChatGroupEntity.prototype, "config", void 0);
 | 
				
			||||||
 | 
					ChatGroupEntity = __decorate([
 | 
				
			||||||
 | 
					    (0, typeorm_1.Entity)({ name: 'chat_group' })
 | 
				
			||||||
 | 
					], ChatGroupEntity);
 | 
				
			||||||
 | 
					exports.ChatGroupEntity = ChatGroupEntity;
 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user