From f7007d4825bb1d0cbde31bd1d8b03a6ee1704a6a Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 20 May 2024 16:41:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_regional_agent_user_belong.go | 9 +++++++++ rule/regional_agent.go | 8 +++++--- rule/regional_sub_agent.go | 8 +++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/db/db_regional_agent_user_belong.go b/db/db_regional_agent_user_belong.go index 0e8b45f..45ba04e 100644 --- a/db/db_regional_agent_user_belong.go +++ b/db/db_regional_agent_user_belong.go @@ -255,6 +255,15 @@ func VirtualCoinFindByParams(Db *xorm.Engine, params map[string]interface{}) (*[ } } +func VirtualCoinFindByAll(Db *xorm.Engine) (*[]model.VirtualCoin, error) { + var m []model.VirtualCoin + //查询全部数据 + err := Db.Find(&m) + if err != nil { + return nil, err + } + return &m, nil +} func RegionalAgentCalcSystemRelateInsert(Db *xorm.Engine, regionalAgentCalcSystemRelate *model.RegionalAgentCalcSystemRelate) (int64, error) { _, err := Db.InsertOne(regionalAgentCalcSystemRelate) if err != nil { diff --git a/rule/regional_agent.go b/rule/regional_agent.go index 315b81f..df4bde4 100644 --- a/rule/regional_agent.go +++ b/rule/regional_agent.go @@ -77,13 +77,15 @@ func HandleCommissionDistributionSystem(engine *xorm.Engine, args *md.RegionalAg } //查询 virtual_coin 获取虚拟货币的 “兑换比例” - virtualCoin, err := db.VirtualCoinFindByParams(engine, map[string]interface{}{}) + virtualCoin, err := db.VirtualCoinFindByAll(engine) if err != nil { return nil, false } var virtualCoinMap = map[int]string{} - for _, v := range *virtualCoin { - virtualCoinMap[v.Id] = v.ExchangeRatio + if virtualCoin != nil { + for _, v := range *virtualCoin { + virtualCoinMap[v.Id] = v.ExchangeRatio + } } //查询代理网点的代理(网点、区、市、省)信息 var parents, tempParents []map[string]interface{} diff --git a/rule/regional_sub_agent.go b/rule/regional_sub_agent.go index 8319f35..3cce2d6 100644 --- a/rule/regional_sub_agent.go +++ b/rule/regional_sub_agent.go @@ -77,13 +77,15 @@ func HandleSubCommissionDistributionSystem(engine *xorm.Engine, args *md.Regiona } //查询 virtual_coin 获取虚拟货币的 “兑换比例” - virtualCoin, err := db.VirtualCoinFindByParams(engine, map[string]interface{}{}) + virtualCoin, err := db.VirtualCoinFindByAll(engine) if err != nil { return nil, false } var virtualCoinMap = map[int]string{} - for _, v := range *virtualCoin { - virtualCoinMap[v.Id] = v.ExchangeRatio + if virtualCoin != nil { + for _, v := range *virtualCoin { + virtualCoinMap[v.Id] = v.ExchangeRatio + } } //查询代理网点的代理(网点、区、市、省)信息 var parents, tempParents []map[string]interface{}