@@ -2,14 +2,19 @@ |
||
| 2 | 2 |
|
| 3 | 3 |
from __future__ import division |
| 4 | 4 |
|
| 5 |
-from django.contrib.auth.hashers import check_password, make_password |
|
| 5 |
+from django.conf import settings |
|
| 6 |
+from django.contrib.auth.hashers import check_password |
|
| 6 | 7 |
from django_response import response |
| 7 | 8 |
from logit import logit |
| 9 |
+from pywe_miniapp import get_phone_number |
|
| 8 | 10 |
|
| 9 | 11 |
from mch.models import BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, LatestAppInfo, ModelInfo, OperatorInfo |
| 10 | 12 |
from utils.error.errno_utils import OperatorStatusCode |
| 11 | 13 |
|
| 12 | 14 |
|
| 15 |
+WECHAT = settings.WECHAT |
|
| 16 |
+ |
|
| 17 |
+ |
|
| 13 | 18 |
@logit |
| 14 | 19 |
def login_api(request): |
| 15 | 20 |
phone = request.POST.get('phone', '')
|
@@ -109,6 +114,11 @@ def upgrade_api(request): |
||
| 109 | 114 |
|
| 110 | 115 |
@logit |
| 111 | 116 |
def consumer_info_api(request): |
| 117 |
+ wxcfg = WECHAT.get('MINIAPP', {})
|
|
| 118 |
+ |
|
| 119 |
+ appid = wxcfg.get('appID')
|
|
| 120 |
+ secret = wxcfg.get('appsecret')
|
|
| 121 |
+ |
|
| 112 | 122 |
user_id = request.POST.get('user_id', '')
|
| 113 | 123 |
iv = request.POST.get('iv', '')
|
| 114 | 124 |
encryptedData = request.POST.get('encryptedData', '')
|
@@ -117,11 +127,23 @@ def consumer_info_api(request): |
||
| 117 | 127 |
serialNo = request.POST.get('SerialNo', '')
|
| 118 | 128 |
verifyResult = request.POST.get('verifyResult', '')
|
| 119 | 129 |
|
| 120 |
- # To Get Phone |
|
| 130 |
+ # {
|
|
| 131 |
+ # "phoneNumber": "13580006666", |
|
| 132 |
+ # "purePhoneNumber": "13580006666", |
|
| 133 |
+ # "countryCode": "86", |
|
| 134 |
+ # "watermark": |
|
| 135 |
+ # {
|
|
| 136 |
+ # "appid": "APPID", |
|
| 137 |
+ # "timestamp": TIMESTAMP |
|
| 138 |
+ # } |
|
| 139 |
+ # } |
|
| 140 |
+ phone_number = get_phone_number(appid=appid, secret=secret, encryptedData=encryptedData, iv=iv) |
|
| 141 |
+ |
|
| 142 |
+ purePhoneNumber = phone_number.get('purePhoneNumber', '')
|
|
| 121 | 143 |
|
| 122 | 144 |
ConsumeInfoSubmitLogInfo.objects.create( |
| 123 | 145 |
user_id=user_id, |
| 124 |
- phone='', |
|
| 146 |
+ phone=purePhoneNumber, |
|
| 125 | 147 |
iv=iv, |
| 126 | 148 |
encryptedData=encryptedData, |
| 127 | 149 |
lat=lat, |
@@ -130,4 +152,6 @@ def consumer_info_api(request): |
||
| 130 | 152 |
verifyResult=verifyResult, |
| 131 | 153 |
) |
| 132 | 154 |
|
| 133 |
- return response() |
|
| 155 |
+ return response(200, data={
|
|
| 156 |
+ 'purePhoneNumber': purePhoneNumber, |
|
| 157 |
+ }) |
@@ -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.0 |
|
| 36 |
+pywe-miniapp==1.0.1 |
|
| 37 | 37 |
pywe-oauth==1.0.6 |
| 38 | 38 |
pywe-pay==1.0.11 |
| 39 | 39 |
pywe-pay-notify==1.0.1 |