适配最新的食谱

This commit is contained in:
2026-05-10 20:25:48 +08:00
parent 59b3117eb9
commit 4459e5acf3
8 changed files with 6 additions and 15 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import { NextRequest, NextResponse } from "next/server";
import {NextRequest, NextResponse} from "next/server";
import mammoth from "mammoth";
import * as cheerio from "cheerio";
@@ -128,8 +128,8 @@ function splitCellContent(content: string): string[] {
* 确定餐食类型
*/
function getMealType(mealName: string): MealTypeCode | null {
if (mealName.includes("早")) return MealTypeCode.BREAKFAST;
if (mealName.includes("水果")) return MealTypeCode.FRUIT;
if (mealName.includes("早") && !mealName.includes("早点")) return MealTypeCode.BREAKFAST;
if (mealName.includes("水果") || mealName.includes("早点")) return MealTypeCode.FRUIT;
if (mealName.includes("中") || mealName.includes("午餐")) return MealTypeCode.LUNCH;
if (mealName.includes("午点") || mealName.includes("点心")) return MealTypeCode.SNACK;
if (mealName.includes("体弱") || mealName.includes("晚")) return MealTypeCode.SPECIAL;
+2 -2
View File
@@ -71,13 +71,13 @@ interface WeeklyMenu {
meals: DailyMeal[];
}
// 餐食类型配置 (体弱儿在第四位)
// 餐食类型配置
const MEAL_TYPES = [
{code: MealTypeCode.BREAKFAST, label: "早餐", icon: Sun},
{code: MealTypeCode.FRUIT, label: "水果餐", icon: Apple},
{code: MealTypeCode.LUNCH, label: "中餐", icon: UtensilsCrossed},
{code: MealTypeCode.SPECIAL, label: "体弱儿餐", icon: Heart},
{code: MealTypeCode.SNACK, label: "午点", icon: Cookie},
{code: MealTypeCode.SPECIAL, label: "体弱儿餐", icon: Heart},
];
type UploadState = "idle" | "uploading" | "parsing" | "done" | "error";