Browse Source

更新

one_orenge
huangjiajun 7 months ago
parent
commit
995ba77216
3 changed files with 66 additions and 50 deletions
  1. +64
    -50
      app/svc/svc_deal_commission.go
  2. +1
    -0
      consume/md/md.go
  3. +1
    -0
      consume/zhios_task_reward_exchange.go

+ 64
- 50
app/svc/svc_deal_commission.go View File

@@ -68,6 +68,9 @@ func CommOrderRelateInsert(eg *xorm.Engine, oid int64, pvd string, createTime in
Level: level, Level: level,
}, },
} }
if mapData["reward_type"] == "2" {
data = make([]*model.TaskOrdListRelate, 0)
}
mode := mapData["mode"] mode := mapData["mode"]
for lvUser.ParentUser != nil { for lvUser.ParentUser != nil {
lvUser = lvUser.ParentUser lvUser = lvUser.ParentUser
@@ -105,7 +108,7 @@ func CommOrderRelateInsert(eg *xorm.Engine, oid int64, pvd string, createTime in
return return
} else { } else {
// 插入虚拟币数据 // 插入虚拟币数据
vcrData := CommCombineVirtualCoinRelateData(oldLvUser, oid, pvd, oldLevel, mapData["mode"])
vcrData := CommCombineVirtualCoinRelateData(oldLvUser, oid, pvd, oldLevel, mapData)
err2 := db2.DbInsertBatch(eg, vcrData) err2 := db2.DbInsertBatch(eg, vcrData)
for _, item := range vcrData { for _, item := range vcrData {
fmt.Println(item) fmt.Println(item)
@@ -122,67 +125,72 @@ func ConvertList2Map(a []*comm_plan.VirtualCoinCommission) (b map[string]float64
} }
return b return b
} }
func CommCombineVirtualCoinRelateData(lvUser *comm_plan.LvUser, oid int64, pvd string, level int, mode string) []*model.VirtualCoinRelate {
func CommCombineVirtualCoinRelateData(lvUser *comm_plan.LvUser, oid int64, pvd string, level int, mapData map[string]string) []*model.VirtualCoinRelate {
mode := mapData["mode"]

var data []*model.VirtualCoinRelate var data []*model.VirtualCoinRelate
//可能没有极差返利 只有补贴
profitList := lvUser.ProfitList
if len(profitList) == 0 {
profitList = lvUser.SubsidyFeeList
}
if profitList != nil {
var subsidyFeeList map[string]float64
if lvUser.SubsidyFeeList != nil && len(lvUser.ProfitList) > 0 {
subsidyFeeList = ConvertList2Map(lvUser.SubsidyFeeList)
}
var coinList = make([]string, 0)
for _, v := range profitList {
coinList = append(coinList, v.Cid)
if mapData["reward_type"] != "2" {
//可能没有极差返利 只有补贴
profitList := lvUser.ProfitList
if len(profitList) == 0 {
profitList = lvUser.SubsidyFeeList
} }
if utils.InArr(mode, []string{"lv_winery", "public_platoon"}) && lvUser.SubsidyFeeList != nil { //补贴类型 没有的要补上
subsidyFeeList = ConvertList2Map(lvUser.SubsidyFeeList)
for _, v := range lvUser.SubsidyFeeList {
if utils.InArr(v.Cid, coinList) == false && v.Val > 0 {
v.Val = 0
profitList = append(profitList, v)
}
if profitList != nil {
var subsidyFeeList map[string]float64
if lvUser.SubsidyFeeList != nil && len(lvUser.ProfitList) > 0 {
subsidyFeeList = ConvertList2Map(lvUser.SubsidyFeeList)
} }
}
for _, item := range profitList {

if lvUser.Uid == 0 {
continue
var coinList = make([]string, 0)
for _, v := range profitList {
coinList = append(coinList, v.Cid)
} }
if item.Cid != "0" && item.Cid != "commission" {
//加上补贴
subsidyFee := subsidyFeeList[item.Cid]
var additionalSubsidy float64 = 0
profit := utils.Float64ToStrByPrec(item.Val+subsidyFee, 9)
if utils.InArr(mode, []string{"lv_winery", "public_platoon"}) {
profit = utils.Float64ToStrByPrec(item.Val, 9)
additionalSubsidy = subsidyFee
if utils.InArr(mode, []string{"lv_winery", "public_platoon"}) && lvUser.SubsidyFeeList != nil { //补贴类型 没有的要补上
subsidyFeeList = ConvertList2Map(lvUser.SubsidyFeeList)
for _, v := range lvUser.SubsidyFeeList {
if utils.InArr(v.Cid, coinList) == false && v.Val > 0 {
v.Val = 0
profitList = append(profitList, v)
}
} }
if mode == "public_platoon" && level > 1 {
profit = "0"
}
for _, item := range profitList {

if lvUser.Uid == 0 {
continue
} }
var virtualCoinRelate = &model.VirtualCoinRelate{
Oid: oid,
Uid: lvUser.Uid,
CoinId: utils.StrToInt(item.Cid),
Amount: profit,
Pvd: pvd,
CreateAt: int(time.Now().Unix()),
Level: level,
Mode: mode,
AdditionalSubsidy: utils.Float64ToStrByPrec(additionalSubsidy, 6),
ExtendType: lvUser.ExtendType,
if item.Cid != "0" && item.Cid != "commission" {
//加上补贴
subsidyFee := subsidyFeeList[item.Cid]
var additionalSubsidy float64 = 0
profit := utils.Float64ToStrByPrec(item.Val+subsidyFee, 9)
if utils.InArr(mode, []string{"lv_winery", "public_platoon"}) {
profit = utils.Float64ToStrByPrec(item.Val, 9)
additionalSubsidy = subsidyFee
}
if mode == "public_platoon" && level > 1 {
profit = "0"
}
var virtualCoinRelate = &model.VirtualCoinRelate{
Oid: oid,
Uid: lvUser.Uid,
CoinId: utils.StrToInt(item.Cid),
Amount: profit,
Pvd: pvd,
CreateAt: int(time.Now().Unix()),
Level: level,
Mode: mode,
AdditionalSubsidy: utils.Float64ToStrByPrec(additionalSubsidy, 6),
ExtendType: lvUser.ExtendType,
}
data = append(data, virtualCoinRelate)
} }
data = append(data, virtualCoinRelate)
} }
} }
} }

if lvUser.ParentUser != nil { if lvUser.ParentUser != nil {
level += 1 level += 1
data = append(data, CommCombineVirtualCoinRelateData(lvUser.ParentUser, oid, pvd, level, mode)...)
data = append(data, CommCombineVirtualCoinRelateData(lvUser.ParentUser, oid, pvd, level, mapData)...)
} }
return data return data
} }
@@ -209,6 +217,9 @@ func SettleDone(eg *xorm.Engine, pvd string, oid int64, masterId string, mapData
appName = set.Val appName = set.Val
} }
for _, item := range ol { for _, item := range ol {
if mapData["reward_type"] == "2" && item.Level == 0 {
continue
}
//佣金不为空 //佣金不为空
if item.Amount > 0 { if item.Amount > 0 {
//公排 //公排
@@ -236,6 +247,9 @@ func SettleDone(eg *xorm.Engine, pvd string, oid int64, masterId string, mapData
} }
// 虚拟币相关操作 // 虚拟币相关操作
for _, item := range vcrList { for _, item := range vcrList {
if mapData["reward_type"] == "2" && item.Level == 0 {
continue
}
if utils.StrToFloat64(item.Amount) > 0 { if utils.StrToFloat64(item.Amount) > 0 {
if utils.InArr(item.Mode, []string{"lv_commission_public_platoon", "lv_price_public_platoon"}) && item.ExtendType == 5 { if utils.InArr(item.Mode, []string{"lv_commission_public_platoon", "lv_price_public_platoon"}) && item.ExtendType == 5 {
fmt.Println("======================555") fmt.Println("======================555")


+ 1
- 0
consume/md/md.go View File

@@ -16,6 +16,7 @@ type ZhiosTaskReward struct {
Title string `json:"title"` Title string `json:"title"`
DeviceModel string `json:"device_model"` DeviceModel string `json:"device_model"`
Oid string `json:"oid"` Oid string `json:"oid"`
RewardType string `json:"reward_type"`
} }
type AcquisitionCfg struct { type AcquisitionCfg struct {
Id string `json:"id"` Id string `json:"id"`


+ 1
- 0
consume/zhios_task_reward_exchange.go View File

@@ -79,6 +79,7 @@ func handleZhiosTaskRewardExchange(msg []byte) error {
"mode": canalMsg.Mode, "mode": canalMsg.Mode,
"title": title, "title": title,
"device_model": canalMsg.DeviceModel, "device_model": canalMsg.DeviceModel,
"reward": canalMsg.RewardType,
} }
svc.GetLvUser(eg, CommissionParam, utils.StrToInt64(canalMsg.Oid), mid, mapData) svc.GetLvUser(eg, CommissionParam, utils.StrToInt64(canalMsg.Oid), mid, mapData)
return nil return nil


Loading…
Cancel
Save