From 9be27efdce564a475d6b515e6203299095b5818d Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 25 Apr 2024 11:07:43 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=80=E4=B8=AA=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...cles_deal_available_green_energy_points.go | 66 +++++++++---------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/rule/one_circles/one_circles_deal_available_green_energy_points.go b/rule/one_circles/one_circles_deal_available_green_energy_points.go index 5b6341e..87ff0c5 100644 --- a/rule/one_circles/one_circles_deal_available_green_energy_points.go +++ b/rule/one_circles/one_circles_deal_available_green_energy_points.go @@ -5,9 +5,7 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db/model" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/enum" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/md" - zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" "encoding/json" - "errors" "github.com/shopspring/decimal" "time" "xorm.io/xorm" @@ -451,44 +449,44 @@ func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amoun //更新 `one_circles_green_energy_basic_setting` 表 if chain.NowPrice != nowPriceValue { chain.NowPrice = nowPriceValue - // 新增 / 更新 one_circles_green_energy_price 记录 - date := now.Format("2006-01-02") - hour := zhios_order_relate_utils.IntToStr(now.Hour()) - oneCirclesGreenEnergyPrice, err := db.OneCirclesGreenEnergyPriceGetOneByParamsBySession(session, date, hour) + _, err := db.OneCirclesGreenEnergyBasicSettingUpdate(session, chain.Id, chain, "now_price") if err != nil { return err } - if oneCirclesGreenEnergyPrice == nil { - oneCirclesGreenEnergyPrice = &model.OneCirclesGreenEnergyPrice{ - Price: nowPriceValue, - Date: date, - Hour: hour, - } - insertId, err1 := db.OneCirclesGreenEnergyPriceInsertBySession(session, oneCirclesGreenEnergyPrice) - if err1 != nil { - return err1 - } - if insertId <= 0 { - return errors.New("插入 one_circles_green_energy_price 失败") - } - } else { - oneCirclesGreenEnergyPrice.Price = nowPriceValue - _, err1 := db.OneCirclesGreenEnergyPriceUpdate(session, oneCirclesGreenEnergyPrice.Id, oneCirclesGreenEnergyPrice, "price") - if err1 != nil { - return err1 - } - //if updateAffected <= 0 { - // return errors.New("更新 one_circles_green_energy_price 失败") - //} - } - } - _, err := db.OneCirclesGreenEnergyBasicSettingUpdate(session, chain.Id, chain) - if err != nil { - return err + //// 新增 / 更新 one_circles_green_energy_price 记录 + //date := now.Format("2006-01-02") + //hour := zhios_order_relate_utils.IntToStr(now.Hour()) + //oneCirclesGreenEnergyPrice, err := db.OneCirclesGreenEnergyPriceGetOneByParamsBySession(session, date, hour) + //if err != nil { + // return err + //} + //if oneCirclesGreenEnergyPrice == nil { + // oneCirclesGreenEnergyPrice = &model.OneCirclesGreenEnergyPrice{ + // Price: nowPriceValue, + // Date: date, + // Hour: hour, + // } + // insertId, err1 := db.OneCirclesGreenEnergyPriceInsertBySession(session, oneCirclesGreenEnergyPrice) + // if err1 != nil { + // return err1 + // } + // if insertId <= 0 { + // return errors.New("插入 one_circles_green_energy_price 失败") + // } + //} else { + // oneCirclesGreenEnergyPrice.Price = nowPriceValue + // _, err1 := db.OneCirclesGreenEnergyPriceUpdate(session, oneCirclesGreenEnergyPrice.Id, oneCirclesGreenEnergyPrice, "price") + // if err1 != nil { + // return err1 + // } + // //if updateAffected <= 0 { + // // return errors.New("更新 one_circles_green_energy_price 失败") + // //} + //} } //插入 `one_circles_available_green_energy_points_flow` 记录 - _, err = db.OneCirclesAvailableGreenEnergyPointsFlowInsert(session, &oneCirclesAvailableGreenEnergyPointsFlow) + _, err := db.OneCirclesAvailableGreenEnergyPointsFlowInsert(session, &oneCirclesAvailableGreenEnergyPointsFlow) if err != nil { return err }