fix: bug
This commit is contained in:
@@ -234,29 +234,43 @@ export default function TemplateRunScreen() {
|
||||
return;
|
||||
}
|
||||
|
||||
const handleConfirm = async () => {
|
||||
const handleConfirm = async () => {
|
||||
// 转换表单数据为 API 期望的格式
|
||||
const transformedData = transformFormData(formData);
|
||||
console.log('转换后的数据:', transformedData);
|
||||
|
||||
const identify = await subscription.meterEvent({
|
||||
meter_id: `mtr_test_61TR3BkyDcen9OrBm412fzUa9k2QB732`,
|
||||
event_name: `token_usage`,
|
||||
payload: {
|
||||
value: `100`
|
||||
}
|
||||
})
|
||||
console.log({ identify })
|
||||
// error
|
||||
const orid = identify.data?.identifier
|
||||
console.log({ orid })
|
||||
if (orid) {
|
||||
try {
|
||||
setCurrentStep('progress');
|
||||
executeTemplate(template!.id, transformedData);
|
||||
} catch (e) {
|
||||
// 退款orid
|
||||
// 这个我后端取 获取月
|
||||
const list = await subscription.list()
|
||||
const listData = list.data;
|
||||
if (listData && listData.length > 0) {
|
||||
const item = listData[0]
|
||||
const subscriptionId = item?.stripeSubscriptionId!;
|
||||
const summary = await subscription.credit.summary({
|
||||
subscriptionId: subscriptionId,
|
||||
filter: {
|
||||
type: `applicability_scope`,
|
||||
applicability_scope: {
|
||||
price_type: `metered`
|
||||
}
|
||||
}
|
||||
});
|
||||
const identify = await subscription.meterEvent({
|
||||
event_name: `token_usage`,
|
||||
payload: {
|
||||
value: `100`
|
||||
}
|
||||
})
|
||||
// error
|
||||
const orid = identify.data?.identifier
|
||||
if (orid) {
|
||||
try {
|
||||
setCurrentStep('progress');
|
||||
executeTemplate(template!.id, transformedData);
|
||||
} catch (e) {
|
||||
// 退款orid
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 跳转到订阅
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user