oss接通了80端口,还没有接通https,先用
This commit is contained in:
@@ -97,6 +97,9 @@ export class OssAliyunProvider implements IOssProvider {
|
||||
const ossKey = buildOssObjectKey(this.uploadPrefix, input.bizType, input.fileName);
|
||||
await client.put(ossKey, input.buffer, {
|
||||
mime: input.mimeType || 'application/octet-stream',
|
||||
headers: {
|
||||
'Content-Disposition': 'inline',
|
||||
},
|
||||
});
|
||||
return {
|
||||
bucket: this.bucket,
|
||||
|
||||
@@ -136,6 +136,9 @@ export class AdminStoresService {
|
||||
if (!partner) throw new BadRequestException('开城合伙人不存在');
|
||||
const city = await this.prisma.commonCity.findUnique({ where: { id: BigInt(dto.cityId) } });
|
||||
if (!city) throw new BadRequestException('开城城市不存在');
|
||||
if (city.partnerId && city.partnerId !== partner.id) {
|
||||
throw new BadRequestException('开城城市与合伙人不匹配');
|
||||
}
|
||||
|
||||
const store = await this.prisma.store.create({
|
||||
data: {
|
||||
@@ -149,10 +152,73 @@ export class AdminStoresService {
|
||||
district: dto.district ?? '',
|
||||
address: dto.address,
|
||||
intro: dto.intro ?? null,
|
||||
bankAccountName: dto.bankAccountName ?? null,
|
||||
bankAccountNo: dto.bankAccountNo ?? null,
|
||||
bankBranch: dto.bankBranch ?? null,
|
||||
openTime: '10:00',
|
||||
closeTime: '22:00',
|
||||
status: 'OPEN',
|
||||
},
|
||||
});
|
||||
|
||||
if (dto.coverUrl) {
|
||||
const cover = await this.prisma.commonResource.create({
|
||||
data: {
|
||||
ownerType: 'STORE',
|
||||
ownerId: store.id,
|
||||
bizType: 'COVER',
|
||||
mediaType: 'IMAGE',
|
||||
ossBucket: 'legacy',
|
||||
ossKey: dto.coverUrl,
|
||||
url: dto.coverUrl,
|
||||
},
|
||||
});
|
||||
await this.prisma.store.update({ where: { id: store.id }, data: { coverResourceId: cover.id } });
|
||||
}
|
||||
|
||||
const envUrls = (dto.envPhotoUrls ?? []).filter(Boolean);
|
||||
for (let i = 0; i < envUrls.length; i++) {
|
||||
await this.prisma.commonResource.create({
|
||||
data: {
|
||||
ownerType: 'STORE',
|
||||
ownerId: store.id,
|
||||
bizType: 'ENV',
|
||||
mediaType: 'IMAGE',
|
||||
ossBucket: 'legacy',
|
||||
ossKey: envUrls[i],
|
||||
url: envUrls[i],
|
||||
sortOrder: i,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (dto.contractUrl) {
|
||||
await this.prisma.commonResource.create({
|
||||
data: {
|
||||
ownerType: 'STORE',
|
||||
ownerId: store.id,
|
||||
bizType: 'CONTRACT',
|
||||
mediaType: 'FILE',
|
||||
ossBucket: 'legacy',
|
||||
ossKey: dto.contractUrl,
|
||||
url: dto.contractUrl,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
await this.prisma.commonEvent.create({
|
||||
data: {
|
||||
eventType: 'STORE_AUDIT',
|
||||
refType: 'STORE',
|
||||
refId: store.id,
|
||||
actorType: 'HQ',
|
||||
status: 'APPROVED',
|
||||
param1: 'NEW',
|
||||
param1Desc: 'audit_type',
|
||||
remark: 'HQ 后台新建',
|
||||
},
|
||||
});
|
||||
|
||||
await this.prisma.storeAccount.create({
|
||||
data: {
|
||||
storeId: store.id,
|
||||
@@ -161,7 +227,7 @@ export class AdminStoresService {
|
||||
},
|
||||
});
|
||||
|
||||
return serializeBigInt(store);
|
||||
return this.detailStore(store.id);
|
||||
}
|
||||
|
||||
async createStoreAccount(dto: CreateStoreAccountDto) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsIn, IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
import { IsArray, IsIn, IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class UpdateStoreStatusDto {
|
||||
@IsString()
|
||||
@@ -58,6 +58,27 @@ export class CreateStoreDto {
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
accountName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
bankAccountName?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
bankAccountNo?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
bankBranch?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
envPhotoUrls?: string[];
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
contractUrl?: string;
|
||||
}
|
||||
|
||||
export class UpdateStoreDto {
|
||||
|
||||
Reference in New Issue
Block a user