瀏覽代碼

小程序登录增加短信验证码登录

kevin 1 年之前
父節點
當前提交
452202d53e
共有 1 個文件被更改,包括 7 次插入2 次删除
  1. 7 2
      app/api/model/user/UserOpen.php

+ 7 - 2
app/api/model/user/UserOpen.php

@@ -388,12 +388,12 @@ class UserOpen extends UserModel
             $vall = [
                 'mobile'     => $data['mobile'],
                 'user_no'    => $data['mobile'],
-                'reg_source' => 'app',
+                'reg_source' => 'wx',
                 'grade_id'   => GradeModel::getDefaultGradeId(),
                 'app_id'     => self::$app_id,
                 'password'   => md5('123456'),
                 'nickName'   => $data['mobile'],
-                'mpopen_id'  => authcode($data['openid'], 'DECODE'),
+                'openid'     => $data['openid'], // authcode($data['openid'], 'DECODE'),
             ];
             if (!$this->save($vall)) {
                 $this->error = '登录失败';
@@ -403,6 +403,11 @@ class UserOpen extends UserModel
             $user = $this->where('user_no', $data['user_no'])->find();
         }
 
+        $info = [
+            'open_id'    => $data['openid'],
+            'reg_source' => 'wx',
+        ];
+        $this->where('user_id', $user['user_id'])->update($info);
         // 生成token (session3rd)
         $this->token = $this->token($user['user_no']);
         // 记录缓存, 30天