o = get_userinfo(card_id, code, appid=appid, secret=secret, storage=RedisStorage(r))
common_field_list = userinfo.get('common_field_list', [])
@@ -26,7 +26,7 @@ WECHAT = settings.WECHAT |
||
| 26 | 26 |
def get_userinfo_api(request): |
| 27 | 27 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 28 | 28 |
|
| 29 |
- wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 29 |
+ wxcfg = WECHAT.get('{}:MINIAPP'.format(brand_id), {})
|
|
| 30 | 30 |
|
| 31 | 31 |
appid = wxcfg.get('appID')
|
| 32 | 32 |
secret = wxcfg.get('appsecret')
|
@@ -94,7 +94,7 @@ def get_userinfo_api(request): |
||
| 94 | 94 |
def mini_login_api(request): |
| 95 | 95 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 96 | 96 |
|
| 97 |
- wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 97 |
+ wxcfg = WECHAT.get('{}:MINIAPP'.format(brand_id), {})
|
|
| 98 | 98 |
|
| 99 | 99 |
appid = wxcfg.get('appID')
|
| 100 | 100 |
secret = wxcfg.get('appsecret')
|
@@ -163,7 +163,7 @@ def get_userinfo_api2(request): |
||
| 163 | 163 |
brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
| 164 | 164 |
user_id = request.POST.get('user_id', '')
|
| 165 | 165 |
|
| 166 |
- wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 166 |
+ wxcfg = WECHAT.get('{}:MINIAPP'.format(brand_id), {})
|
|
| 167 | 167 |
|
| 168 | 168 |
appid = wxcfg.get('appID')
|
| 169 | 169 |
secret = wxcfg.get('appsecret')
|
@@ -210,7 +210,9 @@ def get_userinfo_api2(request): |
||
| 210 | 210 |
@logit(res=True) |
| 211 | 211 |
@transaction.atomic |
| 212 | 212 |
def membercard_extradata(request): |
| 213 |
- wxcfg = WECHAT.get('JSAPI', {})
|
|
| 213 |
+ brand_id = request.POST.get('brand_id', settings.KODO_DEFAULT_BRAND_ID)
|
|
| 214 |
+ |
|
| 215 |
+ wxcfg = WECHAT.get('{}:JSAPI'.format(brand_id), {})
|
|
| 214 | 216 |
|
| 215 | 217 |
appid = wxcfg.get('appID')
|
| 216 | 218 |
secret = wxcfg.get('appsecret')
|
@@ -2,7 +2,7 @@ pywe-card==1.0.0 |
||
| 2 | 2 |
pywe-component==1.0.1 |
| 3 | 3 |
pywe-component-preauthcode==1.0.3 |
| 4 | 4 |
pywe-jssdk==1.1.0 |
| 5 |
-pywe-membercard==1.0.2 |
|
| 5 |
+pywe-membercard==1.0.3 |
|
| 6 | 6 |
pywe-miniapp==1.1.5 |
| 7 | 7 |
pywe-oauth==1.0.7 |
| 8 | 8 |
pywe-pay==1.0.13 |
@@ -7,9 +7,9 @@ from pywe_pay import WeChatPay |
||
| 7 | 7 |
WECHAT = settings.WECHAT |
| 8 | 8 |
|
| 9 | 9 |
|
| 10 |
-def test_pay(openid, amount=100, trade_type='JSAPI', pay_type='PACKET'): |
|
| 10 |
+def test_pay(brand_id, openid, amount=100, trade_type='JSAPI', pay_type='PACKET'): |
|
| 11 | 11 |
# 根据 trade_type 获取 wechat 配置 |
| 12 |
- wxcfg = WECHAT.get(trade_type, {})
|
|
| 12 |
+ wxcfg = WECHAT.get('{}:{}'.format(brand_id, trade_type), {})
|
|
| 13 | 13 |
# WeChatPay 初始化 |
| 14 | 14 |
wxpay = WeChatPay(wxcfg.get('appID'), wxcfg.get('apiKey'), wxcfg.get('mchID'), mch_cert=wxcfg.get('mch_cert'), mch_key=wxcfg.get('mch_key'))
|
| 15 | 15 |
|