fix(admin,mini-user): store lat/lng edit with Baidu map, center pickup qty hint
CI / verify (pull_request) Has been cancelled

HQ store detail can set coordinates and open Baidu Map search by name/address; admin update API persists lat/lng.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-27 22:53:13 +08:00
parent 15b878f2a4
commit d36fe13bcd
4 changed files with 168 additions and 25 deletions
@@ -194,6 +194,20 @@ export class AdminStoresService {
if (!hoursCheck.ok) throw new BadRequestException(hoursCheck.message);
}
const latitude = dto.latitude !== undefined ? (dto.latitude == null ? null : Number(dto.latitude)) : undefined;
const longitude = dto.longitude !== undefined ? (dto.longitude == null ? null : Number(dto.longitude)) : undefined;
if (latitude !== undefined || longitude !== undefined) {
if (latitude == null || longitude == null) {
throw new BadRequestException('经纬度须同时提供');
}
if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90) {
throw new BadRequestException('纬度无效');
}
if (!Number.isFinite(longitude) || longitude < -180 || longitude > 180) {
throw new BadRequestException('经度无效');
}
}
const store = await this.prisma.store.update({
where: { id },
data: {
@@ -208,6 +222,7 @@ export class AdminStoresService {
...(dto.openTime2 !== undefined ? { openTime2: dto.openTime2 || null } : {}),
...(dto.closeTime2 !== undefined ? { closeTime2: dto.closeTime2 || null } : {}),
...(dto.avgPrice !== undefined ? { avgPrice: dto.avgPrice } : {}),
...(latitude != null && longitude != null ? { latitude, longitude } : {}),
},
});
@@ -146,6 +146,14 @@ export class UpdateStoreDto {
@IsString()
address?: string;
@IsOptional()
@IsNumber()
latitude?: number;
@IsOptional()
@IsNumber()
longitude?: number;
@IsOptional()
@IsString()
district?: string;