ts-glitter 20.5.1 → 20.5.3
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/module/user-excel.js +25 -21
- package/lowcode/cms-plugin/module/user-excel.ts +9 -6
- package/lowcode/cms-plugin/stock-history.ts +0 -1
- package/lowcode/cms-plugin/user-list.js +98 -97
- package/lowcode/cms-plugin/user-list.ts +111 -103
- package/lowcode/modules/checkInput.js +2 -2
- package/lowcode/modules/checkInput.ts +58 -61
- package/lowcode/public-components/checkout/index.js +0 -1
- package/lowcode/public-components/checkout/index.ts +0 -1
- 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 +25 -22
- package/lowcode/public-components/user-manager/um-order.ts +32 -23
- 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 +12 -9
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +5 -3
- package/src/api-public/services/user.js +48 -61
- package/src/api-public/services/user.js.map +1 -1
- package/src/api-public/services/user.ts +62 -66
|
@@ -212,6 +212,7 @@ export class User {
|
|
|
212
212
|
delete userData.repeat_password;
|
|
213
213
|
const findAuth = await this.findAuthUser(account);
|
|
214
214
|
const userID = findAuth ? findAuth.user : User.generateUserID();
|
|
215
|
+
|
|
215
216
|
if (
|
|
216
217
|
register_form.list.find((dd: any) => {
|
|
217
218
|
return dd.key === 'email' && `${dd.hidden}` !== 'true' && dd.required;
|
|
@@ -288,6 +289,11 @@ export class User {
|
|
|
288
289
|
userData: {},
|
|
289
290
|
});
|
|
290
291
|
|
|
292
|
+
const rebate_value = parseInt(userData.rebate, 10);
|
|
293
|
+
if (!isNaN(rebate_value) && rebate_value > 0) {
|
|
294
|
+
await new Rebate(this.app).insertRebate(userID, rebate_value, '匯入會員購物金');
|
|
295
|
+
}
|
|
296
|
+
|
|
291
297
|
return usData;
|
|
292
298
|
} catch (e: any) {
|
|
293
299
|
console.error(e);
|
|
@@ -837,9 +843,7 @@ export class User {
|
|
|
837
843
|
if (type === 'userID') {
|
|
838
844
|
query2.push(`userID=${db.escape(query)}`);
|
|
839
845
|
} else if (type === 'email_or_phone') {
|
|
840
|
-
query2.push(
|
|
841
|
-
`((email=${db.escape(query)}) or (phone=${db.escape(query)}))`
|
|
842
|
-
);
|
|
846
|
+
query2.push(`((email=${db.escape(query)}) or (phone=${db.escape(query)}))`);
|
|
843
847
|
} else {
|
|
844
848
|
query2.push(`email=${db.escape(query)}`);
|
|
845
849
|
}
|
|
@@ -2178,100 +2182,98 @@ export class User {
|
|
|
2178
2182
|
}
|
|
2179
2183
|
|
|
2180
2184
|
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)}
|
|
2185
|
+
const getUser = await db.query(
|
|
2186
|
+
`SELECT * FROM \`${this.app}\`.t_user WHERE userID = ${db.escape(userID)}
|
|
2186
2187
|
`,
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
})();
|
|
2188
|
+
[]
|
|
2189
|
+
);
|
|
2190
|
+
const userData = getUser[0] ?? {};
|
|
2191
2191
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
}
|
|
2192
|
+
if (!userData.userData) {
|
|
2193
|
+
return { data: {} };
|
|
2194
|
+
}
|
|
2196
2195
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
});
|
|
2201
|
-
const register_form = await this.getConfigV2({
|
|
2202
|
-
key: 'custom_form_register',
|
|
2203
|
-
user_id: 'manager',
|
|
2204
|
-
});
|
|
2196
|
+
try {
|
|
2197
|
+
const login_config = await this.getConfigV2({ key: 'login_config', user_id: 'manager' });
|
|
2198
|
+
const register_form = await this.getConfigV2({ key: 'custom_form_register', user_id: 'manager' });
|
|
2205
2199
|
|
|
2206
2200
|
register_form.list = register_form.list ?? [];
|
|
2207
2201
|
FormCheck.initialRegisterForm(register_form.list);
|
|
2208
2202
|
|
|
2203
|
+
const userDataVerify = await redis.getValue(`verify-${userData.userData.email}`);
|
|
2204
|
+
const parDataVerify = await redis.getValue(`verify-${par.userData.email}`);
|
|
2205
|
+
|
|
2206
|
+
// 更改密碼驗證
|
|
2209
2207
|
if (par.userData.pwd) {
|
|
2210
|
-
if (
|
|
2208
|
+
if (userDataVerify === par.userData.verify_code) {
|
|
2209
|
+
const pwd = await tool.hashPwd(par.userData.pwd);
|
|
2211
2210
|
await db.query(
|
|
2212
|
-
`
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
[await tool.hashPwd(par.userData.pwd)]
|
|
2211
|
+
`UPDATE \`${this.app}\`.t_user SET pwd = ? WHERE userID = ${db.escape(userID)}
|
|
2212
|
+
`,
|
|
2213
|
+
[pwd]
|
|
2216
2214
|
);
|
|
2217
2215
|
} else {
|
|
2218
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2219
|
-
msg: '
|
|
2216
|
+
throw exception.BadRequestError('BAD_REQUEST', 'Password verify code error.', {
|
|
2217
|
+
msg: 'password-verify-false',
|
|
2220
2218
|
});
|
|
2221
2219
|
}
|
|
2222
2220
|
}
|
|
2223
2221
|
|
|
2222
|
+
// 更改信箱驗證
|
|
2224
2223
|
if (par.userData.email && par.userData.email !== userData.userData.email) {
|
|
2225
2224
|
const count = (
|
|
2226
2225
|
await db.query(
|
|
2227
|
-
`
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2226
|
+
`SELECT count(1)
|
|
2227
|
+
FROM \`${this.app}\`.t_user
|
|
2228
|
+
WHERE (userData->>'$.email' = ${db.escape(par.userData.email)})
|
|
2229
|
+
AND (userID != ${db.escape(userID)})`,
|
|
2231
2230
|
[]
|
|
2232
2231
|
)
|
|
2233
2232
|
)[0]['count(1)'];
|
|
2233
|
+
|
|
2234
2234
|
if (count) {
|
|
2235
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2235
|
+
throw exception.BadRequestError('BAD_REQUEST', 'User email already exists.', {
|
|
2236
2236
|
msg: 'email-exists',
|
|
2237
2237
|
});
|
|
2238
2238
|
}
|
|
2239
|
+
|
|
2239
2240
|
if (
|
|
2241
|
+
!manager &&
|
|
2240
2242
|
login_config.email_verify &&
|
|
2241
|
-
par.userData.verify_code !==
|
|
2242
|
-
register_form.list.
|
|
2243
|
-
return dd.key === 'email' && `${dd.hidden}` !== 'true';
|
|
2244
|
-
})
|
|
2243
|
+
par.userData.verify_code !== parDataVerify &&
|
|
2244
|
+
register_form.list.some((r: any) => r.key === 'email' && `${r.hidden}` !== 'true')
|
|
2245
2245
|
) {
|
|
2246
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2246
|
+
throw exception.BadRequestError('BAD_REQUEST', 'ParData email verify code error.', {
|
|
2247
2247
|
msg: 'email-verify-false',
|
|
2248
2248
|
});
|
|
2249
2249
|
}
|
|
2250
2250
|
}
|
|
2251
2251
|
|
|
2252
|
+
// 更改手機驗證
|
|
2252
2253
|
if (par.userData.phone && par.userData.phone !== userData.userData.phone) {
|
|
2253
2254
|
const count = (
|
|
2254
2255
|
await db.query(
|
|
2255
|
-
`
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2256
|
+
`SELECT count(1)
|
|
2257
|
+
FROM \`${this.app}\`.t_user
|
|
2258
|
+
WHERE (userData->>'$.phone' = ${db.escape(par.userData.phone)})
|
|
2259
|
+
AND (userID != ${db.escape(userID)}) `,
|
|
2259
2260
|
[]
|
|
2260
2261
|
)
|
|
2261
2262
|
)[0]['count(1)'];
|
|
2263
|
+
|
|
2262
2264
|
if (count) {
|
|
2263
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2265
|
+
throw exception.BadRequestError('BAD_REQUEST', 'User phone already exists.', {
|
|
2264
2266
|
msg: 'phone-exists',
|
|
2265
2267
|
});
|
|
2266
2268
|
}
|
|
2269
|
+
|
|
2267
2270
|
if (
|
|
2271
|
+
!manager &&
|
|
2268
2272
|
login_config.phone_verify &&
|
|
2269
2273
|
!(await PhoneVerify.verify(par.userData.phone, par.userData.verify_code_phone)) &&
|
|
2270
|
-
register_form.list.
|
|
2271
|
-
return dd.key === 'phone' && `${dd.hidden}` !== 'true';
|
|
2272
|
-
})
|
|
2274
|
+
register_form.list.some((dd: any) => dd.key === 'phone' && `${dd.hidden}` !== 'true')
|
|
2273
2275
|
) {
|
|
2274
|
-
throw exception.BadRequestError('BAD_REQUEST', '
|
|
2276
|
+
throw exception.BadRequestError('BAD_REQUEST', 'ParData phone verify code error.', {
|
|
2275
2277
|
msg: 'phone-verify-false',
|
|
2276
2278
|
});
|
|
2277
2279
|
}
|
|
@@ -2282,10 +2284,8 @@ export class User {
|
|
|
2282
2284
|
|
|
2283
2285
|
if (par.userData.phone) {
|
|
2284
2286
|
await db.query(
|
|
2285
|
-
`
|
|
2286
|
-
|
|
2287
|
-
where id > 0
|
|
2288
|
-
and email = ?`,
|
|
2287
|
+
`UPDATE \`${this.app}\`.t_checkout SET email = ? WHERE id > 0 AND email = ?
|
|
2288
|
+
`,
|
|
2289
2289
|
[par.userData.phone, `${userData.userData.phone}`]
|
|
2290
2290
|
);
|
|
2291
2291
|
userData.account = par.userData.phone;
|
|
@@ -2293,10 +2293,8 @@ export class User {
|
|
|
2293
2293
|
|
|
2294
2294
|
if (par.userData.email) {
|
|
2295
2295
|
await db.query(
|
|
2296
|
-
`
|
|
2297
|
-
|
|
2298
|
-
where id > 0
|
|
2299
|
-
and email = ?`,
|
|
2296
|
+
`UPDATE \`${this.app}\`.t_checkout SET email = ? WHERE id > 0 AND email = ?
|
|
2297
|
+
`,
|
|
2300
2298
|
[par.userData.email, `${userData.userData.email}`]
|
|
2301
2299
|
);
|
|
2302
2300
|
userData.account = par.userData.email;
|
|
@@ -2304,8 +2302,8 @@ export class User {
|
|
|
2304
2302
|
|
|
2305
2303
|
par.userData = await this.checkUpdate({
|
|
2306
2304
|
updateUserData: par.userData,
|
|
2307
|
-
userID
|
|
2308
|
-
manager
|
|
2305
|
+
userID,
|
|
2306
|
+
manager,
|
|
2309
2307
|
});
|
|
2310
2308
|
|
|
2311
2309
|
delete par.userData.verify_code;
|
|
@@ -2320,13 +2318,11 @@ export class User {
|
|
|
2320
2318
|
delete par.account;
|
|
2321
2319
|
}
|
|
2322
2320
|
|
|
2323
|
-
const data =
|
|
2324
|
-
`
|
|
2325
|
-
|
|
2326
|
-
WHERE 1 = 1
|
|
2327
|
-
and userID = ?`,
|
|
2321
|
+
const data = await db.query(
|
|
2322
|
+
`UPDATE \`${this.app}\`.t_user SET ? WHERE 1 = 1 AND userID = ?
|
|
2323
|
+
`,
|
|
2328
2324
|
[par, userID]
|
|
2329
|
-
)
|
|
2325
|
+
);
|
|
2330
2326
|
|
|
2331
2327
|
await UserUpdate.update(this.app, userID);
|
|
2332
2328
|
|