This commit is contained in:
Leo
2025-11-13 23:55:25 +08:00
parent 9e69230948
commit b8981ffc98
2 changed files with 38 additions and 3 deletions

View File

@@ -116,11 +116,44 @@ public class ErpProductController extends BaseController
{
try {
int count = erpProductService.pullAndSaveProductList(appid, pageNo, pageSize, productStatus);
return success("成功拉取并保存 " + count + " 个商品");
if (count > 0) {
return success("成功拉取并保存 " + count + " 个商品");
} else {
String statusText = getStatusText(productStatus);
String message = "拉取完成,但没有获取到商品数据";
if (productStatus != null) {
message += "(筛选条件:状态=" + statusText + "";
}
message += "。建议1.尝试不选择状态拉取全部商品2.尝试其他状态(下架、已售等)";
return success(message);
}
} catch (Exception e) {
return error("拉取商品列表失败: " + e.getMessage());
}
}
/**
* 获取状态文本(用于提示信息)
*/
private String getStatusText(Integer status) {
if (status == null) {
return "全部";
}
switch (status) {
case 1:
return "上架";
case 2:
return "下架";
case 3:
return "已售";
case 22:
return "草稿";
case 23:
return "审核中";
default:
return String.valueOf(status);
}
}
/**
* 批量上架商品