From a7c3baaae3d94138482c990a9c3983a4c0dd674a Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 20 Apr 2024 18:58:05 +0800 Subject: [PATCH] update --- .../one_circles_community_dividends.go | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/rule/one_circles/one_circles_community_dividends.go b/rule/one_circles/one_circles_community_dividends.go index 77930ba..8382772 100644 --- a/rule/one_circles/one_circles_community_dividends.go +++ b/rule/one_circles/one_circles_community_dividends.go @@ -5,10 +5,12 @@ 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/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/enum" + zhios_order_relate_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils" zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/utils/logx" "errors" "fmt" "github.com/shopspring/decimal" + "time" "xorm.io/xorm" ) @@ -45,6 +47,7 @@ func CommunityDividends(engine *xorm.Engine, masterId string) (err error) { } }() session.Begin() + now := time.Now() for _, v := range list { //4、 给相应的用户加上分红权益 @@ -63,8 +66,23 @@ func CommunityDividends(engine *xorm.Engine, masterId string) (err error) { fmt.Println("err:::::33333", err) return err } + + //5、增加 one_circles_community_dividends_with_user_records 记录 + _, err = session.InsertOne(&model.OneCirclesCommunityDividendsWithUserRecords{ + Uid: v.Uid, + Value: zhios_order_relate_utils.Float64ToStr(singleValue), + RecordsId: m.Id, + CoinId: m.CoinId, + CreateAt: now.Format("2006-01-02 15:04:05"), + UpdateAt: now.Format("2006-01-02 15:04:05"), + }) + if err != nil { + _ = session.Rollback() + fmt.Println("err:::::insert", err) + return err + } } - //5、 减少“社区分红”钱包中的值 + //6、 减少“社区分红”钱包中的值 totalDividend, _ := totalValue.Float64() err = DealAvailableGreenEnergyCoin(session, int(enum.CommunityDividends), totalDividend, 0, enum.CommunityDividends.String(), oneCirclesGreenEnergyBasicSetting, oneCirclesGreenEnergyBasicSetting.NowPrice) if err != nil { @@ -73,7 +91,7 @@ func CommunityDividends(engine *xorm.Engine, masterId string) (err error) { return err } - //6、修改 one_circles_community_dividends 记录 + //7、修改 one_circles_community_dividends 记录 m.IsOver = 1 m.PersonsNum = len(list) affected, err := session.Where("id=?", m.Id).Cols("is_over", "persons_num").Update(m)