已完成用户APP首期功能开发

交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
This commit is contained in:
czl231
2026-09-13 00:57:32 +08:00
parent a0a4bb1218
commit 3ef33b531d
793 changed files with 40959 additions and 1204 deletions

View File

@@ -315,6 +315,13 @@ func ValidateResourceValues(model any, values map[string]any, creating bool) err
if !positive("amount") || !nonEmpty("channel") {
return errors.New("invalid payment")
}
case *models.DevUsageStat:
source, sourceExists := values["source"].(string)
allowedSource := source == "meter" || source == "device" || source == "manual"
if !nonNegative("usage_kg") || !nonNegative("breakfast_kg") || !nonNegative("lunch_kg") || !nonNegative("dinner_kg") ||
!nonEmpty("stat_date") || !nonEmpty("calc_version") || !nonEmpty("calculated_at") || (sourceExists && !allowedSource) || (creating && !sourceExists) {
return errors.New("invalid usage statistic")
}
}
return nil
}