spec_pull.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date 2018/9/26
  7. * @version
  8. */
  9. module.exports = app => {
  10. class SpecPull extends app.BaseService {
  11. /**
  12. * 构造函数
  13. *
  14. * @param {Object} ctx - egg全局变量
  15. * @return {void}
  16. */
  17. constructor(ctx) {
  18. super(ctx);
  19. this.tableName = 's2b_spec_pull';
  20. }
  21. async syncLedger (pid) {
  22. const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'sync-ledger' });
  23. return pull;
  24. }
  25. async syncRevise(pid) {
  26. const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'sync-revise' });
  27. return pull;
  28. }
  29. async loadWbsFile(pid) {
  30. const pull = await this.getDataByCondition({ pid, valid: 1, pull_type: 'load-wbs-info' });
  31. if (pull) {
  32. pull.extra_option = pull.extra_option ? JSON.parse(pull.extra_option) : {};
  33. delete pull.info;
  34. }
  35. return pull;
  36. }
  37. }
  38. return SpecPull;
  39. };