message.js 413 B

1234567891011121314151617181920
  1. 'use strict';
  2. const Service = require('egg').Service;
  3. class MessageService extends Service {
  4. async add( data ) {
  5. let mysql = this.app.mysql;
  6. data.add_time = mysql.literals.now;
  7. console.log( data );
  8. let ret = await mysql.insert("train_records_message", data);
  9. return {id: ret.insertId};
  10. }
  11. }
  12. module.exports = MessageService;