v4.0.17 小程序版本优化
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-09-03 23:28:37 +08:00
parent 8a196c377e
commit 0e711be6c6
18 changed files with 254 additions and 84 deletions
@@ -1668,4 +1668,19 @@ export class StoreService {
await this.partnerGetStore(partnerAccountId, storeId);
return this.replaceStoreCategories(storeId, categoryIds, priorities);
}
/** 评价提交后回写门店综合评分(服务+环境均值) */
async refreshStoreRatingFromReviews(storeId: bigint) {
const agg = await this.prisma.storeRating.aggregate({
where: { storeId },
_avg: { serviceScore: true, envScore: true },
});
const avgService = Number(agg._avg.serviceScore ?? 0);
const avgEnv = Number(agg._avg.envScore ?? 0);
const rating = Math.round(((avgService + avgEnv) / 2) * 100) / 100;
await this.prisma.store.update({
where: { id: storeId },
data: { rating },
});
}
}