ellisran il y a 1 semaine
Parent
commit
b6fe681cf3
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      app/service/material_exponent_shard.js

+ 2 - 1
app/service/material_exponent_shard.js

@@ -76,7 +76,8 @@ module.exports = app => {
             for (const nu of needUpdateArray) {
             for (const nu of needUpdateArray) {
                 if (data[nu] !== undefined && mesInfo[nu] !== data[nu]) updateData[nu] = data[nu];
                 if (data[nu] !== undefined && mesInfo[nu] !== data[nu]) updateData[nu] = data[nu];
             }
             }
-            await transaction.update(this.tableName, updateData);
+            // 如果只有id,则不更新
+            if (Object.keys(updateData).length > 1) await transaction.update(this.tableName, updateData);
             if (updateData.m_price !== undefined || updateData.weight_num !== undefined || needCalc) {
             if (updateData.m_price !== undefined || updateData.weight_num !== undefined || needCalc) {
                 const mnInfo = mn_id ? await transaction.get(this.ctx.service.materialExponentNode.tableName, { mid: this.ctx.material.id, id: mn_id }) : null;
                 const mnInfo = mn_id ? await transaction.get(this.ctx.service.materialExponentNode.tableName, { mid: this.ctx.material.id, id: mn_id }) : null;
                 const msInfo = ms_id && !mn_id ? await transaction.get(this.ctx.service.materialStage.tableName, { mid: this.ctx.material.id, id: ms_id }) : null;
                 const msInfo = ms_id && !mn_id ? await transaction.get(this.ctx.service.materialStage.tableName, { mid: this.ctx.material.id, id: ms_id }) : null;