Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 1 week ago
parent
commit
4253067309
6 changed files with 51 additions and 10 deletions
  1. +3
    -0
      enum/user_virtual_amount_flow.go
  2. +5
    -5
      md/es.go
  3. +13
    -1
      rule/egg_energy/activity_coin_ready_exchange_egg_energy.go
  4. +1
    -1
      rule/egg_energy/activity_coin_start_exchange_egg_person_energy.go
  5. +20
    -3
      rule/egg_energy/give_activty_coin.go
  6. +9
    -0
      rule/egg_energy/md/mq_egg_energy.go

+ 3
- 0
enum/user_virtual_amount_flow.go View File

@@ -19,6 +19,7 @@ const (
EggEnergyVideoRewardPersonalActiveCoin
EggEnergyPlayletRewardPersonalActiveCoin
EggEnergyWatchAdRewardFansActiveCoin
EggEnergyRecruitNewUsersReward
)

func (kind UserVirtualAmountFlowTransferType) String() string {
@@ -53,6 +54,8 @@ func (kind UserVirtualAmountFlowTransferType) String() string {
return "观看短剧" //观看短剧-个人蛋蛋积分
case EggEnergyWatchAdRewardFansActiveCoin:
return "粉丝奖励" //浏览视频奖励-直推奖励蛋蛋积分
case EggEnergyRecruitNewUsersReward:
return "拉新奖励"
default:
return "未知状态"
}


+ 5
- 5
md/es.go View File

@@ -202,13 +202,13 @@ const EggFriendCircleCommentEsMapping = `
"type": "integer"
},
"circle_id":{
"type": "integer"
"type": "keyword"
},
"comment_id":{
"type": "integer"
"type": "keyword"
},
"reply_comment_id":{
"type": "integer"
"type": "keyword"
},
"content":{
"type": "keyword"
@@ -309,7 +309,7 @@ const EggFriendCircleLikeEsMapping = `
"number_of_replicas" : 1
},
"aliases": {
"egg_friend_circle": {}
"egg_friend_circle_like": {}
},
"mappings":{
"properties":{
@@ -317,7 +317,7 @@ const EggFriendCircleLikeEsMapping = `
"type": "integer"
},
"circle_id":{
"type": "integer"
"type": "keyword"
},
"created_at":{
"type": "date",


+ 13
- 1
rule/egg_energy/activity_coin_ready_exchange_egg_energy.go View File

@@ -16,6 +16,18 @@ import (

// ActivityCoinReadyExchangeEggEnergy 蛋蛋积分【准备】兑换成蛋蛋能量
func ActivityCoinReadyExchangeEggEnergy(engine *xorm.Engine, uid int64, ch *rabbit.Channel) (err error) {
//TODO::判断是否存在正在签到记录
var eggSignIn model.EggSignIn
has, err := engine.Where("uid = ? and is_completed =?", uid, 0).
Get(&eggSignIn)
if err != nil {
return
}
if has {
err = errors.New("重复签到~~~")
return
}

//1、查找`egg_energy_basic_setting` 基础设置
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine)
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
@@ -123,7 +135,7 @@ func ActivityCoinReadyExchangeEggEnergy(engine *xorm.Engine, uid int64, ch *rabb

//7、新增 `egg_energy_user_activity` 记录
var m model.EggEnergyUserActivity
has, err := engine.Where("uid =? and date =?", uid, now.Format("2006-01-02")).Get(&m)
has, err = engine.Where("uid =? and date =?", uid, now.Format("2006-01-02")).Get(&m)
if err != nil {
return err
}


+ 1
- 1
rule/egg_energy/activity_coin_start_exchange_egg_person_energy.go View File

@@ -54,7 +54,7 @@ func ActivityCoinStartExchangeEggEnergy(engine *xorm.Engine, req md.EggEnergyStr
Kind: "sub",
Title: enum.EggPointCoinToExchangeToTeamEggEnergy.String(),
TransferType: int(enum.EggPointCoinToExchangeToTeamEggEnergy),
CoinId: req.TeamEnergyCoinId,
CoinId: req.TeamPointCoinId,
Uid: req.Uid,
Amount: egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints),
})


+ 20
- 3
rule/egg_energy/give_activty_coin.go View File

@@ -31,6 +31,16 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
uid := user.Id
now := time.Now()

//TODO::拒绝重复异常回调
redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, uid)
nextWatchAdDate, _ := cache.GetString(redisKey)
if nextWatchAdDate != "" {
nextWatchAdDateValue := egg_system_rules.String2Time(nextWatchAdDate)
if nextWatchAdDateValue.After(time.Now()) {
return 0, errors.New("未到可观看时间~~")
}
}

//1、查找 `egg_energy_basic_setting` 基础设置
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine)
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{
@@ -199,10 +209,10 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
return
}
fatherRewardValue := rewardValue * (egg_system_rules.StrToFloat64(directPushRewardSetting.RewardRateValue) / 100)
var fatherSign model.EggSignIn
if directPushRewardSetting.MemberSelfIsOpenGetTeamReward == "1" {
fmt.Println("user:::::::::::::", user)
var m model.EggSignIn
has, err44 := engine.Where("uid =?", user.ParentUid).And("end_time >=?", time.Now().Format("2006-01-02 15:04:05")).Get(&m)
has, err44 := engine.Where("uid =?", user.ParentUid).And("end_time >=?", time.Now().Format("2006-01-02 15:04:05")).Get(&fatherSign)
if err44 != nil {
return rewardValue, err44
}
@@ -265,6 +275,13 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
Uid: vv.Uid,
Amount: vv.RewardValue,
}, md2.EggEnergyRoutKeyForSettlementPublicGiveActivityCoin)
ch.Publish(md2.EggEnergyExchange, md2.EggEnergyTeamAssistanceReq{
AssistanceUid: uid,
Uid: vv.Uid,
AssistanceValue: vv.RewardValue,
SignStart: fatherSign.StartTime,
SignEnd: fatherSign.EndTime,
}, md2.EggEnergyTeamAssistance)
}
}
err = session.Commit()
@@ -315,7 +332,7 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin
return rewardValue, err2
}
}
redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, uid)
var watchAdDate string
if eggEnergyUserWatchRecords.ResidueWatchAdNum == egg_system_rules.StrToInt(videoRewardSystem.RewardTotalNum) {
if eggEnergyUserWatchRecords.NextWatchAdDate.Before(time.Now()) {


+ 9
- 0
rule/egg_energy/md/mq_egg_energy.go View File

@@ -5,6 +5,7 @@ const EggEnergyExchange = "egg.energy"
const (
EggEnergyRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红
EggEnergyRoutKeyForSettlementPublicGiveActivityCoin = "settlement_public_give_activity_coin" // 计算观看激励视屏得到活跃积分
EggEnergyTeamAssistance = "egg_energy_team_assistance" // 团队助力
EggEnergyRoutKeyForStartExchangeGreenEnergy = "start_exchange_egg_energy" // 开始兑换蛋蛋能量
EggEnergyRoutKeyForAutoExchangeGreenEnergy = "auto_exchange_egg_energy" // 自动兑换蛋蛋能量
EggEnergyRoutKeyForEggEnergyFundData = "fund_data" // 资金汇入
@@ -13,6 +14,14 @@ const (
EggEnergyRoutKeyForDealUserEcpm = "user_ecpm" // 处理给用户Ecpm值
)

type EggEnergyTeamAssistanceReq struct {
Uid int64 `json:"uid"`
AssistanceUid int64 `json:"assistance_uid"`
AssistanceValue float64 `json:"assistance_value"`
SignStart string `json:"sign_start"`
SignEnd string `json:"sign_end"`
}

type EggEnergyStructForSignIn struct {
MasterId string `json:"master_id"`
Uid int `json:"uid"`


Loading…
Cancel
Save