feat(mindspace): add SEO/GEO delivery, page template catalog, and admin hooks
Memind CI / Test, build, and release guards (push) Has been cancelled

Enable optional SEO/GEO injection and discovery routes for confirmed public pages while keeping private pages noindex. Add premium page template skills, portal catalog API, template shop UI, and Baidu push gated by memind_adm config.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-10 08:06:12 +08:00
parent 7c65540366
commit fde6503bdf
158 changed files with 9194 additions and 270 deletions
+37 -1
View File
@@ -50,10 +50,15 @@ function mapOrderRow(row) {
createdAt: Number(row.created_at),
codeUrl: row.code_url ?? null,
h5Url: row.h5_url ?? null,
orderPurpose: row.order_purpose ?? 'recharge',
orderPurposeRef: row.order_purpose_ref ?? null,
};
}
export function createRechargeService(pool, { userAuth, wechatPay, config = loadRechargeConfig() } = {}) {
export function createRechargeService(
pool,
{ userAuth, wechatPay, templateCatalogService = null, config = loadRechargeConfig() } = {},
) {
const expireStaleOrders = async (userId) => {
const now = Date.now();
await pool.query(
@@ -275,6 +280,37 @@ export function createRechargeService(pool, { userAuth, wechatPay, config = load
return { ok: false, message: '订单状态不可支付' };
}
if (locked.orderPurpose === 'template_purchase') {
if (!templateCatalogService?.fulfillWechatPurchaseLocked) {
await conn.rollback();
return { ok: false, message: '模板购买服务未启用' };
}
const templateResult = await templateCatalogService.fulfillWechatPurchaseLocked({
conn,
order: locked,
transaction,
now,
});
if (!templateResult.ok) {
await conn.rollback();
return templateResult;
}
await conn.query(
`UPDATE h5_payment_orders
SET status = 'paid', provider_txn = ?, paid_at = ?, updated_at = ?
WHERE id = ?`,
[transaction.transaction_id ?? transaction.out_trade_no ?? null, now, now, locked.id],
);
await conn.commit();
return {
ok: true,
user: await userAuth.getUserById(locked.userId),
balanceCents: templateResult.balanceCents,
grantedSkills: templateResult.grantedSkills,
skillName: templateResult.skillName,
};
}
const recharge = await userAuth.recharge(locked.userId, locked.amountCents, null, '用户自助充值', {
paymentOrderId: locked.id,
conn,