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>
这个提交包含在:
XuqmGroup 2026-05-17 13:04:18 +08:00
父节点 81f04ee432
当前提交 39367a57e1

查看文件

@ -482,30 +482,34 @@ public class StoreSubmissionService {
// Log full root response so we can verify exact field names from production // Log full root response so we can verify exact field names from production
log.info("MI poll full response for version={}: {}", v.getId(), root); log.info("MI poll full response for version={}: {}", v.getId(), root);
JsonNode pkg = root.path("packageInfo"); JsonNode pkg = root.path("packageInfo");
// Xiaomi /devupload/dev/query response: // Xiaomi /devupload/dev/query returns status of the currently-published app,
// packageInfo.appStatus: 1=待审核, 2=审核中, 3=已发布/上线, 4=已下线, 5=拒绝 // NOT the pending submission. appStatus=3 means the old version is online
// root.updateVersion (bool): true=用户可更新(已上线), false=不可更新(审核中或拒绝) // 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=拒绝/失败 // packageInfo.synchroResult: 1=上线成功, 0=拒绝/失败
int appStatus = pkg.path("appStatus").asInt(pkg.path("status").asInt(-1)); 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()); log.info("MI poll appStatus={} updateVersion={} for version={}", appStatus, updateVersion, v.getId());
yield switch (appStatus) { // appStatus=5 is an explicit rejection signal
case 3 -> updateVersion if (appStatus == 5) {
? AppVersionEntity.StoreReviewState.APPROVED yield AppVersionEntity.StoreReviewState.REJECTED;
: AppVersionEntity.StoreReviewState.UNDER_REVIEW; // published but new version rejected }
case 5 -> AppVersionEntity.StoreReviewState.REJECTED; // updateVersion=true means the submitted version is now live/approved
case 1, 2 -> AppVersionEntity.StoreReviewState.UNDER_REVIEW; if (updateVersion) {
default -> { yield AppVersionEntity.StoreReviewState.APPROVED;
// appStatus field absent fall back to synchroResult and updateVersion }
int synchroResult = pkg.path("synchroResult").asInt(-1); // Fall back: synchroResult distinguishes rejected(0) from still-pending(-1)
log.info("MI poll synchroResult={} for version={}", synchroResult, v.getId()); int synchroResult = pkg.path("synchroResult").asInt(-1);
// synchroResult: 1=已上线(通过), 0=拒绝/失败 log.info("MI poll synchroResult={} for version={}", synchroResult, v.getId());
yield synchroResult == 1 ? AppVersionEntity.StoreReviewState.APPROVED yield synchroResult == 0 ? AppVersionEntity.StoreReviewState.REJECTED
: synchroResult == 0 ? AppVersionEntity.StoreReviewState.REJECTED : AppVersionEntity.StoreReviewState.UNDER_REVIEW;
: updateVersion ? AppVersionEntity.StoreReviewState.APPROVED
: AppVersionEntity.StoreReviewState.UNDER_REVIEW;
}
};
} }
default -> null; // APP_STORE, GOOGLE_PLAY: no vendor query API default -> null; // APP_STORE, GOOGLE_PLAY: no vendor query API
}; };