Browse Source

update

master
shenjiachi 6 days ago
parent
commit
7fd99ebbd8
4 changed files with 15 additions and 23 deletions
  1. +2
    -1
      app/hdl/institutional_management/public_platoon/hdl_basic.go
  2. +11
    -20
      app/task/svc/svc_egg_energy_auto_record_price.go
  3. +1
    -1
      app/task/svc/svc_egg_energy_deal_fund_data.go
  4. +1
    -1
      app/task/svc/svc_egg_energy_deal_platform_revenue_data.go

+ 2
- 1
app/hdl/institutional_management/public_platoon/hdl_basic.go View File

@@ -223,7 +223,8 @@ func GetRelationshipMap(c *gin.Context) {
return
}
if user == nil {
e.OutErr(c, e.ERR_NO_DATA, errors.New("手机号不存在"))
var list *md.TreeNode
e.OutSuc(c, list, nil)
return
}
relation, err = userRelationDb.PublicPlatoonUserRelationGetOneByParams(map[string]interface{}{


+ 11
- 20
app/task/svc/svc_egg_energy_auto_record_price.go View File

@@ -7,7 +7,6 @@ import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"code.fnuoos.com/EggPlanet/egg_system_rules.git"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc"
"errors"
"fmt"
"time"
"xorm.io/xorm"
@@ -50,32 +49,24 @@ func EggEnergyAutoRecordPrices(engine *xorm.Engine) {
// 3. 当前时间已经有记录 更新价格
if lastPrice.Date == dateNowStr && lastPrice.Hour == hourNowStr {
lastPrice.Price = eggEnergyCoreData.NowPrice
affected, err2 := priceDb.EggEnergyPriceUpdate(lastPrice)
_, err2 := priceDb.EggEnergyPriceUpdate(lastPrice)
if err2 != nil {
fmt.Println("SaveEggEnergyPrice_ERR:::::", err2.Error())
return
}
if affected == 0 {
fmt.Println("SaveEggEnergyPrice_ERR:::::", errors.New(fmt.Sprintf("%s 新增价格失败, 当前价格 %s", now.Format("2006-01-02 15:04:05"), eggEnergyCoreData.NowPrice)))
} else {
// 4. 保存当前价格
priceData := model.EggEnergyPrice{
Price: eggEnergyCoreData.NowPrice,
Date: dateNowStr,
Hour: hourNowStr,
}
_, err2 := priceDb.EggEnergyPriceInsert(&priceData)
if err2 != nil {
fmt.Println("SaveEggEnergyPrice_ERR:::::", err2.Error())
return
}
}
} else {
// 4. 保存当前价格
priceData := model.EggEnergyPrice{
Price: eggEnergyCoreData.NowPrice,
Date: dateNowStr,
Hour: hourNowStr,
}
id, err2 := priceDb.EggEnergyPriceInsert(&priceData)
if err2 != nil {
fmt.Println("SaveEggEnergyPrice_ERR:::::", err2.Error())
return
}
if id == 0 {
fmt.Println("SaveEggEnergyPrice_ERR:::::", errors.New(fmt.Sprintf("%s 新增价格失败, 当前价格 %s", now.Format("2006-01-02 15:04:05"), eggEnergyCoreData.NowPrice)))
return
}
}
return
}

+ 1
- 1
app/task/svc/svc_egg_energy_deal_fund_data.go View File

@@ -27,7 +27,7 @@ func EggEnergyDealFundData(eg *xorm.Engine) {
// 悲观锁防止串行
getString, _ := cache.GetString(EggEnergyDealFundDataKey)
if getString != "" {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次处理未执行完")
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "FundData 上一次处理未执行完")
return
}
cache.SetEx(EggEnergyDealFundDataKey, "running", 60*30) //30分钟


+ 1
- 1
app/task/svc/svc_egg_energy_deal_platform_revenue_data.go View File

@@ -27,7 +27,7 @@ func EggEnergyDealPlatformRevenueData(eg *xorm.Engine) {
// 悲观锁防止串行
getString, _ := cache.GetString(EggEnergyDealPlatformRevenueDataKey)
if getString != "" {
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "上一次处理未执行完")
fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", "Platform Revenue Data 上一次处理未执行完")
return
}
cache.SetEx(EggEnergyDealPlatformRevenueDataKey, "running", 60*30) //30分钟


Loading…
Cancel
Save