Unnecessary return statements are those which return no value and occur just before the function would have "fallen through" to the bottom.
这是对第二个return的warn,不能这样用呢,程序如下:
exports.consumeAmountGetReward = function (user,callback) {
var activity = QActivity.getValidActivity('consumeAmount'),
config = QSetting.current(),
localize = config.localize;
if(!activity){
callback(localize['20088']);
return;
}
if(user.consumeAmountRemainCount <= 0){
callback(localize['20076']);
return;
}else{
user.consumeAmountRemainCount -= 1;
user.consumeAmountCrystal -= activity.data.crystal;
businese.UserManager.saveUser(user, function (err) {
if(err){
callback(err);
}else{
callback(null,outputConsumeAmountActivity(user,activity));
}
});
}
};