feat: chat integration, tenant admin spec, backend chat service, miniprogram updates, DEMO moved to tmp, XCX-TEST removed, migrations & docs

This commit is contained in:
Neo
2026-03-20 09:02:10 +08:00
parent 3d2e5f8165
commit beb88d5bea
388 changed files with 6436 additions and 25458 deletions

View File

@@ -0,0 +1,43 @@
/**
* 星级评分转换工具函数
* 纯函数,无 wx.* 依赖
*
* API 使用 0-10 分制UI 使用 0-5 星制(支持半星)
*/
/**
* 将 0-10 分数转换为 0-5 星级
* @param score 0-10 分数
* @returns 0-5 星级值
*/
export function scoreToStar(score: number): number {
return score / 2
}
/**
* 将 0-5 星级转换为 0-10 分数
* @param star 0-5 星级值
* @returns 0-10 分数
*/
export function starToScore(star: number): number {
return star * 2
}
/**
* 将 0-10 分数四舍五入到最近 0.5 星
* 用于后端评分 → 半星展示
* @param score 0-10 分数
* @returns 0-5 星(步长 0.5
*/
export function scoreToHalfStar(score: number): number {
return Math.round((score / 2) * 2) / 2
}
/**
* 判断是否为未评分状态
* score 为 null / undefined / 0 时视为未评分
* @returns true 时展示 '--' 替代星星
*/
export function isUnrated(score: number | null | undefined): boolean {
return score === null || score === undefined || score === 0
}