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

Feature/#2809 change create pay sign input param #2810

Conversation

JaneConan
Copy link
Contributor

@JaneConan JaneConan commented Apr 6, 2023

解决 #2809 问题

@JeffreySu
Copy link
Owner

JeffreySu commented Apr 7, 2023

@JaneConan 仔细看了一下,这种方式并不推荐,CreatePaySign 已经提供了一个默认为 null 的参数,至于当你不提供的时候才会从系统默认配置当中读取,你如果是多个账号,完全可以进行多个配置(放入 items 中),例如:

"SenparcWeixinSetting": {
    //公众号
    "WeixinAppId": "#{WeixinAppId}#",
    "WeixinAppSecret": "#{WeixinAppSecret}#",

    //小程序
    "WxOpenAppId": "#{WxOpenAppId}#",
    "WxOpenAppSecret": "#{WxOpenAppSecret}#",

    //微信支付V3(载入默认对象,可选)
    "TenPayV3_AppId": "#{TenPayV3_AppId}#",
    "TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#",

    "Items": {
      "公众号支付": {
        "TenPayV3_AppId": "#{TenPayV3_AppId}#",
        "TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#"

      },
      "小程序支付": {
        "TenPayV3_AppId": "#{TenPayV3_AppId}#",
        "TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#"
      }
    }

获取的时候只需要:

var tenpaySettingForMP = Senparc.Weixin.Config.SenparcWeixinSetting["公众号支付"];

var tenpaySettingForWxOpen = Senparc.Weixin.Config.SenparcWeixinSetting["小程序支付"];

@f0508crm
Copy link

f0508crm commented Apr 7, 2023

appId也是从配置文件里面读取的,那为什么还要用到TenPayV3_AppId,而且他们的值本身就必须一致

@f0508crm
Copy link

f0508crm commented Apr 7, 2023

`"Items": {
"公众号支付": {
"TenPayV3_AppId": "#{TenPayV3_AppId}#",
"TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#"

  },
  "小程序支付": {
    "TenPayV3_AppId": "#{TenPayV3_AppId}#",
    "TenPayV3_AppSecret": "#{TenPayV3_AppSecret}#"
  }
}`

这边的AppId和AppSecret 是不是就是公众号或小程序的值,为什么多此一举在这边又配置了一遍呢。
`//公众号
"WeixinAppId": "#{WeixinAppId}#",
"WeixinAppSecret": "#{WeixinAppSecret}#",

//小程序
"WxOpenAppId": "#{WxOpenAppId}#",
"WxOpenAppSecret": "#{WxOpenAppSecret}#",`

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

Successfully merging this pull request may close these issues.

None yet

3 participants