fix MI poll: don't mistake old published version as new version approved
The MI /devupload/dev/query API returns the currently-published app's status, not the pending submission. appStatus=3 means the previous version is still online, not that the new submission was accepted. Use updateVersion=true as the approval signal; default updateVersion to false to avoid false positives. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
81f04ee432
当前提交
39367a57e1
@ -482,31 +482,35 @@ public class StoreSubmissionService {
|
||||
// Log full root response so we can verify exact field names from production
|
||||
log.info("MI poll full response for version={}: {}", v.getId(), root);
|
||||
JsonNode pkg = root.path("packageInfo");
|
||||
// Xiaomi /devupload/dev/query response:
|
||||
// packageInfo.appStatus: 1=待审核, 2=审核中, 3=已发布/上线, 4=已下线, 5=拒绝
|
||||
// root.updateVersion (bool): true=用户可更新(已上线), false=不可更新(审核中或拒绝)
|
||||
// Xiaomi /devupload/dev/query returns status of the currently-published app,
|
||||
// NOT the pending submission. appStatus=3 means the old version is online —
|
||||
// it does NOT mean the newly-submitted version was accepted.
|
||||
//
|
||||
// Reliable fields:
|
||||
// root.updateVersion (bool): true = new version update available to users
|
||||
// (i.e. the newly submitted version is APPROVED/published)
|
||||
// false = users cannot update (new version still under review OR rejected)
|
||||
// packageInfo.appStatus: 5 = this version was explicitly rejected/驳回
|
||||
// packageInfo.synchroResult: 1=上线成功, 0=拒绝/失败
|
||||
int appStatus = pkg.path("appStatus").asInt(pkg.path("status").asInt(-1));
|
||||
boolean updateVersion = root.path("updateVersion").asBoolean(true);
|
||||
// updateVersion=false means the submitted version is not yet live (either under review or rejected)
|
||||
// We need a DIFFERENT signal to distinguish rejected from still-under-review
|
||||
boolean updateVersion = root.path("updateVersion").asBoolean(false);
|
||||
log.info("MI poll appStatus={} updateVersion={} for version={}", appStatus, updateVersion, v.getId());
|
||||
yield switch (appStatus) {
|
||||
case 3 -> updateVersion
|
||||
? AppVersionEntity.StoreReviewState.APPROVED
|
||||
: AppVersionEntity.StoreReviewState.UNDER_REVIEW; // published but new version rejected
|
||||
case 5 -> AppVersionEntity.StoreReviewState.REJECTED;
|
||||
case 1, 2 -> AppVersionEntity.StoreReviewState.UNDER_REVIEW;
|
||||
default -> {
|
||||
// appStatus field absent — fall back to synchroResult and updateVersion
|
||||
// appStatus=5 is an explicit rejection signal
|
||||
if (appStatus == 5) {
|
||||
yield AppVersionEntity.StoreReviewState.REJECTED;
|
||||
}
|
||||
// updateVersion=true means the submitted version is now live/approved
|
||||
if (updateVersion) {
|
||||
yield AppVersionEntity.StoreReviewState.APPROVED;
|
||||
}
|
||||
// Fall back: synchroResult distinguishes rejected(0) from still-pending(-1)
|
||||
int synchroResult = pkg.path("synchroResult").asInt(-1);
|
||||
log.info("MI poll synchroResult={} for version={}", synchroResult, v.getId());
|
||||
// synchroResult: 1=已上线(通过), 0=拒绝/失败
|
||||
yield synchroResult == 1 ? AppVersionEntity.StoreReviewState.APPROVED
|
||||
: synchroResult == 0 ? AppVersionEntity.StoreReviewState.REJECTED
|
||||
: updateVersion ? AppVersionEntity.StoreReviewState.APPROVED
|
||||
yield synchroResult == 0 ? AppVersionEntity.StoreReviewState.REJECTED
|
||||
: AppVersionEntity.StoreReviewState.UNDER_REVIEW;
|
||||
}
|
||||
};
|
||||
}
|
||||
default -> null; // APP_STORE, GOOGLE_PLAY: no vendor query API
|
||||
};
|
||||
}
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户