fetch_all_users

Kimi.Huang 5 anos atrás
pai
commit
a66eef3e28
9 arquivos alterados com 51 adições e 0 exclusões
  1. 1 0
      kodo/settings.py
  2. 1 0
      requirements_pywe.txt
  3. 0 0
      shells/__init__.py
  4. 6 0
      shells/admin.py
  5. 8 0
      shells/apps.py
  6. 0 0
      shells/migrations/__init__.py
  7. 6 0
      shells/models.py
  8. 6 0
      shells/tests.py
  9. 23 0
      shells/views.py

+ 1 - 0
kodo/settings.py

@@ -66,6 +66,7 @@ INSTALLED_APPS = (
66 66
     'photo',
67 67
     'pre',
68 68
     'server',
69
+    'shells',
69 70
     'statistic',
70 71
     'website',
71 72
 )

+ 1 - 0
requirements_pywe.txt

@@ -9,4 +9,5 @@ pywe-pay==1.0.13
9 9
 pywe-pay-notify==1.0.4
10 10
 pywe-response==1.0.1
11 11
 pywe-sign==1.0.8
12
+pywe-user==1.0.2
12 13
 pywe-xml==1.0.6

+ 0 - 0
shells/__init__.py


+ 6 - 0
shells/admin.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.contrib import admin
5
+
6
+# Register your models here.

+ 8 - 0
shells/apps.py

@@ -0,0 +1,8 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.apps import AppConfig
5
+
6
+
7
+class ShellsConfig(AppConfig):
8
+    name = 'shells'

+ 0 - 0
shells/migrations/__init__.py


+ 6 - 0
shells/models.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models
5
+
6
+# Create your models here.

+ 6 - 0
shells/tests.py

@@ -0,0 +1,6 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.test import TestCase
5
+
6
+# Create your tests here.

+ 23 - 0
shells/views.py

@@ -0,0 +1,23 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.conf import settings
4
+from pywe_storage import RedisStorage
5
+from pywe_user import get_all_users
6
+
7
+from utils.redis.connect import r
8
+
9
+
10
+WECHAT = settings.WECHAT
11
+
12
+
13
+def fetch_users_func(authorizer_appid, get_user_infos):
14
+    print authorizer_appid, get_user_infos
15
+
16
+
17
+def fetch_all_users(brand_id, ):
18
+    wxcfg = WECHAT.get('{}:JSAPI'.format(brand_id), {})
19
+
20
+    appid = wxcfg.get('appID')
21
+    secret = wxcfg.get('appsecret')
22
+
23
+    get_all_users(appid=appid, secret=secret, storage=RedisStorage(r), users_func=fetch_users_func)