fix: 排行榜报错

This commit is contained in:
guanchao
2026-10-27 12:45:12 +08:00
parent 9bf0d4486e
commit e00f4fc8d4
2 changed files with 15 additions and 13 deletions
+14 -7
View File
@@ -5311,12 +5311,13 @@ export default class JiaZai extends cc.Component {
// ============================================
getSRank(isShow: boolean = true, onRendered?: () => void) {
// return;
if (this.isCareerDisabledByMemoryWarning()) {
if (!cc.isValid(this, true) || !cc.isValid(this.node, true) || this.isCareerDisabledByMemoryWarning()) {
return;
}
const requestId = ++this._sRankRequestId;
const finishRender = () => {
if (requestId !== this._sRankRequestId
|| !cc.isValid(this, true)
|| !this.node || !cc.isValid(this.node, true)
|| this.isCareerDisabledByMemoryWarning()) return;
if (this.locatePositionAfterRank) {
@@ -5329,8 +5330,9 @@ export default class JiaZai extends cc.Component {
Utils.getSRank(res => {
if (requestId !== this._sRankRequestId
|| this.isCareerDisabledByMemoryWarning()
|| !cc.isValid(this, true)
|| !this.node
|| !cc.isValid(this.node)) {
|| !cc.isValid(this.node, true)) {
return;
}
if (res.data) {
@@ -5578,17 +5580,19 @@ export default class JiaZai extends cc.Component {
// 加载入职排行榜预制体
LoadCareer(callback: () => void, isShow: boolean = true) {
if (this.isCareerDisabledByMemoryWarning()) {
if (!cc.isValid(this, true) || !cc.isValid(this.node, true) || this.isCareerDisabledByMemoryWarning()) {
return;
}
const generation = ++this.careerLoadGeneration;
this.careerPendingLoads++;
// Cocos 销毁组件会清空数组属性;保留原队列,让晚到的回调仍能结束清理等待。
const loadWaiters = this.careerLoadWaiters;
let finished = false;
const finish = () => {
if (finished) return;
finished = true;
this.careerPendingLoads--;
if (!this.careerPendingLoads) this.careerLoadWaiters.splice(0).forEach(resolve => resolve());
if (!this.careerPendingLoads) loadWaiters.splice(0).forEach(resolve => resolve());
};
const loadCareer = (dependencyError?: Error) => {
if (dependencyError) {
@@ -5596,8 +5600,9 @@ export default class JiaZai extends cc.Component {
finish(); return;
}
if (generation !== this.careerLoadGeneration
|| !cc.isValid(this, true)
|| !this.node
|| !cc.isValid(this.node)
|| !cc.isValid(this.node, true)
|| this.isCareerDisabledByMemoryWarning()) {
finish(); return;
}
@@ -5611,8 +5616,9 @@ export default class JiaZai extends cc.Component {
finish(); return;
}
if (generation !== this.careerLoadGeneration
|| !cc.isValid(this, true)
|| !this.node
|| !cc.isValid(this.node)) {
|| !cc.isValid(this.node, true)) {
finish(); return;
}
@@ -5626,8 +5632,9 @@ export default class JiaZai extends cc.Component {
finish(); return;
}
if (generation !== this.careerLoadGeneration
|| !cc.isValid(this, true)
|| !this.node
|| !cc.isValid(this.node)) {
|| !cc.isValid(this.node, true)) {
finish(); return;
}
finish();
+1 -6
View File
@@ -672,12 +672,7 @@ export default class Utils {
if (!options?.json && dataStr !== '') {
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
}
if (url != "getSRank" && url != "getRank") {
url = requestHttpip + url;
}
else {
url = "https://bx7gi3d4oq.sealoshzh.site/" + url;
}
url = requestHttpip + url;
if (url == requestHttpip + "getAddressRankOther") {