getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } public static function updateUserLoginInfo($userid, $data) { $status = DB::table('users')->where('id', $userid)->update(['token' => $data['token'],'phone_verified'=>1,'last_login_time'=>$data['last_login_time'],'login_num'=>$data['login_num']+1]); return $status; } public static function updateToken($userid, $token) { $status = DB::table('users')->where('id', $userid)->update(['token' => $token]); return $status; } public static function getCurrentUser() { $token = getenv('HTTP_TOKEN') ? getenv('HTTP_TOKEN') : (isset($_GET['token']) ? $_GET['token'] : ''); if($token) { return self::getUserInfoByToken($token); } else { return array(); } } public static function getUserInfoByToken($token) { $user = User::where('token', $token)->first(); return !empty($user) ? $user : null; } public static function parseToken($token) { $user = DB::table('users')->where('token', $token)->first(); return !empty($user) ? $user : null; } public function getAccounts() { return $this->belongsToMany('App\Models\Account', 'user_account', 'user_id', 'account_id')->withPivot('is_master','tid'); } public static function updatePhoneVerified($mobile,$type) //检测账户注册到哪个步骤 { $user_info = self::where('mobile', $mobile)->first(); if (!$user_info) { $user_info = new self(); $user_info->mobile = $mobile; } if ($type) $user_info->phone_verified = $type; $user_info->save(); return $user_info; } }