Skip to content

Commit

Permalink
删除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanhh committed Jun 20, 2021
1 parent d630f34 commit 3052b48
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 23 deletions.
1 change: 0 additions & 1 deletion back/api/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default (app: Router) => {
async (req: Request, res: Response, next: NextFunction) => {
const logger: Logger = Container.get('logger');
try {
console.log(req.params.file);
const content = getFileContentByName(
`${config.scriptPath}${req.params.file}`,
);
Expand Down
8 changes: 1 addition & 7 deletions back/loaders/initData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@ const initData = [
name: '删除日志',
command: 'ql rmlog 7',
schedule: '30 7 */7 * *',
status: CrontabStatus.idle,
},
{
name: '互助码',
command: 'ql code',
schedule: '30 7 * * *',
status: CrontabStatus.idle,
status: CrontabStatus.disabled,
},
];

Expand Down
1 change: 0 additions & 1 deletion back/services/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export default class EnvService {
{ status: { $ne: EnvStatus.disabled }, name: { $exists: true } },
);
const groups = _.groupBy(envs, 'name');
console.log(groups);
let env_string = '';
for (const key in groups) {
if (Object.prototype.hasOwnProperty.call(groups, key)) {
Expand Down
1 change: 1 addition & 0 deletions sample/task.sample.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#!/usr/bin/env bash
10 changes: 7 additions & 3 deletions shell/reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
dir_shell=/ql/shell
. $dir_shell/share.sh

echo -e "1. 开始安装青龙依赖\n"
echo -e "1. 开始检测配置文件\n"
fix_config
echo -e "配置文件检测完成\n"

echo -e "2. 开始安装青龙依赖\n"
npm_install_2 $dir_root
echo -e "青龙依赖安装完成\n"

echo -e "2. 开始安装脚本依赖\n"
echo -e "3. 开始安装脚本依赖\n"
cp -f $dir_sample/package.json $dir_scripts/package.json
npm_install_2 $dir_scripts
echo -e "脚本依赖安装完成\n"

echo -e "3. 复制通知文件\n"
echo -e "4. 复制通知文件\n"
echo -e "复制一份 $file_notify_py_sample$file_notify_py\n"
cp -fv $file_notify_py_sample $file_notify_py
echo
Expand Down
15 changes: 15 additions & 0 deletions shell/share.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ file_config_user=$dir_config/config.sh
file_auth_sample=$dir_sample/auth.sample.json
file_auth_user=$dir_config/auth.json
file_extra_shell=$dir_config/extra.sh
file_task_before=$dir_config/task_before.sh
file_task_after=$dir_config/task_after.sh
file_task_sample=$dir_sample/task.sample.sh
file_extra_sample=$dir_sample/extra.sample.sh
file_notify_js_sample=$dir_sample/notify.js
file_notify_py_sample=$dir_sample/notify.py
Expand Down Expand Up @@ -162,6 +165,18 @@ fix_config() {
echo
fi

if [ ! -f $file_task_before ]; then
echo -e "复制一份 $file_task_sample$file_task_before\n"
cp -fv $file_task_sample $file_task_before
echo
fi

if [ ! -f $file_task_after ]; then
echo -e "复制一份 $file_task_sample$file_task_after\n"
cp -fv $file_task_sample $file_task_after
echo
fi

if [ ! -f $file_extra_shell ]; then
echo -e "复制一份 $file_extra_sample$file_extra_shell\n"
cp -fv $file_extra_sample $file_extra_shell
Expand Down
12 changes: 5 additions & 7 deletions shell/task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ usage() {
define_cmd
gen_array_scripts
echo -e "task命令运行本程序自动添加进crontab的脚本,需要输入脚本的绝对路径或去掉 “$dir_scripts/” 目录后的相对路径(定时任务中请写作相对路径),用法为:"
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
echo -e "3.$cmd_task <file_name> conc # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
echo -e "1.$cmd_task <file_name> # 依次执行,如果设置了随机延迟,将随机延迟一定秒数"
echo -e "2.$cmd_task <file_name> now # 依次执行,无论是否设置了随机延迟,均立即运行,前台会输出日志,同时记录在日志文件中"
echo -e "3.$cmd_task <file_name> conc <环境变量名> # 并发执行,无论是否设置了随机延迟,均立即运行,前台不产生日志,直接记录在日志文件中"
if [[ ${#array_scripts[*]} -gt 0 ]]; then
echo -e "\n当前有以下脚本可以运行:"
for ((i = 0; i < ${#array_scripts[*]}; i++)); do
Expand All @@ -74,11 +74,8 @@ run_normal() {
local p1=$1
cd $dir_scripts
define_program "$p1"
. $file_task_before
if [[ $p1 == *.js ]]; then
if [[ $AutoHelpOther == true ]] && [[ $(ls $dir_code) ]]; then
local latest_log=$(ls -r $dir_code | head -1)
. $dir_code/$latest_log
fi
if [[ $# -eq 1 ]]; then
random_delay
fi
Expand All @@ -92,6 +89,7 @@ run_normal() {
local id=$(cat $list_crontab_user | grep -E "$cmd_task $p1$" | perl -pe "s|.*ID=(.*) $cmd_task $p1$|\1|" | xargs | sed 's/ /","/g')
update_cron_status "\"$id\"" "0"
timeout $command_timeout_time $which_program $p1 2>&1 | tee $log_path
. $file_task_after
update_cron_status "\"$id\"" "1"
}

Expand Down
1 change: 0 additions & 1 deletion shell/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ usage() {
echo -e "3. $cmd_update raw <fileurl> # 更新单个脚本文件"
echo -e "4. $cmd_update repo <repourl> <path> <blacklist> <dependence> <branch> # 更新单个仓库的脚本"
echo -e "5. $cmd_update rmlog <days> # 删除旧日志"
echo -e "6. $cmd_update code # 获取互助码"
echo -e "6. $cmd_update bot # 启动tg-bot"
echo -e "7. $cmd_update reset # 重置青龙基础环境"
}
Expand Down
1 change: 0 additions & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export function render(oldRender: any) {
oldRender();
})
.catch((e) => {
console.log(e);
if (e.response && e.response.status === 401) {
localStorage.removeItem(config.authKey);
history.push('/login');
Expand Down
2 changes: 0 additions & 2 deletions src/pages/env/editNameModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const EditNameModal = ({
const [loading, setLoading] = useState(false);

const handleOk = async (values: any) => {
console.log(values);
console.log(ids);
setLoading(true);
const { code, data } = await request.put(`${config.apiPrefix}envs/name`, {
data: {
Expand Down

0 comments on commit 3052b48

Please sign in to comment.