|
@@ -125,17 +125,23 @@ module.exports = app => {
|
|
|
let rst = null;
|
|
|
this.transaction = await this.db.beginTransaction();
|
|
|
try {
|
|
|
- const data = {
|
|
|
- id,
|
|
|
- prj_id,
|
|
|
- stage_id,
|
|
|
- business_id,
|
|
|
- tender_id,
|
|
|
- business_type: rptArchiveConst.getBusinessType(stage_id),
|
|
|
- content: JSON.stringify(archiveArr),
|
|
|
- };
|
|
|
// console.log(data);
|
|
|
- rst = await this.transaction.update(this.tableName, data);
|
|
|
+ // rst = await this.transaction.update(this.tableName, data);
|
|
|
+ if (archiveArr.length === 0) {
|
|
|
+ await this.transaction.delete(this.tableName, { id });
|
|
|
+ await this.transaction.update(this.ctx.service.stage.tableName, { id: stage_id, rpt_filed: 0 });
|
|
|
+ } else {
|
|
|
+ const data = {
|
|
|
+ id,
|
|
|
+ prj_id,
|
|
|
+ stage_id,
|
|
|
+ business_id,
|
|
|
+ tender_id,
|
|
|
+ business_type: rptArchiveConst.getBusinessType(stage_id),
|
|
|
+ content: JSON.stringify(archiveArr),
|
|
|
+ };
|
|
|
+ rst = await this.transaction.update(this.tableName, data);
|
|
|
+ }
|
|
|
await this.transaction.commit();
|
|
|
} catch (ex) {
|
|
|
console.log(ex);
|