|
@@ -45,20 +45,20 @@ class UserService extends CrudService {
|
|
|
return token;
|
|
|
}
|
|
|
// 监听用户vip信息
|
|
|
- // async watchvip() {
|
|
|
- // const list = [];
|
|
|
- // const data = await this.model.find();
|
|
|
- // for (const val of data) {
|
|
|
- // if (val.is_vip === '1') {
|
|
|
- // if (moment().isAfter(val.vip_end_time)) list.push(val);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (list.length > 0) {
|
|
|
- // for (const val of list) {
|
|
|
- // await this.model.updateOne({ _id: ObjectId(val._id) }, { is_vip: '0' });
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
+ async watchvip() {
|
|
|
+ const list = [];
|
|
|
+ const data = await this.model.find();
|
|
|
+ for (const val of data) {
|
|
|
+ if (val.is_vip === '1') {
|
|
|
+ if (moment().isAfter(val.vip_end_time)) list.push(val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (list.length > 0) {
|
|
|
+ for (const val of list) {
|
|
|
+ await this.model.updateOne({ _id: ObjectId(val._id) }, { is_vip: '0' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = UserService;
|