lrf402788946 4 年 前
コミット
1732ef6c58

+ 2 - 2
app/controller/weixin.js

@@ -187,8 +187,8 @@ class WeixinController extends Controller {
     const key = `appinfo:${state}`;
     await this.app.redis.set(key, appopenid, 'EX', 600);
     const res = await this.ctx.service.user.findByAppOpenid(appopenid);
-    console.warn({ user: res, openid: appopenid });
-    this.ctx.ok({ user: res, openid: appopenid });
+    const obj = { user: res, openid: appopenid };
+    this.ctx.ok(obj);
   }
 }
 

+ 0 - 2
app/service/apply.js

@@ -41,7 +41,6 @@ class ApplyService extends CrudService {
    * @param {Object} body planid:计划id,ids:期数id列表;classtype:班级类型
    */
   async arrangeteacher({ planid, ids, classtype }) {
-    console.log(classtype);
     assert(planid, '缺少计划信息');
     const trainplan = await this.trainmodel.findById(planid);
     if (!trainplan) {
@@ -322,7 +321,6 @@ class ApplyService extends CrudService {
         }
       }
     }
-    // console.log(termnum);
     trainplan.termnum = termnum;
     await trainplan.save();
   }

+ 0 - 5
app/service/attendance.js

@@ -31,7 +31,6 @@ class AttendanceService extends CrudService {
     if (!user) {
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '用户不存在');
     }
-    console.log(user);
     const student = await this.stumodel.findById(user.uid);
     if (!student) {
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '学生信息不存在');
@@ -93,7 +92,6 @@ class AttendanceService extends CrudService {
         }
         if (!result) {
           const newattend = await attendance.attend.create(newData);
-          console.log('newattend:', newattend);
           attendance.attend.push(newattend);
           await attendance.save();
         }
