Opt

Kimi.Huang 5 years ago
parent
commit
365f22847b
4 changed files with 8 additions and 8 deletions
  1. 2 2
      account/models.py
  2. 1 1
      api/hb_views.py
  3. 1 1
      commands/management/commands/membercard.py
  4. 4 4
      miniapp/redpack_views.py

+ 2 - 2
account/models.py

@@ -420,8 +420,8 @@ class UserInfo(BaseModelMixin, LensmanTypeBoolMixin):
420 420
     def cardata(self):
421 421
         return {
422 422
             'brand_id': self.brand_id,
423
-            'membercardid': self.membercardid,
424
-            'memberusercardcode': self.memberusercardcode,
423
+            'card_id': self.membercardid,
424
+            'code': self.memberusercardcode,
425 425
         }
426 426
 
427 427
 

+ 1 - 1
api/hb_views.py

@@ -7,7 +7,7 @@ from miniapp.redpack_views import send_jsapi_hb
7 7
 
8 8
 
9 9
 def exec_send_jsapi_hb(user, elog, amount):
10
-    send_jsapi_hb(user.openid, amount, transfer=False)
10
+    send_jsapi_hb(user.brand_id, user.openid, amount, transfer=False)
11 11
 
12 12
     elog.has_send_redpack = True
13 13
     elog.redpack_send_amount = amount

+ 1 - 1
commands/management/commands/membercard.py

@@ -30,7 +30,7 @@ def get_phone(fields):
30 30
 class Command(CompatibilityBaseCommand):
31 31
     def handle(self, *args, **options):
32 32
 
33
-        logger.info('Redpack is dealing')
33
+        logger.info('MemberCard userinfo is dealing')
34 34
 
35 35
         while True:
36 36
             # r.rpushjson('MEMBERCARD_USERINFO_LIST', {

+ 4 - 4
miniapp/redpack_views.py

@@ -10,10 +10,10 @@ from account.models import UserInfo
10 10
 WECHAT = settings.WECHAT
11 11
 
12 12
 
13
-def send_jsapi_hb(openid, amount, transfer=True):
13
+def send_jsapi_hb(brand_id, openid, amount, transfer=True):
14 14
     trade_type = 'JSAPI'
15 15
     # 根据 trade_type 获取 wechat 配置
16
-    wxcfg = WECHAT.get(trade_type, {})
16
+    wxcfg = WECHAT.get('{}:{}'.format(brand_id, trade_type), {})
17 17
     # WeChatPay 初始化
18 18
     wxpay = WeChatPay(wxcfg.get('appID'), wxcfg.get('apiKey'), wxcfg.get('mchID'), mch_cert=wxcfg.get('mch_cert'), mch_key=wxcfg.get('mch_key'))
19 19
 
@@ -46,7 +46,7 @@ def jsapi_hb_api(request):
46 46
     openid = user.openid
47 47
     amount = 100
48 48
 
49
-    ret_data = send_jsapi_hb(openid, amount, transfer=True)
49
+    ret_data = send_jsapi_hb(brand_id, openid, amount, transfer=True)
50 50
 
51 51
     return response(200, data=ret_data)
52 52
 
@@ -65,7 +65,7 @@ def mini_hb_api(request):
65 65
 
66 66
     trade_type = 'MINIAPP'
67 67
     # 根据 trade_type 获取 wechat 配置
68
-    wxcfg = WECHAT.get(trade_type, {})
68
+    wxcfg = WECHAT.get('{}:{}'.format(brand_id, trade_type), {})
69 69
     # WeChatPay 初始化
70 70
     wxpay = WeChatPay(wxcfg.get('appID'), wxcfg.get('apiKey'), wxcfg.get('mchID'), mch_cert=wxcfg.get('mch_cert'), mch_key=wxcfg.get('mch_key'))
71 71