From 80ccb1e7346b83407adc2005f8d9e0fb70facbf8 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 26 Feb 2024 22:20:43 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=80=E4=B8=AA=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_one_circles_green_energy_price.go | 5 ++--- .../one_circles_deal_available_green_energy_points.go | 7 ++----- .../one_circles_public_platoon_give_activty_coin.go | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/db/db_one_circles_green_energy_price.go b/db/db_one_circles_green_energy_price.go index e2d7365..a2ce44c 100644 --- a/db/db_one_circles_green_energy_price.go +++ b/db/db_one_circles_green_energy_price.go @@ -84,10 +84,9 @@ func OneCirclesGreenEnergyPriceUpdate(session *xorm.Session, id interface{}, One } // OneCirclesGreenEnergyPriceGetOneByParamsBySession 通过传入的参数查询数据(单条) -func OneCirclesGreenEnergyPriceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.OneCirclesGreenEnergyPrice, error) { +func OneCirclesGreenEnergyPriceGetOneByParamsBySession(session *xorm.Session, date, hour string) (*model.OneCirclesGreenEnergyPrice, error) { var m model.OneCirclesGreenEnergyPrice - var query = fmt.Sprintf("%s =?", params["key"]) - has, err := session.Where(query, params["value"]).Desc("hour").Get(&m) + has, err := session.Where("date =? and hour =?", date, hour).Get(&m) if err != nil { return nil, zhios_order_relate_logx.Error(err) } diff --git a/rule/one_circles/one_circles_deal_available_green_energy_points.go b/rule/one_circles/one_circles_deal_available_green_energy_points.go index 04be7b8..21dbd9d 100644 --- a/rule/one_circles/one_circles_deal_available_green_energy_points.go +++ b/rule/one_circles/one_circles_deal_available_green_energy_points.go @@ -394,14 +394,11 @@ func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amoun // 新增 / 更新 one_circles_green_energy_price 记录 date := now.Format("2006-01-02") hour := zhios_order_relate_utils.IntToStr(now.Hour()) - oneCirclesGreenEnergyPrice, err := db.OneCirclesGreenEnergyPriceGetOneByParamsBySession(session, map[string]interface{}{ - "key": "date", - "value": date, - }) + oneCirclesGreenEnergyPrice, err := db.OneCirclesGreenEnergyPriceGetOneByParamsBySession(session, date, hour) if err != nil { return err } - if oneCirclesGreenEnergyPrice == nil || oneCirclesGreenEnergyPrice.Hour != hour { + if oneCirclesGreenEnergyPrice == nil { oneCirclesGreenEnergyPrice = &model.OneCirclesGreenEnergyPrice{ Price: nowPriceValue, Date: date, diff --git a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go index ce40f85..50fdf51 100644 --- a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go +++ b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go @@ -216,7 +216,7 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid watchAdDate = time.Now().Add(time.Duration(zhios_order_relate_utils.StrToInt64(videoRewardSystem.IntervalMinutes)) * time.Minute).Format("2006-01-02 15:04:05") //watchAdDate = oneCirclesUserWatchRecords.NextWatchAdDate.Format("2006-01-02 15:04:05") } - cache.SetEx(redisKey, watchAdDate, 60*60*12) //TODO::默认缓存1小时 + cache.SetEx(redisKey, watchAdDate, 60*60*24) //TODO::默认缓存1小时 } return }