mirror of
https://github.com/whyour/qinglong.git
synced 2025-08-24 04:36:08 +08:00
修复编译错误
This commit is contained in:
parent
b0f3b51736
commit
f3791cbb62
|
@ -25,7 +25,6 @@ export default (app: Router) => {
|
||||||
try {
|
try {
|
||||||
const userService = Container.get(UserService);
|
const userService = Container.get(UserService);
|
||||||
const authInfo = await userService.getUserInfo();
|
const authInfo = await userService.getUserInfo();
|
||||||
const envCount = await EnvModel.count();
|
|
||||||
const { version, changeLog, changeLogLink } = await parseVersion(
|
const { version, changeLog, changeLogLink } = await parseVersion(
|
||||||
config.versionFile,
|
config.versionFile,
|
||||||
);
|
);
|
||||||
|
@ -95,9 +94,7 @@ export default (app: Router) => {
|
||||||
const logger: Logger = Container.get('logger');
|
const logger: Logger = Container.get('logger');
|
||||||
try {
|
try {
|
||||||
const systemService = Container.get(SystemService);
|
const systemService = Container.get(SystemService);
|
||||||
const result = await systemService.updateSystemConfig(
|
const result = await systemService.updateSystemConfig(req.body);
|
||||||
req.body,
|
|
||||||
);
|
|
||||||
res.send(result);
|
res.send(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return next(e);
|
return next(e);
|
||||||
|
|
|
@ -2,7 +2,13 @@ import { Service, Inject } from 'typedi';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
import config from '../config';
|
import config from '../config';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { AuthDataType, AuthInfo, AuthInstance, AuthModel, AuthModelInfo } from '../data/auth';
|
import {
|
||||||
|
AuthDataType,
|
||||||
|
AuthInfo,
|
||||||
|
AuthInstance,
|
||||||
|
AuthModel,
|
||||||
|
AuthModelInfo,
|
||||||
|
} from '../data/auth';
|
||||||
import { NotificationInfo } from '../data/notify';
|
import { NotificationInfo } from '../data/notify';
|
||||||
import NotificationService from './notify';
|
import NotificationService from './notify';
|
||||||
import ScheduleService, { TaskCallbacks } from './schedule';
|
import ScheduleService, { TaskCallbacks } from './schedule';
|
||||||
|
@ -16,7 +22,7 @@ import {
|
||||||
parseVersion,
|
parseVersion,
|
||||||
} from '../config/util';
|
} from '../config/util';
|
||||||
import { TASK_COMMAND } from '../config/const';
|
import { TASK_COMMAND } from '../config/const';
|
||||||
import taskLimit from '../shared/pLimit'
|
import taskLimit from '../shared/pLimit';
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
export default class SystemService {
|
export default class SystemService {
|
||||||
|
@ -31,7 +37,7 @@ export default class SystemService {
|
||||||
|
|
||||||
public async getSystemConfig() {
|
public async getSystemConfig() {
|
||||||
const doc = await this.getDb({ type: AuthDataType.systemConfig });
|
const doc = await this.getDb({ type: AuthDataType.systemConfig });
|
||||||
return doc || {};
|
return doc || ({} as AuthInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async updateAuthDb(payload: AuthInfo): Promise<AuthInstance> {
|
private async updateAuthDb(payload: AuthInfo): Promise<AuthInstance> {
|
||||||
|
@ -42,7 +48,7 @@ export default class SystemService {
|
||||||
|
|
||||||
public async getDb(query: any): Promise<AuthInstance> {
|
public async getDb(query: any): Promise<AuthInstance> {
|
||||||
const doc: any = await AuthModel.findOne({ where: { ...query } });
|
const doc: any = await AuthModel.findOne({ where: { ...query } });
|
||||||
return doc && (doc.get({ plain: true }));
|
return doc && doc.get({ plain: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
public async updateNotificationMode(notificationInfo: NotificationInfo) {
|
public async updateNotificationMode(notificationInfo: NotificationInfo) {
|
||||||
|
|
|
@ -231,7 +231,7 @@ usage() {
|
||||||
|
|
||||||
## 更新qinglong
|
## 更新qinglong
|
||||||
update_qinglong() {
|
update_qinglong() {
|
||||||
rm -rf "${dir_tmp}/*"
|
rm -rf ${dir_tmp}/*
|
||||||
local mirror="gitee"
|
local mirror="gitee"
|
||||||
local downloadQLUrl="https://gitee.com/whyour/qinglong/repository/archive"
|
local downloadQLUrl="https://gitee.com/whyour/qinglong/repository/archive"
|
||||||
local downloadStaticUrl="https://gitee.com/whyour/qinglong-static/repository/archive"
|
local downloadStaticUrl="https://gitee.com/whyour/qinglong-static/repository/archive"
|
||||||
|
@ -253,7 +253,8 @@ update_qinglong() {
|
||||||
|
|
||||||
if [[ $exit_status -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
echo -e "\n更新青龙源文件成功...\n"
|
echo -e "\n更新青龙源文件成功...\n"
|
||||||
unzip -oq "${dir_tmp}/ql.zip"
|
cd
|
||||||
|
unzip -oq ${dir_tmp}/ql.zip -d ${dir_tmp}
|
||||||
|
|
||||||
update_qinglong_static
|
update_qinglong_static
|
||||||
else
|
else
|
||||||
|
@ -267,7 +268,7 @@ update_qinglong_static() {
|
||||||
|
|
||||||
if [[ $exit_status -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
echo -e "\n更新青龙静态资源成功...\n"
|
echo -e "\n更新青龙静态资源成功...\n"
|
||||||
unzip -oq "${dir_tmp}/static.zip"
|
unzip -oq ${dir_tmp}/static.zip -d ${dir_tmp}
|
||||||
|
|
||||||
check_update_dep
|
check_update_dep
|
||||||
else
|
else
|
||||||
|
@ -288,9 +289,9 @@ check_update_dep() {
|
||||||
if [[ $exit_status -eq 0 ]]; then
|
if [[ $exit_status -eq 0 ]]; then
|
||||||
echo -e "\n依赖检测安装成功...\n"
|
echo -e "\n依赖检测安装成功...\n"
|
||||||
|
|
||||||
cp -rf ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}
|
cp -rf ${dir_tmp}/qinglong-${primary_branch}/* ${dir_root}/
|
||||||
rm -rf $dir_static/*
|
rm -rf $dir_static/*
|
||||||
cp -rf ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}
|
cp -rf ${dir_tmp}/qinglong-static-${primary_branch}/* ${dir_static}/
|
||||||
cp -f $file_config_sample $dir_config/config.sample.sh
|
cp -f $file_config_sample $dir_config/config.sample.sh
|
||||||
|
|
||||||
reload_pm2
|
reload_pm2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user