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

chain 方法实现有误 #77

Closed
Tai7sy opened this issue Dec 27, 2021 · 2 comments
Closed

chain 方法实现有误 #77

Tai7sy opened this issue Dec 27, 2021 · 2 comments
Labels
question Further information is requested

Comments

@Tai7sy
Copy link

Tai7sy commented Dec 27, 2021

方法内将URL进行了normalize

$indices[] = $this->normalize($key);

会导致一些API失效, 如 查询订单
https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_4_2.shtml#menu2

参数 out_trade_no 需要从path传入, 本身out_trade_no支持数字大小写和部分特殊字符
normalize之后会将参数修改导致API返回订单未找到

@TheNorthMemory
Copy link
Collaborator

本 SDK 把 URL 中的大写视为包含连字号的 segment。请求时, camelCase 会替换为 camel-case。相关 issue 可参考 #56#69

为了避免大小写错乱,URL 中存在变量时的正确做法是:使用 链式 URI Template 的 Path 变量。比如:

  • 推荐写法 ->v3->marketing->favor->users->_openid_->coupons->post(['openid' => 'AbcdEF12345'])
  • ->v3->marketing->favor->users->{'{openid}'}->coupons->post(['openid' => 'AbcdEF12345'])
  • ->chain('{+myurl}'->post(['myurl' => 'v3/marketing/favor/users/AbcdEF12345/coupons'])
  • ->{'{+myurl}'}->post(['myurl' => 'v3/marketing/favor/users/AbcdEF12345/coupons'])

@TheNorthMemory TheNorthMemory added the question Further information is requested label Dec 28, 2021
@Tai7sy
Copy link
Author

Tai7sy commented Dec 28, 2021

thanks

@Tai7sy Tai7sy closed this as completed Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants