Mike 7 years ago
parent
commit
fb039413dc
1 changed files with 4 additions and 4 deletions
  1. 4 4
      server/app/Http/Controllers/Api/V1/AuthController.php

+ 4 - 4
server/app/Http/Controllers/Api/V1/AuthController.php

xqd xqd
@@ -89,11 +89,11 @@ class AuthController extends Controller
         $phone = $request->phone;
         $wechat = $request->wechat;
 
-        $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxd2334195ddfc7d93&secret=c349515d0079ccbc71f4a4f191c1621e&code=".$wechat."&grant_type=authorization_code";
+        $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxc5181c0d406023e6&secret=c349515d0079ccbc71f4a4f191c1621e&code=".$wechat."&grant_type=authorization_code";
         $res = file_get_contents($url);     //file_get_contents获取指定路由返回的数据
         \Log::info($res);
         $arr = json_decode($res, true);
-        $openid = $arr['openid'];
+        if(!$arr['errcode'])$openid = $arr['openid'];
         \Log::info('openid: ' . $openid);
 
         $jpush = $request->jpush;
@@ -180,11 +180,11 @@ class AuthController extends Controller
             return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
 
 
-        $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxd2334195ddfc7d93&secret=c349515d0079ccbc71f4a4f191c1621e&code=".$request->wechat."&grant_type=authorization_code";
+        $url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wxc5181c0d406023e6&secret=c349515d0079ccbc71f4a4f191c1621e&code=".$request->wechat."&grant_type=authorization_code";
         $res = file_get_contents($url);     //file_get_contents获取指定路由返回的数据
         \Log::info($res);
         $arr = json_decode($res, true);
-        $openid = $arr['openid'];
+        if(!$arr['errcode'])$openid = $arr['openid'];
         \Log::info('openid: ' . $openid);
         $user = UserInfoModel::where('wechat',$openid)->first();
         if (empty($user)) {