ts-glitter 20.4.5 → 20.4.7

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.
Files changed (121) hide show
  1. package/lowcode/Entry.js +1 -1
  2. package/lowcode/Entry.ts +1 -1
  3. package/lowcode/backend-manager/bg-widget.js +19 -17
  4. package/lowcode/backend-manager/bg-widget.ts +19 -17
  5. package/lowcode/cms-plugin/user/user-module.js +28 -28
  6. package/lowcode/cms-plugin/user/user-module.ts +29 -31
  7. package/lowcode/cms-plugin/user-list.js +55 -42
  8. package/lowcode/cms-plugin/user-list.ts +71 -47
  9. package/lowcode/glitter-base/route/progress.js +32 -0
  10. package/lowcode/glitter-base/route/progress.ts +36 -0
  11. package/lowcode/glitter-base/route/user.js +37 -1
  12. package/lowcode/glitter-base/route/user.ts +40 -1
  13. package/lowcode/glitterBundle/dialog/ShareDialog.ts +0 -1
  14. package/package.json +3 -1
  15. package/src/api-public/controllers/ai-chat.js.map +1 -1
  16. package/src/api-public/controllers/app-release.js.map +1 -1
  17. package/src/api-public/controllers/delivery.js.map +1 -1
  18. package/src/api-public/controllers/graph-api.js.map +1 -1
  19. package/src/api-public/controllers/index.js +9 -8
  20. package/src/api-public/controllers/index.js.map +1 -1
  21. package/src/api-public/controllers/index.ts +171 -169
  22. package/src/api-public/controllers/lambda.js.map +1 -1
  23. package/src/api-public/controllers/manager.js.map +1 -1
  24. package/src/api-public/controllers/post.js.map +1 -1
  25. package/src/api-public/controllers/progress.d.ts +3 -0
  26. package/src/api-public/controllers/progress.js +29 -0
  27. package/src/api-public/controllers/progress.js.map +1 -0
  28. package/src/api-public/controllers/progress.ts +25 -0
  29. package/src/api-public/controllers/sql_api.js.map +1 -1
  30. package/src/api-public/controllers/track.js.map +1 -1
  31. package/src/api-public/controllers/user.js +47 -1
  32. package/src/api-public/controllers/user.js.map +1 -1
  33. package/src/api-public/controllers/user.ts +44 -3
  34. package/src/api-public/services/checkout.d.ts +1 -0
  35. package/src/api-public/services/checkout.js +16 -6
  36. package/src/api-public/services/checkout.js.map +1 -1
  37. package/src/api-public/services/checkout.ts +28 -18
  38. package/src/api-public/services/customer-sessions.js.map +1 -1
  39. package/src/api-public/services/fake-data-model/fake-order.d.ts +6 -1
  40. package/src/api-public/services/fake-data-model/fake-order.js +159 -155
  41. package/src/api-public/services/fake-data-model/fake-order.js.map +1 -1
  42. package/src/api-public/services/fake-data-model/fake-order.ts +186 -179
  43. package/src/api-public/services/fake-data-model/fake-product.js +94 -94
  44. package/src/api-public/services/fake-data-model/fake-product.js.map +1 -1
  45. package/src/api-public/services/fake-data-model/fake-product.ts +109 -114
  46. package/src/api-public/services/fake-data-model/fake-user.d.ts +17 -1
  47. package/src/api-public/services/fake-data-model/fake-user.js +70 -384
  48. package/src/api-public/services/fake-data-model/fake-user.js.map +1 -1
  49. package/src/api-public/services/fake-data-model/fake-user.ts +111 -394
  50. package/src/api-public/services/initial-fake-data.js +50 -10
  51. package/src/api-public/services/initial-fake-data.js.map +1 -1
  52. package/src/api-public/services/initial-fake-data.ts +92 -22
  53. package/src/api-public/services/invoice.js.map +1 -1
  54. package/src/api-public/services/manager.js.map +1 -1
  55. package/src/api-public/services/notify.js +234 -213
  56. package/src/api-public/services/notify.js.map +1 -1
  57. package/src/api-public/services/notify.ts +520 -494
  58. package/src/api-public/services/phone-verify.js.map +1 -1
  59. package/src/api-public/services/pos.js.map +1 -1
  60. package/src/api-public/services/post.js.map +1 -1
  61. package/src/api-public/services/rebate.d.ts +1 -0
  62. package/src/api-public/services/rebate.js +15 -8
  63. package/src/api-public/services/rebate.js.map +1 -1
  64. package/src/api-public/services/rebate.ts +24 -15
  65. package/src/api-public/services/recommend.js.map +1 -1
  66. package/src/api-public/services/schedule.js +8 -5
  67. package/src/api-public/services/schedule.js.map +1 -1
  68. package/src/api-public/services/schedule.ts +344 -335
  69. package/src/api-public/services/shopee.js.map +1 -1
  70. package/src/api-public/services/shopping.d.ts +1 -1
  71. package/src/api-public/services/shopping.js +28 -25
  72. package/src/api-public/services/shopping.js.map +1 -1
  73. package/src/api-public/services/shopping.ts +89 -76
  74. package/src/api-public/services/stock.js.map +1 -1
  75. package/src/api-public/services/user.d.ts +10 -1
  76. package/src/api-public/services/user.js +245 -42
  77. package/src/api-public/services/user.js.map +1 -1
  78. package/src/api-public/services/user.ts +325 -45
  79. package/src/api-public/services/voucher.js.map +1 -1
  80. package/src/api-public/services/workers.js.map +1 -1
  81. package/src/api-public/utils/ut-permission.d.ts +0 -1
  82. package/src/api-public/utils/ut-permission.js.map +1 -1
  83. package/src/config.d.ts +2 -1
  84. package/src/config.js +2 -1
  85. package/src/config.js.map +1 -1
  86. package/src/config.ts +142 -142
  87. package/src/controllers/app.js.map +1 -1
  88. package/src/controllers/backend-server.js.map +1 -1
  89. package/src/controllers/filemanager.js.map +1 -1
  90. package/src/controllers/index.js.map +1 -1
  91. package/src/controllers/user.js.map +1 -1
  92. package/src/domain-check.js.map +1 -1
  93. package/src/index.js.map +1 -1
  94. package/src/index.ts +3 -12
  95. package/src/modules/AWSLib.js +2 -3
  96. package/src/modules/AWSLib.js.map +1 -1
  97. package/src/modules/database.d.ts +1 -2
  98. package/src/modules/database.js.map +1 -1
  99. package/src/modules/firebase.js.map +1 -1
  100. package/src/modules/logger.js.map +1 -1
  101. package/src/modules/redis.d.ts +1 -1
  102. package/src/modules/redis.js.map +1 -1
  103. package/src/run.js +1 -2
  104. package/src/run.js.map +1 -1
  105. package/src/services/backend-service.js.map +1 -1
  106. package/src/services/create-instance.js +3 -4
  107. package/src/services/create-instance.js.map +1 -1
  108. package/src/services/global-event.js.map +1 -1
  109. package/src/services/ios-release.js.map +1 -1
  110. package/src/services/page.js.map +1 -1
  111. package/src/services/private_config.js.map +1 -1
  112. package/src/services/release.js.map +1 -1
  113. package/src/services/seo.js.map +1 -1
  114. package/src/services/tool.js +2 -3
  115. package/src/services/tool.js.map +1 -1
  116. package/src/services/user.js.map +1 -1
  117. package/src/services/web-socket.js.map +1 -1
  118. package/src/update-progress-track.d.ts +14 -0
  119. package/src/update-progress-track.js +28 -0
  120. package/src/update-progress-track.js.map +1 -0
  121. package/src/update-progress-track.ts +34 -0
