This commit is contained in:
张成
2026-04-01 14:47:34 +08:00
parent 4c724143c0
commit 38430c9244
7 changed files with 20 additions and 4 deletions

View File

@@ -109,6 +109,7 @@ async function verifyRequest(body) {
plan_id: sub.plan_id,
subscription_id: sub.id,
token_id: row.id,
token_key: row.key || "",
stat_month: statMonth,
usage_snapshot: {
msg_count: usageSvc.num(usageRow.msg_count),

View File

@@ -36,7 +36,7 @@ async function findActiveSubscriptionForUser(userId) {
}
async function createToken(body) {
const { user_id, token_name, expire_at } = body;
const { user_id, token_name, expire_at, key } = body;
if (!user_id || !expire_at) throw new Error("缺少 user_id 或 expire_at");
const u = await baseModel.biz_user.findByPk(user_id);
if (!u) throw new Error("用户不存在");
@@ -60,6 +60,7 @@ async function createToken(body) {
user_id,
plan_id,
token_name: token_name || "default",
key: key || null,
token_hash,
secret_cipher,
status: "active",