Merge commit '336116fbf21cbb33ddbaf00685f93b18ea84d5d6' into dev_jacy

This commit is contained in:
2026-07-09 22:08:02 +08:00
18 changed files with 341 additions and 190 deletions
@@ -0,0 +1,13 @@
import { BadRequestException } from '@nestjs/common';
export function parseBigIntParam(value: unknown, label = 'ID'): bigint {
const text = String(value ?? '').trim();
if (!/^\d+$/.test(text)) {
throw new BadRequestException(`${label}格式无效`);
}
try {
return BigInt(text);
} catch {
throw new BadRequestException(`${label}格式无效`);
}
}
@@ -9,6 +9,7 @@ import { PARTNER_STAFF_ROLE_LABELS, PartnerStaffRole, type PartnerLeaderboardPer
import { PrismaService } from '../../common/prisma/prisma.module';
import { serializeBigInt } from '../../common/decorators/current-user.decorator';
import { mapStoreCompat } from '../../common/compat/v31-compat';
import { parseBigIntParam } from '../../common/parse-bigint';
import { AnalyticsService } from '../analytics/analytics.service';
@Injectable()
@@ -133,7 +134,7 @@ export class StoreService {
data: {
cityId: city.id,
partnerId: account.partnerId,
categoryId: body.categoryId ? BigInt(String(body.categoryId)) : null,
categoryId: body.categoryId ? parseBigIntParam(body.categoryId, '分类ID') : null,
name: String(body.name),
phone: normalizedPhone,
province: String(body.province ?? city.province ?? '河南省'),
@@ -226,7 +227,12 @@ export class StoreService {
extraJson: { storeName: store.name, phone: normalizedPhone },
});
return serializeBigInt({ store, audit });
return serializeBigInt({
store: mapStoreCompat({
...store,
coverResource: coverUrl ? { url: coverUrl } : null,
}),
});
}
async partnerUpdateStoreStatus(
@@ -681,7 +687,7 @@ export class StoreService {
private async resolvePartnerCity(partnerId: bigint, cityId: unknown) {
if (cityId) {
const city = await this.prisma.commonCity.findFirst({
where: { id: BigInt(String(cityId)), partnerId },
where: { id: parseBigIntParam(cityId, '城市ID'), partnerId },
});
if (!city) throw new BadRequestException('所选地区未匹配到开城城市');
return city;