Commit 511ea731 by wkliang

fix

parent dcbf3c3e
......@@ -54,7 +54,8 @@ module.exports = function (app) {
let keys = Object.keys(params[2].action_body)
for (let i of keys) {
// 小数处理
let regdig = /^[0-9]\d*\.[1-9]\d*|^-[0-9]\d*\.[1-9]\d*$/
let regdigu = /^[1-9]\d*\.\d*|0\.\d*[1-9]\d*$/
let regdig = /^-[1-9]\d*\.\d*|-0\.\d*[1-9]\d*$/
// 整数处理
let regint = /^-?[0-9]\d*$/
// 空key处理
......@@ -63,13 +64,13 @@ module.exports = function (app) {
} else if (Array.isArray(params[2].action_body[i])) {
// list
for (let j = 0; j < params[2].action_body[i]; ++j) {
if (regdig.test(`${params[2].action_body[i][j]}`)) {
if (regdig.test(`${params[2].action_body[i][j]}`) || regdigu.test(`${params[2].action_body[i][j]}`)) {
params[2].action_body[i][j] = Number(params[2].action_body[i][j])
} else if (regint.test(`${params[2].action_body[i][j]}`)) {
params[2].action_body[i][j] = Number(params[2].action_body[i][j])
}
}
} else if (regdig.test(`${params[2].action_body[i]}`)) {
} else if (regdig.test(`${params[2].action_body[i]}`) || regdigu.test(`${params[2].action_body[i]}`)) {
// 小数
params[2].action_body[i] = Number(params[2].action_body[i])
} else if (regint.test(`${params[2].action_body[i]}`)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment