Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let picowayNoticed = false;
- let ultravliftNoticed = false;
- let eyebagNoticed = false;
- await Promise.all(allItems.map(async item => {
- if (item.contractGuaranteeRemarks && !contractGuaranteeRemarks) {
- contractGuaranteeRemarks = item.contractGuaranteeRemarks;
- }
- if (item.treatmentRemarks && !contractGuaranteeRemarks) {
- contractGuaranteeRemarks = item.treatmentRemarks;
- }
- if (
- !picowayNoticed &&
- (item.picowayDays > 0 || item.silkpeelDays > 0 || item.ecoolsDays > 0)
- ) {
- let remarks: Array<string> = ['Picoway 皮秒激光去斑療程須知:\n為能達至最佳效果,請定期進行療程,並配合防曬(早上搽)及保濕(晚上搽)\n\n療程日期建議:'];
- const result: Array<any> = await wemQueryRunner.query(`SELECT * FROM ${WEM_DATABASE_PERFECTSHAPE_SQL_NAME}.dbo.EquipmentDaysRemarks(GETDATE(), @0, @1, @2) ORDER BY TMDate`, [
- item.picowayDays,
- item.silkpeelDays,
- item.ecoolsDays,
- ]);
- for (let i = 0; i < result.length; i++) {
- remarks.push([
- (i + 1).toString(),
- result[i]['TMDate']
- ].join('. '));
- }
- console.log('___DEBUG___', 'ITEM_REMARKS', remarks);
- suggestedDateRemarks.push(remarks.join('\n'));
- picowayNoticed = true;
- }
- if (
- !ultravliftNoticed &&
- (item.ultravliftDays > 0 || item.ultravliftDeepDays > 0 || item.ultravliftMediumDays > 0)
- ) {
- let remarks: Array<string> = ['隔空埋線療程須知:\n為達到隔空埋線的最佳效果,建議客人每月到店進行1次隔空埋線療程: \n\n療程日期建議:'];
- let result: Array<any> | undefined;
- if (item.ultravliftDeepDays > 0 || item.ultravliftMediumDays > 0) {
- result = await wemQueryRunner.query(`SELECCT * FROM ${WEM_DATABASE_PERFECTSHAPE_SQL_NAME}.dbo.UltraVLiftDeepMediumDaysRemarks(GETDATE(), @0, @1) ORDER BY TMDate`, [
- item.ultravliftDeepDays,
- item.ultravliftMediumDays,
- ]);
- } else if (item.ultravliftDays > 0) {
- result = await wemQueryRunner.query(`Select * from ${WEM_DATABASE_PERFECTSHAPE_SQL_NAME}.dbo.UltraVLiftDaysRemarks(GETDATE(), " & UltraVLift_days & ") order by TMDate`, [
- item.ultravliftDays,
- ]);
- }
- if (result) {
- if (item.ultravliftDeepDays > 0 || item.ultravliftMediumDays > 0) {
- for (let i = 0; i < result.length; i++) {
- remarks.push((i + 1).toString() + '. ' + result[i]['TMDate'] + ' [' + result[i]['EQName'] + ']',);
- }
- } else if (item.ultravliftDays > 0) {
- for (let i = 0; i < result.length; i++) {
- remarks.push([
- (i + 1).toString(),
- result[i]['TMDate']
- ].join('. '));
- }
- }
- suggestedDateRemarks.push(remarks.join('\n'));
- ultravliftNoticed = true;
- }
- }
- if (
- !eyebagNoticed && item.eyebagDays > 0
- ) {
- let remarks: Array<string> = ['眼袋槍療程須知:\n為達到眼袋槍的最佳效果,建議客人每星期到店進行1次眼袋槍療程: \n\n療程日期建議:'];
- const result: Array<any> = await wemQueryRunner.query(`SELECT * FROM ${WEM_DATABASE_PERFECTSHAPE_SQL_NAME}.dbo.EyebagDaysRemarks(GETDATE(), @0) order by TMDate`, [
- item.eyebagDays,
- ]);
- for (let i = 0; i < result.length; i++) {
- remarks.push([
- (i + 1).toString(),
- result[i]['TMDate']
- ].join('. '));
- }
- suggestedDateRemarks.push(remarks.join('\n'));
- eyebagNoticed = true;
- }
- }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement