Ver a proveniência

更新

one_orenge
huangjiajun há 6 meses
ascendente
cometimento
87efca7f68
5 ficheiros alterados com 115 adições e 2 eliminações
  1. +17
    -2
      app/svc/svc_deal_commission.go
  2. +1
    -0
      consume/init.go
  3. +10
    -0
      consume/md/consume_key.go
  4. +1
    -0
      consume/md/md.go
  5. +86
    -0
      consume/zhios_task_video_reward_exchange.go

+ 17
- 2
app/svc/svc_deal_commission.go Ver ficheiro

@@ -308,14 +308,23 @@ func CommSettleMoney(session *xorm.Session, item *model.TaskOrdListRelate, appNa
} else {
orderAction = 11 // 推广
}
ItemTitle := "任务分佣"
var ItemTitle = "任务分佣结算"
if item.Pvd == "adset_video" {
ItemTitle = "看视频奖励"
}
if item.Level > 0 {
ItemTitle = "团队任务奖励"
if item.Pvd == "adset_video" {
ItemTitle = "团队看视频奖励"
}
}
finUserFlow := model.FinUserFlow{
Type: 0,
Uid: item.Uid,
Amount: utils.Float64ToStrByPrec(item.Amount, 8),
BeforeAmount: beforeAmount,
AfterAmount: afterAmount,
OrdType: "task_center",
OrdType: item.Pvd,
OrdId: utils.AnyToString(item.Oid),
OrdAction: orderAction,
OrdDetail: "",
@@ -395,8 +404,14 @@ func CommSettleVirtualCoin(session *xorm.Session, virtualCoinRelateItem *model.V
}
}
var title = "任务分佣结算"
if virtualCoinRelateItem.Pvd == "adset_video" {
title = "看视频奖励"
}
if virtualCoinRelateItem.Level > 0 {
title = "团队任务奖励"
if virtualCoinRelateItem.Pvd == "adset_video" {
title = "团队看视频奖励"
}
}
// 用户虚拟币流水表新增记录
var userVirtualCoinFlow = model.UserVirtualCoinFlow{


+ 1
- 0
consume/init.go Ver ficheiro

@@ -93,6 +93,7 @@ func initConsumes() {
jobs[consumeMd.CancalUserIntegralExchangeConsumeFunName] = CancalUserIntegralExchange //兑换
jobs[consumeMd.ZhiosTaskRewardConsumeFunName] = ZhiosTaskRewardExchange //兑换
jobs[consumeMd.CanalOneOrengeUserVirtualCcoinFlowFunName] = CanalOneOrengeUserVirtualCoinFlowConsume
jobs[consumeMd.ZhiosTaskVideoRewardConsumeFunName] = ZhiosTaskVideoRewardExchange //视频分佣

}



+ 10
- 0
consume/md/consume_key.go Ver ficheiro

@@ -461,6 +461,15 @@ var RabbitMqQueueKeyList = []*MqQueue{
BindKey: "",
ConsumeFunName: "ZhiosTaskRewardExchange",
},
{
ExchangeName: "zhios.task_video_reward.exchange",
Name: "zhios_task_video_reward_dev",
Type: FanOutQueueType,
IsPersistent: false,
RoutKey: "task_video_reward_dev",
BindKey: "",
ConsumeFunName: "ZhiosTaskVideoRewardExchange",
},
{
ExchangeName: "canal.topic", //
Name: "canal_fin_user_flow",
@@ -535,5 +544,6 @@ const (
CancalUserRelateConsumeFunName = "CancalUserRelateConsume"
CancalUserIntegralExchangeConsumeFunName = "CancalUserIntegralExchange"
ZhiosTaskRewardConsumeFunName = "ZhiosTaskRewardExchange"
ZhiosTaskVideoRewardConsumeFunName = "ZhiosTaskVideoRewardExchange"
CanalOneOrengeUserVirtualCcoinFlowFunName = "CanalOneOrengeUserVirtualCoinFlowConsume"
)

+ 1
- 0
consume/md/md.go Ver ficheiro

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


+ 86
- 0
consume/zhios_task_video_reward_exchange.go Ver ficheiro

@@ -0,0 +1,86 @@
package consume

import (
"applet/app/db"
"applet/app/svc"
"applet/app/utils"
"applet/app/utils/logx"
"applet/consume/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
md3 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md"
"encoding/json"
"errors"
"fmt"
"github.com/streadway/amqp"
)

//
func ZhiosTaskVideoRewardExchange(queue md.MqQueue) {
fmt.Println(">>>>>>>>>>>>>>>>>>>>>>>>")
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
logx.Error(err)
return
}
defer ch.Release()
//1、将自己绑定到交换机上
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey)
//2、取出数据进行消费
ch.Qos(1)
delivery := ch.Consume(queue.Name, false)

var res amqp.Delivery
var ok bool
for {
res, ok = <-delivery
if ok == true {
//fmt.Println(string(res.Body))
fmt.Println(">>>>>>>>>>>>>>>>CanalOrderConsume<<<<<<<<<<<<<<<<<<<<<<<<<")
err = handleZhiosVideoTaskVideoRewardExchange(res.Body)
//_ = res.Reject(false)
fmt.Println(err)
_ = res.Ack(true)
} else {
panic(errors.New("error getting message"))
}
}
fmt.Println("get msg done")
}

func handleZhiosVideoTaskVideoRewardExchange(msg []byte) error {
//1、解析canal采集至mq中queue的数据结构体
var canalMsg *md.ZhiosTaskReward
fmt.Println(string(msg))
var tmpString string
err := json.Unmarshal(msg, &tmpString)
if err != nil {
fmt.Println(err.Error())
return err
}
fmt.Println(tmpString)
err = json.Unmarshal([]byte(tmpString), &canalMsg)
if err != nil {
return err
}
mid := canalMsg.Mid
eg := db.DBs[mid]
if eg == nil {
return nil
}
uid := canalMsg.Uid
//计算佣金
var CommissionParam md3.CommissionFirstParam
CommissionParam.CommissionParam.Commission = canalMsg.Reward
CommissionParam.Uid = uid
CommissionParam.Provider = canalMsg.PlanType
title := canalMsg.Title
var mapData = map[string]string{
"coin_id_type": canalMsg.CoinIdType,
"mode": canalMsg.Mode,
"title": title,
"device_model": canalMsg.DeviceModel,
"reward_type": canalMsg.RewardType,
}
svc.GetLvUser(eg, CommissionParam, utils.StrToInt64(canalMsg.Oid), mid, mapData)
return nil
}

Carregando…
Cancelar
Guardar