feat(store): benefit coupon usage rules and show env photos on store detail
CI / verify (pull_request) Has been cancelled
CI / verify (pull_request) Has been cancelled
Add benefitUsageRule on store create/edit (HQ + partner) and C-end detail between intro and env gallery. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -304,6 +304,11 @@ export class StoreService {
|
||||
if (introRaw && (introRaw.length < 2 || introRaw.length > 500)) {
|
||||
throw new BadRequestException('门店简介须为 2~500 字');
|
||||
}
|
||||
const benefitUsageRuleRaw =
|
||||
body.benefitUsageRule != null ? String(body.benefitUsageRule).trim() : '';
|
||||
if (benefitUsageRuleRaw.length > 1000) {
|
||||
throw new BadRequestException('好客权益券使用规则最多 1000 字');
|
||||
}
|
||||
|
||||
const latitude = parseOptionalCoord(body.latitude, 'lat');
|
||||
const longitude = parseOptionalCoord(body.longitude, 'lng');
|
||||
@@ -323,6 +328,7 @@ export class StoreService {
|
||||
district: String(body.district ?? ''),
|
||||
address: String(body.address),
|
||||
intro: introRaw || null,
|
||||
benefitUsageRule: benefitUsageRuleRaw || null,
|
||||
avgPrice: avgPriceRaw,
|
||||
openTime,
|
||||
closeTime,
|
||||
@@ -518,6 +524,8 @@ export class StoreService {
|
||||
const phone = body.phone !== undefined ? String(body.phone).trim() : undefined;
|
||||
const address = body.address !== undefined ? String(body.address).trim() : undefined;
|
||||
const introRaw = body.intro !== undefined ? String(body.intro).trim() : undefined;
|
||||
const benefitUsageRuleRaw =
|
||||
body.benefitUsageRule !== undefined ? String(body.benefitUsageRule).trim() : undefined;
|
||||
const latitude =
|
||||
body.latitude !== undefined ? parseOptionalCoord(body.latitude, 'lat') : undefined;
|
||||
const longitude =
|
||||
@@ -531,6 +539,9 @@ export class StoreService {
|
||||
if (introRaw && (introRaw.length < 2 || introRaw.length > 500)) {
|
||||
throw new BadRequestException('门店简介须为 2~500 字');
|
||||
}
|
||||
if (benefitUsageRuleRaw !== undefined && benefitUsageRuleRaw.length > 1000) {
|
||||
throw new BadRequestException('好客权益券使用规则最多 1000 字');
|
||||
}
|
||||
if (
|
||||
(latitude !== undefined || longitude !== undefined) &&
|
||||
(latitude == null || longitude == null)
|
||||
@@ -552,6 +563,9 @@ export class StoreService {
|
||||
: {}),
|
||||
...(hasCoordsUpdate ? { latitude, longitude } : {}),
|
||||
...(introRaw !== undefined ? { intro: introRaw || null } : {}),
|
||||
...(benefitUsageRuleRaw !== undefined
|
||||
? { benefitUsageRule: benefitUsageRuleRaw || null }
|
||||
: {}),
|
||||
...(resubmitAudit
|
||||
? {
|
||||
auditStatus: 'PENDING' as const,
|
||||
|
||||
Reference in New Issue
Block a user