Silent 6 years ago
parent
commit
667409fe43
3 changed files with 5 additions and 4 deletions
  1. 2 2
      app/Http/Controllers/WeChat/LoginController.php
  2. 2 1
      wechat/app.js
  3. 1 1
      wechat/utils/api.js

+ 2 - 2
app/Http/Controllers/WeChat/LoginController.php

xqd
@@ -10,12 +10,12 @@ class LoginController extends Controller
 {
     public function login(Request $request)
     {
-        if(empty($request->input('code')) || empty($request->input('iv')) || empty($request->input('encryptData'))) {
+        if(empty($request->input('code')) || empty($request->input('iv')) || empty($request->input('encryptedData'))) {
             return response()->json(['status' => 'error', 'info' => '参数错误']);
         }
         $code = $request->input('code');
         $iv = $request->input('iv');
-        $encryptData = $request->input('encryptData');
+        $encryptedData = $request->input('encryptedData');
         $app = app('wechat.mini_program');
         $res = $app->auth->session($code);
         Log::info($res);

+ 2 - 1
wechat/app.js

xqd
@@ -40,9 +40,10 @@ App({
           data: {
             code: res.code,
             iv: info.iv,
-            encryptData: info.encryptData
+            encryptedData: info.encryptedData
           },
           success: info => {
+            console.log(info);
             if (info.data.status == 'success') {
               wx.setStorageSync('pt_student_id', info.data.id);
             }

+ 1 - 1
wechat/utils/api.js

xqd
@@ -1,4 +1,4 @@
-const headUrl = 'http://t20.9026.com/api/';
+const headUrl = 'http://t20.9026.com/wechat/';
 
 module.exports = {
   headUrl: headUrl,