增加首冲

This commit is contained in:
hy001 2026-05-28 15:07:52 +08:00
parent 7541ba77a6
commit 973f76a438
2 changed files with 21 additions and 4 deletions

View File

@ -29,6 +29,8 @@ public class RechargeSuccessEvent implements Serializable {
private String currency;
private String payPlatform;
private String paymentMethod;
private String googleProductId;
private String productId;
private String appVersion;
private String sourceOrderId;
private String orderId;

View File

@ -58,6 +58,15 @@ public class RechargeSuccessEventPublisher {
return;
}
String sourceOrderId = String.valueOf(purchaseHistoryId);
String payPlatform = normalizePayPlatform(defaultIfBlank(event.getPayPlatform(), event.getPlatform()));
String paymentMethod = classifyPaymentMethod(payPlatform);
String appVersion = defaultIfBlank(event.getAppVersion(), "");
String productId = Objects.nonNull(event.getProductConfig())
? defaultIfBlank(event.getProductConfig().getProductId(), event.getOrigin())
: defaultIfBlank(event.getOrigin(), "");
String googleProductId = Objects.equals(GOOGLE, payPlatform) ? productId : "";
Map<String, Object> payload = new HashMap<>();
payload.put("payerUserId", event.getUserId());
payload.put("acceptUserId", userId);
@ -66,11 +75,9 @@ public class RechargeSuccessEventPublisher {
payload.put("platform", event.getPlatform());
payload.put("payPlatform", event.getPayPlatform());
payload.put("appVersion", event.getAppVersion());
payload.put("productId", productId);
payload.put("googleProductId", googleProductId);
String sourceOrderId = String.valueOf(purchaseHistoryId);
String payPlatform = normalizePayPlatform(defaultIfBlank(event.getPayPlatform(), event.getPlatform()));
String paymentMethod = classifyPaymentMethod(payPlatform);
String appVersion = defaultIfBlank(event.getAppVersion(), "");
publish(new RechargeSuccessEvent()
.setEventId("RECHARGE_SUCCESS:" + paymentMethod + ":" + sourceOrderId)
.setSysOrigin(event.getSysOrigin())
@ -80,6 +87,8 @@ public class RechargeSuccessEventPublisher {
.setCurrency("USD")
.setPayPlatform(payPlatform)
.setPaymentMethod(paymentMethod)
.setProductId(productId)
.setGoogleProductId(googleProductId)
.setAppVersion(appVersion)
.setSourceOrderId(sourceOrderId)
.setOrderId(sourceOrderId)
@ -115,6 +124,10 @@ public class RechargeSuccessEventPublisher {
payload.put("productContent", product.getContent());
String appVersion = appVersionFromMetadata(order);
payload.put("appVersion", appVersion);
String productId = defaultIfBlank(order.getTrackId(), "");
String googleProductId = Objects.equals(GOOGLE, payPlatform) ? productId : "";
payload.put("productId", productId);
payload.put("googleProductId", googleProductId);
publish(new RechargeSuccessEvent()
.setEventId("RECHARGE_SUCCESS:" + paymentMethod + ":" + payPlatform + ":" + order.getId())
@ -125,6 +138,8 @@ public class RechargeSuccessEventPublisher {
.setCurrency(defaultIfBlank(order.getCurrency(), "USD"))
.setPayPlatform(payPlatform)
.setPaymentMethod(paymentMethod)
.setProductId(productId)
.setGoogleProductId(googleProductId)
.setAppVersion(appVersion)
.setSourceOrderId(order.getId())
.setOrderId(defaultIfBlank(order.getOrderId(), order.getId()))