schedule.js 853 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. module.exports = app => {
  3. class Schedule extends app.BaseService {
  4. constructor(ctx) {
  5. super(ctx);
  6. this.tableName = 'schedule';
  7. }
  8. async saveMode(data) {
  9. const transaction = await this.db.beginTransaction();
  10. try {
  11. const options = {
  12. where: {
  13. tid: this.ctx.tender.id,
  14. },
  15. };
  16. const updateData = {
  17. mode: data,
  18. };
  19. await transaction.update(this.tableName, updateData, options);
  20. await transaction.commit();
  21. return true;
  22. } catch (err) {
  23. await transaction.rollback();
  24. throw err;
  25. }
  26. }
  27. }
  28. return Schedule;
  29. };