Browse Source

添加分类

chenxiqiang 6 years ago
parent
commit
91709be042
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      manage-server/app/Http/Controllers/CommonController.php

+ 3
- 2
manage-server/app/Http/Controllers/CommonController.php View File

@@ -26,18 +26,19 @@ class CommonController extends Controller
26 26
         $miniProgram = app("wechat.mini_program");
27 27
 
28 28
         $auth = $miniProgram->auth->session($code);
29
-        if(isset($auth->openid)) {
29
+        if(array_key_exists("openid", $auth)) {
30 30
             return response()->json([
31 31
                 "status" => 0,
32 32
                 "data" => [
33 33
                     "token" => sha1($auth->openid . $auth->access_token)
34 34
                 ]]);
35
-        } else if(isset($auth->errcode)){
35
+        } else if(array_key_exists("errcode", $auth)){
36 36
             return response()->json([
37 37
                 "status" => $auth->errcode,
38 38
                 "message" => $auth->errmsg]);
39 39
         } else {
40 40
             return response()->json([
41
+                "status" => -1, 
41 42
                 "data" => $auth
42 43
             ]);
43 44
         }

Loading…
Cancel
Save