更新商品风险处理

This commit is contained in:
super
2026-04-05 22:04:21 +08:00
parent 380dd9f206
commit 486e690204
45 changed files with 3783 additions and 12 deletions
@@ -74,7 +74,10 @@ public class ZiniaoShopIndexService {
return cursor;
}
public ZiniaoShopMatchResultVo findIndexedStoreByName(String targetShopName) {
/**
* @param buildOpenStoreUrl 是否拼接紫鸟打开店铺 URL;商品风险等由 Python 侧自行拼地址时应传 false,避免多余鉴权调用且不因链接失败误判匹配状态。
*/
public ZiniaoShopMatchResultVo findIndexedStoreByName(String targetShopName, boolean buildOpenStoreUrl) {
String normalizedShopName = normalizeShopName(targetShopName);
if (normalizedShopName.isBlank()) {
return pendingResult("店铺名为空,无法匹配索引");
@@ -98,6 +101,20 @@ public class ZiniaoShopIndexService {
return pendingResult("店铺索引信息不完整,请等待后台刷新");
}
if (!buildOpenStoreUrl) {
ZiniaoShopMatchResultVo vo = new ZiniaoShopMatchResultVo();
vo.setMatched(true);
vo.setShopId(entry.getShopId());
vo.setShopName(entry.getShopName());
vo.setCompanyName(entry.getCompanyName());
vo.setPlatform(entry.getPlatform());
vo.setMatchedUserId(entry.getMatchedUserId());
vo.setOpenStoreUrl(null);
vo.setMatchStatus(isFresh(entry) ? MATCH_STATUS_MATCHED : MATCH_STATUS_STALE);
vo.setMatchMessage(isFresh(entry) ? null : "店铺索引已过保鲜期,请等待后台刷新");
return vo;
}
String apiKey = findApiKeyByHash(entry.getApiKeyHash());
if (apiKey == null) {
return pendingResult("店铺索引所依赖的紫鸟 key 已失效,请等待后台刷新");
@@ -134,6 +151,10 @@ public class ZiniaoShopIndexService {
return vo;
}
public ZiniaoShopMatchResultVo findIndexedStoreByName(String targetShopName) {
return findIndexedStoreByName(targetShopName, true);
}
public void refreshShopIndex() {
long now = Instant.now().toEpochMilli();
ZiniaoShopIndexRefreshCursorDto previousCursor = ziniaoTransientCacheService
@@ -34,6 +34,10 @@ public class ZiniaoShopSwitchService {
return ziniaoShopIndexService.findIndexedStoreByName(targetShopName);
}
public ZiniaoShopMatchResultVo findIndexedStoreByName(String targetShopName, boolean buildOpenStoreUrl) {
return ziniaoShopIndexService.findIndexedStoreByName(targetShopName, buildOpenStoreUrl);
}
public ZiniaoShopMatchResultVo emptyMatchResult() {
ZiniaoShopMatchResultVo vo = new ZiniaoShopMatchResultVo();
vo.setMatched(false);