dengbiao il y a 5 mois
Parent
révision
16b4f4dc3f
4 fichiers modifiés avec 32 ajouts et 18 suppressions
  1. +9
    -0
      db/db_regional_agent_user_belong.go
  2. +1
    -0
      db/model/regional_agent_base.go
  3. +11
    -9
      rule/regional_agent.go
  4. +11
    -9
      rule/regional_sub_agent.go

+ 9
- 0
db/db_regional_agent_user_belong.go Voir le fichier

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


+ 1
- 0
db/model/regional_agent_base.go Voir le fichier

@@ -36,4 +36,5 @@ type RegionalAgentBase struct {
AutoAddRegion int `json:"auto_add_region" xorm:"default 0 comment('自动加入网点设置:1、自动获取位置并加入网点 2、手动选择网点加入') TINYINT(4)"`
CustomerSetRegion int `json:"customer_set_region" xorm:"default 0 comment('网点自定义设置:1、用户可以手动添加网点 2、只允许后台添加网点') TINYINT(4)"`
SiteOfMinimumSeparationDistance string `json:"site_of_minimum_separation_distance" xorm:"comment('网点之间最小间隔距离(单位:km)') VARCHAR(255)"`
CoinIdList string `json:"coin_id_list" xorm:"comment('') VARCHAR(255)"`
}

+ 11
- 9
rule/regional_agent.go Voir le fichier

@@ -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{}
@@ -301,17 +303,17 @@ func CommAmount(CommissionRate float64, amount float64, agentUser *[]model.Regio
} else {
temp["divide_amount"] = everyPersonDivideAmount
var coinSetDetailMap []map[string]interface{}
for _, v := range coinSetDetail {
for _, v1 := range coinSetDetail {
var exchangeRatio float64
if zhios_order_relate_utils.AnyToFloat64(virtualCoin[v.CoinID]) != 0 {
exchangeRatio = zhios_order_relate_utils.AnyToFloat64(virtualCoin[v.CoinID])
if zhios_order_relate_utils.AnyToFloat64(virtualCoin[v1.CoinID]) != 0 {
exchangeRatio = zhios_order_relate_utils.AnyToFloat64(virtualCoin[v1.CoinID])
} else {
exchangeRatio = 0
}
coinSetDetailMap = append(coinSetDetailMap, map[string]interface{}{
"coin_id": v.CoinID,
"coin_name": v.CoinName,
"divide_value": zhios_order_relate_utils.AnyToFloat64(temp["divide_amount"]) * (zhios_order_relate_utils.AnyToFloat64(v.Value) / 100) * exchangeRatio,
"coin_id": v1.CoinID,
"coin_name": v1.CoinName,
"divide_value": zhios_order_relate_utils.AnyToFloat64(temp["divide_amount"]) * (zhios_order_relate_utils.AnyToFloat64(v1.Value) / 100) * exchangeRatio,
})
}
temp["divide_virtual_currency"] = coinSetDetailMap


+ 11
- 9
rule/regional_sub_agent.go Voir le fichier

@@ -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{}
@@ -265,17 +267,17 @@ func SubCommAmount(parentUid int, CommissionRate float64, amount float64, agentU
} else {
temp["divide_amount"] = everyPersonDivideAmount
var coinSetDetailMap []map[string]interface{}
for _, v := range coinSetDetail {
for _, v1 := range coinSetDetail {
var exchangeRatio float64
if zhios_order_relate_utils.AnyToFloat64(virtualCoin[v.CoinID]) != 0 {
exchangeRatio = zhios_order_relate_utils.AnyToFloat64(virtualCoin[v.CoinID])
if zhios_order_relate_utils.AnyToFloat64(virtualCoin[v1.CoinID]) != 0 {
exchangeRatio = zhios_order_relate_utils.AnyToFloat64(virtualCoin[v1.CoinID])
} else {
exchangeRatio = 0
}
coinSetDetailMap = append(coinSetDetailMap, map[string]interface{}{
"coin_id": v.CoinID,
"coin_name": v.CoinName,
"divide_value": zhios_order_relate_utils.AnyToFloat64(temp["divide_amount"]) * (zhios_order_relate_utils.AnyToFloat64(v.Value) / 100) * exchangeRatio,
"coin_id": v1.CoinID,
"coin_name": v1.CoinName,
"divide_value": zhios_order_relate_utils.AnyToFloat64(temp["divide_amount"]) * (zhios_order_relate_utils.AnyToFloat64(v1.Value) / 100) * exchangeRatio,
})
}
temp["divide_virtual_currency"] = coinSetDetailMap


Chargement…
Annuler
Enregistrer