mirror of
				https://github.com/whyour/qinglong.git
				synced 2025-11-04 02:56:07 +08:00 
			
		
		
		
	修改更新仓库逻辑
This commit is contained in:
		
							parent
							
								
									702c3160ec
								
							
						
					
					
						commit
						1718120623
					
				| 
						 | 
					@ -17,7 +17,6 @@ import { TASK_PREFIX, QL_PREFIX } from '../config/const';
 | 
				
			||||||
import cronClient from '../schedule/client';
 | 
					import cronClient from '../schedule/client';
 | 
				
			||||||
import taskLimit from '../shared/pLimit';
 | 
					import taskLimit from '../shared/pLimit';
 | 
				
			||||||
import { spawn } from 'cross-spawn';
 | 
					import { spawn } from 'cross-spawn';
 | 
				
			||||||
import { Fn } from 'sequelize/types/utils';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service()
 | 
					@Service()
 | 
				
			||||||
export default class CronService {
 | 
					export default class CronService {
 | 
				
			||||||
| 
						 | 
					@ -281,7 +280,7 @@ export default class CronService {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  private formatViewSort(order: (string | Fn)[][], viewQuery: any) {
 | 
					  private formatViewSort(order: string[][], viewQuery: any) {
 | 
				
			||||||
    if (viewQuery.sorts && viewQuery.sorts.length > 0) {
 | 
					    if (viewQuery.sorts && viewQuery.sorts.length > 0) {
 | 
				
			||||||
      for (const { property, type } of viewQuery.sorts) {
 | 
					      for (const { property, type } of viewQuery.sorts) {
 | 
				
			||||||
        order.unshift([property, type]);
 | 
					        order.unshift([property, type]);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -300,7 +300,7 @@ git_clone_scripts() {
 | 
				
			||||||
  local branch="$3"
 | 
					  local branch="$3"
 | 
				
			||||||
  local proxy="$4"
 | 
					  local proxy="$4"
 | 
				
			||||||
  [[ $branch ]] && local part_cmd="-b $branch "
 | 
					  [[ $branch ]] && local part_cmd="-b $branch "
 | 
				
			||||||
  echo -e "开始克隆仓库 $url 到 $dir\n"
 | 
					  echo -e "开始拉取 $url 到 $dir\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set_proxy "$proxy"
 | 
					  set_proxy "$proxy"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,13 +130,9 @@ update_repo() {
 | 
				
			||||||
  make_dir "${dir_scripts}/${uniq_path}"
 | 
					  make_dir "${dir_scripts}/${uniq_path}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local formatUrl="$url"
 | 
					  local formatUrl="$url"
 | 
				
			||||||
  if [[ -d ${repo_path}/.git ]]; then
 | 
					  rm -rf ${repo_path} &>/dev/null
 | 
				
			||||||
    reset_romote_url ${repo_path} "${formatUrl}" "${branch}"
 | 
					  git_clone_scripts "${formatUrl}" ${repo_path} "${branch}" "${proxy}"
 | 
				
			||||||
    git_pull_scripts ${repo_path} "${branch}" "${proxy}"
 | 
					
 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    rm -rf ${repo_path} &>/dev/null
 | 
					 | 
				
			||||||
    git_clone_scripts "${formatUrl}" ${repo_path} "${branch}" "${proxy}"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  if [[ $exit_status -eq 0 ]]; then
 | 
					  if [[ $exit_status -eq 0 ]]; then
 | 
				
			||||||
    echo -e "\n更新${repo_path}成功...\n"
 | 
					    echo -e "\n更新${repo_path}成功...\n"
 | 
				
			||||||
    diff_scripts "$repo_path" "$author" "$path" "$blackword" "$dependence" "$extensions" "$autoAddCron" "$autoDelCron"
 | 
					    diff_scripts "$repo_path" "$author" "$path" "$blackword" "$dependence" "$extensions" "$autoAddCron" "$autoDelCron"
 | 
				
			||||||
| 
						 | 
					@ -269,13 +265,9 @@ update_qinglong_static() {
 | 
				
			||||||
  local no_restart="$1"
 | 
					  local no_restart="$1"
 | 
				
			||||||
  local primary_branch="$2"
 | 
					  local primary_branch="$2"
 | 
				
			||||||
  local url="https://${mirror}.com/whyour/qinglong-static.git"
 | 
					  local url="https://${mirror}.com/whyour/qinglong-static.git"
 | 
				
			||||||
  if [[ -d ${ql_static_repo}/.git ]]; then
 | 
					  rm -rf ${ql_static_repo} &>/dev/null
 | 
				
			||||||
    reset_romote_url ${ql_static_repo} ${url} ${primary_branch}
 | 
					  git_clone_scripts ${url} ${ql_static_repo} ${primary_branch}
 | 
				
			||||||
    git_pull_scripts ${ql_static_repo} ${primary_branch}
 | 
					
 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    rm -rf ${ql_static_repo} &>/dev/null
 | 
					 | 
				
			||||||
    git_clone_scripts ${url} ${ql_static_repo} ${primary_branch}
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  if [[ $exit_status -eq 0 ]]; then
 | 
					  if [[ $exit_status -eq 0 ]]; then
 | 
				
			||||||
    echo -e "\n更新青龙静态资源成功...\n"
 | 
					    echo -e "\n更新青龙静态资源成功...\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user