fix: 部分活动未上报yinli_Pay

This commit is contained in:
guanchao
2026-10-15 15:37:27 +08:00
parent af38c6c9ec
commit e279afa31d
9 changed files with 423 additions and 76 deletions
+17 -2
View File
@@ -1,6 +1,7 @@
import Utils from "../Pay/Utils";
import ActivityScheduleService from "./ActivityScheduleService";
import ActivityBundleLoader from "./ActivityBundleLoader";
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
const FIELDS: { [id: string]: string } = { "1001": "coinAmount", "2001": "freezeAmount", "2002": "hammerAmount", "2003": "magicAmount", "2005": "userPowerTime" };
const LOCAL: { [field: string]: string } = { coinAmount: "coin", freezeAmount: "freezeAmount", hammerAmount: "hammerAmount", magicAmount: "magicAmount", userPowerTime: "userPowerTime" };
@@ -192,6 +193,14 @@ export default class PyramidService {
cc.warn("[Pyramid] 支付结果查询失败,继续重试", error);
}
if (result && (result.paymentStatus === "succeeded" || result.paymentStatus === "closed")) {
if (result.paymentStatus === "succeeded") {
try {
const price = Number(result.goodsPrice ?? pending.price) * Number(result.itemCount ?? 1);
const productId = result.itemid || pending.productId;
if (!Number.isSafeInteger(price) || price <= 0 || !productId) throw new Error("订单上报信息缺失");
MiniGameSdk.API.yinli_Pay(price, pending.orderId, productId);
} catch (error) { cc.warn("[Pyramid] 付费上报失败", error); }
}
delete this.journal.confirmingOrder; this.paymentRetryBlocked = false; this.save(); await this.refresh(); return;
}
if (attempt < this.paymentPollDelays.length)
@@ -213,7 +222,10 @@ export default class PyramidService {
}
private static async openIosCustomerPayment(platform: any, state: any, level: any,
generation: number, orderId: string): Promise<void> {
const pending = { orderId, periodId: state.periodId, level: state.currentLevel, channel: "ios_customer" };
const pending = {
orderId, periodId: state.periodId, level: state.currentLevel, channel: "ios_customer",
price: level.itemPrice, productId: level.itemId
};
this.journal.confirmingOrder = pending; this.save(); this.emit();
const opened: any = await new Promise(resolve => Utils.GoKEFu({
outTradeNo: orderId, price: level.itemPrice, payment_name: level.itemId, payment_count: 1,
@@ -260,7 +272,10 @@ export default class PyramidService {
// if (result.paymentFailed) { platform.showToast({ title: "取消充值", icon: "none" }); return; }
if (result.err) throw Object.assign(new Error(result.err), result);
// Only the SDK success callback creates durable payment confirmation work.
this.journal.confirmingOrder = { orderId: result.outTradeNo, periodId: state.periodId, level: state.currentLevel };
this.journal.confirmingOrder = {
orderId: result.outTradeNo, periodId: state.periodId, level: state.currentLevel,
price: level.itemPrice, productId: level.itemId
};
this.paymentRetryBlocked = false; this.save(); this.emit(); await this.confirmPayment(true);
});
}