From 7fd99ebbd86af3cbc1299b6a51ae8c66ff50fba5 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 12 Dec 2024 10:53:40 +0800 Subject: [PATCH] update --- .../public_platoon/hdl_basic.go | 3 +- .../svc/svc_egg_energy_auto_record_price.go | 31 +++++++------------ app/task/svc/svc_egg_energy_deal_fund_data.go | 2 +- ...c_egg_energy_deal_platform_revenue_data.go | 2 +- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/app/hdl/institutional_management/public_platoon/hdl_basic.go b/app/hdl/institutional_management/public_platoon/hdl_basic.go index db2b6ad..b72a16c 100644 --- a/app/hdl/institutional_management/public_platoon/hdl_basic.go +++ b/app/hdl/institutional_management/public_platoon/hdl_basic.go @@ -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{}{ diff --git a/app/task/svc/svc_egg_energy_auto_record_price.go b/app/task/svc/svc_egg_energy_auto_record_price.go index 2f5125d..10e7a98 100644 --- a/app/task/svc/svc_egg_energy_auto_record_price.go +++ b/app/task/svc/svc_egg_energy_auto_record_price.go @@ -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 } diff --git a/app/task/svc/svc_egg_energy_deal_fund_data.go b/app/task/svc/svc_egg_energy_deal_fund_data.go index 245648c..48a494f 100644 --- a/app/task/svc/svc_egg_energy_deal_fund_data.go +++ b/app/task/svc/svc_egg_energy_deal_fund_data.go @@ -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分钟 diff --git a/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go b/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go index 69b532b..541deca 100644 --- a/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go +++ b/app/task/svc/svc_egg_energy_deal_platform_revenue_data.go @@ -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分钟