Преглед изворни кода

update 一个圈圈

master
dengbiao пре 8 месеци
родитељ
комит
9be27efdce
1 измењених фајлова са 32 додато и 34 уклоњено
  1. +32
    -34
      rule/one_circles/one_circles_deal_available_green_energy_points.go

+ 32
- 34
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/db/model"
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/enum" "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" 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" "encoding/json"
"errors"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
"time" "time"
"xorm.io/xorm" "xorm.io/xorm"
@@ -451,44 +449,44 @@ func DealAvailableGreenEnergyCoin(session *xorm.Session, kind int, amount, amoun
//更新 `one_circles_green_energy_basic_setting` 表 //更新 `one_circles_green_energy_basic_setting` 表
if chain.NowPrice != nowPriceValue { if chain.NowPrice != nowPriceValue {
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 { if err != nil {
return err 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` 记录 //插入 `one_circles_available_green_energy_points_flow` 记录
_, err = db.OneCirclesAvailableGreenEnergyPointsFlowInsert(session, &oneCirclesAvailableGreenEnergyPointsFlow)
_, err := db.OneCirclesAvailableGreenEnergyPointsFlowInsert(session, &oneCirclesAvailableGreenEnergyPointsFlow)
if err != nil { if err != nil {
return err return err
} }


Loading…
Откажи
Сачувај