fix(god):补充遗漏的抄表记录字段。

This commit is contained in:
徐涛 2022-09-06 18:52:25 +08:00
parent c3324128d0
commit 2e8bbf2b99

View File

@ -6,6 +6,7 @@ import (
"electricity_bill_calc/global"
"electricity_bill_calc/model"
"fmt"
"log"
"time"
"github.com/samber/lo"
@ -91,6 +92,7 @@ func (_GodModeService) resetEndUserRecords(tx *xorm.Session, reportId string) (b
err := tx.Where(builder.Eq{"report_id": reportId}).Find(&records)
if err != nil {
tx.Rollback()
log.Printf("[debug] [god mode] err: %+v", err)
return false, err
}
for _, u := range records {
@ -121,6 +123,7 @@ func (_GodModeService) resetEndUserRecords(tx *xorm.Session, reportId string) (b
u.LossFeeDiluted.Valid = false
u.MaintenanceFeeDiluted.Valid = false
u.FinalDiluted.Valid = false
u.PublicConsumptionDiluted.Valid = false
u.FinalCharge.Valid = false
affected, err := tx.
@ -156,7 +159,7 @@ func (_GodModeService) resetEndUserRecords(tx *xorm.Session, reportId string) (b
"final_diluted",
"final_charge",
).
Update(&u)
Update(u)
if err != nil {
tx.Rollback()
return false, err