羽绒服
This commit is contained in:
@@ -182,6 +182,12 @@ public class JDProductService {
|
||||
wenan4.put("content", "【教你下单】 " + title + cleanSkuName + "\n" + WENAN_FANAN_BX.replaceAll("信息更新日期:", "信息更新日期:" + format));
|
||||
wenanArray.add(wenan4);
|
||||
|
||||
|
||||
JSONObject wenan5 = new JSONObject();
|
||||
wenan5.put("type", "羽绒服专属-标价到手"); // type明确产品类型+下单方式,与其他方案区分
|
||||
wenan5.put("content", "(羽绒服专属) " + title + cleanSkuName + "\n" + WENAN_YURONGFU.replaceAll("更新", format + "更新"));
|
||||
wenanArray.add(wenan5);
|
||||
|
||||
productObj.put("wenan", wenanArray);
|
||||
|
||||
// 添加通用文案 - 使用转链后的短链替换原始链接
|
||||
@@ -294,12 +300,12 @@ public class JDProductService {
|
||||
String errorCode = response != null ? response.getCode() : "null";
|
||||
String errorMsg = response != null ? response.getMsg() : "null";
|
||||
Integer resultCode = response != null && response.getGetResult() != null ? response.getGetResult().getCode() : null;
|
||||
|
||||
|
||||
// 尝试解析response.getMsg()中的详细错误信息(JSON格式)
|
||||
String detailErrorMsg = errorMsg;
|
||||
Integer detailCode = resultCode;
|
||||
boolean parsedDetail = false;
|
||||
|
||||
|
||||
try {
|
||||
if (errorMsg != null && errorMsg.startsWith("{") && errorMsg.contains("message")) {
|
||||
// 解析外层JSON
|
||||
@@ -318,7 +324,7 @@ public class JDProductService {
|
||||
detailCode = parsedDetailCode;
|
||||
}
|
||||
parsedDetail = true;
|
||||
log.error("礼金创建失败 - 京东API错误: code={}, message={}, SKU={}, owner={}, amount={}, quantity={}",
|
||||
log.error("礼金创建失败 - 京东API错误: code={}, message={}, SKU={}, owner={}, amount={}, quantity={}",
|
||||
detailCode, detailErrorMsg, skuId, owner, amount, quantity);
|
||||
}
|
||||
}
|
||||
@@ -329,22 +335,22 @@ public class JDProductService {
|
||||
// JSON解析失败,使用原始错误信息
|
||||
log.warn("解析错误信息失败,使用原始信息: {}", errorMsg);
|
||||
}
|
||||
|
||||
|
||||
// 记录日志并抛出包含详细错误信息的异常
|
||||
if (!parsedDetail) {
|
||||
log.error("礼金创建失败 - response.code={}, response.msg={}, result.code={}, SKU={}, owner={}, amount={}, quantity={}",
|
||||
log.error("礼金创建失败 - response.code={}, response.msg={}, result.code={}, SKU={}, owner={}, amount={}, quantity={}",
|
||||
errorCode, errorMsg, resultCode, skuId, owner, amount, quantity);
|
||||
}
|
||||
|
||||
|
||||
// 构造错误消息
|
||||
String finalErrorMsg;
|
||||
if (parsedDetail) {
|
||||
finalErrorMsg = String.format("礼金创建失败:%s (错误码:%d)", detailErrorMsg, detailCode);
|
||||
} else {
|
||||
finalErrorMsg = String.format("礼金创建失败:京东API返回错误 (response.code=%s, result.code=%s, msg=%s)",
|
||||
finalErrorMsg = String.format("礼金创建失败:京东API返回错误 (response.code=%s, result.code=%s, msg=%s)",
|
||||
errorCode, resultCode != null ? resultCode : "null", detailErrorMsg);
|
||||
}
|
||||
|
||||
|
||||
throw new Exception(finalErrorMsg);
|
||||
}
|
||||
|
||||
@@ -465,20 +471,20 @@ public class JDProductService {
|
||||
*/
|
||||
public List<Map<String, Object>> batchCreateGiftCouponsWithLinks(String skuId, double amount, int quantity, int batchSize, String owner, String skuName) {
|
||||
log.info("开始批量创建礼金券 - SKU={}, 金额={}元, 数量={}, 批次大小={}, Owner={}", skuId, amount, quantity, batchSize, owner);
|
||||
|
||||
|
||||
List<Map<String, Object>> results = new ArrayList<>();
|
||||
int successCount = 0;
|
||||
int failCount = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < batchSize; i++) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("index", i + 1);
|
||||
result.put("success", false);
|
||||
|
||||
|
||||
try {
|
||||
// 创建礼金券
|
||||
String giftCouponKey = createGiftCoupon(skuId, amount, quantity, owner, skuName);
|
||||
|
||||
|
||||
if (giftCouponKey == null || giftCouponKey.trim().isEmpty()) {
|
||||
log.error("批量创建礼金券失败 [{}/{}] - giftCouponKey为空", i + 1, batchSize);
|
||||
result.put("error", "礼金创建失败,giftCouponKey为空");
|
||||
@@ -487,14 +493,14 @@ public class JDProductService {
|
||||
failCount++;
|
||||
} else {
|
||||
log.info("批量创建礼金券成功 [{}/{}] - giftCouponKey={}", i + 1, batchSize, giftCouponKey);
|
||||
|
||||
|
||||
// 保存到Redis
|
||||
try {
|
||||
saveGiftCouponToRedis(skuId, giftCouponKey, skuName, owner);
|
||||
} catch (Exception e) {
|
||||
log.warn("保存礼金到Redis失败,但礼金创建成功 - giftCouponKey={}, error={}", giftCouponKey, e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
// 生成包含礼金的推广链接
|
||||
String shortURL = null;
|
||||
try {
|
||||
@@ -502,7 +508,7 @@ public class JDProductService {
|
||||
String originalUrl = skuId;
|
||||
// transfer方法支持SKU ID或materialUrl直接传入
|
||||
shortURL = transfer(originalUrl, giftCouponKey);
|
||||
|
||||
|
||||
if (shortURL == null || shortURL.trim().isEmpty()) {
|
||||
log.warn("生成推广链接失败 - giftCouponKey={}, 礼金创建成功但转链失败", giftCouponKey);
|
||||
} else {
|
||||
@@ -511,7 +517,7 @@ public class JDProductService {
|
||||
} catch (Exception e) {
|
||||
log.error("生成推广链接异常 - giftCouponKey={}, error={}", giftCouponKey, e.getMessage(), e);
|
||||
}
|
||||
|
||||
|
||||
result.put("success", true);
|
||||
result.put("giftCouponKey", giftCouponKey);
|
||||
result.put("shortURL", shortURL);
|
||||
@@ -524,9 +530,9 @@ public class JDProductService {
|
||||
result.put("shortURL", null);
|
||||
failCount++;
|
||||
}
|
||||
|
||||
|
||||
results.add(result);
|
||||
|
||||
|
||||
// 避免请求过快,每创建一张礼金后稍作延迟
|
||||
if (i < batchSize - 1) {
|
||||
try {
|
||||
@@ -537,7 +543,7 @@ public class JDProductService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log.info("批量创建礼金券完成 - 总数={}, 成功={}, 失败={}", batchSize, successCount, failCount);
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -107,8 +107,24 @@ public class JDUtil {
|
||||
5:全国联保,全国统一安装标准。支持官方 400,服务号查询,假一赔十。
|
||||
""";
|
||||
public static final String WENAN_FANAN_BX = "本人提供免费指导下单服务,一台也是团购价,细心指导\n" + "\n" + "【质量】官旗下单,包正的\n" + "【物流】您自己账户可跟踪,24小时发货\n" + "【售后】您自己账户直接联系,无忧售后\n" + "【安装】专业人员安装,全程无需您操心\n" + "【价格】标价就是到手价,骑共享单车去酒吧,该省省该花花\n" + "【服务】手把手教您下单,有问题随时咨询\n" + "【体验】所有服务都是官旗提供,价格有内部渠道优惠,同品质更优惠!\n" + "\n" + "信息更新日期:\n" + "\n" + "捡漏价格不定时有变动,优惠不等人,发「省份+型号」免费咨询当日最低价!";
|
||||
public static final String WENAN_YURONGFU = "坦博尔正品羽绒服!大额优惠券直接送!立省几百\n" +
|
||||
"品牌官方授权渠道直发,比旗舰自营店到手价更低,用你自己的账号下单更放心~\n" +
|
||||
"款色码全任你选(仅限店内展示款式),下单前必询库存!拒绝盲拍哦~\n" +
|
||||
"先确认货号、颜色、尺码,再拍不踩雷,建议先去实体店试穿合身,避免后续麻烦呀\n" +
|
||||
"到手价 = 页面标价 + 6 元代拍费(划重点:不是所有款都二百多,以页面标价为准)\n" +
|
||||
"叠加专属优惠券后,比自己直接买省不少,福利不等人!\n" +
|
||||
"正品保障拉满!假一罚十,支持任何渠道验货无忧\n" +
|
||||
"后续有质量问题,直接用自己的账号走官方售后,售后有保障\n" +
|
||||
"目前仅店内展示款式可拍,暂时没有额外款式补充哈\n" +
|
||||
"粉丝优先回复处理,官方渠道直发,代拍不退代拍费,望理解~\n" +
|
||||
"\n" +
|
||||
"更新\n" + // 日期替换标记,代码自动替换为“yyyyMMdd更新”
|
||||
"\n" ;
|
||||
|
||||
|
||||
public static final String FANAN_COMMON = "\n 文案复制到微x,点击领券,把商品加到J东,去APP结算才能显示折扣补贴\n";
|
||||
|
||||
|
||||
/**
|
||||
* 内部单号:
|
||||
* 分销标记(标记用,勿改):
|
||||
|
||||
Reference in New Issue
Block a user