ts-glitter 20.5.0 → 20.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/cms-plugin/member-setting.js +2 -4
- package/lowcode/cms-plugin/member-setting.ts +2 -4
- package/lowcode/cms-plugin/shopping-collections.js +2 -2
- package/lowcode/cms-plugin/shopping-collections.ts +3 -2
- package/lowcode/cms-plugin/shopping-order-manager.js +1 -1
- package/lowcode/cms-plugin/shopping-order-manager.ts +1 -1
- package/lowcode/cms-plugin/stock-history.js +7 -2
- package/lowcode/cms-plugin/stock-history.ts +5 -2
- package/lowcode/cms-plugin/user-list.js +98 -97
- package/lowcode/cms-plugin/user-list.ts +111 -103
- package/lowcode/modules/checkInput.js +1 -1
- package/lowcode/modules/checkInput.ts +58 -60
- package/lowcode/public-components/checkout/index.js +0 -12
- package/lowcode/public-components/checkout/index.ts +1 -12
- package/lowcode/public-components/user-manager/um-info.js +49 -48
- package/lowcode/public-components/user-manager/um-info.ts +219 -204
- package/lowcode/public-components/user-manager/um-order.js +36 -22
- package/lowcode/public-components/user-manager/um-order.ts +43 -24
- package/lowcode/src/glitterBundle/module/Animation.js +7 -13
- package/lowcode/src/glitterBundle/module/Enum.js +2 -6
- package/lowcode/src/glitterBundle/module/Html_generate.js +50 -42
- package/lowcode/src/glitterBundle/module/PageManager.js +23 -30
- package/lowcode/src/glitterBundle/plugins/click-event.js +25 -19
- package/lowcode/src/glitterBundle/plugins/dialog-style-editor.js +13 -16
- package/lowcode/src/glitterBundle/plugins/editor-elem.js +1 -6
- package/lowcode/src/glitterBundle/plugins/editor.js +1 -5
- package/lowcode/src/glitterBundle/plugins/html-render.js +2 -5
- package/lowcode/src/glitterBundle/plugins/plugin-creater.js +28 -22
- package/lowcode/src/glitterBundle/plugins/seo-manager.js +1 -5
- package/lowcode/src/glitterBundle/plugins/style-attr.js +1 -5
- package/lowcode/src/glitterBundle/plugins/style-editor.js +1 -3
- package/package.json +1 -1
- package/src/api-public/services/financial-service.js +7 -6
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +11 -8
- package/src/api-public/services/model/handlePaymentTransaction.js +29 -2
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +8 -9
- package/src/api-public/services/shopping.d.ts +1 -1
- package/src/api-public/services/shopping.js +23 -10
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +15 -3
- package/src/api-public/services/user.js +44 -61
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +56 -66
|
@@ -837,9 +837,7 @@ export class User {
|
|
|
837
837
|
if (type === 'userID') {
|
|
838
838
|
query2.push(`userID=${db.escape(query)}`);
|
|
839
839
|
} else if (type === 'email_or_phone') {
|
|
840
|
-
query2.push(
|
|
841
|
-
`((email=${db.escape(query)}) or (phone=${db.escape(query)}))`
|
|
842
|
-
);
|
|
840
|
+
query2.push(`((email=${db.escape(query)}) or (phone=${db.escape(query)}))`);
|
|
843
841
|
} else {
|
|
844
842
|
query2.push(`email=${db.escape(query)}`);
|
|
845
843
|
}
|
|
@@ -2178,100 +2176,98 @@ export class User {
|
|
|
2178
2176
|
}
|
|
2179
2177
|
|
|
2180
2178
|
public async updateUserData(userID: string, par: any, manager: boolean = false) {
|
|
2181
|
-
const
|
|
2182
|
-
|
|
2183
|
-
`select *
|
|
2184
|
-
from \`${this.app}\`.\`t_user\`
|
|
2185
|
-
where userID = ${db.escape(userID)}
|
|
2179
|
+
const getUser = await db.query(
|
|
2180
|
+
`SELECT * FROM \`${this.app}\`.t_user WHERE userID = ${db.escape(userID)}
|
|
2186
2181
|
`,
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
})();
|
|
2182
|
+
[]
|
|
2183
|
+
);
|
|
2184
|
+
const userData = getUser[0] ?? {};
|
|
2191
2185
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
}
|
|
2186
|
+
if (!userData.userData) {
|
|
2187
|
+
return { data: {} };
|
|
2188
|
+
}
|
|
2196
2189
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
});
|
|
2201
|
-
const register_form = await this.getConfigV2({
|
|
2202
|
-
key: 'custom_form_register',
|
|
2203
|
-
user_id: 'manager',
|
|
2204
|
-
});
|
|
2190
|
+
try {
|
|
2191
|
+
const login_config = await this.getConfigV2({ key: 'login_config', user_id: 'manager' });
|
|
2192
|
+
const register_form = await this.getConfigV2({ key: 'custom_form_register', user_id: 'manager' });
|
|
2205
2193
|
|
|
2206
2194
|
register_form.list = register_form.list ?? [];
|
|
2207
2195
|
FormCheck.initialRegisterForm(register_form.list);
|
|
2208
2196
|
|
|
2197
|
+
const userDataVerify = await redis.getValue(`verify-${userData.userData.email}`);
|
|
2198
|
+
const parDataVerify = await redis.getValue(`verify-${par.userData.email}`);
|
|
2199
|
+
|
|
2200
|
+
// 更改密碼驗證
|
|
2209
2201
|
if (par.userData.pwd) {
|
|
2210
|
-
if (
|
|
2202
|
+
if (userDataVerify === par.userData.verify_code) {
|
|
2203
|
+
const pwd = await tool.hashPwd(par.userData.pwd);
|
|
2211
2204
|
await db.query(
|
|
2212
|
-
`
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
[await tool.hashPwd(par.userData.pwd)]
|
|
2205
|
+
`UPDATE \`${this.app}\`.t_user SET pwd = ? WHERE userID = ${db.escape(userID)}
|
|
2206
|
+
`,
|
|
2207
|
+
[pwd]
|
|
2216
2208
|
);
|
|
2217
2209
|
} else {
|
|
2218
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2219
|
-
msg: '
|
|
2210
|
+
throw exception.BadRequestError('BAD_REQUEST', 'Password verify code error.', {
|
|
2211
|
+
msg: 'password-verify-false',
|
|
2220
2212
|
});
|
|
2221
2213
|
}
|
|
2222
2214
|
}
|
|
2223
2215
|
|
|
2216
|
+
// 更改信箱驗證
|
|
2224
2217
|
if (par.userData.email && par.userData.email !== userData.userData.email) {
|
|
2225
2218
|
const count = (
|
|
2226
2219
|
await db.query(
|
|
2227
|
-
`
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2220
|
+
`SELECT count(1)
|
|
2221
|
+
FROM \`${this.app}\`.t_user
|
|
2222
|
+
WHERE (userData->>'$.email' = ${db.escape(par.userData.email)})
|
|
2223
|
+
AND (userID != ${db.escape(userID)})`,
|
|
2231
2224
|
[]
|
|
2232
2225
|
)
|
|
2233
2226
|
)[0]['count(1)'];
|
|
2227
|
+
|
|
2234
2228
|
if (count) {
|
|
2235
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2229
|
+
throw exception.BadRequestError('BAD_REQUEST', 'User email already exists.', {
|
|
2236
2230
|
msg: 'email-exists',
|
|
2237
2231
|
});
|
|
2238
2232
|
}
|
|
2233
|
+
|
|
2239
2234
|
if (
|
|
2235
|
+
!manager &&
|
|
2240
2236
|
login_config.email_verify &&
|
|
2241
|
-
par.userData.verify_code !==
|
|
2242
|
-
register_form.list.
|
|
2243
|
-
return dd.key === 'email' && `${dd.hidden}` !== 'true';
|
|
2244
|
-
})
|
|
2237
|
+
par.userData.verify_code !== parDataVerify &&
|
|
2238
|
+
register_form.list.some((r: any) => r.key === 'email' && `${r.hidden}` !== 'true')
|
|
2245
2239
|
) {
|
|
2246
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2240
|
+
throw exception.BadRequestError('BAD_REQUEST', 'ParData email verify code error.', {
|
|
2247
2241
|
msg: 'email-verify-false',
|
|
2248
2242
|
});
|
|
2249
2243
|
}
|
|
2250
2244
|
}
|
|
2251
2245
|
|
|
2246
|
+
// 更改手機驗證
|
|
2252
2247
|
if (par.userData.phone && par.userData.phone !== userData.userData.phone) {
|
|
2253
2248
|
const count = (
|
|
2254
2249
|
await db.query(
|
|
2255
|
-
`
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2250
|
+
`SELECT count(1)
|
|
2251
|
+
FROM \`${this.app}\`.t_user
|
|
2252
|
+
WHERE (userData->>'$.phone' = ${db.escape(par.userData.phone)})
|
|
2253
|
+
AND (userID != ${db.escape(userID)}) `,
|
|
2259
2254
|
[]
|
|
2260
2255
|
)
|
|
2261
2256
|
)[0]['count(1)'];
|
|
2257
|
+
|
|
2262
2258
|
if (count) {
|
|
2263
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2259
|
+
throw exception.BadRequestError('BAD_REQUEST', 'User phone already exists.', {
|
|
2264
2260
|
msg: 'phone-exists',
|
|
2265
2261
|
});
|
|
2266
2262
|
}
|
|
2263
|
+
|
|
2267
2264
|
if (
|
|
2265
|
+
!manager &&
|
|
2268
2266
|
login_config.phone_verify &&
|
|
2269
2267
|
!(await PhoneVerify.verify(par.userData.phone, par.userData.verify_code_phone)) &&
|
|
2270
|
-
register_form.list.
|
|
2271
|
-
return dd.key === 'phone' && `${dd.hidden}` !== 'true';
|
|
2272
|
-
})
|
|
2268
|
+
register_form.list.some((dd: any) => dd.key === 'phone' && `${dd.hidden}` !== 'true')
|
|
2273
2269
|
) {
|
|
2274
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2270
|
+
throw exception.BadRequestError('BAD_REQUEST', 'ParData phone verify code error.', {
|
|
2275
2271
|
msg: 'phone-verify-false',
|
|
2276
2272
|
});
|
|
2277
2273
|
}
|
|
@@ -2282,10 +2278,8 @@ export class User {
|
|
|
2282
2278
|
|
|
2283
2279
|
if (par.userData.phone) {
|
|
2284
2280
|
await db.query(
|
|
2285
|
-
`
|
|
2286
|
-
|
|
2287
|
-
where id > 0
|
|
2288
|
-
and email = ?`,
|
|
2281
|
+
`UPDATE \`${this.app}\`.t_checkout SET email = ? WHERE id > 0 AND email = ?
|
|
2282
|
+
`,
|
|
2289
2283
|
[par.userData.phone, `${userData.userData.phone}`]
|
|
2290
2284
|
);
|
|
2291
2285
|
userData.account = par.userData.phone;
|
|
@@ -2293,10 +2287,8 @@ export class User {
|
|
|
2293
2287
|
|
|
2294
2288
|
if (par.userData.email) {
|
|
2295
2289
|
await db.query(
|
|
2296
|
-
`
|
|
2297
|
-
|
|
2298
|
-
where id > 0
|
|
2299
|
-
and email = ?`,
|
|
2290
|
+
`UPDATE \`${this.app}\`.t_checkout SET email = ? WHERE id > 0 AND email = ?
|
|
2291
|
+
`,
|
|
2300
2292
|
[par.userData.email, `${userData.userData.email}`]
|
|
2301
2293
|
);
|
|
2302
2294
|
userData.account = par.userData.email;
|
|
@@ -2304,8 +2296,8 @@ export class User {
|
|
|
2304
2296
|
|
|
2305
2297
|
par.userData = await this.checkUpdate({
|
|
2306
2298
|
updateUserData: par.userData,
|
|
2307
|
-
userID
|
|
2308
|
-
manager
|
|
2299
|
+
userID,
|
|
2300
|
+
manager,
|
|
2309
2301
|
});
|
|
2310
2302
|
|
|
2311
2303
|
delete par.userData.verify_code;
|
|
@@ -2320,13 +2312,11 @@ export class User {
|
|
|
2320
2312
|
delete par.account;
|
|
2321
2313
|
}
|
|
2322
2314
|
|
|
2323
|
-
const data =
|
|
2324
|
-
`
|
|
2325
|
-
|
|
2326
|
-
WHERE 1 = 1
|
|
2327
|
-
and userID = ?`,
|
|
2315
|
+
const data = await db.query(
|
|
2316
|
+
`UPDATE \`${this.app}\`.t_user SET ? WHERE 1 = 1 AND userID = ?
|
|
2317
|
+
`,
|
|
2328
2318
|
[par, userID]
|
|
2329
|
-
)
|
|
2319
|
+
);
|
|
2330
2320
|
|
|
2331
2321
|
await UserUpdate.update(this.app, userID);
|
|
2332
2322
|
|