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