@@ -10,545 +10,571 @@ import exception from '../../modules/exception.js';
10
10
  const html = String.raw;
11
11
 
12
12
  export class ManagerNotify {
13
- public app_name: string;
13
+ public app_name: string;
14
14
 
15
- constructor(app_name: string) {
16
- this.app_name = app_name;
17
- }
15
+ constructor(app_name: string) {
16
+ this.app_name = app_name;
17
+ }
18
18
 
19
- // 取得商家資料
20
- public async getSaasAPP() {
21
- const return_data = (
22
- await db.query(
23
- `SELECT brand, user
19
+ // 取得商家資料
20
+ public async getSaasAPP() {
21
+ const return_data = (
22
+ await db.query(
23
+ `SELECT brand, user
24
24
  FROM \`${saasConfig.SAAS_NAME}\`.app_config
25
25
  WHERE appName = ?`,
26
- [this.app_name]
27
- )
28
- )[0];
29
- const account = await db.query(
30
- `SELECT account, userData
26
+ [this.app_name]
27
+ )
28
+ )[0];
29
+ const account = await db.query(
30
+ `SELECT account, userData
31
31
  FROM \`${return_data.brand}\`.t_user
32
32
  WHERE userID = ?`,
33
- [return_data.user]
34
- );
35
- return_data.account = account[0].account;
36
- return_data.userData = account[0].userData;
37
- return return_data;
38
- }
33
+ [return_data.user]
34
+ );
35
+ return_data.account = account[0].account;
36
+ return_data.userData = account[0].userData;
37
+ return return_data;
38
+ }
39
39
 
40
- // 取得商家通知設定
41
- public async getSaasSettings() {
42
- const setting = (
43
- await db.query(
44
- ` SELECT * FROM \`${this.app_name}\`.t_user_public_config
40
+ // 取得商家通知設定
41
+ public async getSaasSettings() {
42
+ const setting = (
43
+ await db.query(
44
+ ` SELECT * FROM \`${this.app_name}\`.t_user_public_config
45
45
  WHERE \`key\` = 'notify_setting';`,
46
- [this.app_name]
47
- )
48
- )[0];
49
- return (() => {
50
- try {
51
- return setting.value.data;
52
- } catch (e) {
53
- return [];
54
- }
55
- })();
56
- }
46
+ [this.app_name]
47
+ )
48
+ )[0];
49
+ return (() => {
50
+ try {
51
+ return setting.value.data;
52
+ } catch (e) {
53
+ return [];
54
+ }
55
+ })();
56
+ }
57
57
 
