fix(bug):清理近乎无效的缓存,修正部分接口权限。
This commit is contained in:
parent
afea03a8e3
commit
ad9fd0f62d
|
@ -18,7 +18,7 @@ import (
|
|||
)
|
||||
|
||||
func InitializeMeter04kVController(router *gin.Engine) {
|
||||
router.GET("/park/:pid/meter/template", security.EnterpriseAuthorize, download04kvMeterArchiveTemplate)
|
||||
router.GET("/park/:pid/meter/template", download04kvMeterArchiveTemplate)
|
||||
router.GET("/park/:pid/meters", security.EnterpriseAuthorize, ListPaged04kVMeter)
|
||||
router.GET("/park/:pid/meter/:code", security.EnterpriseAuthorize, fetch04kVMeterDetail)
|
||||
router.POST("/park/:pid/meter", security.EnterpriseAuthorize, createSingle04kVMeter)
|
||||
|
@ -29,9 +29,9 @@ func InitializeMeter04kVController(router *gin.Engine) {
|
|||
func download04kvMeterArchiveTemplate(c *gin.Context) {
|
||||
result := response.NewResult(c)
|
||||
requestParkId := c.Param("pid")
|
||||
if !ensureParkBelongs(c, result, requestParkId) {
|
||||
return
|
||||
}
|
||||
// if !ensureParkBelongs(c, result, requestParkId) {
|
||||
// return
|
||||
// }
|
||||
parkDetail, err := service.ParkService.FetchParkDetail(requestParkId)
|
||||
if err != nil {
|
||||
result.NotFound("未找到指定的园区信息。")
|
||||
|
|
|
@ -155,6 +155,8 @@ func (c _ChargeService) CancelCharge(seq int64, uid string) error {
|
|||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
cache.AbolishRelation("user")
|
||||
cache.AbolishRelation(fmt.Sprintf("user_%s", uid))
|
||||
cache.AbolishRelation("charge")
|
||||
cache.AbolishRelation(fmt.Sprintf("charge_%s_%d", uid, seq))
|
||||
return nil
|
||||
|
@ -233,9 +235,6 @@ func (_ChargeService) ListPagedChargeRecord(keyword, beginDate, endDate string,
|
|||
}
|
||||
|
||||
func (_ChargeService) lastValidChargeTo(uid string) (time.Time, error) {
|
||||
if cachedValid, _ := cache.RetreiveSearch[time.Time]("last_valid_charge", uid); cachedValid != nil {
|
||||
return *cachedValid, nil
|
||||
}
|
||||
veryBlankTime, _ := time.Parse("2006-01-02 15:04:05", "0001-01-01 00:00:00")
|
||||
var records []string
|
||||
err := global.DBConn.
|
||||
|
@ -257,6 +256,5 @@ func (_ChargeService) lastValidChargeTo(uid string) (time.Time, error) {
|
|||
return acc
|
||||
}
|
||||
}, veryBlankTime)
|
||||
cache.CacheSearch(lastValid, []string{"charge"}, "last_valid_charge", uid)
|
||||
return lastValid, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user