@@ -112,20 +112,14 @@ def upgrade_api(request): |
||
| 112 | 112 |
}) |
| 113 | 113 |
|
| 114 | 114 |
|
| 115 |
-@logit |
|
| 116 |
-def consumer_info_api(request): |
|
| 115 |
+def getPhoneNumber(request): |
|
| 117 | 116 |
wxcfg = WECHAT.get('MINIAPP', {})
|
| 118 | 117 |
|
| 119 | 118 |
appid = wxcfg.get('appID')
|
| 120 | 119 |
secret = wxcfg.get('appsecret')
|
| 121 | 120 |
|
| 122 |
- user_id = request.POST.get('user_id', '')
|
|
| 123 | 121 |
iv = request.POST.get('iv', '')
|
| 124 | 122 |
encryptedData = request.POST.get('encryptedData', '')
|
| 125 |
- lat = request.POST.get('lat', '')
|
|
| 126 |
- lon = request.POST.get('lon', '')
|
|
| 127 |
- serialNo = request.POST.get('SerialNo', '')
|
|
| 128 |
- verifyResult = request.POST.get('verifyResult', '')
|
|
| 129 | 123 |
|
| 130 | 124 |
# {
|
| 131 | 125 |
# "phoneNumber": "13580006666", |
@@ -139,7 +133,27 @@ def consumer_info_api(request): |
||
| 139 | 133 |
# } |
| 140 | 134 |
phone_number = get_phone_number(appid=appid, secret=secret, encryptedData=encryptedData, iv=iv) |
| 141 | 135 |
|
| 142 |
- purePhoneNumber = phone_number.get('purePhoneNumber', '')
|
|
| 136 |
+ return phone_number.get('purePhoneNumber', '')
|
|
| 137 |
+ |
|
| 138 |
+ |
|
| 139 |
+@logit |
|
| 140 |
+def consumer_info_api(request): |
|
| 141 |
+ return response(200, 'Get Consumer Phone Success', u'获取消费者手机号成功', {
|
|
| 142 |
+ 'purePhoneNumber': getPhoneNumber(request), |
|
| 143 |
+ }) |
|
| 144 |
+ |
|
| 145 |
+ |
|
| 146 |
+@logit |
|
| 147 |
+def consumer_info_api(request): |
|
| 148 |
+ user_id = request.POST.get('user_id', '')
|
|
| 149 |
+ iv = request.POST.get('iv', '')
|
|
| 150 |
+ encryptedData = request.POST.get('encryptedData', '')
|
|
| 151 |
+ lat = request.POST.get('lat', '')
|
|
| 152 |
+ lon = request.POST.get('lon', '')
|
|
| 153 |
+ serialNo = request.POST.get('SerialNo', '')
|
|
| 154 |
+ verifyResult = request.POST.get('verifyResult', '')
|
|
| 155 |
+ |
|
| 156 |
+ purePhoneNumber = getPhoneNumber(request) |
|
| 143 | 157 |
|
| 144 | 158 |
ConsumeInfoSubmitLogInfo.objects.create( |
| 145 | 159 |
user_id=user_id, |
@@ -207,6 +207,7 @@ urlpatterns += [ |
||
| 207 | 207 |
] |
| 208 | 208 |
|
| 209 | 209 |
urlpatterns += [ |
| 210 |
+ url(r'^consumer_phone$', mch_views.consumer_phone_api, name='consumer_phone_api'), |
|
| 210 | 211 |
url(r'^consumer_info$', mch_views.consumer_info_api, name='consumer_info_api'), |
| 211 | 212 |
] |
| 212 | 213 |
|
@@ -33,7 +33,7 @@ jsonfield==2.0.2 |
||
| 33 | 33 |
mock==2.0.0 |
| 34 | 34 |
pysnippets==1.0.4 |
| 35 | 35 |
pywe-jssdk==1.0.2 |
| 36 |
-pywe-miniapp==1.0.1 |
|
| 36 |
+pywe-miniapp==1.0.2 |
|
| 37 | 37 |
pywe-oauth==1.0.6 |
| 38 | 38 |
pywe-pay==1.0.11 |
| 39 | 39 |
pywe-pay-notify==1.0.1 |