ts-glitter 22.4.0 → 22.4.4
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/cms-plugin/member-type-list.js +4 -5
- package/lowcode/cms-plugin/member-type-list.ts +4 -5
- package/lowcode/cms-plugin/pos-pages/pos-function.js +2 -1
- package/lowcode/cms-plugin/pos-pages/pos-function.ts +2 -1
- package/package.json +1 -1
- package/src/api-public/controllers/index.js +7 -2
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +7 -1
- package/src/api-public/services/monitor.d.ts +1 -0
- package/src/api-public/services/monitor.js +1 -0
- package/src/api-public/services/monitor.js.map +1 -1
- package/src/api-public/services/monitor.ts +1 -0
- package/src/api-public/services/schedule.d.ts +1 -0
- package/src/api-public/services/schedule.js +38 -7
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +70 -38
- package/src/api-public/services/user.js +57 -64
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +118 -105
- package/src/index.js +4 -0
- package/src/index.js.map +1 -1
- package/src/index.ts +6 -1
- package/src/seo-config.js +0 -5
- package/src/seo-config.js.map +1 -1
- package/src/seo-config.ts +0 -5
- package/qqd3064m3g.json +0 -1
|
@@ -92,7 +92,7 @@ export class Schedule {
|
|
|
92
92
|
AND created_time < NOW() - INTERVAL ${config.auto_cancel_order_timer} HOUR
|
|
93
93
|
AND (orderData->>'$.proof_purchase' IS NULL)
|
|
94
94
|
ORDER BY id DESC;`,
|
|
95
|
-
[]
|
|
95
|
+
[],
|
|
96
96
|
);
|
|
97
97
|
await Promise.all(
|
|
98
98
|
orders.map(async (order: any) => {
|
|
@@ -103,7 +103,7 @@ export class Schedule {
|
|
|
103
103
|
orderData: order.orderData,
|
|
104
104
|
status: '0',
|
|
105
105
|
});
|
|
106
|
-
})
|
|
106
|
+
}),
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -125,7 +125,7 @@ export class Schedule {
|
|
|
125
125
|
const users = await db.query(
|
|
126
126
|
`select *
|
|
127
127
|
from \`${app}\`.t_user `,
|
|
128
|
-
[]
|
|
128
|
+
[],
|
|
129
129
|
);
|
|
130
130
|
for (const user of users) {
|
|
131
131
|
//更新會籍
|
|
@@ -181,7 +181,7 @@ export class Schedule {
|
|
|
181
181
|
`SELECT *
|
|
182
182
|
FROM \`${app}\`.t_user
|
|
183
183
|
WHERE MONTH (JSON_EXTRACT(userData, '$.birth')) = MONTH (CURDATE());`,
|
|
184
|
-
[]
|
|
184
|
+
[],
|
|
185
185
|
);
|
|
186
186
|
|
|
187
187
|
if (rgs.type === 'base') {
|
|
@@ -197,7 +197,7 @@ export class Schedule {
|
|
|
197
197
|
const usersLevel = await userClass.getUserLevel(
|
|
198
198
|
users.map((item: { userID: number }) => {
|
|
199
199
|
return { userId: item.userID };
|
|
200
|
-
})
|
|
200
|
+
}),
|
|
201
201
|
);
|
|
202
202
|
for (const user of users) {
|
|
203
203
|
const member = usersLevel.find(item => item.id == user.userID);
|
|
@@ -246,7 +246,7 @@ export class Schedule {
|
|
|
246
246
|
`SELECT *
|
|
247
247
|
FROM \`${app}\`.t_user
|
|
248
248
|
WHERE MONTH (JSON_EXTRACT(userData, '$.birth')) = MONTH (CURDATE());`,
|
|
249
|
-
[]
|
|
249
|
+
[],
|
|
250
250
|
);
|
|
251
251
|
|
|
252
252
|
// 篩選出一年內曾寄信過的顧客
|
|
@@ -316,7 +316,7 @@ export class Schedule {
|
|
|
316
316
|
WHERE tag = 'triggerInvoice'
|
|
317
317
|
AND status = 0
|
|
318
318
|
AND DATE_FORMAT(trigger_time, '%Y-%m-%d %H') = DATE_FORMAT(NOW(), '%Y-%m-%d %H');`,
|
|
319
|
-
[]
|
|
319
|
+
[],
|
|
320
320
|
);
|
|
321
321
|
for (const order of orders) {
|
|
322
322
|
if (order.content.cart_token) {
|
|
@@ -344,7 +344,7 @@ export class Schedule {
|
|
|
344
344
|
WHERE tag = 'sendFCM'
|
|
345
345
|
AND status = 0
|
|
346
346
|
AND DATE_FORMAT(trigger_time, '%Y-%m-%d %H:%i') = DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i');`,
|
|
347
|
-
[]
|
|
347
|
+
[],
|
|
348
348
|
);
|
|
349
349
|
for (const email of emails) {
|
|
350
350
|
if (email.status === 0) {
|
|
@@ -373,7 +373,7 @@ export class Schedule {
|
|
|
373
373
|
WHERE tag = 'sendMailBySchedule'
|
|
374
374
|
AND status = 0
|
|
375
375
|
AND DATE_FORMAT(trigger_time, '%Y-%m-%d %H:%i') = DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i');`,
|
|
376
|
-
[]
|
|
376
|
+
[],
|
|
377
377
|
);
|
|
378
378
|
for (const email of emails) {
|
|
379
379
|
if (email.status === 0) {
|
|
@@ -400,7 +400,7 @@ export class Schedule {
|
|
|
400
400
|
FROM \`${app}\`.t_triggers
|
|
401
401
|
WHERE tag = 'sendLineBySchedule'
|
|
402
402
|
AND DATE_FORMAT(trigger_time, '%Y-%m-%d %H:%i') = DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i');`,
|
|
403
|
-
[]
|
|
403
|
+
[],
|
|
404
404
|
);
|
|
405
405
|
|
|
406
406
|
for (const email of emails) {
|
|
@@ -412,7 +412,7 @@ export class Schedule {
|
|
|
412
412
|
text: email.content,
|
|
413
413
|
},
|
|
414
414
|
},
|
|
415
|
-
email.id
|
|
415
|
+
email.id,
|
|
416
416
|
);
|
|
417
417
|
}
|
|
418
418
|
}
|
|
@@ -442,7 +442,7 @@ export class Schedule {
|
|
|
442
442
|
`select count(1)
|
|
443
443
|
from \`${saasConfig.SAAS_NAME}\`.currency_config
|
|
444
444
|
where updated = '${date_index}'`,
|
|
445
|
-
[]
|
|
445
|
+
[],
|
|
446
446
|
)
|
|
447
447
|
)[0]['count(1)'] === 0
|
|
448
448
|
) {
|
|
@@ -459,7 +459,7 @@ export class Schedule {
|
|
|
459
459
|
await db.query(
|
|
460
460
|
`insert into \`${saasConfig.SAAS_NAME}\`.currency_config (\`json\`, updated)
|
|
461
461
|
values (?, ?)`,
|
|
462
|
-
[JSON.stringify(response.data), date_index]
|
|
462
|
+
[JSON.stringify(response.data), date_index],
|
|
463
463
|
);
|
|
464
464
|
setTimeout(() => this.currenciesUpdate(sec), sec * 1000);
|
|
465
465
|
})
|
|
@@ -489,15 +489,21 @@ export class Schedule {
|
|
|
489
489
|
FROM ${process.env.GLITTER_DB}.t_monitor
|
|
490
490
|
WHERE app_name = ${db.escape(app)}
|
|
491
491
|
AND req_type = 'file'
|
|
492
|
-
and CONVERT_TZ(created_time
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
492
|
+
and CONVERT_TZ(created_time
|
|
493
|
+
, '+00:00'
|
|
494
|
+
, '+08:00') BETWEEN
|
|
495
|
+
(CONVERT_TZ(CURDATE()
|
|
496
|
+
, '+00:00'
|
|
497
|
+
, '+08:00'))
|
|
498
|
+
and (CONVERT_TZ(CURDATE()
|
|
499
|
+
, '+00:00'
|
|
500
|
+
, '+08:00') + INTERVAL 1 DAY);`,
|
|
501
|
+
[],
|
|
496
502
|
);
|
|
497
503
|
await db.query(
|
|
498
504
|
`replace
|
|
499
|
-
|
|
500
|
-
[count[0]['now'], count[0]['count'], `${count[0]['now'].toISOString()}`.substring(0, 10)]
|
|
505
|
+
into \`${app}\`.visit_logs (date, count,tag_name) values (?, ? , ?)`,
|
|
506
|
+
[count[0]['now'], count[0]['count'], `${count[0]['now'].toISOString()}`.substring(0, 10)],
|
|
501
507
|
);
|
|
502
508
|
}
|
|
503
509
|
} catch (e) {
|
|
@@ -532,36 +538,62 @@ export class Schedule {
|
|
|
532
538
|
return dd[key];
|
|
533
539
|
});
|
|
534
540
|
})
|
|
535
|
-
.flat()
|
|
541
|
+
.flat(),
|
|
536
542
|
);
|
|
537
543
|
}
|
|
538
544
|
Monitor.insert_stack.splice(0, readAdd.length);
|
|
539
545
|
setTimeout(() => this.insertHistory(sec), sec * 1000);
|
|
540
546
|
console.log(`insertHistory-Stop`, (new Date().getTime() - clock.getTime()) / 1000);
|
|
541
|
-
} catch (e) {
|
|
547
|
+
} catch (e) {
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
async insertOnlineTime(sec: number) {
|
|
552
|
+
let clock = new Date();
|
|
553
|
+
try {
|
|
554
|
+
console.log(`insertOnlineTime`);
|
|
555
|
+
for (const key in Monitor.online_time) {
|
|
556
|
+
const updateID=Monitor.online_time[key];
|
|
557
|
+
if(!updateID.length) {continue}
|
|
558
|
+
Monitor.online_time[key]=[];
|
|
559
|
+
await db.query(
|
|
560
|
+
`update \`${key}\`.t_user
|
|
561
|
+
set online_time=NOW()
|
|
562
|
+
where userID in (${[...new Set(updateID)].join(',')})`,
|
|
563
|
+
[]
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
setTimeout(() => this.insertOnlineTime(sec), sec * 1000);
|
|
567
|
+
console.log(`insertOnlineTime-Stop`, (new Date().getTime() - clock.getTime()) / 1000);
|
|
568
|
+
} catch (e) {
|
|
569
|
+
console.log(e)
|
|
570
|
+
setTimeout(() => this.insertOnlineTime(sec), sec * 1000);
|
|
571
|
+
}
|
|
542
572
|
}
|
|
543
573
|
|
|
544
574
|
main() {
|
|
545
575
|
const scheduleList: ScheduleItem[] = ConfigSetting.is_local
|
|
546
576
|
? //線下測試環境
|
|
547
|
-
|
|
577
|
+
[{ second: 10, status: true, func: 'insertHistory', desc: '插入瀏覽筆數' },
|
|
578
|
+
{ second: 5 , status: true, func: 'insertOnlineTime', desc: '上線時間' }]
|
|
548
579
|
: //線上環境
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
580
|
+
[
|
|
581
|
+
// { second: 10, status: false, func: 'example', desc: '排程啟用範例' },
|
|
582
|
+
{ second: 3600, status: true, func: 'birthRebate', desc: '生日禮發放購物金' },
|
|
583
|
+
{ second: 3600, status: true, func: 'birthBlessMail', desc: '生日祝福信件' },
|
|
584
|
+
{ second: 600, status: true, func: 'renewMemberLevel', desc: '更新會員分級' },
|
|
585
|
+
{ second: 30, status: true, func: 'resetVoucherHistory', desc: '未付款歷史優惠券重設' },
|
|
586
|
+
{ second: 30, status: true, func: 'autoSendMail', desc: '自動排程寄送信件' },
|
|
587
|
+
{ second: 30, status: true, func: 'autoSendFCM', desc: '自動排程寄送FCM' },
|
|
588
|
+
{ second: 30, status: true, func: 'autoSendLine', desc: '自動排程寄送line訊息' },
|
|
589
|
+
{ second: 3600 * 24, status: true, func: 'currenciesUpdate', desc: '多國貨幣的更新排程' },
|
|
590
|
+
// { second: 3600 * 24, status: false, func: 'initialSampleApp', desc: '重新刷新示範商店' },
|
|
591
|
+
{ second: 30 * 100, status: true, func: 'autoCancelOrder', desc: '自動取消未付款未出貨訂單' },
|
|
592
|
+
{ second: 30, status: true, func: 'autoTriggerInvoice', desc: '自動開立發票' },
|
|
593
|
+
{ second: 60 * 5, status: true, func: 'visitLogs', desc: '更新每天造訪人數' },
|
|
594
|
+
{ second: 10, status: true, func: 'insertHistory', desc: '插入瀏覽筆數' },
|
|
595
|
+
{ second: 5, status: true, func: 'insertOnlineTime', desc: '上線時間' },
|
|
596
|
+
];
|
|
565
597
|
try {
|
|
566
598
|
scheduleList.forEach(schedule => {
|
|
567
599
|
if (schedule.status && typeof this[schedule.func] === 'function') {
|
|
@@ -450,9 +450,9 @@ class User {
|
|
|
450
450
|
or (userData ->>'$.lineID' = ?)
|
|
451
451
|
or (userData ->>'$.phone' = ?)
|
|
452
452
|
ORDER BY CASE
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
WHEN (userData ->>'$.lineID' = ?) THEN 1
|
|
454
|
+
ELSE 3
|
|
455
|
+
END
|
|
456
456
|
`, [line_profile.email, userData.sub, (_a = line_profile.phone_number) !== null && _a !== void 0 ? _a : 'alkms', userData.sub]));
|
|
457
457
|
}
|
|
458
458
|
let findList = await getUsData();
|
|
@@ -468,7 +468,7 @@ class User {
|
|
|
468
468
|
name: userData.name || '未命名',
|
|
469
469
|
lineID: userData.sub,
|
|
470
470
|
email: line_profile.email,
|
|
471
|
-
phone: line_profile.phone
|
|
471
|
+
phone: line_profile.phone,
|
|
472
472
|
},
|
|
473
473
|
1,
|
|
474
474
|
]);
|
|
@@ -1016,22 +1016,22 @@ class User {
|
|
|
1016
1016
|
const limitClause = obj.page !== undefined && obj.limit !== undefined ? `LIMIT ${obj.page * obj.limit}, ${obj.limit}` : '';
|
|
1017
1017
|
const orderCountingSQL = await this.getCheckoutCountingModeSQL();
|
|
1018
1018
|
const sql = `
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1019
|
+
SELECT ${obj.select}
|
|
1020
|
+
FROM (SELECT email,
|
|
1021
|
+
COUNT(*) AS order_count,
|
|
1022
|
+
SUM(total) AS total_amount
|
|
1023
|
+
FROM \`${this.app}\`.t_checkout
|
|
1024
|
+
WHERE ${orderCountingSQL}
|
|
1025
|
+
GROUP BY email) AS o
|
|
1026
|
+
RIGHT JOIN \`${this.app}\`.t_user u ON o.email = u.account
|
|
1027
|
+
LEFT JOIN (SELECT email,
|
|
1028
|
+
total AS last_order_total,
|
|
1029
|
+
created_time AS last_order_time,
|
|
1030
|
+
ROW_NUMBER() OVER(PARTITION BY email ORDER BY created_time DESC) AS rn
|
|
1031
|
+
FROM \`${this.app}\`.t_checkout
|
|
1032
|
+
WHERE ${orderCountingSQL}) AS lo ON o.email = lo.email AND lo.rn = 1
|
|
1033
|
+
WHERE (${whereClause})
|
|
1034
|
+
ORDER BY ${orderByClause} ${limitClause}
|
|
1035
1035
|
`;
|
|
1036
1036
|
return sql;
|
|
1037
1037
|
}
|
|
@@ -1417,7 +1417,7 @@ class User {
|
|
|
1417
1417
|
if (pass('subscriber')) {
|
|
1418
1418
|
const subscriberList = await database_1.default.query(`SELECT DISTINCT u.userID, s.email
|
|
1419
1419
|
FROM \`${this.app}\`.t_subscribe AS s
|
|
1420
|
-
|
|
1420
|
+
LEFT JOIN
|
|
1421
1421
|
\`${this.app}\`.t_user AS u ON s.email = JSON_EXTRACT(u.userData, '$.email');`, []);
|
|
1422
1422
|
dataList.push({ type: 'subscriber', title: '電子郵件訂閱者', users: subscriberList });
|
|
1423
1423
|
}
|
|
@@ -1425,7 +1425,7 @@ class User {
|
|
|
1425
1425
|
const buyingList = [];
|
|
1426
1426
|
const buyingData = await database_1.default.query(`SELECT u.userID, c.email, JSON_UNQUOTE(JSON_EXTRACT(c.orderData, '$.email')) AS order_email
|
|
1427
1427
|
FROM \`${this.app}\`.t_checkout AS c
|
|
1428
|
-
|
|
1428
|
+
JOIN
|
|
1429
1429
|
\`${this.app}\`.t_user AS u ON c.email = JSON_EXTRACT(u.userData, '$.email')
|
|
1430
1430
|
WHERE c.status = 1;`, []);
|
|
1431
1431
|
buyingData.map((item1) => {
|
|
@@ -1467,22 +1467,15 @@ class User {
|
|
|
1467
1467
|
users: [],
|
|
1468
1468
|
});
|
|
1469
1469
|
}
|
|
1470
|
-
const users = await database_1.default.query(`SELECT userID
|
|
1471
|
-
FROM \`${this.app}\`.t_user;`, []);
|
|
1472
|
-
const levelItems = await this.getUserLevel(users.map((item) => {
|
|
1473
|
-
return { userId: item.userID };
|
|
1474
|
-
}));
|
|
1475
|
-
for (const levelItem of levelItems) {
|
|
1476
|
-
const n = dataList.findIndex(item => item.tag === levelItem.data.id);
|
|
1477
|
-
if (n > -1) {
|
|
1478
|
-
dataList[n].users.push({
|
|
1479
|
-
userID: levelItem.id,
|
|
1480
|
-
email: levelItem.email,
|
|
1481
|
-
count: 0,
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
1470
|
}
|
|
1471
|
+
await Promise.all(dataList.map(async (item) => {
|
|
1472
|
+
return new Promise(async (resolve, reject) => {
|
|
1473
|
+
item.users = await database_1.default.query(`select userID, email
|
|
1474
|
+
from \`${this.app}\`.t_user
|
|
1475
|
+
where member_level = ${database_1.default.escape(item.tag)}`, []);
|
|
1476
|
+
resolve(true);
|
|
1477
|
+
});
|
|
1478
|
+
}));
|
|
1486
1479
|
if (type) {
|
|
1487
1480
|
dataList = dataList.filter(item => type.includes(item.type));
|
|
1488
1481
|
}
|
|
@@ -1543,10 +1536,10 @@ class User {
|
|
|
1543
1536
|
const slice = idList.slice(i, i + batchSize);
|
|
1544
1537
|
const placeholders = slice.map(() => '?').join(',');
|
|
1545
1538
|
const query = `
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1539
|
+
SELECT *
|
|
1540
|
+
FROM \`${this.app}\`.t_user_public_config
|
|
1541
|
+
WHERE \`key\` = 'member_update'
|
|
1542
|
+
AND user_id IN (${placeholders});
|
|
1550
1543
|
`;
|
|
1551
1544
|
batches.push({ query, params: slice });
|
|
1552
1545
|
}
|
|
@@ -1587,7 +1580,7 @@ class User {
|
|
|
1587
1580
|
}
|
|
1588
1581
|
if (quickPass) {
|
|
1589
1582
|
const index = user.member_level ? levelList.findIndex((level) => level.id === user.member_level) : 0;
|
|
1590
|
-
const getLevel = levelList[index];
|
|
1583
|
+
const getLevel = levelList[index] || normalMember;
|
|
1591
1584
|
const formatData = {
|
|
1592
1585
|
id: getLevel.id,
|
|
1593
1586
|
og: {
|
|
@@ -1640,10 +1633,10 @@ class User {
|
|
|
1640
1633
|
.map(item => `"${item.email}"`)
|
|
1641
1634
|
.concat(['-1111']);
|
|
1642
1635
|
const users = await database_1.default.query(`
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1636
|
+
SELECT *
|
|
1637
|
+
FROM \`${this.app}\`.t_user
|
|
1638
|
+
WHERE userID in (${idList.join(',')})
|
|
1639
|
+
OR email in (${emailList.join(',')})
|
|
1647
1640
|
`, []);
|
|
1648
1641
|
if (!users || users.length == 0)
|
|
1649
1642
|
return [];
|
|
@@ -1724,16 +1717,16 @@ class User {
|
|
|
1724
1717
|
}
|
|
1725
1718
|
const subData = await database_1.default.query(`SELECT s.*, u.account
|
|
1726
1719
|
FROM \`${this.app}\`.t_subscribe AS s
|
|
1727
|
-
|
|
1728
|
-
|
|
1720
|
+
LEFT JOIN \`${this.app}\`.t_user AS u
|
|
1721
|
+
ON s.email = u.account
|
|
1729
1722
|
WHERE ${querySql.length > 0 ? querySql.join(' AND ') : '1 = 1'} LIMIT ${query.page * query.limit}
|
|
1730
1723
|
, ${query.limit}
|
|
1731
1724
|
|
|
1732
1725
|
`, []);
|
|
1733
1726
|
const subTotal = await database_1.default.query(`SELECT count(*) as c
|
|
1734
1727
|
FROM \`${this.app}\`.t_subscribe AS s
|
|
1735
|
-
|
|
1736
|
-
|
|
1728
|
+
LEFT JOIN \`${this.app}\`.t_user AS u
|
|
1729
|
+
ON s.email = u.account
|
|
1737
1730
|
WHERE ${querySql.length > 0 ? querySql.join(' AND ') : '1 = 1'}
|
|
1738
1731
|
|
|
1739
1732
|
`, []);
|
|
@@ -2061,9 +2054,9 @@ class User {
|
|
|
2061
2054
|
try {
|
|
2062
2055
|
if (user_id_and_account.includes('@')) {
|
|
2063
2056
|
await database_1.default.query(`update \`${this.app}\`.t_user
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2057
|
+
SET ?
|
|
2058
|
+
WHERE 1 = 1
|
|
2059
|
+
and ((userData ->>'$.email' = ?))`, [
|
|
2067
2060
|
{
|
|
2068
2061
|
pwd: await tool_1.default.hashPwd(newPwd),
|
|
2069
2062
|
},
|
|
@@ -2072,9 +2065,9 @@ class User {
|
|
|
2072
2065
|
}
|
|
2073
2066
|
else {
|
|
2074
2067
|
await database_1.default.query(`update \`${this.app}\`.t_user
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2068
|
+
SET ?
|
|
2069
|
+
WHERE 1 = 1
|
|
2070
|
+
and ((userData ->>'$.phone' = ?))`, [
|
|
2078
2071
|
{
|
|
2079
2072
|
pwd: await tool_1.default.hashPwd(newPwd),
|
|
2080
2073
|
},
|
|
@@ -2331,7 +2324,7 @@ class User {
|
|
|
2331
2324
|
});
|
|
2332
2325
|
}
|
|
2333
2326
|
})();
|
|
2334
|
-
if (
|
|
2327
|
+
if (typeof return_Data === 'string') {
|
|
2335
2328
|
return JSON.parse(return_Data);
|
|
2336
2329
|
}
|
|
2337
2330
|
return return_Data;
|
|
@@ -2445,14 +2438,14 @@ class User {
|
|
|
2445
2438
|
const result = await database_1.default.query(`select count(1)
|
|
2446
2439
|
from ${process_1.default.env.GLITTER_DB}.app_config
|
|
2447
2440
|
where (appName = ?
|
|
2448
|
-
|
|
2441
|
+
and user = ?)
|
|
2449
2442
|
OR appName in (
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2443
|
+
(SELECT appName
|
|
2444
|
+
FROM \`${config_1.saasConfig.SAAS_NAME}\`.app_auth_config
|
|
2445
|
+
WHERE user = ?
|
|
2446
|
+
AND status = 1
|
|
2447
|
+
AND invited = 1
|
|
2448
|
+
AND appName = ?));`, [this.app, (_a = this.token) === null || _a === void 0 ? void 0 : _a.userID, (_b = this.token) === null || _b === void 0 ? void 0 : _b.userID, this.app]);
|
|
2456
2449
|
return {
|
|
2457
2450
|
result: result[0]['count(1)'] === 1,
|
|
2458
2451
|
};
|