first commit

This commit is contained in:
编码猿
2024-09-27 01:15:47 +08:00
commit 8be1fcce6b
155 changed files with 9435 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
/*
* Copyright (c) 2023.
*
* 作者bmy
* 邮箱2271608011@qq.com
* giteehttps://gitee.com/bmycode
* githubhttps://github.com/helpcode
*
*/
import Http from "@/http";
import config from "@/config";
import type { ReleasesLatestType } from "@/serve/types/ReleasesLatestType";
class Gitee {
public async ReleasesLatest(): Promise<ReleasesLatestType> {
return await Http.get(config.giteeApi.releasesUrl)
}
/**
*
* @param curV 新版本号
* @param reqV 当前应用的版本号
*/
public compare(curV: string, reqV: string): boolean {
if (curV && reqV) {
//将两个版本号拆成数字
let arr1 = curV.split('.'),
arr2 = reqV.split('.');
let minLength = Math.min(arr1.length, arr2.length),
position = 0,
diff = 0;
//依次比较版本号每一位大小,当对比得出结果后跳出循环(后文有简单介绍)
while (position < minLength && ((diff = parseInt(arr1[position]) - parseInt(arr2[position])) == 0)) {
position++;
}
diff = (diff != 0) ? diff : (arr1.length - arr2.length);
//若curV大于reqV则返回true
return diff > 0;
} else {
//输入为空
return false;
}
}
}
export default new Gitee