feat: 模型数据导入

This commit is contained in:
archer
2023-03-30 01:04:52 +08:00
parent f32c557bdd
commit 2b2c70e53d
16 changed files with 415 additions and 76 deletions

View File

@@ -5,9 +5,9 @@ import { authToken } from '@/service/utils/tools';
export default async function handler(req: NextApiRequest, res: NextApiResponse<any>) {
try {
let { modelId, answer } = req.body as {
modelId: string;
answer: string;
let { dataId, text } = req.body as {
dataId: string;
text: string;
};
const { authorization } = req.headers;
@@ -15,7 +15,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
throw new Error('无权操作');
}
if (!modelId) {
if (!dataId) {
throw new Error('缺少参数');
}
@@ -26,11 +26,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
await ModelData.updateOne(
{
modelId,
_id: dataId,
userId
},
{
a: answer
text
}
);