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

第一个接口:创建迭代 #4

Open
sinkcup opened this issue Oct 23, 2021 · 1 comment
Open

第一个接口:创建迭代 #4

sinkcup opened this issue Oct 23, 2021 · 1 comment
Assignees

Comments

@sinkcup
Copy link
Member

sinkcup commented Oct 23, 2021

https://help.coding.net/openapi#aecade80c431254ede1ecec5b66615d2

@sinkcup sinkcup self-assigned this Oct 23, 2021
sinkcup added a commit that referenced this issue Oct 23, 2021
@sinkcup
Copy link
Member Author

sinkcup commented Oct 23, 2021

只是调用接口的话,这个 sdk 也太简陋了,所以打算加入参数验证。

Laravel validation 挺好用的,尝试直接安装 composer 使用,报错:

A facade root has not been set.

搜索发现:这个 Laravel 组建不能直接在 php 中使用,需要这些步骤:

https://stackoverflow.com/questions/28573889/illuminate-validator-in-stand-alone-non-laravel-application

https://learnku.com/articles/54597

按照这些步骤配好,可以跑了,想用 ValidationException,但 message 不正常,永远是:

The given data was invalid.

if ($validator->fails()) {
    error_log(var_export($validator->errors()->all(), true));
    throw new ValidationException($validator);
}

如果用 withMessages ,也报错:

A facade root has not been set.

throw ValidationException::withMessages($validator->errors()->all());

所以先换个方式实现,标 TODO,待研究

sinkcup added a commit that referenced this issue Oct 23, 2021
sinkcup added a commit that referenced this issue Oct 23, 2021
sinkcup added a commit that referenced this issue Oct 23, 2021
sinkcup added a commit that referenced this issue Oct 23, 2021
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