Parcourir la source

Wesmiler 校企小程序源代码部署

wesmiler il y a 3 ans
Parent
commit
ee8fa8577a
2 fichiers modifiés avec 5 ajouts et 7 suppressions
  1. 1 3
      app/api/controller/Passport.php
  2. 4 4
      app/api/service/passport/Login.php

+ 1 - 3
app/api/controller/Passport.php

@@ -60,9 +60,7 @@ class Passport extends Controller
     {
         // 微信小程序一键登录
         $LoginService = new LoginService;
-        $params = $this->postForm()? $this->postForm() : $this->request->param();
-        var_dump($params);
-        if (!$LoginService->loginMpWx($params)) {
+        if (!$LoginService->loginMpWx($this->request->param())) {
             return $this->renderError($LoginService->getError());
         }
         // 获取登录成功后的用户信息

+ 4 - 4
app/api/service/passport/Login.php

@@ -72,7 +72,7 @@ class Login extends BaseService
     public function loginMpWx(array $form): bool
     {
         // 获取微信小程序登录态(session)
-        $wxSession = PartyService::getMpWxSession($form['partyData']['code']);
+        $wxSession = PartyService::getMpWxSession($form['code']);
 
         // 判断openid是否存在
         $userId = OauthService::getUserIdByOauthId($wxSession['openid'], 'MP-WEIXIN');
@@ -83,7 +83,7 @@ class Login extends BaseService
         // 用户信息存在, 更新登录信息
         if (!empty($userInfo)) {
             // 更新用户登录信息
-            $this->updateUser($userInfo, true, $form['partyData']);
+            $this->updateUser($userInfo, true, $form);
             // 记录登录态
             return $this->setSession();
         }
@@ -97,9 +97,9 @@ class Login extends BaseService
         // 后台未开启强制绑定手机号, 直接保存新用户
         if (!$setting['isForceBindMpweixin']) {
             // 用户不存在: 创建一个新用户
-            $this->createUser('', true, $form['partyData']);
+            $this->createUser('', true, $form);
             // 保存第三方用户信息
-            $this->createUserOauth($this->getUserId(), true, $form['partyData']);
+            $this->createUserOauth($this->getUserId(), true, $form);
         }
         // 记录登录态
         return $this->setSession();