index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const WxAccount = require('./weixin/account/index')
  2. const QQAccount = require('./qq/account/index')
  3. const AliAccount = require('./alipay/account/index')
  4. const AppleAccount = require('./apple/account/index')
  5. const createApi = require('./share/create-api')
  6. module.exports = {
  7. initWeixin: function () {
  8. const oauthConfig = this.configUtils.getOauthConfig({ provider: 'weixin' })
  9. return createApi(WxAccount, {
  10. appId: oauthConfig.appid,
  11. secret: oauthConfig.appsecret
  12. })
  13. },
  14. initQQ: function () {
  15. const oauthConfig = this.configUtils.getOauthConfig({ provider: 'qq' })
  16. return createApi(QQAccount, {
  17. appId: oauthConfig.appid,
  18. secret: oauthConfig.appsecret
  19. })
  20. },
  21. initAlipay: function () {
  22. const oauthConfig = this.configUtils.getOauthConfig({ provider: 'alipay' })
  23. return createApi(AliAccount, {
  24. appId: oauthConfig.appid,
  25. privateKey: oauthConfig.privateKey
  26. })
  27. },
  28. initApple: function () {
  29. const oauthConfig = this.configUtils.getOauthConfig({ provider: 'apple' })
  30. return createApi(AppleAccount, {
  31. bundleId: oauthConfig.bundleId
  32. })
  33. }
  34. }