Browse Source

update

master
dengbiao 1 day ago
parent
commit
2453fe4b5a
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      rule/egg_energy/star_level_dividends.go

+ 6
- 6
rule/egg_energy/star_level_dividends.go View File

@@ -24,17 +24,17 @@ const SettlementStarLevelDividendsLockKey = "settlement_star_level_dividends_loc
func SettlementStarLevelDividends(engine *xorm.Engine, ch *rabbit.Channel) (err error) { func SettlementStarLevelDividends(engine *xorm.Engine, ch *rabbit.Channel) (err error) {
now := time.Now() now := time.Now()
fmt.Println(now.Hour()) fmt.Println(now.Hour())
if !(now.Hour() > 1 && now.Hour() < 8) {
//TODO::只在凌晨1点 ~ 凌晨 8 点运行
return errors.New("非运行时间")
}
//if !(now.Hour() > 1 && now.Hour() < 8) {
// //TODO::只在凌晨1点 ~ 凌晨 8 点运行
// return errors.New("非运行时间")
//}
//TODO::增加“悲观锁”防止串行 //TODO::增加“悲观锁”防止串行
getString, _ := cache.GetString(SettlementStarLevelDividendsLockKey) getString, _ := cache.GetString(SettlementStarLevelDividendsLockKey)
if getString != "" { if getString != "" {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次结算未执行完") fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次结算未执行完")
return errors.New("上一次结算未执行完") return errors.New("上一次结算未执行完")
} }
cache.SetEx(SettlementStarLevelDividendsLockKey, "running", 3600*8) //8小时
cache.SetEx(SettlementStarLevelDividendsLockKey, "running", 3600*12) //8小时


//1、查找 `egg_energy_basic_setting` 基础设置 //1、查找 `egg_energy_basic_setting` 基础设置
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine)
@@ -214,7 +214,7 @@ func SettlementStarLevelDividends(engine *xorm.Engine, ch *rabbit.Channel) (err


if len(userSignInArr) > 0 { if len(userSignInArr) > 0 {
var users []*model.User var users []*model.User
err = session.In("uid", userSignInArr).Find(&users)
err = session.In("id", userSignInArr).Find(&users)
if err != nil { if err != nil {
fmt.Println("err:::::7777777", err) fmt.Println("err:::::7777777", err)
return err return err


Loading…
Cancel
Save