Browse Source

update 一个圈圈

master
DengBiao 9 months ago
parent
commit
80ccb1e734
3 changed files with 5 additions and 9 deletions
  1. +2
    -3
      db/db_one_circles_green_energy_price.go
  2. +2
    -5
      rule/one_circles/one_circles_deal_available_green_energy_points.go
  3. +1
    -1
      rule/one_circles/one_circles_public_platoon_give_activty_coin.go

+ 2
- 3
db/db_one_circles_green_energy_price.go View File

@@ -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)
}


+ 2
- 5
rule/one_circles/one_circles_deal_available_green_energy_points.go View File

@@ -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,


+ 1
- 1
rule/one_circles/one_circles_public_platoon_give_activty_coin.go View File

@@ -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
}


Loading…
Cancel
Save