mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2025-12-14 15:32:51 +00:00
修复insertParam 当body为数组时导致的错误
This commit is contained in:
parent
50079fb816
commit
2afd61606b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.20",
|
"version": "7.1.21",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
@ -65,11 +65,25 @@ export abstract class BaseController {
|
|||||||
if (!curdOption?.insertParam) {
|
if (!curdOption?.insertParam) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.baseCtx.request.body = {
|
const body = this.baseCtx.request.body;
|
||||||
// @ts-ignore
|
if (body) {
|
||||||
...this.baseCtx.request.body,
|
// 判断body是否是数组
|
||||||
...(await curdOption.insertParam(this.baseCtx, this.baseApp)),
|
if (Array.isArray(body)) {
|
||||||
};
|
for (let i = 0; i < body.length; i++) {
|
||||||
|
body[i] = {
|
||||||
|
...body[i],
|
||||||
|
...(await curdOption.insertParam(this.baseCtx, this.baseApp)),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
this.baseCtx.request.body = body;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.baseCtx.request.body = {
|
||||||
|
// @ts-ignore
|
||||||
|
...this.baseCtx.request.body,
|
||||||
|
...(await curdOption.insertParam(this.baseCtx, this.baseApp)),
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-midway/core",
|
"name": "@cool-midway/core",
|
||||||
"version": "7.1.20",
|
"version": "7.1.21",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"typings": "index.d.ts",
|
"typings": "index.d.ts",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user