MaiXinRong 2 gadi atpakaļ
vecāks
revīzija
59657194f1
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      app/service/pay.js

+ 3 - 3
app/service/pay.js

@@ -199,11 +199,11 @@ module.exports = app => {
         }
 
         async doDeleteStage(stage, transaction) {
-            await transaction.delete(this.tableName, { csid: id });
+            await transaction.delete(this.tableName, { csid: stage.id });
             if (stage.order > 1) {
                 const preStage = await this.ctx.service.stage.getDataByCondition({ tid: stage.tid, order: stage.order - 1});
-                const max = await this.db.query('SELECT MAX(stimes) as stimes, MAX(sorder) as sorder FROM ? WHERE sid = ?', [this.ctx.service.stagePay.tableName, preStage.id]);
-                const resortSql = `UPDATE ${this.tableName} p LEFT JOIN ${this.ctx.service.stagePay.tableName} sp ON p.id === sp.pid`+
+                const max = await this.db.queryOne('SELECT MAX(stimes) as stimes, MAX(sorder) as sorder FROM ?? WHERE sid = ?', [this.ctx.service.stagePay.tableName, preStage.id]);
+                const resortSql = `UPDATE ${this.tableName} p LEFT JOIN ${this.ctx.service.stagePay.tableName} sp ON p.id = sp.pid`+
                     '  SET p.`order` = sp.porder WHERE p.tid = ? and p.valid = 1 and sp.sid = ? and sp.stimes = ? and sp.sorder = ?';
                 await transaction.query(resortSql, [stage.tid, preStage.id, max.stimes, max.sorder]);
             }