@xuda.io/account_module 1.2.1215 → 1.2.1217
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +4 -2
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2447,7 +2447,7 @@ export const ts_contact = async function (contact_id) {
|
|
|
2447
2447
|
};
|
|
2448
2448
|
|
|
2449
2449
|
export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
2450
|
-
const { uid, year, month, day } = req;
|
|
2450
|
+
const { uid, year, month, day, usage_scope = 'account' } = req;
|
|
2451
2451
|
try {
|
|
2452
2452
|
const app_id = await get_account_default_project_id(uid);
|
|
2453
2453
|
const { data: acc_obj } = await db_module.get_couch_doc('xuda_accounts', uid);
|
|
@@ -2464,6 +2464,7 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
|
2464
2464
|
});
|
|
2465
2465
|
// console.log('ai_usage', ai_usage.rows);
|
|
2466
2466
|
|
|
2467
|
+
total_usage = 0;
|
|
2467
2468
|
let profile = {};
|
|
2468
2469
|
|
|
2469
2470
|
debugger;
|
|
@@ -2491,8 +2492,9 @@ export const get_account_ai_usage = async function (req, job_id, headers) {
|
|
|
2491
2492
|
let membership_plan = _conf.PLAN_OBJ?.[acc_obj?.ai_workspace_plan]?.features?.ai_credits || 0;
|
|
2492
2493
|
let ai_workspace_plan = _conf.PLAN_OBJ?.[acc_obj?.membership_plan]?.features?.ai_credits || 0;
|
|
2493
2494
|
let contact_connection = 0;
|
|
2495
|
+
let total_credits = membership_plan + ai_workspace_plan + contact_connection;
|
|
2494
2496
|
|
|
2495
|
-
let data = { credits: { membership_plan, ai_workspace_plan, contact_connection }, usage: { profile, projects: [] } };
|
|
2497
|
+
let data = { credits: { membership_plan, ai_workspace_plan, contact_connection, total: total_credits }, usage: { profile, projects: [] } };
|
|
2496
2498
|
|
|
2497
2499
|
return { code: 55, data };
|
|
2498
2500
|
} catch (err) {
|