浏览代码

聚财登录

sugangqiang 2 年之前
父节点
当前提交
095e7b9f9e
共有 1 个文件被更改,包括 22 次插入1 次删除
  1. 22 1
      app/common/api/UserApi.php

+ 22 - 1
app/common/api/UserApi.php

@@ -64,11 +64,32 @@ class UserApi {
         return $this->info->toArray();
         return $this->info->toArray();
     }
     }
 
 
+    public function checkPwd() {
+        if (!$this->_checkPwd() && $this->usertype == 2 && in_array($this->info["source"], [1, 2])) {
+            //source3是新系统注册,企业号登录密码不正确时,验证一下是不是聚财账号
+            if ($this->info["source"] == 1) {
+                if (!$this->info["jUsername"]) {
+                    return false;
+                }
+            }
+            try {
+                $res = JucaiApi::login($this->username, $this->password, 1);
+                $resObj = json_decode($res);
+                if ($resObj->state == 1) {
+                    return true;
+                }
+                return false;
+            } catch (think\exception $e) {
+                return false;
+            }
+        }
+    }
+
     /**
     /**
      * 检查密码
      * 检查密码
      * @return type
      * @return type
      */
      */
-    public function checkPwd() {
+    public function _checkPwd() {
         switch ($this->usertype) {
         switch ($this->usertype) {
             case 1:
             case 1:
                 $salt = hash("md5", $this->info["salt"], true);
                 $salt = hash("md5", $this->info["salt"], true);