|
|
@@ -24,7 +24,7 @@ import ( |
|
|
|
) |
|
|
|
|
|
|
|
// SettlementGiveActivityCoin 结算观看激励广告得到蛋蛋积分 |
|
|
|
func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ch *rabbit.Channel) (err error) { |
|
|
|
func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm string, ch *rabbit.Channel) (err error) { |
|
|
|
uid := user.Id |
|
|
|
now := time.Now() |
|
|
|
|
|
|
@@ -62,6 +62,8 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ch *rabbit |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
go dealEcpm(user, ecpm, ch) //TODO::协程处理ecpm的变化 |
|
|
|
|
|
|
|
var rewardValue float64 //TODO::奖励多少个活跃积分(根据ecpm, 新用户机制, 蛋蛋分机制) |
|
|
|
redisConn := cache.GetPool().Get() |
|
|
|
sysCfgDb := implement.NewSysCfgDb(engine, redisConn) |
|
|
@@ -284,9 +286,25 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ch *rabbit |
|
|
|
} |
|
|
|
cache.SetEx(redisKey, watchAdDate, 60*60*24) //TODO::默认缓存1小时 |
|
|
|
} |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
func dealEcpm(user model.User, ecpm string, ch *rabbit.Channel) { |
|
|
|
//查找缓存中的ecpm值和当前的ecpm是否一致 |
|
|
|
key := fmt.Sprintf(md.UserEcpmCacheKey, user.Id) |
|
|
|
ecpmCacheValue, _ := cache.GetString(key) |
|
|
|
if ecpmCacheValue == "" || ecpmCacheValue != ecpm { |
|
|
|
//更新缓存值 |
|
|
|
cache.SetEx(key, ecpm, md.UserEcpmCacheTime) |
|
|
|
|
|
|
|
//TODO::推入rabbitmq 异步处理 |
|
|
|
ch.Publish(md2.EggEnergyExchange, md.DealUserEcpmReq{ |
|
|
|
Uid: user.Id, |
|
|
|
Ecpm: ecpm, |
|
|
|
}, md2.EggEnergyRoutKeyForDealUserEcpm) |
|
|
|
} |
|
|
|
} |
|
|
|
func ActivityCoinToAlipayRealName(engine *xorm.Engine, uid int64, amount string) (err error) { |
|
|
|
amountValue, _ := decimal.NewFromString(amount) |
|
|
|
|
|
|
|