From ad9fd0f62dd65e488238c486dbed95ecdff285f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E6=B6=9B?= Date: Mon, 29 Aug 2022 11:07:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(bug):=E6=B8=85=E7=90=86=E8=BF=91=E4=B9=8E?= =?UTF-8?q?=E6=97=A0=E6=95=88=E7=9A=84=E7=BC=93=E5=AD=98=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3=E6=9D=83=E9=99=90?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/meter04kv.go | 8 ++++---- service/charge.go | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/controller/meter04kv.go b/controller/meter04kv.go index d080571..ca3fd0c 100644 --- a/controller/meter04kv.go +++ b/controller/meter04kv.go @@ -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("未找到指定的园区信息。") diff --git a/service/charge.go b/service/charge.go index 0e57c5c..3c575a2 100644 --- a/service/charge.go +++ b/service/charge.go @@ -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 }