feat(torrents): add sale filter on torrent list page and admin list page

to list all sale now torrents
This commit is contained in:
OldHawk
2017-12-03 12:38:50 +08:00
parent de33ce7b33
commit d69e4ebfb9
7 changed files with 60 additions and 5 deletions

View File

@@ -255,6 +255,8 @@
CA_KEYWORD: 'Keyword',
CA_TORRENT_STATUS: 'Torrent status',
CA_TORRENT_HNR: 'Hit and Run',
CA_TORRENT_SALE_STATUS: 'Sale Status',
CA_TORRENT_SALE_NOW: 'Sale now',
CA_TORRENT_VIP: 'VIP resources',
CA_RESOURCE_TYPE: 'Resource type',
PH_KEYWORD: 'Search keyword',

View File

@@ -255,6 +255,8 @@
CA_KEYWORD: '关键字',
CA_TORRENT_STATUS: '种子状态',
CA_TORRENT_HNR: 'Hit and Run',
CA_TORRENT_SALE_STATUS: '促销状态',
CA_TORRENT_SALE_NOW: '正在促销',
CA_TORRENT_VIP: 'VIP 资源',
CA_RESOURCE_TYPE: '资源类型',
PH_KEYWORD: '搜索关键字',

View File

@@ -186,7 +186,8 @@
torrent_release: vm.releaseYear,
torrent_tags: vm.searchTags,
torrent_hnr: vm.filterHnR,
torrent_vip: vm.filterVIP
torrent_vip: vm.filterVIP,
torrent_sale: vm.filterSale
}, function (items) {
if (items.length === 0) {
Notification.error({
@@ -248,6 +249,17 @@
vm.torrentBuildPager();
};
/**
* onSaleChanged
*/
vm.onSaleClicked = function () {
vm.filterSale = !vm.filterSale;
vm.torrentBuildPager();
};
vm.onSaleChanged = function () {
vm.torrentBuildPager();
};
/**
* onVIPClicked, onVIPChanged
*/

View File

@@ -242,7 +242,7 @@
vm.getResourcePageInfo = function (p, callback) {
//if searchKey or searchTags has value, the skip=0
var skip = vm.topItems;
if (vm.searchKey.trim().length > 0 || vm.searchTags.length > 0 || vm.releaseYear || vm.filterHnR || vm.sort) {
if (vm.searchKey.trim().length > 0 || vm.searchTags.length > 0 || vm.releaseYear || vm.filterHnR || vm.filterSale || vm.sort) {
skip = 0;
}
@@ -255,7 +255,8 @@
torrent_type: vm.torrentType,
torrent_release: vm.releaseYear,
torrent_tags: vm.searchTags,
torrent_hnr: vm.filterHnR
torrent_hnr: vm.filterHnR,
torrent_sale: vm.filterSale
}, function (items) {
if (items.length === 0) {
Notification.error({
@@ -319,6 +320,17 @@
vm.torrentBuildPager();
};
/**
* onSaleChanged
*/
vm.onSaleClicked = function () {
vm.filterSale = !vm.filterSale;
vm.torrentBuildPager();
};
vm.onSaleChanged = function () {
vm.torrentBuildPager();
};
/**
* onMoreTagsClicked
*/

View File

@@ -54,6 +54,15 @@
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_SALE_STATUS' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-hnr">
<label>
<input type="checkbox" ng-model="vm.filterSale" ng-change="vm.onSaleChanged();"> {{ 'CA_TORRENT_SALE_NOW' | translate}}
</label>
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_VIP' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-vip">
@@ -210,7 +219,7 @@
</span>
<span class="label label-sale" ng-if="item.isSaling"
title="{{vm.TGI.getTorrentSaleTypeDesc(item);}} | {{ 'SALE_EXPIRES_TIME' | translate}}: {{item.torrent_sale_expires | date: 'MM-dd HH:mm'}}"
ng-click="$event.stopPropagation();"
ng-click="vm.onSaleClicked(); $event.stopPropagation();"
ng-class="{'label-default': !item.isSaling, 'label-success': item.isSaling}">
{{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}}
</span>

View File

@@ -98,6 +98,15 @@
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_SALE_STATUS' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-hnr">
<label>
<input type="checkbox" ng-model="vm.filterSale" ng-change="vm.onSaleChanged();"> {{ 'CA_TORRENT_SALE_NOW' | translate}}
</label>
</div>
</dd>
<div class="more-tags panel-collapsed" style="display: none;">
<div ng-repeat="item in vm.resourcesTags.radio | filter:vm.torrentType">
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}:</dt>
@@ -209,7 +218,7 @@
</span>
<span class="label label-sale" ng-if="item.isSaling"
title="{{vm.TGI.getTorrentSaleTypeDesc(item);}} | {{ 'SALE_EXPIRES_TIME' | translate}}: {{item.torrent_sale_expires | date: 'MM-dd HH:mm'}}"
ng-click="$event.stopPropagation();"
ng-click="vm.onSaleClicked(); $event.stopPropagation();"
ng-class="{'label-default': !item.isSaling, 'label-success': item.isSaling}">
{{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}}
</span>

View File

@@ -1279,6 +1279,7 @@ exports.list = function (req, res) {
var stype = 'movie';
var newest = false;
var hnr = false;
var sale = false;
var vip = false;
var release = undefined;
var userid = undefined;
@@ -1313,6 +1314,9 @@ exports.list = function (req, res) {
if (req.query.torrent_hnr !== undefined) {
hnr = (req.query.torrent_hnr === 'true');
}
if (req.query.torrent_sale !== undefined) {
sale = (req.query.torrent_sale === 'true');
}
if (req.query.torrent_vip !== undefined) {
vip = (req.query.torrent_vip === 'true');
}
@@ -1363,6 +1367,11 @@ exports.list = function (req, res) {
if (hnr === true) {
condition.torrent_hnr = true;
}
if (sale === true) {
condition.torrent_sale_status = {
$ne: 'U1/D1'
};
}
if (vip === true) {
condition.torrent_vip = true;
} else {