enhance(god):增加清理关联缓存。
This commit is contained in:
parent
0ec7f5fba1
commit
97bad80784
|
@ -1,9 +1,11 @@
|
||||||
package service
|
package service
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"electricity_bill_calc/cache"
|
||||||
"electricity_bill_calc/exceptions"
|
"electricity_bill_calc/exceptions"
|
||||||
"electricity_bill_calc/global"
|
"electricity_bill_calc/global"
|
||||||
"electricity_bill_calc/model"
|
"electricity_bill_calc/model"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/samber/lo"
|
"github.com/samber/lo"
|
||||||
|
@ -163,7 +165,6 @@ func (_GodModeService) resetEndUserRecords(tx *xorm.Session, reportId string) (b
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,6 +237,7 @@ func (g _GodModeService) ClearReportSummary(reportId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("report_%s", reportId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,6 +258,7 @@ func (g _GodModeService) ClearReportMaintenances(reportId string) (bool, error)
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("report_%s", reportId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +279,8 @@ func (g _GodModeService) ResetEndUserRegisterRecords(reportId string) (bool, err
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("end_user_detail")
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("report_%s", reportId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,6 +317,8 @@ func (g _GodModeService) ResetReport(reportId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("end_user_detail")
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("report_%s", reportId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +346,9 @@ func (g _GodModeService) DeleteReport(reportId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("end_user_detail")
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("report_%s", reportId))
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,6 +427,8 @@ func (g _GodModeService) RemoveSpecificMaintenance(parkId, maintenanceId string)
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("maintenance_fee")
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("maintenance_fee_%s", maintenanceId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +449,7 @@ func (g _GodModeService) RemoveAllMaintenance(parkId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("maintenance_fee")
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,6 +470,7 @@ func (g _GodModeService) RemoveAllMeters(parkId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("meter_04kv")
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +530,8 @@ func (g _GodModeService) RemovePark(parkId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation("park")
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("park_%s", parkId))
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,5 +582,9 @@ func (g _GodModeService) DeleteUser(userId string) (bool, error) {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
cache.AbolishRelation(fmt.Sprintf("user_%s", userId))
|
||||||
|
cache.AbolishRelation("user")
|
||||||
|
cache.AbolishRelation("park")
|
||||||
|
cache.AbolishRelation("report")
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user