|
@@ -13,4 +13,34 @@ export class VideoService extends BaseService<modelType> {
|
|
|
const { number, _id } = data;
|
|
|
await this.model.updateOne({ _id }, { number: number + 1 });
|
|
|
}
|
|
|
+ // 首页查询
|
|
|
+ async list() {
|
|
|
+ const one = { type: '0', is_use: '0', status: '1' };
|
|
|
+ const two = { type: '1', is_use: '0', status: '1' };
|
|
|
+ const thr = { type: '2', is_use: '0', status: '1' };
|
|
|
+ const four = { type: '3', is_use: '0', status: '1' };
|
|
|
+ const five = { type: '4', is_use: '0', status: '1' };
|
|
|
+ let data;
|
|
|
+ data = await this.model.find(one).skip(0).limit(7).lean();
|
|
|
+ const oneInfo = data[0] || {};
|
|
|
+ const oneList = data.slice(1, 7) || [];
|
|
|
+ const oneTotal = await this.model.count(one);
|
|
|
+ data = await this.model.find(two).skip(0).limit(7).lean();
|
|
|
+ const twoInfo = data[0]|| {};
|
|
|
+ const twoList = data.slice(1, 7)|| [];
|
|
|
+ const twoTotal = await this.model.count(two);
|
|
|
+ data = await this.model.find(thr).skip(0).limit(7).lean();
|
|
|
+ const thrInfo = data[0]|| {};
|
|
|
+ const thrList = data.slice(1, 7)|| [];
|
|
|
+ const thrTotal = await this.model.count(thr);
|
|
|
+ data = await this.model.find(four).skip(0).limit(7).lean();
|
|
|
+ const fourInfo = data[0]|| {};
|
|
|
+ const fourList = data.slice(1, 7)|| [];
|
|
|
+ const fourTotal = await this.model.count(four);
|
|
|
+ data = await this.model.find(five).skip(0).limit(7).lean();
|
|
|
+ const fiveInfo = data[0]|| {};
|
|
|
+ const fiveList = data.slice(1, 7)|| [];
|
|
|
+ const fiveTotal = await this.model.count(five);
|
|
|
+ return { oneInfo, oneList, oneTotal, twoInfo, twoList, twoTotal, thrInfo, thrList, thrTotal, fourInfo, fourList, fourTotal, fiveInfo, fiveList, fiveTotal };
|
|
|
+ }
|
|
|
}
|