lrf %!s(int64=2) %!d(string=hai) anos
pai
achega
c05474435f

+ 3 - 2
app/controller/business/config/.lessonCoach.js

@@ -1,6 +1,6 @@
 module.exports = {
   create: {
-    requestBody: ['lesson_id', 'school_id', 'coach_id', 'money'],
+    requestBody: ['lesson_id', 'school_id', 'coach_id', 'money', 'is_sign'],
   },
   destroy: {
     params: ['!id'],
@@ -8,7 +8,7 @@ module.exports = {
   },
   update: {
     params: ['!id'],
-    requestBody: ['lesson_id', 'school_id', 'coach_id', 'money'],
+    requestBody: ['lesson_id', 'school_id', 'coach_id', 'money', 'is_sign'],
   },
   show: {
     parameters: {
@@ -24,6 +24,7 @@ module.exports = {
         lesson_id: 'lesson_id',
         school_id: 'school_id',
         coach_id: 'coach_id',
+        is_sign: 'is_sign',
       },
       // options: {
       //   "meta.state": 0 // 默认条件

+ 2 - 1
app/model/apply/tempLessonApply.js

@@ -1,6 +1,7 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 临时上课申请
 const tempLessonApply = {
@@ -9,7 +10,7 @@ const tempLessonApply = {
   student_id: { type: String, required: false, zh: '学员id', ref: 'Student', getProp: [ 'name' ] }, //
   coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
   img_url: { type: Array, required: false, zh: '证据' }, //
-  money: { type: Number, required: false, zh: '金额' }, //
+  money: { type: Decimal128, required: false, zh: '金额' }, //
   pay_id: { type: String, required: false, zh: '支付id', ref: 'PayOrder' }, //
 };
 const schema = new Schema(tempLessonApply, { toJSON: { virtuals: true } });

+ 2 - 1
app/model/business/charge.js

@@ -1,13 +1,14 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 充值记录
 const charge = {
   school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
   payer_id: { type: String, required: false, zh: '充值用户角色id', refPath: 'payer_role', getProp: [ 'name' ] }, //
   payer_role: { type: String, required: false, zh: '充值用户角色' }, //
-  money: { type: Number, required: false, zh: '充值金额' }, //
+  money: { type: Decimal128, required: false, zh: '充值金额' }, //
   pay_id: { type: String, required: false, zh: '支付id', ref: 'Payorder' }, //
   is_pay: { type: String, required: false, zh: '支付状态' }, // 0:未支付;1:支付成功;-1:支付失败;-3:已退款
   time: { type: String, required: false, zh: '时间' }, //

+ 2 - 1
app/model/business/coachInBill.js

@@ -1,6 +1,7 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 教练费明细
 const coachInBill = {
@@ -8,7 +9,7 @@ const coachInBill = {
   type: { type: String, required: false, zh: '类型' }, // 0:公开课收入;1私教课收入;2提现
   school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
   coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
-  money: { type: Number, required: false, zh: '金额' }, //
+  money: { type: Decimal128, required: false, zh: '金额' }, //
 };
 const schema = new Schema(coachInBill, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });

+ 2 - 1
app/model/business/lesson.js

@@ -1,6 +1,7 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 课程表
 const lesson = {
@@ -8,7 +9,7 @@ const lesson = {
   title: { type: String, required: false, zh: '课程标题' }, //
   time_start: { type: String, required: false, zh: '开始上课时间' }, //
   time_end: { type: String, required: false, zh: '结束时间' }, //
-  money: { type: Number, zh: '金额' },
+  money: { type: Decimal128, zh: '金额' },
   limit: { type: Number, zh: '人数上限' },
   refund_hour: { type: String, zh: '退款期限' },
   type: { type: String, required: false, zh: '课程类型', default: '0' }, // 0:公开课;1私教课

+ 7 - 4
app/model/business/lessonCoach.js

@@ -1,13 +1,15 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 课程表-教练
 const lessonCoach = {
-  lesson_id: { type: String, required: false, zh: '课程id', ref: 'Lesson', getProp: [ 'title' ] }, //
-  school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
-  coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
-  money: { type: Number, required: false, zh: '课时费' }, //
+  lesson_id: { type: String, required: false, zh: '课程id', ref: 'Lesson', getProp: ['title'] }, //
+  school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: ['name'] }, //
+  coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: ['name'] }, //
+  money: { type: Decimal128, required: false, zh: '课时费' }, //
+  is_sign: { type: String, required: false, default: '0', zh: '签到' }, // 0:未到;1:已签到
 };
 const schema = new Schema(lessonCoach, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
@@ -15,6 +17,7 @@ schema.index({ 'meta.createdAt': 1 });
 schema.index({ lesson_id: 1 });
 schema.index({ school_id: 1 });
 schema.index({ coach_id: 1 });
+schema.index({ is_sign: 1 });
 
 schema.plugin(metaPlugin);
 module.exports = app => {

+ 7 - 4
app/model/business/lessonStudent.js

@@ -1,18 +1,20 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 课程表-学员
 const lessonStudent = {
-  lesson_id: { type: String, required: false, zh: '课程id', ref: 'Lesson', getProp: [ 'name' ] }, //
-  school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
-  student_id: { type: String, required: false, zh: '学生id', ref: 'Student', getProp: [ 'name' ] }, //
-  money: { type: String, required: false, zh: '缴费金额' }, //
+  lesson_id: { type: String, required: false, zh: '课程id', ref: 'Lesson', getProp: ['name'] }, //
+  school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: ['name'] }, //
+  student_id: { type: String, required: false, zh: '学生id', ref: 'Student', getProp: ['name'] }, //
+  money: { type: Decimal128, required: false, zh: '缴费金额' }, //
   is_try: { type: String, required: false, default: '0', zh: '是否试课' }, // 0:非试课;1:试课
   try_status: { type: String, default: '0', zh: '试课审核状态' }, // 0:未审核;1:审核通过;2审核拒绝
   is_pay: { type: String, default: '0', zh: '是否已支付' }, // 0:未支付;1:已支付:-1:支付失败:-3已退款
   pay_id: { type: String, required: false, zh: '支付id', ref: 'PayOrder' }, //
   config: { type: Array, required: false, zh: '学生与教练关系表的设置快照' }, //
+  is_sign: { type: String, required: false, default: '0', zh: '签到' }, // 0:未到;1:已签到
 };
 const schema = new Schema(lessonStudent, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });
@@ -23,6 +25,7 @@ schema.index({ student_id: 1 });
 schema.index({ pay_id: 1 });
 schema.index({ is_try: 1 });
 schema.index({ is_pay: 1 });
+schema.index({ is_sign: 1 });
 
 schema.plugin(metaPlugin);
 module.exports = app => {

+ 2 - 1
app/model/business/payOrder.js

@@ -1,6 +1,7 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 付款订单表
 const payOrder = {
@@ -10,7 +11,7 @@ const payOrder = {
   payer_role: { type: String, required: false, zh: '支付的用户角色' }, //
   pay_for: { type: String, required: false, zh: '支付原因' }, // lesson:上课,写表名等...; 学生上课(公开课/私教课):lessonStudent; 学生临时上课:tempLessonApply
   from_id: { type: String, required: false, zh: '关联id' }, // 支付原因的数据id.有就写,没有不写
-  money: { type: Number, required: false, zh: '金额' }, //
+  money: { type: Decimal128, required: false, zh: '金额' }, //
   time: { type: String, required: false, zh: '时间' }, //
   order_no: { type: String, required: false, zh: '订单号' }, //
   desc: { type: String, required: false, zh: '支付说明' }, //

+ 4 - 3
app/model/relation/relationCoachSchool.js

@@ -1,13 +1,14 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 
 // 教练与学校的关系表
 const relationCoachSchool = {
-  coach_id: { type: String, required: true, zh: '教练id', ref: 'Coach', getProp: ['name', 'phone', 'level', 'icon'] }, //
-  school_id: { type: String, required: true, zh: '学校id', ref: 'School', getProp: ['name', 'phone'] }, //
+  coach_id: { type: String, required: true, zh: '教练id', ref: 'Coach', getProp: [ 'name', 'phone', 'level', 'icon' ] }, //
+  school_id: { type: String, required: true, zh: '学校id', ref: 'School', getProp: [ 'name', 'phone' ] }, //
   doc: { type: Object, required: false, zh: '教练档案' }, //
-  money: { type: Number, zh: '工资' },
+  money: { type: Decimal128, zh: '工资' },
 };
 const schema = new Schema(relationCoachSchool, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });

+ 2 - 1
app/model/relation/relationStudentSchool.js

@@ -1,6 +1,7 @@
 'use strict';
 const Schema = require('mongoose').Schema;
 const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
+const { Decimal128 } = require('mongoose').Types;
 // 学生档案
 const doc = {
   is_past: { type: String, default: '0' }, // 往期学员: 0-当期;1-往期
@@ -12,7 +13,7 @@ const relationStudentSchool = {
   student_id: { type: String, required: false, zh: '学员id', ref: 'Student', getProp: [ 'name', 'icon', 'level', 'phone' ] }, //
   school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'img_url', 'name', 'phone', 'coach_num', 'student_num', 'address', 'brief' ] }, //
   doc: { type: Object, required: false, zh: '档案' }, //
-  money: { type: Number, zh: '余额' },
+  money: { type: Decimal128, zh: '余额' },
 };
 const schema = new Schema(relationStudentSchool, { toJSON: { virtuals: true } });
 schema.index({ id: 1 });

+ 11 - 0
app/schedule/task.js

@@ -0,0 +1,11 @@
+'use strict';
+module.exports = {
+  schedule: {
+    interval: '1m', // 1 分钟间隔
+    type: 'worker', // 指定所有的 worker 都需要执行
+    immediate: true,
+  },
+  async task(ctx) {
+    console.log('line 8 in function:');
+  },
+};

+ 1 - 0
app/service/relation/relationCoachSchool.js

@@ -20,6 +20,7 @@ class RelationCoachSchoolService extends CrudService {
     }
     throw new BusinessError(ErrorCode.DATA_EXISTED, '教练已在学校备案,无需重复添加');
   }
+
 }
 
 module.exports = RelationCoachSchoolService;