@@ -113,7 +111,6 @@ class AttendanceService extends CrudService {
         await this.model.create(newdatastu);
       }
     } else if (type === '1') {
-      console.log('寝室考勤');
       const beedroom = await this.bmodel.findOne({ code: student.bedroom });
       if (!beedroom) {
         throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '寝室信息不存在');
@@ -155,7 +152,6 @@ class AttendanceService extends CrudService {
         }
         if (!result) {
           const newattend = await attendance.attend.create(newData);
-          console.log('newattend:', newattend);
           attendance.attend.push(newattend);
           await attendance.save();
         }
@@ -183,7 +179,6 @@ class AttendanceService extends CrudService {
     const datetime = sd.format(new Date(), 'YYYY-MM-DD HH:mm');
     // TODO 考勤时间没有处理
     const diffres = await this.islate(datetime, setting, '0');
-    console.log(diffres);
   }
 
   // 判断上课考勤是否迟到和开始

+ 0 - 14
app/service/bedroom.js

@@ -26,7 +26,6 @@ class BedroomService extends CrudService {
     const _bedrooms = _.map(students, 'bedroom');
     // 取得无重复的寝室号
     const bedrooms = _.uniq(_bedrooms);
-    console.log(bedrooms);
     const data = [];
     // 根据寝室号 取得相应的学生信息
     for (const elm of bedrooms) {
@@ -73,25 +72,20 @@ class BedroomService extends CrudService {
       .sort({ floor: -1 });
     // 循环所有当前批次下的寝室列表进行分寝处理
     const studentList = await this.getstudents(termid, batchid);
-    console.log('stulen-->' + studentList.length);
     for (const bedroom of bedroomList) {
-      console.log(bedroom.code);
       // 判断当前寝室号是否已有
       // 根据期id查找所有当期学生列表
       const _stu = _.filter(studentList, { bedroom: bedroom.code });
-      console.log(_stu.length);
       if (bedroom.number !== _stu.length) {
         let i = 0;
         let _gender = '';
         for (const stud of studentList) {
-          console.log('stu---' + stud.bedroom);
           if (stud.bedroom) {
             if (stud.bedroom === bedroom.code) {
               i = i + 1;
             }
             continue;
           }
-          console.log('i--->' + i);
           if (i === 0) {
             if (!bedroom.gender) {
               stud.bedroomid = bedroom.id;
@@ -168,9 +162,6 @@ class BedroomService extends CrudService {
     // 根据期id查找所有当期学生列表
     const cltype = await this.ctmodel.find({ bedroom: '0' });
     const types = _.map(cltype, 'code');
-    console.log('-----types-start--');
-    console.log(types);
-    console.log('-----types-end--');
     const studentList = await this.smodel
       .find({ termid, batchid, type: { $in: types } })
       .sort({ gender: -1 });
@@ -186,7 +177,6 @@ class BedroomService extends CrudService {
 
   // 新 分配寝室查询可以的列表
   async getAssignRoom({ termid }) {
-    console.log(termid);
     const bedroomList = await this.model.find();
     const stuList = await this.smodel.find({ termid });
     const stuBedIdGroup = _.groupBy(stuList, 'bedroomid');
@@ -238,7 +228,6 @@ class BedroomService extends CrudService {
     const bedroom = await this.model.findById(bedroomid);
     if (!bedroom) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '不存在该寝室');
     let { number, gender } = bedroom;
-    console.log(`bedroom:gender=>${gender}`);
     // 找到多少人在这个寝室
     const inRoom = await this.ctx.model.Student.find({ termid, bedroomid });
     const ifTotal = inRoom.length * 1 + ids.length;
@@ -247,7 +236,6 @@ class BedroomService extends CrudService {
       // 寝室没设置性别,从这个寝室的学生中取出性别
       const stu = _.head(inRoom);
       gender = _.trim(_.get(stu, 'gender'));
-      console.log(`bedroom:in room sutdent gender=>${gender}`);
     }
     const selectStuList = await this.ctx.model.Student.find({ _id: ids.map(i => ObjectId(i)) });
     for (const id of ids) {
@@ -256,12 +244,10 @@ class BedroomService extends CrudService {
       const { gender: sg, name } = r;
       // 寝室或有已入住学生,产生的性别结果,
       if (!gender) {
-        console.log('in no gender limit');
         r.bedroom = code;
         r.bedroomid = bedroomid;
         await r.save();
       } else {
-        console.log(`in gender limit : gender: ${gender} / sg:${sg}`);
         if (sg && sg.includes(gender)) {
           // 有性别判断
           r.bedroom = code;

+ 0 - 1
app/service/class.js

@@ -363,7 +363,6 @@ class ClassService extends CrudService {
     teachers = _.uniq(_.compact(teachers));
     for (const tea of teachers) {
       const user = users.find(item => item.uid === tea.id);
-      console.log(user);
       if (user && user.openid) {
         const _tea = _.cloneDeep(JSON.parse(JSON.stringify(tea)));
         _tea.hasuserinfo = '1';

+ 0 - 1
app/service/headteacher.js

@@ -29,7 +29,6 @@ class HeadteacherService extends CrudService {
   async update({ id }, data) {
     const { name, mobile, openid } = data;
     // 修改后的手机号查找是否已存在
-    console.log(mobile);
     const have_mobile = await this.umodel.count({ mobile, uid: { $ne: id } });
     if (have_mobile > 0) throw new BusinessError(ErrorCode.DATA_EXIST, '电话已经存在');
     const res = await this.model.update({ _id: ObjectId(id) }, data);

+ 0 - 2
app/service/job.js

@@ -22,9 +22,7 @@ class JobService extends CrudService {
     job.isstore = data.isstore;
     const res = await job.save();
     if (res) {
-      console.log(11111111);
       if (data.isstore === '1') {
-        console.log('&&&&&&&&&&&&');
         const studatas = JSON.parse(job.studs);
         for (const stu of studatas) {
           await this.smodel.create(stu);

+ 0 - 3
app/service/lesson.js

@@ -348,7 +348,6 @@ class LessonService extends CrudService {
         );
         // 如果找到了,就要把这个时间和上一个整合
         if (r) {
-          // console.log(newArr[ri].timeList);
           newArr[ri].timeList.push(l.time);
         } else {
           let obj = _.cloneDeep(l);
@@ -546,7 +545,6 @@ class LessonService extends CrudService {
     // 该期的课表,没有就添加
     const has_lesson = await this.model.find({ termid });
     const classids = has_lesson.map(i => ObjectId(i.classid));
-    // console.log(has_lesson);
     const has_classList = await this.clamodel.find({ _id: { $in: classids } }, { name: 1 });
     const sterm = termnum.find(f => f._id === termid);
     const { batchnum } = sterm;
@@ -596,7 +594,6 @@ class LessonService extends CrudService {
             for (const key of keys) {
               // 将原课表的每日,每个时间段的安排整理成object
               if (key.startsWith('day') && key.endsWith('type')) {
-                // console.log(`${key}=>${ot[key]}`);
                 // kvs.type = ot[key];
               } else if (key.startsWith('day') && key.endsWith('subid')) {
                 kvs.subid = ot[key];

+ 0 - 1
app/service/liveroom.js

@@ -71,7 +71,6 @@ class LiveroomService extends CrudService {
       throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '直播房间不存在');
     }
     const backUrl = encodeURI(`${this.app.config.baseUrl}${this.config.authUrl}?type=0&redirect_uri=${this.app.config.baseUrl}/student/login?redirect_uri=/user/liveDetail/${roomid}`);
-    console.log(backUrl);
     let list = [];
     const query = {};
     if (termid) query.termid = termid;

+ 0 - 1
app/service/login.js

@@ -76,7 +76,6 @@ class LoginService extends CrudService {
     assert(qrcode, 'qrcode不能为空');
     assert(openid, 'openid不能为空');
     // TODO: 发布扫码成功消息
-    console.log('qrcode-->' + qrcode);
     const { mq } = this.ctx;
     const ex = 'qrcode.login';
     const parm = {

+ 0 - 3
app/service/notice.js

@@ -55,8 +55,6 @@ class NoticeService extends CrudService {
     personList = personList.map(i => i._id);
     // 获取所有人后发送信息
     const userList = await this.umodel.find({ uid: { $in: personList } });
-    console.log(userList);
-
     for (const user of userList) {
       // 1,判断有没有openid;2有openid的发送消息,添加记录
       if (!_.get(user, 'openid')) continue;
@@ -78,7 +76,6 @@ class NoticeService extends CrudService {
    */
   async getRangeStudent(condition) {
     const res = await this.stumodel.find({ ...condition, openid: { $exists: true } });
-    console.log(res);
     return res;
   }
   /**

+ 0 - 2
app/service/rabbitmq.js

@@ -12,7 +12,6 @@ class RabbitmqService extends Service {
 
   // 接收消息
   async receiveQueueMsg(ex) {
-    console.log(ex);
     this.ctx.logger.info('调用mq的' + ex);
     const self = this;
     const { mq } = self.ctx;
@@ -30,7 +29,6 @@ class RabbitmqService extends Service {
   async logMessage(msg) {
     const result = msg.content.toString();
     const headers = msg.properties.headers;
-    console.log(headers);
   }
 }
 

+ 3 - 3
app/service/school.js

@@ -57,9 +57,9 @@ class SchoolService extends CrudService {
     // }
     // 取得学校预计人数
     const num_ = await this.getschnum(plan, type, schid, termid, batchid);
-    console.log('*******************');
-    console.log(num_);
-    console.log('*******************');
+    // console.log('*******************');
+    // console.log(num_);
+    // console.log('*******************');
     // 检查学校是否上传过学生
     const schstu = await this.smodel.count({ schid, batchid });
     if (schstu && schstu > 0) throw new BusinessError(ErrorCode.BUSINESS, '该批次已经上传过学生,无需重复上传,若人员有变化,请联系中心负责人');

+ 0 - 7
app/service/student.js

@@ -231,7 +231,6 @@ class StudentService extends CrudService {
       const group = groups.find(item =>
         item.students.find(stuinfo => stuinfo.stuid === _student.id)
       );
-      console.log(group);
       if (group) {
         _student.groupscore = group.score;
       }
@@ -333,7 +332,6 @@ class StudentService extends CrudService {
       // 先判断是否超过第10位,超过就跳出
       if (num >= 10) break;
       const { score, is_fine, job, name, _id } = student;
-      console.log(`${name}-${job}:${score};${is_fine} ;${num}`);
       // 最开始初始化过所有人的状态,并且将干部和不能评优的人都过滤出去,所以正常学生应该都是没有评优,如果此处已经是优秀,那么就是和前人同分改的,直接跳过就好
       if (is_fine === '1') continue;
       // 没有分凑什么热闹
@@ -359,16 +357,12 @@ class StudentService extends CrudService {
     // 算完的和不用算的合并,提交
     const lastList = [ ...studentList, ...reverseList ];
     for (const student of lastList) {
-      if (student.is_fine === '1' && student.job.includes('普通')) {
-        console.log(student.name);
-      }
       // const res = await student.save();
       // const { meta, ...data } = student;
       const r = await this.model.findByIdAndUpdate(
         { _id: ObjectId(student._id) },
         { score: student.score, is_fine: student.is_fine }
       );
-      // console.log(res);
     }
   }
   /**
@@ -541,7 +535,6 @@ class StudentService extends CrudService {
           const obj = await trainPlanInfo(termid);
           if (obj) {
             const { term } = obj;
-            console.log(obj);
             fn = `第${term}期${fn}`;
           }
         }

+ 0 - 1
app/service/talented.js

@@ -145,7 +145,6 @@ class TalentedService extends CrudService {
     }
     let arr = [];
     if (res && !_.isArray(res)) {
-      console.log(res);
       const { classid, studentid, term, files } = res;
       if (term) fn = `${fn}${term}`;
       if (classid) {

+ 0 - 1
app/service/teaplan.js

@@ -160,7 +160,6 @@ class TeaplanService extends CrudService {
         // 查出该批次下所有的班级
 
         const classList = await batch.class;
-        console.log(classList);
         for (const _class of classList) {
           // 取出所有部门和部门可用人数
           const departmentList = await this.departmentcount(teaListAll_);

+ 0 - 9
app/service/trainplan.js

@@ -28,7 +28,6 @@ class TrainplanService extends CrudService {
     assert(year, '缺少年度');
     assert(title, '缺少标题');
     const res = await this.model.create(data);
-    console.log(res);
     let planid = '';
     if (res) planid = res._id;
     const schoolList = await this.smodel.find();
@@ -176,7 +175,6 @@ class TrainplanService extends CrudService {
               });
             }
           }
-          // console.log(arr);
           return i;
         });
         // 去重
@@ -591,7 +589,6 @@ class TrainplanService extends CrudService {
     let xuhao = [ XLSX.utils.decode_range('A1:A4') ];
     const xuexiao = [ XLSX.utils.decode_range('B1:B4') ];
     xuhao = [ ...xuhao, ...xuexiao, ...colRows ];
-    // console.log(xuhao);
     const data = [];
     // 第一行
     const row0 = [ '序号', '学校名称', '备注' ].concat(remarks);
@@ -630,7 +627,6 @@ class TrainplanService extends CrudService {
     ws['!cols'] = wscols;
     // xuhao.push(XLSX.utils.decode_range('B1:D1')) // 测试数据 仓库1模拟数据
     ws['!merges'] = xuhao;
-    // console.log(xuhao);
     XLSX.writeFile(wb, path);
     return respath;
   }
@@ -712,9 +708,7 @@ class TrainplanService extends CrudService {
     // 得到所有的节日日期的数组,然后循环时注意得到一个删除一个
     const festivals = trainplan.festivals;
     const festivalList = this.getfestivalList(festivals);
-    console.log(utils.begindateEnddateSum('2020-01-25', '2020-02-05'));
     const termnumList = this.gettermnumList(termnum);
-    // console.log(termnumList);
     // 得到所有班级的数组,然后循环时注意得到一个删除一个
 
     // 循环12个月,得到12个月以及每个月的数据
@@ -735,7 +729,6 @@ class TrainplanService extends CrudService {
       styleMonth.push(monthCells);
       for (let j = 0; j < festivalList.length; j++) {
         const festival = festivalList[j];
-        // console.log(festival);
         // 如果月份相同时才会增加
         const yue = parseInt(festival.substr(5, 2));
         const lie = parseInt(festival.substr(8, 2));
@@ -752,7 +745,6 @@ class TrainplanService extends CrudService {
         }
       }
       festivalsRowstyle = festivalsRowstyle + classNum + 3;
-      // console.log(stylefestivals);
 
       // 添加月份坐标
       const colRow = {
@@ -943,7 +935,6 @@ class TrainplanService extends CrudService {
   getWeekDay(datestr) {
     const weekday = moment(datestr).weekday();
     if (weekday || weekday === 0) {
-      // console.log(weekday);
       const arr = [ '日', '一', '二', '三', '四', '五', '六' ];
       return '星期' + arr[weekday];
     }

+ 0 - 2
app/service/user.js

@@ -129,8 +129,6 @@ class UserService extends CrudService {
             userid: uid,
             openid,
           } };
-        console.log(parm);
-        console.log(msg);
         await mq.topic('qrcode.bind', qrcode, msg, parm);
       } else {
         this.ctx.logger.error('!!!!!!没有配置MQ插件!!!!!!');

+ 0 - 9
app/service/weixin.js

@@ -32,7 +32,6 @@ class WeixinAuthService extends AxiosService {
     //   code,
     //   grant_type: 'authorization_code',
     // };
-    // console.log('rrrr-' + params);
     // const res = await this.httpGet(reqUrl, params);
 
     if (res.errcode && res.errcode !== 0) {
@@ -65,7 +64,6 @@ class WeixinAuthService extends AxiosService {
       throw new BusinessError(ErrorCode.SERVICE_FAULT, '获得微信用户信息失败');
     }
     const token = res.access_token;
-    console.log(token);
     const urlun = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' + token + '&openid=' + openid + '&lang=zh_CN';
     const result = await this.ctx.curl(urlun, {
       method: 'get',
@@ -120,7 +118,6 @@ class WeixinAuthService extends AxiosService {
     } else {
       backUrl = encodeURI(`${this.ctx.protocol}://${this.ctx.host}${authUrl}?state=${groupid}`);
     }
-    console.log(backUrl);
     return backUrl;
   }
 
@@ -224,9 +221,6 @@ class WeixinAuthService extends AxiosService {
         },
       },
     };
-    console.log('templateid---' + templateid);
-    console.log('openid---' + openid);
-    console.log('requestData---' + JSON.stringify(requestData));
     await this.ctx.curl(url, {
       method: 'post',
       headers: {
@@ -264,9 +258,6 @@ class WeixinAuthService extends AxiosService {
         },
       },
     };
-    // console.log('templateid---' + templateid);
-    // console.log('openid---' + openid);
-    // console.log('requestData---' + JSON.stringify(requestData));
     const res = await this.ctx.curl(url, {
       method: 'post',
       headers: {