|
@@ -11,7 +11,7 @@
|
|
|
import mongoose from 'mongoose';
|
|
|
import async from 'async';
|
|
|
import moment from 'moment';
|
|
|
-const SMS = require('../../users/models/sms');
|
|
|
+// const SMS = require('../../users/models/sms');
|
|
|
const projectModel = mongoose.model('projects');
|
|
|
const projSettingModel = mongoose.model('proj_setting');
|
|
|
const calcProgramModel = mongoose.model('calc_programs');
|
|
@@ -36,7 +36,7 @@ const feeRateModel = mongoose.model('fee_rates');
|
|
|
const compleRationSection = mongoose.model('complementary_ration_section_tree');
|
|
|
let divideModel = mongoose.model("divide_setting");
|
|
|
const userModel = mongoose.model('users');
|
|
|
-const compilationModel = mongoose.model('compilation');
|
|
|
+// const compilationModel = mongoose.model('compilation');
|
|
|
const evaluateListModel = mongoose.model("evaluate_list");
|
|
|
const bidListModel = mongoose.model("bid_evaluation_list");
|
|
|
const contractorListModel = mongoose.model("contractor_list");
|
|
@@ -232,44 +232,44 @@ async function checkUserCompilationStatus(callback) {
|
|
|
/*
|
|
|
* 为每天降为免费公用版的用户发送降级短信。
|
|
|
* */
|
|
|
-async function sendCompilationStatusSms(callback) {
|
|
|
- let functions = [];
|
|
|
- let today = moment(new Date()).format('YYYY-MM-DD');
|
|
|
- let userList = await userModel.find({upgrade_list: {$elemMatch:{ deadline: today }}});
|
|
|
- if (userList.length > 0) {
|
|
|
- const Sms = new SMS();
|
|
|
- for (let user of userList) {
|
|
|
- // let ssoId = JSON.parse(JSON.stringify(user)).ssoId;
|
|
|
- for (let cul of user.upgrade_list) {
|
|
|
- if (cul.deadline === today) {
|
|
|
- // cul.deadline = '';
|
|
|
- // cul.isUpgrade = false;
|
|
|
- // 发送短信
|
|
|
- let compilationData = await compilationModel.findOne({_id: cul.compilationID});
|
|
|
- await Sms.sendProductMsg(user.mobile, 2, user.real_name, compilationData.name, '');
|
|
|
- }
|
|
|
- }
|
|
|
- // functions.push(function (cb) {
|
|
|
- // userModel.update({ssoId: ssoId}, {upgrade_list: user.upgrade_list}, { multi: true }, cb);
|
|
|
- // });
|
|
|
- }
|
|
|
- }
|
|
|
- if(functions.length > 0){
|
|
|
- async.parallel(functions, async function(err, result){
|
|
|
- if(callback){
|
|
|
- callback(err);
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- if(callback) callback(0);
|
|
|
- }
|
|
|
-}
|
|
|
+// async function sendCompilationStatusSms(callback) {
|
|
|
+// let functions = [];
|
|
|
+// let today = moment(new Date()).format('YYYY-MM-DD');
|
|
|
+// let userList = await userModel.find({upgrade_list: {$elemMatch:{ deadline: today }}});
|
|
|
+// if (userList.length > 0) {
|
|
|
+// const Sms = new SMS();
|
|
|
+// for (let user of userList) {
|
|
|
+// // let ssoId = JSON.parse(JSON.stringify(user)).ssoId;
|
|
|
+// for (let cul of user.upgrade_list) {
|
|
|
+// if (cul.deadline === today) {
|
|
|
+// // cul.deadline = '';
|
|
|
+// // cul.isUpgrade = false;
|
|
|
+// // 发送短信
|
|
|
+// let compilationData = await compilationModel.findOne({_id: cul.compilationID});
|
|
|
+// await Sms.sendProductMsg(user.mobile, 2, user.real_name, compilationData.name, '');
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // functions.push(function (cb) {
|
|
|
+// // userModel.update({ssoId: ssoId}, {upgrade_list: user.upgrade_list}, { multi: true }, cb);
|
|
|
+// // });
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(functions.length > 0){
|
|
|
+// async.parallel(functions, async function(err, result){
|
|
|
+// if(callback){
|
|
|
+// callback(err);
|
|
|
+// }
|
|
|
+// });
|
|
|
+// } else {
|
|
|
+// if(callback) callback(0);
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
const sysSchedule = {
|
|
|
clearJunkData,
|
|
|
clearFakeData,
|
|
|
checkUserCompilationStatus,
|
|
|
- sendCompilationStatusSms,
|
|
|
+ // sendCompilationStatusSms,
|
|
|
};
|
|
|
|
|
|
//export {sysSchedule as default}
|