H5端开店增加获取当前店铺位置
This commit is contained in:
@@ -268,6 +268,18 @@ export class AdminStoresService {
|
||||
const categoryId = BigInt(dto.categoryId);
|
||||
await this.storeCategoryService.assertLeafCategoryId(categoryId);
|
||||
|
||||
const latitude = dto.latitude != null ? Number(dto.latitude) : null;
|
||||
const longitude = dto.longitude != null ? Number(dto.longitude) : null;
|
||||
if ((latitude == null) !== (longitude == null)) {
|
||||
throw new BadRequestException('经纬度须同时提供');
|
||||
}
|
||||
if (
|
||||
latitude != null &&
|
||||
(!Number.isFinite(latitude) || !Number.isFinite(longitude!) || latitude < -90 || latitude > 90)
|
||||
) {
|
||||
throw new BadRequestException('经纬度无效');
|
||||
}
|
||||
|
||||
const openTime = dto.openTime?.trim() || '10:00';
|
||||
const closeTime = dto.closeTime?.trim() || '22:00';
|
||||
const openTime2 = dto.openTime2?.trim() || '';
|
||||
@@ -296,6 +308,7 @@ export class AdminStoresService {
|
||||
closeTime,
|
||||
openTime2: openTime2 || null,
|
||||
closeTime2: closeTime2 || null,
|
||||
...(latitude != null && longitude != null ? { latitude, longitude } : {}),
|
||||
status: 'OPEN',
|
||||
auditStatus: 'APPROVED',
|
||||
auditedAt: new Date(),
|
||||
|
||||
Reference in New Issue
Block a user