Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Lin-validator-v2.js校验body参数的一个问题? #140

Open
GitHub-AngusLi opened this issue Aug 16, 2022 · 0 comments
Open

关于Lin-validator-v2.js校验body参数的一个问题? #140

GitHub-AngusLi opened this issue Aug 16, 2022 · 0 comments

Comments

@GitHub-AngusLi
Copy link

这几天在数据表设计一个sex性别字段,定的tinyint类型,字段类型是0,1,2三个,然后用lin-validator-v2.js时候进行sex字段的校验时候,因为传参前端是打算要求传的int类型,不传字符串string类型的值,所以在传0时候,发现如果不是字符串类型的话,会被lin-validator-v2.js给阻止掉,看了下里面源码,发现在_findParam函数里面会被if判断阻止掉提示不通过参数校验。但其实数据表字段设计就是要求可以传整型的0。目前我想着在body的if判断里面写个或条件,把这种情况判断给通过。不知道这块代码设计是否存在不合理的一个缺漏还是我的做法存在问题。

位置:在lin-validator-v2.js的第144行,_findParam里面关于body体的参数判断。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant