Просмотр исходного кода

修复小程序获取手机号存在问题

locky 7 месяцев назад
Родитель
Сommit
43244d1328
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      Controller/WeChatMiniProgram/UserController.py

+ 3 - 3
Controller/WeChatMiniProgram/UserController.py

@@ -123,13 +123,13 @@ class UserView(View):
             data = {
                 'code': code
             }
-            r = requests.post(url=url, data=data, timeout=5)
+            r = requests.post(url=url, json=data, timeout=5)
             result = eval(r.content)
             errcode = result.get('errcode')
             assert errcode == 0
-            pure_phone_number = result['phone_info']['purePhoneNumber']
+            phone_number = result['phone_info']['purePhoneNumber']
             res = {
-                'pure_phone_number': pure_phone_number
+                'phone_number': phone_number
             }
             return response.json(0, res)
         except Exception as e: