@@ -84,10 +84,9 @@ func OneCirclesGreenEnergyPriceUpdate(session *xorm.Session, id interface{}, One | |||||
} | } | ||||
// OneCirclesGreenEnergyPriceGetOneByParamsBySession 通过传入的参数查询数据(单条) | // 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 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 { | if err != nil { | ||||
return nil, zhios_order_relate_logx.Error(err) | return nil, zhios_order_relate_logx.Error(err) | ||||
} | } | ||||
@@ -394,14 +394,11 @@ func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amoun | |||||
// 新增 / 更新 one_circles_green_energy_price 记录 | // 新增 / 更新 one_circles_green_energy_price 记录 | ||||
date := now.Format("2006-01-02") | date := now.Format("2006-01-02") | ||||
hour := zhios_order_relate_utils.IntToStr(now.Hour()) | 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 { | if err != nil { | ||||
return err | return err | ||||
} | } | ||||
if oneCirclesGreenEnergyPrice == nil || oneCirclesGreenEnergyPrice.Hour != hour { | |||||
if oneCirclesGreenEnergyPrice == nil { | |||||
oneCirclesGreenEnergyPrice = &model.OneCirclesGreenEnergyPrice{ | oneCirclesGreenEnergyPrice = &model.OneCirclesGreenEnergyPrice{ | ||||
Price: nowPriceValue, | Price: nowPriceValue, | ||||
Date: date, | Date: date, | ||||
@@ -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 = 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") | //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 | return | ||||
} | } | ||||