58
- // 取得通知狀態
59
- public findSetting(settings: any[], type: 'email' | 'line' | 'sms', key: string): boolean {
60
- if (settings.length == 0) {
61
- return false;
62
- }
63
- const setting = settings.find((item) => item.type === type);
64
- if (setting === undefined || setting.list === undefined || setting.list.length === 0) {
65
- return false;
66
- }
67
- const tag = setting.list.find((item: any) => item.key === key);
68
- if (tag === undefined) {
69
- return false;
70
- }
71
- return tag.status;
58
+ // 取得通知狀態
59
+ public findSetting(settings: any[], type: 'email' | 'line' | 'sms', key: string): boolean {
60
+ if (settings.length == 0) {
61
+ return false;
72
62
  }
63
+ const setting = settings.find(item => item.type === type);
64
+ if (setting === undefined || setting.list === undefined || setting.list.length === 0) {
65
+ return false;
66
+ }
67
+ const tag = setting.list.find((item: any) => item.key === key);
68
+ if (tag === undefined) {
69
+ return false;
70
+ }
71
+ return tag.status;
72
+ }
73
73
 
74
- // 商家信件固定格式
75
- public async sendEmail(email: string, title: string, content: string, href: string) {
76
- try {
77
- const html = String.raw;
78
- const text = html`
74
+ // 商家信件固定格式
75
+ public async sendEmail(email: string, title: string, content: string, href: string) {
76
+ try {
77
+ const html = String.raw;
78
+ const text = html`
79
+ <table
80
+ width="100%"
81
+ border="0"
82
+ cellpadding="0"
83
+ cellspacing="0"
84
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; background-color: rgb(255, 255, 255);"
85
+ id="isPasted"
86
+ >
87
+ <tbody
88
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
89
+ >
90
+ <tr
91
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
92
+ >
93
+ <td
94
+ style="box-sizing: border-box; border: 0px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px;"
95
+ >
79
96
  <table
80
- width="100%"
81
- border="0"
82
- cellpadding="0"
83
- cellspacing="0"
84
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; color: rgb(65, 65, 65); font-family: sans-serif; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; background-color: rgb(255, 255, 255);"
85
- id="isPasted"
97
+ align="center"
98
+ width="100%"
99
+ border="0"
100
+ cellpadding="0"
101
+ cellspacing="0"
102
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; --bs-gutter-x: 1.5rem; --bs-gutter-y: 0; display: flex; flex-wrap: wrap; margin-top: calc(-1 * var(--bs-gutter-y)); margin-right: calc(-0.5 * var(--bs-gutter-x)); margin-left: calc(-0.5 * var(--bs-gutter-x)); border: none; empty-cells: show; max-width: 100%;"
86
103
  >
87
- <tbody style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;">
88
- <tr style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;">
89
- <td style="box-sizing: border-box; border: 0px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px;">
104
+ <tbody
105
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased; flex-shrink: 0; width: 1055.59px; max-width: 100%; padding-right: calc(var(--bs-gutter-x) * 0.5); padding-left: calc(var(--bs-gutter-x) * 0.5); margin-top: var(--bs-gutter-y);"
106
+ >
107
+ <tr
108
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
109
+ >
110
+ <td
111
+ style="box-sizing: border-box; border: 0px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px;"
112
+ >
113
+ <table
114
+ align="center"
115
+ border="0"
116
+ cellpadding="0"
117
+ cellspacing="0"
118
+ width="600"
119
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; color: rgb(0, 0, 0); width: 600px; margin: 0px auto;"
120
+ >
121
+ <tbody
122
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
123
+ >
124
+ <tr
125
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
126
+ >
127
+ <td
128
+ width="100%"
129
+ style="box-sizing: border-box; border: 0px; -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; font-weight: 400; text-align: left; padding-bottom: 5px; padding-top: 5px; vertical-align: top;"
130
+ >
90
131
  <table
91
- align="center"
92
- width="100%"
93
- border="0"
94
- cellpadding="0"
95
- cellspacing="0"
96
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; --bs-gutter-x: 1.5rem; --bs-gutter-y: 0; display: flex; flex-wrap: wrap; margin-top: calc(-1 * var(--bs-gutter-y)); margin-right: calc(-0.5 * var(--bs-gutter-x)); margin-left: calc(-0.5 * var(--bs-gutter-x)); border: none; empty-cells: show; max-width: 100%;"
132
+ width="100%"
133
+ border="0"
134
+ cellpadding="0"
135
+ cellspacing="0"
136
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%;"
97
137
  >
98
- <tbody
99
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased; flex-shrink: 0; width: 1055.59px; max-width: 100%; padding-right: calc(var(--bs-gutter-x) * 0.5); padding-left: calc(var(--bs-gutter-x) * 0.5); margin-top: var(--bs-gutter-y);"
138
+ <tbody
139
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
140
+ >
141
+ <tr
142
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
100
143
  >
101
- <tr style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;">
102
- <td style="box-sizing: border-box; border: 0px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px;">
103
- <table
104
- align="center"
105
- border="0"
106
- cellpadding="0"
107
- cellspacing="0"
108
- width="600"
109
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; color: rgb(0, 0, 0); width: 600px; margin: 0px auto;"
110
- >
111
- <tbody style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;">
112
- <tr style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;">
113
- <td
114
- width="100%"
115
- style="box-sizing: border-box; border: 0px; -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; font-weight: 400; text-align: left; padding-bottom: 5px; padding-top: 5px; vertical-align: top;"
116
- >
117
- <table
118
- width="100%"
119
- border="0"
120
- cellpadding="0"
121
- cellspacing="0"
122
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%;"
123
- >
124
- <tbody
125
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
126
- >
127
- <tr
128
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
129
- >
130
- <td
131
- style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; width: 599px;"
132
- >
133
- <div align="center" style="box-sizing: border-box; -webkit-font-smoothing: antialiased; line-height: 10px;">
134
- <div style="box-sizing: border-box; -webkit-font-smoothing: antialiased; max-width: 600px;">
135
- <img
136
- src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1719903595261-s3s4scs3s7sfsfs7.png"
137
- class="fr-fic fr-dii"
138
- style="width: 100%;"
139
- />
140
- <br />
141
- </div>
142
- </div>
143
- </td>
144
- </tr>
145
- </tbody>
146
- </table>
144
+ <td
145
+ style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; width: 599px;"
146
+ >
147
+ <div
148
+ align="center"
149
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; line-height: 10px;"
150
+ >
151
+ <div
152
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; max-width: 600px;"
153
+ >
154
+ <img
155
+ src="https://d3jnmi1tfjgtti.cloudfront.net/file/234285319/1719903595261-s3s4scs3s7sfsfs7.png"
156
+ class="fr-fic fr-dii"
157
+ style="width: 100%;"
158
+ />
159
+ <br />
160
+ </div>
161
+ </div>
162
+ </td>
163
+ </tr>
164
+ </tbody>
165
+ </table>
147
166
 
148
- <table
149
- width="100%"
150
- border="0"
151
- cellpadding="0"
152
- cellspacing="0"
153
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%;"
154
- >
155
- <tbody
156
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
157
- >
158
- <tr
159
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
160
- >
161
- <td
162
- style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 60px 45px 30px; text-align: left; width: 599px;"
163
- >
164
- <h1
165
- style="box-sizing: border-box; margin: 0px; font-weight: 700; line-height: 33.6px; color: rgb(54, 54, 54); font-size: 28px; -webkit-font-smoothing: antialiased; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; direction: ltr; font-family: Arial, Helvetica, sans-serif; text-align: left;"
166
- id="isPasted"
167
- >
168
- 訊息通知
169
- </h1>
170
- <br />
171
- <div style="width: 100%;text-align: start;">@{{text}}</div>
172
- <br />
173
- <br /><span
174
- style="color: rgb(16, 17, 18); font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"
175
- ><a
176
- href="${new URL(href, 'https://shopnex.tw')}"
177
- target="_blank"
178
- style="box-sizing: border-box; color: rgb(255, 255, 255); text-decoration: none; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 148, 2); border-width: 0px; border-style: solid; border-color: transparent; border-radius: 5px; display: inline-block; font-family: Arial, Helvetica, sans-serif; font-size: 24px; padding-bottom: 15px; padding-top: 15px; text-align: center; width: auto; word-break: keep-all;"
179
- id="isPasted"
180
- ><span
181
- style="box-sizing: border-box; -webkit-font-smoothing: antialiased; padding-left: 30px; padding-right: 30px; font-size: 24px; display: inline-block; letter-spacing: normal;"
182
- ><span
183
- style="box-sizing: border-box; -webkit-font-smoothing: antialiased; word-break: break-word; line-height: 48px;"
184
- ><strong style="box-sizing: border-box; font-weight: 700; -webkit-font-smoothing: antialiased;"
185
- >前往商店</strong
186
- ></span
187
- ></span
188
- ></a
189
- ></span
190
- >
191
- <br />
192
- </td>
193
- </tr>
194
- </tbody>
195
- </table>
167
+ <table
168
+ width="100%"
169
+ border="0"
170
+ cellpadding="0"
171
+ cellspacing="0"
172
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%;"
173
+ >
174
+ <tbody
175
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
176
+ >
177
+ <tr
178
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
179
+ >
180
+ <td
181
+ style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 60px 45px 30px; text-align: left; width: 599px;"
182
+ >
183
+ <h1
184
+ style="box-sizing: border-box; margin: 0px; font-weight: 700; line-height: 33.6px; color: rgb(54, 54, 54); font-size: 28px; -webkit-font-smoothing: antialiased; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; direction: ltr; font-family: Arial, Helvetica, sans-serif; text-align: left;"
185
+ id="isPasted"
186
+ >
187
+ 訊息通知
188
+ </h1>
189
+ <br />
190
+ <div style="width: 100%;text-align: start;">@{{text}}</div>
191
+ <br />
192
+ <br /><span
193
+ style="color: rgb(16, 17, 18); font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"
194
+ ><a
195
+ href="${new URL(href, 'https://shopnex.tw')}"
196
+ target="_blank"
197
+ style="box-sizing: border-box; color: rgb(255, 255, 255); text-decoration: none; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 148, 2); border-width: 0px; border-style: solid; border-color: transparent; border-radius: 5px; display: inline-block; font-family: Arial, Helvetica, sans-serif; font-size: 24px; padding-bottom: 15px; padding-top: 15px; text-align: center; width: auto; word-break: keep-all;"
198
+ id="isPasted"
199
+ ><span
200
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; padding-left: 30px; padding-right: 30px; font-size: 24px; display: inline-block; letter-spacing: normal;"
201
+ ><span
202
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; word-break: break-word; line-height: 48px;"
203
+ ><strong
204
+ style="box-sizing: border-box; font-weight: 700; -webkit-font-smoothing: antialiased;"
205
+ >前往商店</strong
206
+ ></span
207
+ ></span
208
+ ></a
209
+ ></span
210
+ >
211
+ <br />
212
+ </td>
213
+ </tr>
214
+ </tbody>
215
+ </table>
196
216
 
197
- <table
198
- width="100%"
199
- border="0"
200
- cellpadding="0"
201
- cellspacing="0"
202
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; word-break: break-word; background-color: rgb(247, 247, 247);"
203
- >
204
- <tbody
205
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
206
- >
207
- <tr
208
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
209
- >
210
- <td
211
- style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 28px 45px 10px;"
212
- >
213
- <div
214
- style="box-sizing: border-box; -webkit-font-smoothing: antialiased; color: rgb(16, 17, 18); direction: ltr; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: 400; letter-spacing: 0px; line-height: 19.2px; text-align: left;"
215
- >
216
- <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;">
217
- 如果您有任何疑問或需要幫助,我們的團隊隨時在這裡為您提供支持。
218
- </p>
217
+ <table
218
+ width="100%"
219
+ border="0"
220
+ cellpadding="0"
221
+ cellspacing="0"
222
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; word-break: break-word; background-color: rgb(247, 247, 247);"
223
+ >
224
+ <tbody
225
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
226
+ >
227
+ <tr
228
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
229
+ >
230
+ <td
231
+ style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 28px 45px 10px;"
232
+ >
233
+ <div
234
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; color: rgb(16, 17, 18); direction: ltr; font-family: Arial, Helvetica, sans-serif; font-size: 16px; font-weight: 400; letter-spacing: 0px; line-height: 19.2px; text-align: left;"
235
+ >
236
+ <p
237
+ style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;"
238
+ >
239
+ 如果您有任何疑問或需要幫助,我們的團隊隨時在這裡為您提供支持。
240
+ </p>
219
241
 
220
- <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;">
221
- 服務電話:+886 978-028-730
222
- </p>
242
+ <p
243
+ style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;"
244
+ >
245
+ 服務電話:+886 978-028-730
246
+ </p>
223
247
 
224
- <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;">
225
- 電子郵件:mk@ncdesign.info
226
- </p>
227
- </div>
228
- </td>
229
- </tr>
230
- </tbody>
231
- </table>
248
+ <p
249
+ style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;"
250
+ >
251
+ 電子郵件:mk@ncdesign.info
252
+ </p>
253
+ </div>
254
+ </td>
255
+ </tr>
256
+ </tbody>
257
+ </table>
232
258
 
233
- <table
234
- width="100%"
235
- border="0"
236
- cellpadding="0"
237
- cellspacing="0"
238
- style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; word-break: break-word; background-color: rgb(247, 247, 247);"
239
- >
240
- <tbody
241
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
242
- >
243
- <tr
244
- style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
245
- >
246
- <td
247
- style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 20px 10px 10px;"
248
- >
249
- <div
250
- style="box-sizing: border-box; -webkit-font-smoothing: antialiased; color: rgb(16, 17, 18); direction: ltr; font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: 400; letter-spacing: 0px; line-height: 16.8px; text-align: center;"
251
- >
252
- <p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;">
253
- <a
254
- href="https://shopnex.tw/?article=termsofservice&page=blog_detail"
255
- target="_blank"
256
- rel="noopener"
257
- style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
258
- >服務條款</a
259
- >
260
- <a
261
- href="https://shopnex.tw/?article=privacyterms&page=blog_detail"
262
- target="_blank"
263
- rel="noopener"
264
- style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
265
- >隱私條款</a
266
- >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
267
- <a
268
- href="https://shopnex.tw/?article=privacyterms&page=e-commerce-blog"
269
- target="_blank"
270
- rel="noopener"
271
- style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
272
- >開店教學</a
273
- >
274
- </p>
275
- </div>
276
- </td>
277
- </tr>
278
- </tbody>
279
- </table>
280
- </td>
281
- </tr>
282
- </tbody>
283
- </table>
284
- </td>
285
- </tr>
286
- </tbody>
259
+ <table
260
+ width="100%"
261
+ border="0"
262
+ cellpadding="0"
263
+ cellspacing="0"
264
+ style="box-sizing: border-box; caption-side: bottom; border-collapse: collapse; -webkit-font-smoothing: antialiased; border: none; empty-cells: show; max-width: 100%; word-break: break-word; background-color: rgb(247, 247, 247);"
265
+ >
266
+ <tbody
267
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
268
+ >
269
+ <tr
270
+ style="box-sizing: border-box; border-color: inherit; border-style: solid; border-width: 0px; -webkit-font-smoothing: antialiased;"
271
+ >
272
+ <td
273
+ style="box-sizing: border-box; border: 1px solid rgb(221, 221, 221); -webkit-font-smoothing: antialiased; user-select: text; min-width: 5px; padding: 20px 10px 10px;"
274
+ >
275
+ <div
276
+ style="box-sizing: border-box; -webkit-font-smoothing: antialiased; color: rgb(16, 17, 18); direction: ltr; font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: 400; letter-spacing: 0px; line-height: 16.8px; text-align: center;"
277
+ >
278
+ <p
279
+ style="box-sizing: border-box; margin-top: 0px; margin-bottom: 1.25rem; -webkit-font-smoothing: antialiased;"
280
+ >
281
+ <a
282
+ href="https://shopnex.tw/?article=termsofservice&page=blog_detail"
283
+ target="_blank"
284
+ rel="noopener"
285
+ style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
286
+ >服務條款</a
287
+ >
288
+ <a
289
+ href="https://shopnex.tw/?article=privacyterms&page=blog_detail"
290
+ target="_blank"
291
+ rel="noopener"
292
+ style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
293
+ >隱私條款</a
294
+ >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
295
+ <a
296
+ href="https://shopnex.tw/?article=privacyterms&page=e-commerce-blog"
297
+ target="_blank"
298
+ rel="noopener"
299
+ style="box-sizing: border-box; color: rgb(28, 28, 28); text-decoration: underline; -webkit-font-smoothing: antialiased; transition: color 0.2s ease-in-out 0s; user-select: auto;"
300
+ >開店教學</a
301
+ >
302
+ </p>
303
+ </div>
304
+ </td>
305
+ </tr>
306
+ </tbody>
287
307
  </table>
288
- </td>
289
- </tr>
290
- </tbody>
308
+ </td>
309
+ </tr>
310
+ </tbody>
311
+ </table>
312
+ </td>
313
+ </tr>
314
+ </tbody>
291
315
  </table>
292
- `;
293
- sendmail(`SHOPNEX <${process.env.smtp}>`, email, title, text.replace('@{{text}}', content));
294
- } catch (e) {
295
- console.error(e);
296
- throw exception.BadRequestError('BAD_REQUEST', 'sendEmail Error:' + e, null);
297
- }
316
+ </td>
317
+ </tr>
318
+ </tbody>
319
+ </table>
320
+ `;
321
+ sendmail(`SHOPNEX <${process.env.smtp}>`, email, title, text.replace('@{{text}}', content));
322
+ } catch (e) {
323
+ console.error(e);
324
+ throw exception.BadRequestError('BAD_REQUEST', 'sendEmail Error:' + e, null);
298
325
  }
326
+ }
299
327
 
300
- // 判斷是否進行推播通知
301
- public async checkNotify(tag: string) {
302
- return true;
303
- }
328
+ // 判斷是否進行推播通知
329
+ public async checkNotify(tag: string) {
330
+ return true;
331
+ }
304
332
 
305
- // SHOPNEX 註冊通知事項
306
- public async saasRegister(cf: { user_id: string }) {
307
- const link = `https://shopnex.tw/contact-us`;
308
- new Firebase(this.app_name).sendMessage({
309
- title: `歡迎使用 SHOPNEX`,
310
- userID: cf.user_id,
311
- tag: 'welcome',
312
- link: link,
313
- body: `歡迎使用 SHOPNEX 開店平台,立即撥打諮詢電話: 0978028730,提供免費諮詢服務。`,
314
- });
315
- }
333
+ // SHOPNEX 註冊通知事項
334
+ public async saasRegister(cf: { user_id: string }) {
335
+ const link = `https://shopnex.tw/contact-us`;
336
+ new Firebase(this.app_name).sendMessage({
337
+ title: `歡迎使用 SHOPNEX`,
338
+ userID: cf.user_id,
339
+ tag: 'welcome',
340
+ link: link,
341
+ body: `歡迎使用 SHOPNEX 開店平台,立即撥打諮詢電話: 0978028730,提供免費諮詢服務。`,
342
+ });
343
+ }
316
344
 
317
- // 商品出貨
318
- // 商品到貨
345
+ // 商品出貨
346
+ // 商品到貨
319
347
 
320
- // 訂單成立與付款成功
321
- public async checkout(cf: { orderData: any; status: number }) {
322
- const saas = await this.getSaasAPP();
323
- const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=order_list`;
324
- const body = html`您有一筆新訂單 <br />『 ${cf.orderData.orderID} 』${cf.status ? `已付款` : `尚未付款`},消費總金額:${parseInt(`${cf.orderData.total}`, 10).toLocaleString()} 。`;
325
- new Firebase(saas.brand).sendMessage({
326
- title: `您有新訂單`,
327
- userID: saas.user,
328
- tag: 'checkout',
329
- link: link,
330
- body: body,
331
- });
348
+ // 訂單成立與付款成功
349
+ public async checkout(cf: { orderData: any; status: number }) {
350
+ const saas = await this.getSaasAPP();
351
+ const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=order_list`;
352
+ const body = html`您有一筆新訂單 <br />『 ${cf.orderData.orderID}
353
+ 』${cf.status ? `已付款` : `尚未付款`},消費總金額:${parseInt(`${cf.orderData.total}`, 10).toLocaleString()} 。`;
354
+ new Firebase(saas.brand).sendMessage({
355
+ title: `您有新訂單`,
356
+ userID: saas.user,
357
+ tag: 'checkout',
358
+ link: link,
359
+ body: body,
360
+ });
332
361
 
333
- const settings = await this.getSaasSettings();
334
- const setKey = cf.status ? 'auto-email-payment-successful' : 'auto-email-order-create';
335
- if (this.findSetting(settings, 'email', setKey)) {
336
- await this.sendEmail(saas.userData.email, '您有一筆新的訂單', body, link);
337
- }
338
- if (this.findSetting(settings, 'sms', setKey)) {
339
- new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
340
- }
341
- if (this.findSetting(settings, 'line', setKey)) {
342
- new LineMessage(saas.brand).sendLine(
343
- {
344
- data: {
345
- text: body,
346
- attachment: '',
347
- },
348
- lineID: saas.userData.lineID,
349
- },
350
- () => {}
351
- );
352
- }
362
+ const settings = await this.getSaasSettings();
363
+ const setKey = cf.status ? 'auto-email-payment-successful' : 'auto-email-order-create';
364
+ if (this.findSetting(settings, 'email', setKey)) {
365
+ await this.sendEmail(saas.userData.email, '您有一筆新的訂單', body, link);
353
366
  }
367
+ if (this.findSetting(settings, 'sms', setKey)) {
368
+ new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
369
+ }
370
+ if (this.findSetting(settings, 'line', setKey)) {
371
+ new LineMessage(saas.brand).sendLine(
372
+ {
373
+ data: {
374
+ text: body,
375
+ attachment: '',
376
+ },
377
+ lineID: saas.userData.lineID,
378
+ },
379
+ () => {}
380
+ );
381
+ }
382
+ }
354
383
 
355
- // 訂單待核款
356
- public async uploadProof(cf: { orderData: any }) {
357
- const saas = await this.getSaasAPP();
358
- const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=order_list`;
359
- const body = html`顧客已上傳付款證明,您有一筆新增的待核款訂單,訂單編號 『 ${cf.orderData.orderID} 』。`;
384
+ // 訂單待核款
385
+ public async uploadProof(cf: { orderData: any }) {
386
+ const saas = await this.getSaasAPP();
387
+ const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=order_list`;
388
+ const body = html`顧客已上傳付款證明,您有一筆新增的待核款訂單,訂單編號 『 ${cf.orderData.orderID} 』。`;
360
389
 
361
- new Firebase(saas.brand).sendMessage({
362
- title: '待核款訂單',
363
- userID: saas.user,
364
- tag: 'checkout-upload-proof',
365
- link: link,
366
- body: body,
367
- });
390
+ new Firebase(saas.brand).sendMessage({
391
+ title: '待核款訂單',
392
+ userID: saas.user,
393
+ tag: 'checkout-upload-proof',
394
+ link: link,
395
+ body: body,
396
+ });
368
397
 
369
- const settings = await this.getSaasSettings();
370
- const setKey = 'proof-purchase';
371
- if (this.findSetting(settings, 'email', setKey)) {
372
- await this.sendEmail(saas.userData.email, '您有一筆待核款的訂單', body, link);
373
- }
374
- if (this.findSetting(settings, 'sms', setKey)) {
375
- new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
376
- }
377
- if (this.findSetting(settings, 'line', setKey)) {
378
- new LineMessage(saas.brand).sendLine(
379
- {
380
- data: {
381
- text: body,
382
- attachment: '',
383
- },
384
- lineID: saas.userData.lineID,
385
- },
386
- () => {}
387
- );
388
- }
398
+ const settings = await this.getSaasSettings();
399
+ const setKey = 'proof-purchase';
400
+ if (this.findSetting(settings, 'email', setKey)) {
401
+ await this.sendEmail(saas.userData.email, '您有一筆待核款的訂單', body, link);
402
+ }
403
+ if (this.findSetting(settings, 'sms', setKey)) {
404
+ new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
405
+ }
406
+ if (this.findSetting(settings, 'line', setKey)) {
407
+ new LineMessage(saas.brand).sendLine(
408
+ {
409
+ data: {
410
+ text: body,
411
+ attachment: '',
412
+ },
413
+ lineID: saas.userData.lineID,
414
+ },
415
+ () => {}
416
+ );
389
417
  }
418
+ }
390
419
 
391
- // 新用戶註冊
392
- public async userRegister(cf: { user_id: string }) {
393
- if (this.app_name === 'shopnex') {
394
- this.saasRegister({
395
- user_id: cf.user_id,
396
- });
397
- //贈送Ai-points
398
- await db.query(`insert into \`shopnex\`.t_ai_points (orderID,userID,money,status,note) values (?,?,?,?,?)`,[
399
- `${new Date().getTime()}`,
400
- cf.user_id,
401
- 500,
402
- 1,
403
- JSON.stringify({text:'註冊贈送500點AI Points',type:'free'})
404
- ])
405
- }
406
- const saas = await this.getSaasAPP();
407
- const user_data = (
408
- await db.query(
409
- `SELECT *
420
+ // 新用戶註冊
421
+ public async userRegister(cf: { user_id: string }) {
422
+ if (this.app_name === 'shopnex') {
423
+ this.saasRegister({
424
+ user_id: cf.user_id,
425
+ });
426
+ //贈送Ai-points
427
+ await db.query(`insert into \`shopnex\`.t_ai_points (orderID,userID,money,status,note) values (?,?,?,?,?)`, [
428
+ `${new Date().getTime()}`,
429
+ cf.user_id,
430
+ 500,
431
+ 1,
432
+ JSON.stringify({ text: '註冊贈送500點AI Points', type: 'free' }),
433
+ ]);
434
+ }
435
+ const saas = await this.getSaasAPP();
436
+ const user_data = (
437
+ await db.query(
438
+ `SELECT *
410
439
  FROM \`${this.app_name}\`.t_user
411
440
  WHERE userID = ?`,
412
- [cf.user_id]
413
- )
414
- )[0];
415
- if (await this.checkNotify('register')) {
416
- const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=user_list`;
417
- const body = html`新用戶『 ${user_data.userData.name || user_data.account} 』註冊了帳號。`;
418
- new Firebase(saas.brand).sendMessage({
419
- title: `帳號註冊通知`,
420
- userID: saas.user,
421
- tag: 'register',
422
- link: link,
423
- body: body,
424
- });
441
+ [cf.user_id]
442
+ )
443
+ )[0];
444
+ if (await this.checkNotify('register')) {
445
+ const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=user_list`;
446
+ const body = html`新用戶『 ${user_data.userData.name || user_data.account} 』註冊了帳號。`;
447
+ new Firebase(saas.brand).sendMessage({
448
+ title: `帳號註冊通知`,
449
+ userID: saas.user,
450
+ tag: 'register',
451
+ link: link,
452
+ body: body,
453
+ });
425
454
 
426
- const settings = await this.getSaasSettings();
427
- const setKey = 'user-register';
428
- if (this.findSetting(settings, 'email', setKey)) {
429
- await this.sendEmail(saas.userData.email, '帳號註冊通知', body, link);
430
- }
431
- if (this.findSetting(settings, 'sms', setKey)) {
432
- new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
433
- }
434
- if (this.findSetting(settings, 'line', setKey)) {
435
- new LineMessage(saas.brand).sendLine(
436
- {
437
- data: {
438
- text: body,
439
- attachment: '',
440
- },
441
- lineID: saas.userData.lineID,
442
- },
443
- () => {}
444
- );
445
- }
446
- }
447
- return true;
455
+ const settings = await this.getSaasSettings();
456
+ const setKey = 'user-register';
457
+ if (this.findSetting(settings, 'email', setKey)) {
458
+ await this.sendEmail(saas.userData.email, '帳號註冊通知', body, link);
459
+ }
460
+ if (this.findSetting(settings, 'sms', setKey)) {
461
+ new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
462
+ }
463
+ if (this.findSetting(settings, 'line', setKey)) {
464
+ new LineMessage(saas.brand).sendLine(
465
+ {
466
+ data: {
467
+ text: body,
468
+ attachment: '',
469
+ },
470
+ lineID: saas.userData.lineID,
471
+ },
472
+ () => {}
473
+ );
474
+ }
448
475
  }
476
+ return true;
477
+ }
449
478
 
