Browse Source

update

master
dengbiao 6 months ago
parent
commit
a7c3baaae3
1 changed files with 20 additions and 2 deletions
  1. +20
    -2
      rule/one_circles/one_circles_community_dividends.go

+ 20
- 2
rule/one_circles/one_circles_community_dividends.go View File

@@ -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)


Loading…
Cancel
Save