ts-glitter 20.4.6 → 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.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-widget.js +19 -17
- package/lowcode/backend-manager/bg-widget.ts +19 -17
- package/lowcode/cms-plugin/user/user-module.js +28 -28
- package/lowcode/cms-plugin/user/user-module.ts +29 -31
- package/lowcode/cms-plugin/user-list.js +55 -42
- package/lowcode/cms-plugin/user-list.ts +71 -47
- package/lowcode/glitter-base/route/progress.js +32 -0
- package/lowcode/glitter-base/route/progress.ts +36 -0
- package/lowcode/glitter-base/route/user.js +37 -1
- package/lowcode/glitter-base/route/user.ts +40 -1
- package/lowcode/glitterBundle/dialog/ShareDialog.ts +0 -1
- package/package.json +3 -1
- package/src/api-public/controllers/ai-chat.js.map +1 -1
- package/src/api-public/controllers/app-release.js.map +1 -1
- package/src/api-public/controllers/delivery.js.map +1 -1
- package/src/api-public/controllers/graph-api.js.map +1 -1
- package/src/api-public/controllers/index.js +9 -8
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +171 -169
- package/src/api-public/controllers/lambda.js.map +1 -1
- package/src/api-public/controllers/manager.js.map +1 -1
- package/src/api-public/controllers/post.js.map +1 -1
- package/src/api-public/controllers/progress.d.ts +3 -0
- package/src/api-public/controllers/progress.js +29 -0
- package/src/api-public/controllers/progress.js.map +1 -0
- package/src/api-public/controllers/progress.ts +25 -0
- package/src/api-public/controllers/sql_api.js.map +1 -1
- package/src/api-public/controllers/track.js.map +1 -1
- package/src/api-public/controllers/user.js +47 -1
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +44 -3
- package/src/api-public/services/checkout.d.ts +1 -0
- package/src/api-public/services/checkout.js +16 -6
- package/src/api-public/services/checkout.js.map +1 -1
- package/src/api-public/services/checkout.ts +28 -18
- package/src/api-public/services/customer-sessions.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-order.d.ts +6 -1
- package/src/api-public/services/fake-data-model/fake-order.js +159 -155
- package/src/api-public/services/fake-data-model/fake-order.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-order.ts +186 -179
- package/src/api-public/services/fake-data-model/fake-product.js +94 -94
- package/src/api-public/services/fake-data-model/fake-product.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-product.ts +109 -114
- package/src/api-public/services/fake-data-model/fake-user.d.ts +17 -1
- package/src/api-public/services/fake-data-model/fake-user.js +70 -384
- package/src/api-public/services/fake-data-model/fake-user.js.map +1 -1
- package/src/api-public/services/fake-data-model/fake-user.ts +111 -394
- package/src/api-public/services/initial-fake-data.js +50 -10
- package/src/api-public/services/initial-fake-data.js.map +1 -1
- package/src/api-public/services/initial-fake-data.ts +92 -22
- package/src/api-public/services/invoice.js.map +1 -1
- package/src/api-public/services/manager.js.map +1 -1
- package/src/api-public/services/notify.js +234 -213
- package/src/api-public/services/notify.js.map +1 -1
- package/src/api-public/services/notify.ts +520 -494
- package/src/api-public/services/phone-verify.js.map +1 -1
- package/src/api-public/services/pos.js.map +1 -1
- package/src/api-public/services/post.js.map +1 -1
- package/src/api-public/services/rebate.d.ts +1 -0
- package/src/api-public/services/rebate.js +15 -8
- package/src/api-public/services/rebate.js.map +1 -1
- package/src/api-public/services/rebate.ts +24 -15
- package/src/api-public/services/recommend.js.map +1 -1
- package/src/api-public/services/schedule.js +7 -4
- package/src/api-public/services/schedule.js.map +1 -1
- package/src/api-public/services/schedule.ts +344 -335
- package/src/api-public/services/shopee.js.map +1 -1
- package/src/api-public/services/shopping.d.ts +1 -1
- package/src/api-public/services/shopping.js +28 -25
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +89 -76
- package/src/api-public/services/stock.js.map +1 -1
- package/src/api-public/services/user.d.ts +10 -1
- package/src/api-public/services/user.js +245 -42
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +325 -45
- package/src/api-public/services/voucher.js.map +1 -1
- package/src/api-public/services/workers.js.map +1 -1
- package/src/api-public/utils/ut-permission.d.ts +0 -1
- package/src/api-public/utils/ut-permission.js.map +1 -1
- package/src/config.d.ts +2 -1
- package/src/config.js +2 -1
- package/src/config.js.map +1 -1
- package/src/config.ts +142 -142
- package/src/controllers/app.js.map +1 -1
- package/src/controllers/backend-server.js.map +1 -1
- package/src/controllers/filemanager.js.map +1 -1
- package/src/controllers/index.js.map +1 -1
- package/src/controllers/user.js.map +1 -1
- package/src/domain-check.js.map +1 -1
- package/src/index.js.map +1 -1
- package/src/index.ts +3 -12
- package/src/modules/AWSLib.js +2 -3
- package/src/modules/AWSLib.js.map +1 -1
- package/src/modules/database.d.ts +1 -2
- package/src/modules/database.js.map +1 -1
- package/src/modules/firebase.js.map +1 -1
- package/src/modules/logger.js.map +1 -1
- package/src/modules/redis.d.ts +1 -1
- package/src/modules/redis.js.map +1 -1
- package/src/run.js +1 -2
- package/src/run.js.map +1 -1
- package/src/services/backend-service.js.map +1 -1
- package/src/services/create-instance.js +3 -4
- package/src/services/create-instance.js.map +1 -1
- package/src/services/global-event.js.map +1 -1
- package/src/services/ios-release.js.map +1 -1
- package/src/services/page.js.map +1 -1
- package/src/services/private_config.js.map +1 -1
- package/src/services/release.js.map +1 -1
- package/src/services/seo.js.map +1 -1
- package/src/services/tool.js +2 -3
- package/src/services/tool.js.map +1 -1
- package/src/services/user.js.map +1 -1
- package/src/services/web-socket.js.map +1 -1
- package/src/update-progress-track.d.ts +14 -0
- package/src/update-progress-track.js +28 -0
- package/src/update-progress-track.js.map +1 -0
- 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
|
-
|
|
13
|
+
public app_name: string;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
constructor(app_name: string) {
|
|
16
|
+
this.app_name = app_name;
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
|
|
99
|
-
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
+
>
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
308
|
+
</td>
|
|
309
|
+
</tr>
|
|
310
|
+
</tbody>
|
|
311
|
+
</table>
|
|
312
|
+
</td>
|
|
313
|
+
</tr>
|
|
314
|
+
</tbody>
|
|
291
315
|
</table>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
328
|
+
// 判斷是否進行推播通知
|
|
329
|
+
public async checkNotify(tag: string) {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
304
332
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
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
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
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
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
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
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
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
|
}
|