/** * 根据手机获取用户 * @method getByPhone * @param [type] $phone [description] * @return [type] [description] * @author NewFuture */ public static function getByPhone($phone) { $tail = Encrypt::encryptPhoneTail(substr($phone, -4)); if ($users = self::where('phone', 'LIKE', '%%' . $tail)->select('id,number,phone')) { foreach ($users as $user) { if ($phone == Encrypt::decryptPhone($user['phone'], $user['number'], $user['id'])) { return $user; } } } }