|
|
@@ -7,11 +7,17 @@ import ( |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"github.com/shopspring/decimal" |
|
|
|
"time" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
// AutoReleaseExchangeGreenEnergy 结算绿色能量自动释放成可用绿色能量 |
|
|
|
func AutoReleaseExchangeGreenEnergy(engine *xorm.Engine, masterId string) (err error) { |
|
|
|
now := time.Now() |
|
|
|
if now.Hour() > 1 && now.Hour() > 8 { |
|
|
|
//TODO::只在凌晨一点 ~ 凌晨 8 点运行 |
|
|
|
return errors.New("非运行时间") |
|
|
|
} |
|
|
|
//1、查找 `one_circles_green_energy_basic_setting` 基础设置 && `one_circles_public_platoon_basic_setting` 基础设置 |
|
|
|
oneCirclesGreenEnergyBasicSetting, err := db.OneCirclesGreenEnergyBasicSettingGetOneByParams(engine, map[string]interface{}{ |
|
|
|
"key": "is_open", |
|
|
|