@@ -19,6 +19,7 @@ const ( | |||||
EggEnergyVideoRewardPersonalActiveCoin | EggEnergyVideoRewardPersonalActiveCoin | ||||
EggEnergyPlayletRewardPersonalActiveCoin | EggEnergyPlayletRewardPersonalActiveCoin | ||||
EggEnergyWatchAdRewardFansActiveCoin | EggEnergyWatchAdRewardFansActiveCoin | ||||
EggEnergyRecruitNewUsersReward | |||||
) | ) | ||||
func (kind UserVirtualAmountFlowTransferType) String() string { | func (kind UserVirtualAmountFlowTransferType) String() string { | ||||
@@ -53,6 +54,8 @@ func (kind UserVirtualAmountFlowTransferType) String() string { | |||||
return "观看短剧" //观看短剧-个人蛋蛋积分 | return "观看短剧" //观看短剧-个人蛋蛋积分 | ||||
case EggEnergyWatchAdRewardFansActiveCoin: | case EggEnergyWatchAdRewardFansActiveCoin: | ||||
return "粉丝奖励" //浏览视频奖励-直推奖励蛋蛋积分 | return "粉丝奖励" //浏览视频奖励-直推奖励蛋蛋积分 | ||||
case EggEnergyRecruitNewUsersReward: | |||||
return "拉新奖励" | |||||
default: | default: | ||||
return "未知状态" | return "未知状态" | ||||
} | } | ||||
@@ -202,13 +202,13 @@ const EggFriendCircleCommentEsMapping = ` | |||||
"type": "integer" | "type": "integer" | ||||
}, | }, | ||||
"circle_id":{ | "circle_id":{ | ||||
"type": "integer" | |||||
"type": "keyword" | |||||
}, | }, | ||||
"comment_id":{ | "comment_id":{ | ||||
"type": "integer" | |||||
"type": "keyword" | |||||
}, | }, | ||||
"reply_comment_id":{ | "reply_comment_id":{ | ||||
"type": "integer" | |||||
"type": "keyword" | |||||
}, | }, | ||||
"content":{ | "content":{ | ||||
"type": "keyword" | "type": "keyword" | ||||
@@ -309,7 +309,7 @@ const EggFriendCircleLikeEsMapping = ` | |||||
"number_of_replicas" : 1 | "number_of_replicas" : 1 | ||||
}, | }, | ||||
"aliases": { | "aliases": { | ||||
"egg_friend_circle": {} | |||||
"egg_friend_circle_like": {} | |||||
}, | }, | ||||
"mappings":{ | "mappings":{ | ||||
"properties":{ | "properties":{ | ||||
@@ -317,7 +317,7 @@ const EggFriendCircleLikeEsMapping = ` | |||||
"type": "integer" | "type": "integer" | ||||
}, | }, | ||||
"circle_id":{ | "circle_id":{ | ||||
"type": "integer" | |||||
"type": "keyword" | |||||
}, | }, | ||||
"created_at":{ | "created_at":{ | ||||
"type": "date", | "type": "date", | ||||
@@ -16,6 +16,18 @@ import ( | |||||
// ActivityCoinReadyExchangeEggEnergy 蛋蛋积分【准备】兑换成蛋蛋能量 | // ActivityCoinReadyExchangeEggEnergy 蛋蛋积分【准备】兑换成蛋蛋能量 | ||||
func ActivityCoinReadyExchangeEggEnergy(engine *xorm.Engine, uid int64, ch *rabbit.Channel) (err error) { | 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` 基础设置 | //1、查找`egg_energy_basic_setting` 基础设置 | ||||
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) | eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) | ||||
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ | 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` 记录 | //7、新增 `egg_energy_user_activity` 记录 | ||||
var m model.EggEnergyUserActivity | 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 { | if err != nil { | ||||
return err | return err | ||||
} | } | ||||
@@ -54,7 +54,7 @@ func ActivityCoinStartExchangeEggEnergy(engine *xorm.Engine, req md.EggEnergyStr | |||||
Kind: "sub", | Kind: "sub", | ||||
Title: enum.EggPointCoinToExchangeToTeamEggEnergy.String(), | Title: enum.EggPointCoinToExchangeToTeamEggEnergy.String(), | ||||
TransferType: int(enum.EggPointCoinToExchangeToTeamEggEnergy), | TransferType: int(enum.EggPointCoinToExchangeToTeamEggEnergy), | ||||
CoinId: req.TeamEnergyCoinId, | |||||
CoinId: req.TeamPointCoinId, | |||||
Uid: req.Uid, | Uid: req.Uid, | ||||
Amount: egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints), | Amount: egg_system_rules.StrToFloat64(sign.TotalTeamEggPoints), | ||||
}) | }) | ||||
@@ -31,6 +31,16 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin | |||||
uid := user.Id | uid := user.Id | ||||
now := time.Now() | 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` 基础设置 | //1、查找 `egg_energy_basic_setting` 基础设置 | ||||
eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) | eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) | ||||
eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ | eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ | ||||
@@ -199,10 +209,10 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin | |||||
return | return | ||||
} | } | ||||
fatherRewardValue := rewardValue * (egg_system_rules.StrToFloat64(directPushRewardSetting.RewardRateValue) / 100) | fatherRewardValue := rewardValue * (egg_system_rules.StrToFloat64(directPushRewardSetting.RewardRateValue) / 100) | ||||
var fatherSign model.EggSignIn | |||||
if directPushRewardSetting.MemberSelfIsOpenGetTeamReward == "1" { | if directPushRewardSetting.MemberSelfIsOpenGetTeamReward == "1" { | ||||
fmt.Println("user:::::::::::::", user) | 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 { | if err44 != nil { | ||||
return rewardValue, err44 | return rewardValue, err44 | ||||
} | } | ||||
@@ -265,6 +275,13 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin | |||||
Uid: vv.Uid, | Uid: vv.Uid, | ||||
Amount: vv.RewardValue, | Amount: vv.RewardValue, | ||||
}, md2.EggEnergyRoutKeyForSettlementPublicGiveActivityCoin) | }, 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() | err = session.Commit() | ||||
@@ -315,7 +332,7 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin | |||||
return rewardValue, err2 | return rewardValue, err2 | ||||
} | } | ||||
} | } | ||||
redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, uid) | |||||
var watchAdDate string | var watchAdDate string | ||||
if eggEnergyUserWatchRecords.ResidueWatchAdNum == egg_system_rules.StrToInt(videoRewardSystem.RewardTotalNum) { | if eggEnergyUserWatchRecords.ResidueWatchAdNum == egg_system_rules.StrToInt(videoRewardSystem.RewardTotalNum) { | ||||
if eggEnergyUserWatchRecords.NextWatchAdDate.Before(time.Now()) { | if eggEnergyUserWatchRecords.NextWatchAdDate.Before(time.Now()) { | ||||
@@ -5,6 +5,7 @@ const EggEnergyExchange = "egg.energy" | |||||
const ( | const ( | ||||
EggEnergyRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红 | EggEnergyRoutKeyForStarLevelDividend = "star_level_dividend" // 星级分红 | ||||
EggEnergyRoutKeyForSettlementPublicGiveActivityCoin = "settlement_public_give_activity_coin" // 计算观看激励视屏得到活跃积分 | EggEnergyRoutKeyForSettlementPublicGiveActivityCoin = "settlement_public_give_activity_coin" // 计算观看激励视屏得到活跃积分 | ||||
EggEnergyTeamAssistance = "egg_energy_team_assistance" // 团队助力 | |||||
EggEnergyRoutKeyForStartExchangeGreenEnergy = "start_exchange_egg_energy" // 开始兑换蛋蛋能量 | EggEnergyRoutKeyForStartExchangeGreenEnergy = "start_exchange_egg_energy" // 开始兑换蛋蛋能量 | ||||
EggEnergyRoutKeyForAutoExchangeGreenEnergy = "auto_exchange_egg_energy" // 自动兑换蛋蛋能量 | EggEnergyRoutKeyForAutoExchangeGreenEnergy = "auto_exchange_egg_energy" // 自动兑换蛋蛋能量 | ||||
EggEnergyRoutKeyForEggEnergyFundData = "fund_data" // 资金汇入 | EggEnergyRoutKeyForEggEnergyFundData = "fund_data" // 资金汇入 | ||||
@@ -13,6 +14,14 @@ const ( | |||||
EggEnergyRoutKeyForDealUserEcpm = "user_ecpm" // 处理给用户Ecpm值 | 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 { | type EggEnergyStructForSignIn struct { | ||||
MasterId string `json:"master_id"` | MasterId string `json:"master_id"` | ||||
Uid int `json:"uid"` | Uid int `json:"uid"` | ||||