450
- // 客服訊息
451
- public async customerMessager(obj: { title: string; content: string; user_name: string; room_image?: string; room_text?: string }) {
452
- const saas = await this.getSaasAPP();
453
- const link = `./?type=editor&appName=${this.app_name}&function=backend-manger&tab=home_page&toggle-message=true`;
454
- const message = obj.room_image
455
- ? `${obj.user_name}傳送一張圖片給你`
456
- : `${obj.user_name}傳送一則訊息給你:「${(() => {
457
- let text = obj.room_text ?? '';
458
- if (text.length > 25) {
459
- text = text?.substring(0, 25) + '...';
460
- }
461
- return text;
462
- })()}」`;
479
+ // 客服訊息
480
+ public async customerMessager(obj: {
481
+ title: string;
482
+ content: string;
483
+ user_name: string;
484
+ room_image?: string;
485
+ room_text?: string;
486
+ }) {
487
+ const saas = await this.getSaasAPP();
488
+ const link = `./?type=editor&appName=${this.app_name}&function=backend-manger&tab=home_page&toggle-message=true`;
489
+ const message = obj.room_image
490
+ ? `${obj.user_name}傳送一張圖片給你`
491
+ : `${obj.user_name}傳送一則訊息給你:「${(() => {
492
+ let text = obj.room_text ?? '';
493
+ if (text.length > 25) {
494
+ text = text?.substring(0, 25) + '...';
495
+ }
496
+ return text;
497
+ })()}」`;
498
+ await new Firebase(saas.brand).sendMessage({
499
+ title: `收到客服訊息`,
500
+ userID: saas.user,
501
+ tag: 'message',
502
+ link: link,
503
+ body: message,
504
+ pass_store: true,
505
+ });
463
506
 
464
- console.log(`fireBase==>`,{
465
- title: `收到客服訊息`,
466
- userID: saas.user,
467
- tag: 'message',
468
- link: link,
469
- body: message,
470
- pass_store: true,
471
- })
472
- await new Firebase(saas.brand).sendMessage({
473
- title: `收到客服訊息`,
474
- userID: saas.user,
475
- tag: 'message',
476
- link: link,
477
- body: message,
478
- pass_store: true,
479
- });
480
-
481
- let lineObject = {} as any;
482
- const settings = await this.getSaasSettings();
483
- const setKey = 'get-customer-message';
484
- if (this.findSetting(settings, 'email', setKey)) {
485
- await sendmail(`service@ncdesign.info`, saas.userData.email, obj.title, obj.content);
486
- }
487
- if (this.findSetting(settings, 'sms', setKey)) {
488
- new SMS(this.app_name).sendSNS({ data: message, phone: saas.userData.phone }, () => {});
489
- }
490
- if (this.findSetting(settings, 'line', setKey)) {
491
- if (obj.room_image) {
492
- lineObject = {
493
- attachment: {
494
- type: 'image',
495
- payload: {
496
- url: obj.room_image,
497
- is_reusable: true,
498
- },
499
- },
500
- text: message,
501
- };
502
- } else {
503
- lineObject = {
504
- attachment: '',
505
- text: message,
506
- };
507
- }
508
- new LineMessage(saas.brand).sendLine({ data: lineObject, lineID: saas.userData.lineID }, () => {});
509
- }
507
+ let lineObject = {} as any;
508
+ const settings = await this.getSaasSettings();
509
+ const setKey = 'get-customer-message';
510
+ if (this.findSetting(settings, 'email', setKey)) {
511
+ await sendmail(`service@ncdesign.info`, saas.userData.email, obj.title, obj.content);
512
+ }
513
+ if (this.findSetting(settings, 'sms', setKey)) {
514
+ new SMS(this.app_name).sendSNS({ data: message, phone: saas.userData.phone }, () => {});
510
515
  }
516
+ if (this.findSetting(settings, 'line', setKey)) {
517
+ if (obj.room_image) {
518
+ lineObject = {
519
+ attachment: {
520
+ type: 'image',
521
+ payload: {
522
+ url: obj.room_image,
523
+ is_reusable: true,
524
+ },
525
+ },
526
+ text: message,
527
+ };
528
+ } else {
529
+ lineObject = {
530
+ attachment: '',
531
+ text: message,
532
+ };
533
+ }
534
+ new LineMessage(saas.brand).sendLine({ data: lineObject, lineID: saas.userData.lineID }, () => {});
535
+ }
536
+ }
511
537
 
512
- // 商家表單收集信件
513
- public async formSubmit(cf: { user_id: string }) {
514
- const saas = await this.getSaasAPP();
515
- const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=form_receive`;
516
- const user_data = (
517
- await db.query(
518
- `SELECT *
538
+ // 商家表單收集信件
539
+ public async formSubmit(cf: { user_id: string }) {
540
+ const saas = await this.getSaasAPP();
541
+ const link = `./index?type=editor&appName=${this.app_name}&function=backend-manger&tab=form_receive`;
542
+ const user_data = (
543
+ await db.query(
544
+ `SELECT *
519
545
  FROM \`${this.app_name}\`.t_user
520
546
  WHERE userID = ?`,
521
- [cf.user_id]
522
- )
523
- )[0];
524
- const body = html`收到來自『${user_data.userData.name}』提交的表單。`;
525
- new Firebase(saas.brand).sendMessage({
526
- title: '您有新表單',
527
- userID: saas.user,
528
- tag: 'formSubmit',
529
- link: link,
530
- body: body,
531
- });
547
+ [cf.user_id]
548
+ )
549
+ )[0];
550
+ const body = html`收到來自『${user_data.userData.name}』提交的表單。`;
551
+ new Firebase(saas.brand).sendMessage({
552
+ title: '您有新表單',
553
+ userID: saas.user,
554
+ tag: 'formSubmit',
555
+ link: link,
556
+ body: body,
557
+ });
532
558
 
533
- const settings = await this.getSaasSettings();
534
- const setKey = 'form-receive';
535
- if (this.findSetting(settings, 'email', setKey)) {
536
- await this.sendEmail(saas.userData.email, '您收集到一筆新的表單', body, link);
537
- }
538
- if (this.findSetting(settings, 'sms', setKey)) {
539
- new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
540
- }
541
- if (this.findSetting(settings, 'line', setKey)) {
542
- new LineMessage(saas.brand).sendLine(
543
- {
544
- data: {
545
- text: body,
546
- attachment: '',
547
- },
548
- lineID: saas.userData.lineID,
549
- },
550
- () => {}
551
- );
552
- }
559
+ const settings = await this.getSaasSettings();
560
+ const setKey = 'form-receive';
561
+ if (this.findSetting(settings, 'email', setKey)) {
562
+ await this.sendEmail(saas.userData.email, '您收集到一筆新的表單', body, link);
563
+ }
564
+ if (this.findSetting(settings, 'sms', setKey)) {
565
+ new SMS(this.app_name).sendSNS({ data: body, phone: saas.userData.phone }, () => {});
566
+ }
567
+ if (this.findSetting(settings, 'line', setKey)) {
568
+ new LineMessage(saas.brand).sendLine(
569
+ {
570
+ data: {
571
+ text: body,
572
+ attachment: '',
573
+ },
574
+ lineID: saas.userData.lineID,
575
+ },
576
+ () => {}
577
+ );
553
578
  }
579
+ }
554
580
  }