示例#1
0
        rateQuote: function (quote_id, value) {
            var index = resolveIndex('quote', value);
            var remove_index = resolveIndex('quote', -1 * value);
            quote_id = Number(quote_id);

            Lockr.srem(remove_index, quote_id);
            if (Lockr.sismember(index, quote_id)) {
                Lockr.srem(index, quote_id);
            } else {
                Lockr.sadd(index, quote_id);
            }
        }
示例#2
0
        rateComment: function (comment_id, value) {
            var index = resolveIndex('comment', value);
            var remove_index = resolveIndex('comment', -1 * value);
            comment_id = Number(comment_id);

            Lockr.srem(remove_index, comment_id);
            if (Lockr.sismember(index, comment_id)) {
                Lockr.srem(index, comment_id);
            } else {
                Lockr.sadd(index, comment_id);
            }
        },
示例#3
0
            _.each(data.rated_comments, function (r) {
                var index = resolveIndex('comment', r.value);

                Lockr.sadd(index, r.c_id);
            });
示例#4
0
            _.each(data.rated_quotes, function (r) {
                var index = resolveIndex('quote', r.value);

                Lockr.sadd(index, r.q_id);
            });
示例#5
0
 add (key, value, fn) {
   PcLockr.checkKey(key);
   Lockr.sadd(key, value);
   fn && fn();
 }