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{}