fix: 转换器后处理优化

 新增 postProcessCleanup 方法:
- 修复 this.fs. 和 this.path. → fs. 和 path.
- 修复逻辑运算符优先级
  - !this.config.get('x') === 'y' → this.config.get('x') !== 'y'

 配置访问优化:
- WebAppEnvs.get().property.exists() → fs.existsSync(this.config.get('property'))
- GlobalConfig.property.exists() → fs.existsSync(this.config.get('property'))

🎯 效果:
- 减少语法错误
- 修复常见转换问题
This commit is contained in:
wanwu
2025-10-29 13:55:43 +08:00
parent 4d9309cc58
commit bad1b60aa4
159 changed files with 546 additions and 585 deletions

View File

@@ -50,13 +50,39 @@ class ServiceMethodConverter {
tsBody = this.convertDependencyCalls(tsBody, context); tsBody = this.convertDependencyCalls(tsBody, context);
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 【阶段5】添加缩进 // 【阶段5】后处理清理
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
tsBody = this.postProcessCleanup(tsBody);
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 【阶段6】添加缩进
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
tsBody = tsBody.split('\n').map(line => ' ' + line).join('\n'); tsBody = tsBody.split('\n').map(line => ' ' + line).join('\n');
return tsBody; return tsBody;
} }
/**
* 【阶段5】后处理清理
* 修复转换后的常见语法错误
*/
postProcessCleanup(tsBody) {
// 1. 修复 this.fs. 和 this.path. → fs. 和 path.
tsBody = tsBody.replace(/this\.fs\./g, 'fs.');
tsBody = tsBody.replace(/this\.path\./g, 'path.');
// 2. 修复逻辑运算符优先级问题
// if (!this.config.get('xxx') === "yyy") → if (this.config.get('xxx') !== "yyy")
tsBody = tsBody.replace(/if\s*\(\s*!this\.config\.get\([^)]+\)\s*===\s*([^)]+)\)/g, (match) => {
// 提取内容
const configCall = match.match(/this\.config\.get\([^)]+\)/)[0];
const value = match.match(/===\s*([^)]+)\)/)[1].trim();
return `if (${configCall} !== ${value})`;
});
return tsBody;
}
/** /**
* 【阶段1】基础语法转换 * 【阶段1】基础语法转换
*/ */
@@ -120,12 +146,24 @@ class ServiceMethodConverter {
// 【配置访问】WebAppEnvs / GlobalConfig → ConfigService // 【配置访问】WebAppEnvs / GlobalConfig → ConfigService
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// WebAppEnvs.get().property.exists() → fs.existsSync(this.config.get('property'))
// 必须在WebAppEnvs.get().property之前处理
tsBody = tsBody.replace(/WebAppEnvs\.get\(\)\.(\w+)\.exists\(\)/g, (match, prop) => {
return `fs.existsSync(this.config.get('${prop}'))`;
});
// WebAppEnvs.get().property → this.config.get('property') // WebAppEnvs.get().property → this.config.get('property')
tsBody = tsBody.replace(/WebAppEnvs\.get\(\)\.(\w+)/g, (match, prop) => { tsBody = tsBody.replace(/WebAppEnvs\.get\(\)\.(\w+)/g, (match, prop) => {
return `this.config.get('${prop}')`; return `this.config.get('${prop}')`;
}); });
tsBody = tsBody.replace(/WebAppEnvs\.get\(\)/g, 'this.config'); tsBody = tsBody.replace(/WebAppEnvs\.get\(\)/g, 'this.config');
// GlobalConfig.property.exists() → fs.existsSync(this.config.get('property'))
// 必须在GlobalConfig.property之前处理
tsBody = tsBody.replace(/GlobalConfig\.(\w+)\.exists\(\)/g, (match, prop) => {
return `fs.existsSync(this.config.get('${prop}'))`;
});
// GlobalConfig.property → this.config.get('property') // GlobalConfig.property → this.config.get('property')
tsBody = tsBody.replace(/GlobalConfig\.(\w+)/g, (match, prop) => { tsBody = tsBody.replace(/GlobalConfig\.(\w+)/g, (match, prop) => {
return `this.config.get('${prop}')`; return `this.config.get('${prop}')`;

View File

@@ -1,12 +1,14 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
import * as path from 'path';
@Injectable() @Injectable()
export class AddonDevelopBuildServiceImplService { export class AddonDevelopBuildServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -25,11 +27,11 @@ export class AddonDevelopBuildServiceImplService {
try { try {
for (const child of this.fs.readdirSync(addonPath)) { for (const child of this.fs.readdirSync(addonPath)) {
if (fs.lstatSync(child).isDirectory() && !path.basename(child) === "sql") FileUtils.cleanDirectory(child); if (fs.lstatSync(child).isDirectory() && !path.basename(child) === "sql") fs.rmSync(child, { recursive: true, force: true });
} }
FileUtils.copyFile(infoFile, this.addonPath + "info.json"); fs.copyFileSync(infoFile, this.addonPath + "info.json");
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
this.admin(); this.admin();
@@ -52,6 +54,6 @@ export class AddonDevelopBuildServiceImplService {
async download(...args: any[]): Promise<any> { async download(...args: any[]): Promise<any> {
const file: string = this.config.get('webRootDownResource' + "temp/" + key + ".zip"); const file: string = this.config.get('webRootDownResource' + "temp/" + key + ".zip");
if (!fs.existsSync(file)) throw new BadRequestException("请先打包插件"); if (!fs.existsSync(file)) throw new BadRequestException("请先打包插件");
return file.getPath().replace(this.config.get('projectRoot'), ""); return file.replace(this.config.get('projectRoot'), "");
} }
} }

View File

@@ -1,12 +1,14 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
import * as path from 'path';
@Injectable() @Injectable()
export class AddonDevelopServiceImplService { export class AddonDevelopServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -105,8 +107,8 @@ export class AddonDevelopServiceImplService {
if (addon != null) throw new BadRequestException("已安装的插件不允许删除"); if (addon != null) throw new BadRequestException("已安装的插件不允许删除");
try { try {
FileUtils.deleteDirectory(this.config.get('webRootDownAddon' + key)); fs.rmSync(this.config.get('webRootDownAddon', { recursive: true, force: true } + key));
} catch (Exception e) { } catch (e) {
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AddonLogServiceImplService { export class AddonLogServiceImplService {

View File

@@ -1,12 +1,14 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
import * as path from 'path';
@Injectable() @Injectable()
export class AddonServiceImplService { export class AddonServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -72,7 +74,7 @@ export class AddonServiceImplService {
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
vo.setError(e.getMessage()); vo.setError(e.message);
} }
vo.setList(list); vo.setList(list);
@@ -246,10 +248,10 @@ export class AddonServiceImplService {
try (const fos: FileOutputStream = new FileOutputStream(file)) { try (const fos: FileOutputStream = new FileOutputStream(file)) {
fos.write(response.bodyBytes()); fos.write(response.bodyBytes());
ZipUtil.unzip(file.getPath(), this.config.get('webRootDownAddon'), Charset.forName(System.getProperty("sun.jnu.encoding"))); ZipUtil.unzip(file, this.config.get('webRootDownAddon'), Charset.forName(System.getProperty("sun.jnu.encoding")));
} catch (Exception e) { } catch (e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AliappConfigServiceImplService { export class AliappConfigServiceImplService {

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException, UnauthorizedException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class AuthServiceImplService { export class AuthServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -194,7 +195,7 @@ export class AuthServiceImplService {
model.setCreateTime(System.currentTimeMillis() / 1000); model.setCreateTime(System.currentTimeMillis() / 1000);
model.setOperation(getDescription(request)); model.setOperation(getDescription(request));
sysUserLogMapper.insert(model); sysUserLogMapper.insert(model);
} catch (Exception e) { } catch (e) {
} }
} }

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class ConfigServiceImplService { export class ConfigServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, UnauthorizedException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class LoginServiceImplService { export class LoginServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class CaptchaServiceImplService { export class CaptchaServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AdminAppServiceImplService { export class AdminAppServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class DictServiceImplService { export class DictServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyConfigServiceImplService { export class DiyConfigServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class DiyRouteServiceImplService { export class DiyRouteServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class DiyServiceImplService { export class DiyServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyThemeServiceImplService { export class DiyThemeServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyFormConfigServiceImplService { export class DiyFormConfigServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyFormRecordsServiceImplService { export class DiyFormRecordsServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -91,7 +91,7 @@ export class DiyFormRecordsServiceImplService {
const obj: any = clazz.getDeclaredConstructor().newInstance(); const obj: any = clazz.getDeclaredConstructor().newInstance();
const method: Method = clazz.getMethod("render", String.class, String.class); const method: Method = clazz.getMethod("render", String.class, String.class);
value.put("render_value", method.invoke(obj, value.get("field_value").toString(), value.get("field_type").toString())); value.put("render_value", method.invoke(obj, value.get("field_value").toString(), value.get("field_type").toString()));
}catch (Exception e){ }catch (e){
e.printStackTrace(); e.printStackTrace();
} }
@@ -147,7 +147,7 @@ export class DiyFormRecordsServiceImplService {
const obj: any = clazz.getDeclaredConstructor().newInstance(); const obj: any = clazz.getDeclaredConstructor().newInstance();
const method: Method = clazz.getMethod("render", String.class, String.class); const method: Method = clazz.getMethod("render", String.class, String.class);
value.put("render_value", method.invoke(obj, value.get("field_value").toString(), value.get("field_type").toString())); value.put("render_value", method.invoke(obj, value.get("field_value").toString(), value.get("field_type").toString()));
}catch (Exception e){ }catch (e){
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyFormServiceImplService { export class DiyFormServiceImplService {
@@ -551,9 +550,9 @@ export class DiyFormServiceImplService {
diyFormRecordsFieldsMapper.delete(fieldsQueryWrapper); diyFormRecordsFieldsMapper.delete(fieldsQueryWrapper);
return true; return true;
} catch (Exception e) { } catch (e) {
// 事务会自动回滚,因为使用了 @Transactional 注解 // 事务会自动回滚,因为使用了 @Transactional 注解
throw new BadRequestException("删除记录失败: " + e.getMessage()); throw new BadRequestException("删除记录失败: " + e.message);
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class GenerateColumnServiceImplService { export class GenerateColumnServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class GenerateServiceImplService { export class GenerateServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -321,7 +321,7 @@ export class GenerateServiceImplService {
FileTools.createDirs(packageDir); FileTools.createDirs(packageDir);
FileUtil.clean(tempDir); FileUtil.clean(tempDir);
for (const coreGenerateTemplateVo of list) { for (const coreGenerateTemplateVo of list) {
FileTools.createDirs(packageDir + coreGenerateTemplateVo.getPath()); FileTools.createDirs(packageDir + coreGenerateTemplateVo);
FileUtil.writeUtf8String(coreGenerateTemplateVo.getData(), packageDir + coreGenerateTemplateVo.getPath(, coreGenerateTemplateVo.getFileName())); FileUtil.writeUtf8String(coreGenerateTemplateVo.getData(), packageDir + coreGenerateTemplateVo.getPath(, coreGenerateTemplateVo.getFileName()));
} }
const zipFile: string = ZipUtil.zip(packageDir, tempDir + "package.zip"); const zipFile: string = ZipUtil.zip(packageDir, tempDir + "package.zip");
@@ -333,7 +333,7 @@ export class GenerateServiceImplService {
if (coreGenerateTemplateVo.getType() === "sql") { if (coreGenerateTemplateVo.getType() === "sql") {
SQLScriptRunnerTools.execScript(coreGenerateTemplateVo.getData()); SQLScriptRunnerTools.execScript(coreGenerateTemplateVo.getData());
} else { } else {
FileUtil.writeUtf8String(coreGenerateTemplateVo.getData(), this.config.get('projectRoot' + "/" + coreGenerateTemplateVo.getPath(), coreGenerateTemplateVo.getFileName())); FileUtil.writeUtf8String(coreGenerateTemplateVo.getData(), this.config.get('projectRoot' + "/" + coreGenerateTemplateVo, coreGenerateTemplateVo.getFileName()));
} }
} }
} }
@@ -353,7 +353,7 @@ export class GenerateServiceImplService {
vo.setName(coreGenerateTemplateVo.getFileName()); vo.setName(coreGenerateTemplateVo.getFileName());
vo.setType(coreGenerateTemplateVo.getType()); vo.setType(coreGenerateTemplateVo.getType());
vo.setContent(coreGenerateTemplateVo.getData()); vo.setContent(coreGenerateTemplateVo.getData());
vo.setFileDir(coreGenerateTemplateVo.getPath() + "/"); vo.setFileDir(coreGenerateTemplateVo + "/");
voList.add(vo); voList.add(vo);
} }
return voList; return voList;

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AuthSiteServiceImplService { export class AuthSiteServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberAccountServiceImplService { export class MemberAccountServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberAddressServiceImplService { export class MemberAddressServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberCashOutServiceImplService { export class MemberCashOutServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberConfigServiceImplService { export class MemberConfigServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberLabelServiceImplService { export class MemberLabelServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberLevelServiceImplService { export class MemberLevelServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberServiceImplService { export class MemberServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberSignServiceImplService { export class MemberSignServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
@Injectable() @Injectable()
export class CloudBuildServiceImplService { export class CloudBuildServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -143,8 +144,8 @@ export class CloudBuildServiceImplService {
if (this.buildTask == null) return; if (this.buildTask == null) return;
const tempDir: string = this.config.get('webRootDownRuntime' + "cloud_build/" + this.buildTask.getStr("task_key")); const tempDir: string = this.config.get('webRootDownRuntime' + "cloud_build/" + this.buildTask.getStr("task_key"));
try { try {
if (fs.existsSync(tempDir)) FileUtils.deleteDirectory(tempDir); if (fs.existsSync(tempDir)) fs.rmSync(tempDir, { recursive: true, force: true });
} catch (Exception e) { } catch (e) {
} }
cached.remove("cloud_build_task"); cached.remove("cloud_build_task");
this.buildTask = null; this.buildTask = null;

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class NiuCloudServiceImplService { export class NiuCloudServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class NoticeLogServiceImplService { export class NoticeLogServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class NoticeServiceImplService { export class NoticeServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class NuiSmsServiceImplService { export class NuiSmsServiceImplService {
@@ -20,8 +20,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取验证码失败异常信息:{}", e.getMessage()); log.error("获取验证码失败异常信息:{}", e.message);
throw new Error(e); throw new Error(e);
} }
} }
@@ -40,8 +40,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("发送验证码失败异常信息:{}", e.getMessage()); log.error("发送验证码失败异常信息:{}", e.message);
throw new AdminException("发送验证码失败"); throw new AdminException("发送验证码失败");
} }
} }
@@ -58,8 +58,8 @@ export class NuiSmsServiceImplService {
result = NiucloudUtils.Niucloud.post(ACCOUNT_REGISTER_URL, param); result = NiucloudUtils.Niucloud.post(ACCOUNT_REGISTER_URL, param);
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
} catch (Exception e) { } catch (e) {
log.error("注册账号失败异常信息:{}", e.getMessage()); log.error("注册账号失败异常信息:{}", e.message);
throw new AdminException("注册账号失败"); throw new AdminException("注册账号失败");
} }
return result; return result;
@@ -85,9 +85,9 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("登录账号失败异常信息:{}", e.getMessage()); log.error("登录账号失败异常信息:{}", e.message);
throw new AdminException(e.getMessage()); throw new AdminException(e.message);
} }
} }
@@ -117,8 +117,8 @@ export class NuiSmsServiceImplService {
const resetPasswordJson: Record<string, any> = NiucloudUtils.Niucloud.put(resetPasswordUrl, resetPasswordBody); const resetPasswordJson: Record<string, any> = NiucloudUtils.Niucloud.put(resetPasswordUrl, resetPasswordBody);
const resetPasswordDataJson: Record<string, any> = resetPasswordJson.getJSONObject("data"); const resetPasswordDataJson: Record<string, any> = resetPasswordJson.getJSONObject("data");
newPassword = resetPasswordDataJson.getStr("newPassword"); newPassword = resetPasswordDataJson.getStr("newPassword");
} catch (Exception e) { } catch (e) {
log.error("重置密码失败异常信息:{}", e.getMessage()); log.error("重置密码失败异常信息:{}", e.message);
throw new AdminException("重置密码失败"); throw new AdminException("重置密码失败");
} }
@@ -150,7 +150,7 @@ export class NuiSmsServiceImplService {
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (JSONException e) { } catch (JSONException e) {
log.error("获取用户信息失败异常信息:{}", e.getMessage()); log.error("获取用户信息失败异常信息:{}", e.message);
throw new AdminException("获取用户信息失败"); throw new AdminException("获取用户信息失败");
} }
} }
@@ -284,8 +284,8 @@ export class NuiSmsServiceImplService {
result = jsonObject.getJSONObject("data"); result = jsonObject.getJSONObject("data");
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
} catch (Exception e) { } catch (e) {
log.error("获取订单列表失败异常信息:{}", e.getMessage()); log.error("获取订单列表失败异常信息:{}", e.message);
throw new AdminException("获取订单列表失败"); throw new AdminException("获取订单列表失败");
} }
return result; return result;
@@ -308,8 +308,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取发送列表失败异常信息:{}", e.getMessage()); log.error("获取发送列表失败异常信息:{}", e.message);
throw new AdminException("获取发送列表失败"); throw new AdminException("获取发送列表失败");
} }
} }
@@ -357,8 +357,8 @@ export class NuiSmsServiceImplService {
setConfig(registerAccountParam); setConfig(registerAccountParam);
JacksonUtils.removeNull(jsonObject); JacksonUtils.removeNull(jsonObject);
return jsonObject; return jsonObject;
} catch (Exception e) { } catch (e) {
log.error("修改账号信息失败异常信息:{}", e.getMessage()); log.error("修改账号信息失败异常信息:{}", e.message);
throw new AdminException("修改账号信息失败"); throw new AdminException("修改账号信息失败");
} }
} }
@@ -384,8 +384,8 @@ export class NuiSmsServiceImplService {
editAccount(username, editAccountParam); editAccount(username, editAccountParam);
} }
return failList; return failList;
} catch (Exception e) { } catch (e) {
log.error("删除签名失败异常信息:{}", e.getMessage()); log.error("删除签名失败异常信息:{}", e.message);
throw new AdminException("删除签名失败异常"); throw new AdminException("删除签名失败异常");
} }
} }
@@ -406,7 +406,7 @@ export class NuiSmsServiceImplService {
throw new ApiException(failList.getJSONObject(0).getStr("msg")); throw new ApiException(failList.getJSONObject(0).getStr("msg"));
} }
} catch (ApiException e) { } catch (ApiException e) {
log.error("创建签名失败异常信息:{}", e.getMessage()); log.error("创建签名失败异常信息:{}", e.message);
throw new AdminException("创建签名失败"); throw new AdminException("创建签名失败");
} }
} }
@@ -432,8 +432,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取套餐列表失败异常信息:{}", e.getMessage()); log.error("获取套餐列表失败异常信息:{}", e.message);
throw new AdminException("获取套餐列表失败"); throw new AdminException("获取套餐列表失败");
} }
} }
@@ -451,8 +451,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("计算订单失败异常信息:{}", e.getMessage()); log.error("计算订单失败异常信息:{}", e.message);
throw new AdminException("计算订单失败"); throw new AdminException("计算订单失败");
} }
} }
@@ -470,8 +470,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("创建订单失败异常信息:{}", e.getMessage()); log.error("创建订单失败异常信息:{}", e.message);
throw new AdminException("创建订单失败"); throw new AdminException("创建订单失败");
} }
} }
@@ -500,8 +500,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取支付信息失败异常信息:{}", e.getMessage()); log.error("获取支付信息失败异常信息:{}", e.message);
throw new AdminException("获取支付信息失败"); throw new AdminException("获取支付信息失败");
} }
} }
@@ -517,8 +517,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取订单信息失败异常信息:{}", e.getMessage()); log.error("获取订单信息失败异常信息:{}", e.message);
throw new AdminException("获取订单信息失败"); throw new AdminException("获取订单信息失败");
} }
} }
@@ -534,8 +534,8 @@ export class NuiSmsServiceImplService {
//删除null值 防止序列化报错 //删除null值 防止序列化报错
JacksonUtils.removeNull(result); JacksonUtils.removeNull(result);
return result; return result;
} catch (Exception e) { } catch (e) {
log.error("获取订单状态失败异常信息:{}", e.getMessage()); log.error("获取订单状态失败异常信息:{}", e.message);
throw new AdminException("获取订单状态失败"); throw new AdminException("获取订单状态失败");
} }
} }
@@ -583,8 +583,8 @@ export class NuiSmsServiceImplService {
const jsonObject: Record<string, any> = NiucloudUtils.Niucloud.post(templateCreateUrl, templateCreateBody); const jsonObject: Record<string, any> = NiucloudUtils.Niucloud.post(templateCreateUrl, templateCreateBody);
result = jsonObject.getJSONObject("data"); result = jsonObject.getJSONObject("data");
JacksonUtils.removeNull(result); // 删除null值防止序列化报错 JacksonUtils.removeNull(result); // 删除null值防止序列化报错
} catch (Exception e) { } catch (e) {
log.error("创建模版失败异常信息:{}", e.getMessage()); log.error("创建模版失败异常信息:{}", e.message);
throw new AdminException("创建模版失败"); throw new AdminException("创建模版失败");
} }
@@ -629,8 +629,8 @@ export class NuiSmsServiceImplService {
try { try {
sendHttp(TEMPLATE_DELETE, deleteBody); sendHttp(TEMPLATE_DELETE, deleteBody);
niuSmsTemplateMapper.delete(new QueryWrapper<NiuSmsTemplate>().eq("template_id", templateId)); niuSmsTemplateMapper.delete(new QueryWrapper<NiuSmsTemplate>().eq("template_id", templateId));
} catch (Exception e) { } catch (e) {
log.error("删除模版失败异常信息:{}", e.getMessage()); log.error("删除模版失败异常信息:{}", e.message);
throw new AdminException("删除模版失败"); throw new AdminException("删除模版失败");
} }
} }
@@ -660,8 +660,8 @@ export class NuiSmsServiceImplService {
niuSmsTemplate.setAuditStatus(auditStatus); niuSmsTemplate.setAuditStatus(auditStatus);
niuSmsTemplateMapper.updateById(niuSmsTemplate); niuSmsTemplateMapper.updateById(niuSmsTemplate);
return niuSmsTemplate; return niuSmsTemplate;
} catch (Exception e) { } catch (e) {
log.error("获取模版信息失败异常信息:{}", e.getMessage()); log.error("获取模版信息失败异常信息:{}", e.message);
throw new AdminException("获取模版信息失败"); throw new AdminException("获取模版信息失败");
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class PayChannelServiceImplService { export class PayChannelServiceImplService {
@@ -85,8 +84,8 @@ export class PayChannelServiceImplService {
if (ObjectUtil.isNotEmpty(value)) { if (ObjectUtil.isNotEmpty(value)) {
try { try {
config.set(key, StringUtils.hide(value, 0, value.length())); config.set(key, StringUtils.hide(value, 0, value.length()));
} catch (Exception e) { } catch (e) {
log.error("字段:{},值:{},支付设置脱敏失败{}", key, value, e.getMessage()); log.error("字段:{},值:{},支付设置脱敏失败{}", key, value, e.message);
} }
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class PayRefundServiceImplService { export class PayRefundServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class PayServiceImplService { export class PayServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class PayTransferServiceImplService { export class PayTransferServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SiteAccountLogServiceImplService { export class SiteAccountLogServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SiteGroupServiceImplService { export class SiteGroupServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -51,7 +51,7 @@ export class SiteGroupServiceImplService {
iconAndTitle.setTitle(addon.getTitle()); iconAndTitle.setTitle(addon.getTitle());
try { try {
iconAndTitle.setIcon(ImageToBase64ConverterUtil.convertToBase64(addon.getIcon())); iconAndTitle.setIcon(ImageToBase64ConverterUtil.convertToBase64(addon.getIcon()));
} catch (Exception e) { } catch (e) {
iconAndTitle.setIcon(""); iconAndTitle.setIcon("");
} }
addonListResult.add(iconAndTitle); addonListResult.add(iconAndTitle);
@@ -62,7 +62,7 @@ export class SiteGroupServiceImplService {
iconAndTitle.setTitle(addon.getTitle()); iconAndTitle.setTitle(addon.getTitle());
try { try {
iconAndTitle.setIcon(ImageToBase64ConverterUtil.convertToBase64(addon.getIcon())); iconAndTitle.setIcon(ImageToBase64ConverterUtil.convertToBase64(addon.getIcon()));
} catch (Exception e) { } catch (e) {
iconAndTitle.setIcon(""); iconAndTitle.setIcon("");
} }

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SiteServiceImplService { export class SiteServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -244,10 +245,10 @@ export class SiteServiceImplService {
const wrapper: any = wrapperConstructor.newInstance(entityClass); const wrapper: any = wrapperConstructor.newInstance(entityClass);
eqMethod.invoke(wrapper, true, "site_id", id); eqMethod.invoke(wrapper, true, "site_id", id);
deleteMethod.invoke(mapper, wrapper); deleteMethod.invoke(mapper, wrapper);
} catch (Exception e) { } catch (e) {
log.error("删除表数据失败: {} | 原因: {}", log.error("删除表数据失败: {} | 原因: {}",
entityClass.getSimpleName(), entityClass.getSimpleName(),
e.getCause() != null ? e.getCause().getMessage() : e.getMessage()); e.getCause() != null ? e.getCause().getMessage() : e.message);
} }
} }
@@ -259,9 +260,9 @@ export class SiteServiceImplService {
// 删除站点主表 // 删除站点主表
siteMapper.deleteById(id); siteMapper.deleteById(id);
} catch (Exception e) { } catch (e) {
log.error("删除站点失败: {}", e.getMessage(), e); log.error("删除站点失败: {}", e.message, e);
throw new BadRequestException("删除失败: " + (e.getCause() != null ? e.getCause().getMessage() : e.getMessage())); throw new BadRequestException("删除失败: " + (e.getCause() != null ? e.getCause().getMessage() : e.message));
} }
// 清理缓存 // 清理缓存

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SiteUserServiceImplService { export class SiteUserServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -91,8 +91,8 @@ export class SiteUserServiceImplService {
sysUserRoleParam.setUid(uid); sysUserRoleParam.setUid(uid);
sysUserRoleParam.setStatus(siteUserParam.getStatus()); sysUserRoleParam.setStatus(siteUserParam.getStatus());
sysUserRoleService.edit(sysUserRoleParam); sysUserRoleService.edit(sysUserRoleParam);
}catch (Exception e){ }catch (e){
throw new AdminException(e.getMessage()); throw new AdminException(e.message);
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class StatHourServiceImplService { export class StatHourServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class StatServiceImplService { export class StatServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysAgreementServiceImplService { export class SysAgreementServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysAreaServiceImplService { export class SysAreaServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysAttachmentServiceImplService { export class SysAttachmentServiceImplService {
@@ -29,7 +29,7 @@ export class SysAttachmentServiceImplService {
for (const item of iPage.getRecords()) { for (const item of iPage.getRecords()) {
const vo: SysAttachmentListVo = new SysAttachmentListVo(); const vo: SysAttachmentListVo = new SysAttachmentListVo();
BeanUtils.copyProperties(item, vo); BeanUtils.copyProperties(item, vo);
vo.setThumb(CommonUtils.thumbImageSmall(item.getSiteId(), item.getPath())); vo.setThumb(CommonUtils.thumbImageSmall(item.getSiteId(), item));
list.add(vo); list.add(vo);
} }
return PageResult.build(page, limit, iPage.getTotal()).setData(list); return PageResult.build(page, limit, iPage.getTotal()).setData(list);
@@ -90,7 +90,7 @@ export class SysAttachmentServiceImplService {
throw new BadRequestException("请选择要删除的附件"); throw new BadRequestException("请选择要删除的附件");
} }
for (const sysAttachment of sysAttachmentList) { for (const sysAttachment of sysAttachmentList) {
coreUploadService.delete(sysAttachment.getSiteId(), sysAttachment.getStorageType(), sysAttachment.getPath()); coreUploadService.delete(sysAttachment.getSiteId(), sysAttachment.getStorageType(), sysAttachment);
} }
sysAttachmentMapper.delete(new QueryWrapper<SysAttachment>().eq("site_id", RequestUtils.siteId()).in("att_id", param.getAttIds())); sysAttachmentMapper.delete(new QueryWrapper<SysAttachment>().eq("site_id", RequestUtils.siteId()).in("att_id", param.getAttIds()));
} }

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
@Injectable() @Injectable()
export class SysBackupRecordsServiceImplService { export class SysBackupRecordsServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -95,8 +96,8 @@ export class SysBackupRecordsServiceImplService {
const file: string = backupDir(item.getBackupKey(), "backup"); const file: string = backupDir(item.getBackupKey(), "backup");
if (fs.existsSync(file)) { if (fs.existsSync(file)) {
try { try {
FileUtils.deleteDirectory(file); fs.rmSync(file, { recursive: true, force: true });
} catch (Exception e) { } catch (e) {
} }
} }
} }
@@ -155,10 +156,10 @@ export class SysBackupRecordsServiceImplService {
vo.setParams(null); vo.setParams(null);
} }
setBackupRestoreTaskCache(vo); setBackupRestoreTaskCache(vo);
} catch (Exception e) { } catch (e) {
vo.setStep(step); vo.setStep(step);
vo.setTask("fail"); vo.setTask("fail");
vo.setContent("备份恢复失败稍后请手动恢复备份文件路径webroot/runtime/upgrade/"+ record.getBackupKey() +"/backup失败原因" + e.getMessage()); vo.setContent("备份恢复失败稍后请手动恢复备份文件路径webroot/runtime/upgrade/"+ record.getBackupKey() +"/backup失败原因" + e.message);
setBackupRestoreTaskCache(vo); setBackupRestoreTaskCache(vo);
// 删除备份记录 // 删除备份记录
sysBackupRecordsMapper.delete(new QueryWrapper<SysBackupRecords>().eq("backup_key", vo.getKey())); sysBackupRecordsMapper.delete(new QueryWrapper<SysBackupRecords>().eq("backup_key", vo.getKey()));
@@ -208,10 +209,10 @@ export class SysBackupRecordsServiceImplService {
vo.setParams(null); vo.setParams(null);
} }
setBackupTaskCache(vo); setBackupTaskCache(vo);
} catch (Exception e) { } catch (e) {
vo.setStep(step); vo.setStep(step);
vo.setTask("fail"); vo.setTask("fail");
vo.setContent("备份失败,稍后请重新手动备份,失败原因:" + e.getMessage()); vo.setContent("备份失败,稍后请重新手动备份,失败原因:" + e.message);
setBackupTaskCache(vo); setBackupTaskCache(vo);
// 删除备份记录 // 删除备份记录
sysBackupRecordsMapper.delete(new QueryWrapper<SysBackupRecords>().eq("backup_key", vo.getKey())); sysBackupRecordsMapper.delete(new QueryWrapper<SysBackupRecords>().eq("backup_key", vo.getKey()));
@@ -279,7 +280,7 @@ export class SysBackupRecordsServiceImplService {
if (delayed > 0) { if (delayed > 0) {
try { try {
Thread.sleep(delayed * 1000); Thread.sleep(delayed * 1000);
} catch (Exception e) { } catch (e) {
} }
} }
const cache: Cached = CacheFactory.getCacheOperator(); const cache: Cached = CacheFactory.getCacheOperator();
@@ -293,7 +294,7 @@ export class SysBackupRecordsServiceImplService {
if (delayed > 0) { if (delayed > 0) {
try { try {
Thread.sleep(delayed * 1000); Thread.sleep(delayed * 1000);
} catch (Exception e) { } catch (e) {
} }
} }
const cache: Cached = CacheFactory.getCacheOperator(); const cache: Cached = CacheFactory.getCacheOperator();

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysConfigServiceImplService { export class SysConfigServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysExportServiceImplService { export class SysExportServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysMenuServiceImplService { export class SysMenuServiceImplService {
@@ -228,7 +227,7 @@ export class SysMenuServiceImplService {
} }
//排除菜单 //排除菜单
menuList = sysMenuMapper.selectList(queryWrapper); menuList = sysMenuMapper.selectList(queryWrapper);
} catch (Exception e) { } catch (e) {
throw new BaseException("查询菜单错误"); throw new BaseException("查询菜单错误");
} }
return menuList; return menuList;

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysNoticeLogServiceImplService { export class SysNoticeLogServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysNoticeServiceImplService { export class SysNoticeServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysNoticeSmsLogServiceImplService { export class SysNoticeSmsLogServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysPosterServiceImplService { export class SysPosterServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysPrinterServiceImplService { export class SysPrinterServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysPrinterTemplateServiceImplService { export class SysPrinterTemplateServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysRoleServiceImplService { export class SysRoleServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysScheduleServiceImplService { export class SysScheduleServiceImplService {
@@ -285,9 +285,9 @@ export class SysScheduleServiceImplService {
.job(classPath) .job(classPath)
.build()); .build());
} catch (Exception e) { } catch (e) {
// 获取任务名称(即使在异常情况下也尝试获取) // 获取任务名称(即使在异常情况下也尝试获取)
const errorMsg: string = "计划任务:" + path.basename(sysSchedule) + "发生错误, 错误原因:" + e.getMessage() + const errorMsg: string = "计划任务:" + path.basename(sysSchedule) + "发生错误, 错误原因:" + e.message +
" at " + e.getStackTrace()[0].toString(); " at " + e.getStackTrace()[0].toString();
addLog(SysScheduleLog.builder() addLog(SysScheduleLog.builder()
.key(jobKey) .key(jobKey)

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class SysUpgradeRecordsServiceImplService { export class SysUpgradeRecordsServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysUserLogServiceImplService { export class SysUserLogServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysUserRoleServiceImplService { export class SysUserRoleServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysUserServiceImplService { export class SysUserServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -252,8 +252,8 @@ export class SysUserServiceImplService {
sysUserRoleParam.setStatus(siteUserParam.getStatus()); sysUserRoleParam.setStatus(siteUserParam.getStatus());
sysUserRoleParam.setIsAdmin(isAdmin); sysUserRoleParam.setIsAdmin(isAdmin);
sysUserRoleService.add(sysUserRoleParam); sysUserRoleService.add(sysUserRoleParam);
} catch (Exception e) { } catch (e) {
throw new AdminException(e.getMessage()); throw new AdminException(e.message);
} }
return uid; return uid;
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SystemServiceImplService { export class SystemServiceImplService {
@@ -49,7 +48,7 @@ export class SystemServiceImplService {
} }
const dir: string = "upload/qrcode/" + RequestUtils.siteId() + "/" + param.getFolder(); const dir: string = "upload/qrcode/" + RequestUtils.siteId() + "/" + param.getFolder();
vo.setWeappPath(QrcodeUtils.qrcodeToFile(RequestUtils.siteId(), "weapp", "", param.getPage(), data, dir)); vo.setWeappPath(QrcodeUtils.qrcodeToFile(RequestUtils.siteId(), "weapp", "", param.getPage(), data, dir));
} catch (Exception e) { } catch (e) {
} }
return vo; return vo;

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
@Injectable() @Injectable()
export class UpgradeServiceImplService { export class UpgradeServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -223,7 +224,7 @@ export class UpgradeServiceImplService {
if (delayed > 0) { if (delayed > 0) {
try { try {
Thread.sleep(delayed * 1000); Thread.sleep(delayed * 1000);
} catch (Exception e) { } catch (e) {
} }
} }
const cache: Cached = CacheFactory.getCacheOperator(); const cache: Cached = CacheFactory.getCacheOperator();
@@ -258,12 +259,12 @@ export class UpgradeServiceImplService {
vo.setAddon(vo.getUpgradeApps().get(0)); vo.setAddon(vo.getUpgradeApps().get(0));
} }
setUpgradeTaskCache(vo); setUpgradeTaskCache(vo);
} catch (Exception e) { } catch (e) {
if (e.getMessage().includes("队列")) { if (e.message.includes("队列")) {
throw e; throw e;
} else { } else {
vo.setStep(step); vo.setStep(step);
vo.getError().add(e.getMessage()); vo.getError().add(e.message);
setUpgradeTaskCache(vo); setUpgradeTaskCache(vo);
this.upgradeErrorHandle(vo); this.upgradeErrorHandle(vo);
e.printStackTrace(); e.printStackTrace();
@@ -304,7 +305,7 @@ export class UpgradeServiceImplService {
// 移除新版本删除的文件 // 移除新版本删除的文件
const change: string[] = null; const change: string[] = null;
try { try {
change = Arrays.asList(FileUtils.readFileToString(changeRecord, "UTF-8").split("\n")); change = Arrays.asList(fs.readFileSync(changeRecord, "UTF-8", 'utf-8').split("\n"));
} catch (IOException e) { } catch (IOException e) {
throw new Error(e); throw new Error(e);
} }
@@ -351,7 +352,7 @@ export class UpgradeServiceImplService {
vo.setStep("coverCode"); vo.setStep("coverCode");
vo.setStatus("restarting"); vo.setStatus("restarting");
setUpgradeTaskCache(vo); setUpgradeTaskCache(vo);
FileUtils.writeStringToFile(upgradeDir(vo, "upgrade.json"), JSONUtil.parseObj(vo.getUpgradeContent()).toString(), "UTF-8"); fs.writeFileSync(upgradeDir(vo, "upgrade.json", 'utf-8'), JSONUtil.parseObj(vo.getUpgradeContent()).toString(), "UTF-8");
PipeNameUtils.noticeBootRestartByUpgrade(this.config.get('applicationName'), vo.getKey(), vo.getUpgradeContent().getLastBackup().getBackupKey()); PipeNameUtils.noticeBootRestartByUpgrade(this.config.get('applicationName'), vo.getKey(), vo.getUpgradeContent().getLastBackup().getBackupKey());
Thread.sleep(3000); Thread.sleep(3000);
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class StorageConfigServiceImplService { export class StorageConfigServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class VerifierServiceImplService { export class VerifierServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class VerifyServiceImplService { export class VerifyServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WeappConfigServiceImplService { export class WeappConfigServiceImplService {
@@ -29,7 +28,7 @@ export class WeappConfigServiceImplService {
domain.setDownloaddomain(String.join(";", domainResult.getDownloadDomain())); domain.setDownloaddomain(String.join(";", domainResult.getDownloadDomain()));
weappConfigVo.setDomain(domain); weappConfigVo.setDomain(domain);
} }
} catch (Exception e) { } catch (e) {
} }
} }
@@ -58,8 +57,8 @@ export class WeappConfigServiceImplService {
ObjectUtil.isNotEmpty(param.getTcpdomain())? Arrays.asList(param.getTcpdomain().split(";")) : [], ObjectUtil.isNotEmpty(param.getTcpdomain())? Arrays.asList(param.getTcpdomain().split(";")) : [],
ObjectUtil.isNotEmpty(param.getUdpdomain())? Arrays.asList(param.getUdpdomain().split(";")) : [] ObjectUtil.isNotEmpty(param.getUdpdomain())? Arrays.asList(param.getUdpdomain().split(";")) : []
); );
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -70,8 +69,8 @@ export class WeappConfigServiceImplService {
try { try {
const wxOpenMaService: WxOpenMaService = (WxOpenMaService) WechatUtils.miniapp(RequestUtils.siteId()); const wxOpenMaService: WxOpenMaService = (WxOpenMaService) WechatUtils.miniapp(RequestUtils.siteId());
return wxOpenMaService.getPrivacyService().getPrivacySetting(2); return wxOpenMaService.getPrivacyService().getPrivacySetting(2);
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -84,8 +83,8 @@ export class WeappConfigServiceImplService {
const setPrivacySetting: SetPrivacySetting = JSONUtil.toBean(privacySetting, SetPrivacySetting.class); const setPrivacySetting: SetPrivacySetting = JSONUtil.toBean(privacySetting, SetPrivacySetting.class);
setPrivacySetting.setPrivacyVer(2); setPrivacySetting.setPrivacyVer(2);
wxOpenMaService.getPrivacyService().setPrivacySetting(setPrivacySetting); wxOpenMaService.getPrivacyService().setPrivacySetting(setPrivacySetting);
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WeappTemplateServiceImplService { export class WeappTemplateServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as fs from 'fs';
@Injectable() @Injectable()
export class WeappVersionServiceImplService { export class WeappVersionServiceImplService {
@@ -124,7 +124,7 @@ export class WeappVersionServiceImplService {
return "data:image/jpeg;base64," + Base64.getEncoder().encodeToString(FileUtils.readFileToByteArray(qrcode)); return "data:image/jpeg;base64," + Base64.getEncoder().encodeToString(FileUtils.readFileToByteArray(qrcode));
} }
return ""; return "";
} catch (Exception e) { } catch (e) {
return ""; return "";
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WechatConfigServiceImplService { export class WechatConfigServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WechatMediaServiceImplService { export class WechatMediaServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -63,8 +63,8 @@ export class WechatMediaServiceImplService {
const vo: WechatMediaInfoVo = new WechatMediaInfoVo(); const vo: WechatMediaInfoVo = new WechatMediaInfoVo();
BeanUtils.copyProperties(model, vo); BeanUtils.copyProperties(model, vo);
return vo; return vo;
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -100,8 +100,8 @@ export class WechatMediaServiceImplService {
const vo: WechatMediaInfoVo = new WechatMediaInfoVo(); const vo: WechatMediaInfoVo = new WechatMediaInfoVo();
BeanUtils.copyProperties(model, vo); BeanUtils.copyProperties(model, vo);
return vo; return vo;
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -136,8 +136,8 @@ export class WechatMediaServiceImplService {
offset++; offset++;
this.syncNews(offset); this.syncNews(offset);
} }
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
} }

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WechatMenuServiceImplService { export class WechatMenuServiceImplService {
@@ -27,7 +26,7 @@ export class WechatMenuServiceImplService {
WechatUtils.mp(RequestUtils.siteId()).getMenuService().menuCreate(JSONUtil.parseObj(params).toString()) ; WechatUtils.mp(RequestUtils.siteId()).getMenuService().menuCreate(JSONUtil.parseObj(params).toString()) ;
coreConfigService.setConfig(RequestUtils.siteId(), "WECHAT_MENU", data); coreConfigService.setConfig(RequestUtils.siteId(), "WECHAT_MENU", data);
}catch (WxErrorException e){ }catch (WxErrorException e){
throw new AdminException(e.getMessage()); throw new AdminException(e.message);
} }
} }
} }

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class WechatReplyServiceImplService { export class WechatReplyServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class WechatTemplateServiceImplService { export class WechatTemplateServiceImplService {

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class OplatformConfigServiceImplService { export class OplatformConfigServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class OplatformServerServiceImplService { export class OplatformServerServiceImplService {
@@ -38,7 +37,7 @@ export class OplatformServerServiceImplService {
authorizationParam.setAuthCode(inMessage.getAuthorizationCode()); authorizationParam.setAuthCode(inMessage.getAuthorizationCode());
oplatformService.authorization(authorizationParam); oplatformService.authorization(authorizationParam);
} }
} catch (Exception e) { } catch (e) {
log.error("处理开放平台授权事件消息异常", e); log.error("处理开放平台授权事件消息异常", e);
} }
} }

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class OplatformServiceImplService { export class OplatformServiceImplService {
@@ -17,8 +17,8 @@ export class OplatformServiceImplService {
try { try {
const url: string = RequestUtils.getDomain(true) + "/site/wxoplatform/callback"; const url: string = RequestUtils.getDomain(true) + "/site/wxoplatform/callback";
return WechatUtils.WxOpen().getWxOpenComponentService().getPreAuthUrl(url); return WechatUtils.WxOpen().getWxOpenComponentService().getPreAuthUrl(url);
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -61,8 +61,8 @@ export class OplatformServiceImplService {
coreWechatConfigService.setWechatAuthorizationInfo(RequestUtils.siteId(), result); coreWechatConfigService.setWechatAuthorizationInfo(RequestUtils.siteId(), result);
} }
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }

View File

@@ -1,12 +1,13 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class WeappVersionServiceImplService { export class WeappVersionServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -149,7 +150,7 @@ export class WeappVersionServiceImplService {
} }
} }
} }
} catch (Exception e) { } catch (e) {
console.log("小程序模板上传成功获取模板id异常"); console.log("小程序模板上传成功获取模板id异常");
e.printStackTrace(); e.printStackTrace();
} }
@@ -210,10 +211,10 @@ export class WeappVersionServiceImplService {
// 提交审核 // 提交审核
weappVersionService.submitAudit(siteId, model.getId()); weappVersionService.submitAudit(siteId, model.getId());
} catch (Exception e) { } catch (e) {
console.log("小程序提交代码异常"); console.log("小程序提交代码异常");
e.printStackTrace(); e.printStackTrace();
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -267,7 +268,7 @@ export class WeappVersionServiceImplService {
console.log("小程序提交审核异常"); console.log("小程序提交审核异常");
e.printStackTrace(); e.printStackTrace();
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
} }
@@ -319,8 +320,8 @@ export class WeappVersionServiceImplService {
try { try {
const commitResult: WxOpenResult = WechatUtils.WxOpen().getWxOpenComponentService() const commitResult: WxOpenResult = WechatUtils.WxOpen().getWxOpenComponentService()
.getWxMaServiceByAppid(weappCofig.getAppId()).undoCodeAudit(); .getWxMaServiceByAppid(weappCofig.getAppId()).undoCodeAudit();
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
version.setStatus(WeappVersionStatusEnum.APPLET_AUDIT_UNDO.getStatus()); version.setStatus(WeappVersionStatusEnum.APPLET_AUDIT_UNDO.getStatus());

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AgreementServiceImplService { export class AgreementServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AppServiceImplService { export class AppServiceImplService {
@@ -27,8 +26,8 @@ export class AppServiceImplService {
ObjectUtil.defaultIfNull(wxUser.getHeadImgUrl(), ""), ObjectUtil.defaultIfNull(wxUser.getHeadImgUrl(), ""),
param.getPid() param.getPid()
); );
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
@@ -104,8 +103,8 @@ export class AppServiceImplService {
registerMember.setWxUnionid(param.getUnionid()); registerMember.setWxUnionid(param.getUnionid());
registerMember.setPid(param.getPid()); registerMember.setPid(param.getPid());
return registerService.register(registerMember); return registerService.register(registerMember);
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
} }

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class DiyFormServiceImplService { export class DiyFormServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,8 +1,8 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot'; import * as path from 'path';
@Injectable() @Injectable()
export class DiyServiceImplService { export class DiyServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, UnauthorizedException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class AuthServiceImplService { export class AuthServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class LoginServiceImplService { export class LoginServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class RegisterServiceImplService { export class RegisterServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberAccountServiceImplService { export class MemberAccountServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberAddressServiceImplService { export class MemberAddressServiceImplService {
@@ -20,8 +19,8 @@ export class MemberAddressServiceImplService {
if (param.getIsDefault() != null && param.getIsDefault() == 1) { if (param.getIsDefault() != null && param.getIsDefault() == 1) {
try { try {
this.deleteDefaultAddress(param.memberId()); this.deleteDefaultAddress(param.memberId());
} catch (Exception e) { } catch (e) {
log.error("更新会员默认地址数据库操作错误:", e.getMessage()); log.error("更新会员默认地址数据库操作错误:", e.message);
throw new BaseException("添加会员收货地址错误."); throw new BaseException("添加会员收货地址错误.");
} }
} }
@@ -64,8 +63,8 @@ export class MemberAddressServiceImplService {
if (param.getIsDefault() != null && param.getIsDefault() == 1) { if (param.getIsDefault() != null && param.getIsDefault() == 1) {
try { try {
deleteDefaultAddress(param.memberId()); deleteDefaultAddress(param.memberId());
} catch (Exception e) { } catch (e) {
log.error("更新会员默认地址数据库操作错误:", e.getMessage()); log.error("更新会员默认地址数据库操作错误:", e.message);
throw new BaseException("添加会员收货地址错误."); throw new BaseException("添加会员收货地址错误.");
} }
} }

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberCashOutServiceImplService { export class MemberCashOutServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberLevelServiceImplService { export class MemberLevelServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -123,8 +123,8 @@ export class MemberLevelServiceImplService {
const vo: MemberGetMobileVo = new MemberGetMobileVo(); const vo: MemberGetMobileVo = new MemberGetMobileVo();
vo.setMobile(mobile); vo.setMobile(mobile);
return vo; return vo;
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} }
} }

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberServiceImplService { export class MemberServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -122,8 +122,8 @@ export class MemberServiceImplService {
try { try {
const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(RequestUtils.siteId()).getUserService().getPhoneNoInfo(param.getMobileCode()); const phoneInfo: WxMaPhoneNumberInfo = WechatUtils.miniapp(RequestUtils.siteId()).getUserService().getPhoneNoInfo(param.getMobileCode());
param.setMobile(phoneInfo.getPurePhoneNumber()); param.setMobile(phoneInfo.getPurePhoneNumber());
} catch (Exception e) { } catch (e) {
throw new BadRequestException(e.getMessage()); throw new BadRequestException(e.message);
} }
} else { } else {
throw new BadRequestException("手机号不存在"); throw new BadRequestException("手机号不存在");

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class MemberSignServiceImplService { export class MemberSignServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class PayServiceImplService { export class PayServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class Base64ServiceImplService { export class Base64ServiceImplService {

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysAreaServiceImplService { export class SysAreaServiceImplService {
@@ -43,8 +42,8 @@ export class SysAreaServiceImplService {
queryWrapper.eq("pid", pid); queryWrapper.eq("pid", pid);
const sysAreaList: SysArea[] = sysAreaMapper.selectList(queryWrapper); const sysAreaList: SysArea[] = sysAreaMapper.selectList(queryWrapper);
sysAreaVoList = CollectUtils.convert(sysAreaList, SysAreaListVo.class); sysAreaVoList = CollectUtils.convert(sysAreaList, SysAreaListVo.class);
} catch (Exception e) { } catch (e) {
log.error("查询区域错误:", e.getMessage()); log.error("查询区域错误:", e.message);
throw new BaseException("查询区域错误"); throw new BaseException("查询区域错误");
} }
return sysAreaVoList; return sysAreaVoList;

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysConfigServiceImplService { export class SysConfigServiceImplService {

View File

@@ -1,12 +1,12 @@
import { Injectable } from '@nestjs/common'; import { Injectable, BadRequestException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result, ConfigService } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class SysVerifyServiceImplService { export class SysVerifyServiceImplService {
constructor( constructor(
private readonly config: ConfigService,
private readonly eventBus: EventBus, private readonly eventBus: EventBus,
private readonly queueService: QueueService, private readonly queueService: QueueService,
) {} ) {}
@@ -27,8 +27,8 @@ export class SysVerifyServiceImplService {
const qrcodeDir: string = this.config.get('webRootDownResource') + "upload/temp/"; const qrcodeDir: string = this.config.get('webRootDownResource') + "upload/temp/";
const barcodePath: string = BarcodeUtils.generateBarcode(verifyCode, qrcodeDir); const barcodePath: string = BarcodeUtils.generateBarcode(verifyCode, qrcodeDir);
barcode = ImageUtils.imageToBase64(barcodePath); barcode = ImageUtils.imageToBase64(barcodePath);
} catch (Exception e) { } catch (e) {
log.error("条形码生成失败:{}", e.getMessage(), e); log.error("条形码生成失败:{}", e.message, e);
throw new BadRequestException("条形码生成失败"); throw new BadRequestException("条形码生成失败");
} }
sysVerifyGetCodeVo.setBarcode(barcode); sysVerifyGetCodeVo.setBarcode(barcode);

View File

@@ -1,8 +1,7 @@
import { Injectable } from '@nestjs/common'; import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm'; import { Repository } from 'typeorm';
import { QueueService, EventBus } from '@wwjBoot'; import { QueueService, EventBus, Result } from '@wwjBoot';
import { Result } from '@wwjBoot';
@Injectable() @Injectable()
export class TaskServiceImplService { export class TaskServiceImplService {

Some files were not shown because too many files have changed in this diff Show More