Initial MultiPay project

This commit is contained in:
Alex committed 2026-11-02 09:50:37 +08:00
commit 91abad4066
488 files changed
+76727

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import { db } from "../src/db";
import { decryptJson, encryptJson } from "../src/security";
const gatewayId = process.argv[2] || "alipay";
const product = process.argv[3] || "page";
if (!['page', 'precreate'].includes(product)) throw new Error("产品必须是 page 或 precreate");
const row = db.query("SELECT config_encrypted FROM gateways WHERE id=? AND channel='alipay'").get(gatewayId) as { config_encrypted: string } | null;
if (!row) throw new Error(`找不到支付宝网关:${gatewayId}`);
const config = decryptJson<Record<string, string>>(row.config_encrypted || "");
config.paymentProduct = product;
db.query("UPDATE gateways SET config_encrypted=?, updated_at=? WHERE id=?")
.run(encryptJson(config), new Date().toISOString(), gatewayId);
console.log(JSON.stringify({ gatewayId, paymentProduct: product, updated: true }));