**如何评价阿里虾米 PC/Mac 客户端代码注释中称用户为「穷逼 VIP」(BeggarVip)? **
var UserModel = function () {
function UserModel() {
_classCallCheck(this, UserModel);
this._userInfo;
}
_createClass(UserModel, [{
key: '_fetchUserInfo',
value: function _fetchUserInfo() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (update) this._userInfo = electron.remote.getGlobal("userInfo") || {};
}
},
{
key: 'getUserInfo',
value: function getUserInfo() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo;
}
}, {
key: 'checkVipExpired',
value: function checkVipExpired() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
var targetExpired = this._userInfo.vipExpire;
return !(targetExpired && isNumber(targetExpired) && targetExpired > Date.now());
}
}, {
key: 'getExpiredDays',
value: function getExpiredDays() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
var targetExpired = this._userInfo.vipExpire || 0;
return Math.ceil((targetExpired - Date.now()) / (24 * 3600 * 1000));
}
}, {
key: 'isReachedMaxDownloadItem',
value: function isReachedMaxDownloadItem() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo.downCountLeft <= 0;
}
}, {
key: 'isLogin',
value: function isLogin() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return !!this._userInfo.accessToken;
}
/**
* 判断是否是307版本之前的用户信息结构 */ }, {
key: 'isBefore307VersionData',
value: function isBefore307VersionData() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return !this._userInfo.version;
}
/**
* 判断是否是309版本之前的用户信息结构 */ }, {
key: 'isBefore309VersionData',
value: function isBefore309VersionData() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo.verifyIsOpen === undefined && this._userInfo.userVerify === undefined;
}
/**
* 是不是VIP * @param update
* @returns {UserModel.isVip|*}
*/ }, {
key: 'isVip',
value: function isVip() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this.isNormalVip(false) || this.isSuperVip(false);
}
/**
* 穷逼VIP(活动送的那种) * @param update
* @returns {boolean}
*/ }, {
key: 'isBeggarVip',
value: function isBeggarVip() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo.isDemoVip || false;
}
/**
* 普通VIP * @param update
* @returns {number}
*/ }, {
key: 'isNormalVip',
value: function isNormalVip() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo.visits & 1 << 8;
}
/**
* 超级VIP * @param update
* @returns {number}
*/ }, {
key: 'isSuperVip',
value: function isSuperVip() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
this._fetchUserInfo(update);
return this._userInfo.visits & 1;
}
}]);
return UserModel;
}();
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于