|
|
@@ -140,8 +140,14 @@ def DJANGO_WE_COMPONENT_CALLBACK_FUNC(request, appid, data, decrypted=None):
|
140
|
140
|
)
|
141
|
141
|
if event == 'subscribe' or event == 'unsubscribe':
|
142
|
142
|
# 获取用户信息
|
|
143
|
+ # https://blog.csdn.net/weixin_49220773/article/details/126103887
|
|
144
|
+ # 接口报错如下
|
|
145
|
+ # {u'errcode': 61016, u'errmsg': u'function category of API need be confirmed by component rid: 669f1e05-7c2d1d72-323b46c1'}
|
143
|
146
|
userinfo = get_user_info(openid, appid=appid, secret=None, token=token, storage=RedisStorage(r))
|
144
|
|
- subscribe, unionid, openid = userinfo.get('subscribe', ''), userinfo.get('unionid', ''), userinfo.get('openid', '')
|
|
147
|
+ if userinfo.get('errcode'):
|
|
148
|
+ subscribe = 1 if event == 'subscribe' else 0
|
|
149
|
+ else:
|
|
150
|
+ subscribe, unionid, openid = userinfo.get('subscribe', ''), userinfo.get('unionid', ''), userinfo.get('openid', '')
|
145
|
151
|
|
146
|
152
|
# 更新关注信息
|
147
|
153
|
if subscribe:
|