Try sendcustomwxamessage

huangqimin 5 gadi atpakaļ
vecāks
revīzija
f4ded5ca43
2 mainītis faili ar 34 papildinājumiem un 0 dzēšanām
  1. 33 0
      pre/custom_message.py
  2. 1 0
      requirements_pywe.txt

+ 33 - 0
pre/custom_message.py

@@ -0,0 +1,33 @@
1
+# -*- coding: utf-8 -*-
2
+
3
+from django.conf import settings
4
+from pywe_custom_message import send_custom_wxa_message
5
+from pywe_media import media_upload
6
+from pywe_storage import RedisStorage
7
+
8
+from utils.redis.connect import r
9
+
10
+
11
+WECHAT = settings.WECHAT
12
+
13
+
14
+def mediaupload(media_file=None, media_file_path=None):
15
+    wxcfg = WECHAT.get('JSAPI', {})
16
+
17
+    appid = wxcfg.get('appID')
18
+    secret = wxcfg.get('appsecret')
19
+
20
+    res = media_upload(media_file=media_file, media_file_path=media_file_path, appid=appid, secret=secret, token=None, storage=RedisStorage(r))
21
+
22
+    print(res)
23
+
24
+
25
+def sendcustomwxamessage(openid=None, miniappid=None, pagepath=None, thumb_media_id=None, title=None):
26
+    wxcfg = WECHAT.get('JSAPI', {})
27
+
28
+    appid = wxcfg.get('appID')
29
+    secret = wxcfg.get('appsecret')
30
+
31
+    res = send_custom_wxa_message(openid=openid, miniappid=miniappid, pagepath=pagepath, thumb_media_id=thumb_media_id, title=title, appid=appid, secret=secret, token=None, storage=RedisStorage(r))
32
+
33
+    print(res)

+ 1 - 0
requirements_pywe.txt

@@ -3,6 +3,7 @@ pywe-component-preauthcode==1.0.3
3 3
 pywe-jssdk==1.1.0
4 4
 pywe-marketcode==1.0.2
5 5
 pywe-membercard==1.0.1
6
+pywe-custom-message==1.0.1
6 7
 pywe-miniapp==1.1.5
7 8
 pywe-oauth==1.1.1
8 9
 pywe-pay==1.0.13