feat: T10 回归测试 Bug 修复与功能完善

修复 BUG-001 至 BUG-009 及 T10-1 至 T10-6 相关问题:
- 打卡积分显示与累加逻辑优化
- 食谱计算器 Tab 选中样式修复
- 食物百科列表图片与简介展示修复
- 食物详情页数据加载修复
- AI营养师差异化回复优化
- 健康知识/营养知识名称统一
- 饮食指南/科普文章详情页内容展示修复
- 帖子营养统计数据展示修复
- 社区帖子类型中文命名统一
- 帖子详情标签中文显示修复
- 食谱营养AI填充功能完善
- 食谱收藏/点赞功能修复

新增:
- ToolNutritionFillService 营养填充服务
- T10 回归测试用例 (Playwright)
- 知识文章数据 SQL 脚本

涉及模块:
- crmeb-common: VO/Request/Response 优化
- crmeb-service: 业务逻辑完善
- crmeb-front: API 接口扩展
- msh_single_uniapp: 前端页面修复
- tests/e2e: 回归测试用例
This commit is contained in:
2026-03-05 09:35:00 +08:00
parent 6f2dc27fbc
commit d8d2025543
44 changed files with 1536 additions and 165 deletions

View File

@@ -208,6 +208,8 @@ export function getFoodList(data) {
*/
export function getFoodDetail(id) {
const numId = typeof id === 'number' && !isNaN(id) ? id : parseInt(String(id), 10);
// 打印请求参数便于确认(后端仅接受 Long 类型 id传 name 会 400
console.log('[api/tool] getFoodDetail 请求参数:', { id, numId, type: typeof id });
if (isNaN(numId)) {
return Promise.reject(new Error('食物详情接口需要数字ID当前传入: ' + id));
}
@@ -252,6 +254,15 @@ export function getNutrientDetail(name) {
return request.get('tool/knowledge/nutrient/' + name);
}
/**
* AI 营养估算根据饮食描述文本返回估算的热量、蛋白质、钾、磷T06-T09
* @param {String} text - 饮食描述
* @returns {Promise<{data: {energyKcal?, proteinG?, potassiumMg?, phosphorusMg?}}>}
*/
export function getAiNutritionFill(text) {
return request.post('tool/nutrition/fill-ai', { text: text || '' });
}
// ==================== 打卡社区相关 ====================
/**
@@ -346,6 +357,16 @@ export function sharePost(postId) {
return request.post('tool/community/share', { postId });
}
/**
* 填充帖子营养数据(服务端根据帖子内容/打卡补充营养并回写)
* @param {Number|String} postId - 帖子ID
* @returns {Promise<{data?: object}>} 返回更新后的帖子或营养数据
*/
export function fillPostNutrition(postId) {
const id = typeof postId === 'number' && !isNaN(postId) ? postId : parseInt(postId, 10);
return request.post('tool/community/post/' + id + '/fill-nutrition');
}
// ==================== 积分系统相关 ====================
/**
@@ -458,6 +479,10 @@ export function getRecipeDetail(id) {
export function toggleRecipeFavorite(recipeId, isFavorite) {
return request.post('tool/recipe/favorite', { recipeId, isFavorite });
}
// T09: 食谱营养 AI 回填
export function fillRecipeNutrition(recipeId) {
return request.post("tool/recipe/" + recipeId + "/fill-nutrition")
}
// ==================== 文件上传相关 ====================