You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.8 KiB
69 lines
1.8 KiB
package values |
|
|
|
import "server/common" |
|
|
|
// 缓存的数据 |
|
var ( |
|
// CompaireData *Compaire |
|
AppReviewData = []*ReviewData{} // 数据概要缓存数据 |
|
RechargeFrequencyData = []*RechargeFrequency{} // 付费分析缓存数据 |
|
KeepRechargeData = []KeepData{} // 新增付费缓存数据(缓存7日的数据) |
|
) |
|
|
|
type Compaire struct { |
|
Recharge map[common.CurrencyType][]int64 // 昨日今日充值对比 |
|
RechargeSuccess []string // 昨日今日充值成功率对比 |
|
RechargePlayerSuccess []string // 昨日今日充值人次成功率对比 |
|
Withdraw map[common.CurrencyType][]int64 // 昨日今日代付对比 |
|
WithdrawSuccess []string // 昨日今日代付成功率对比 |
|
WithdrawPlayerSuccess []string // 昨日今日代付人次成功率对比 |
|
} |
|
|
|
func GetReviewData(channelID ...int) *ReviewData { |
|
if len(AppReviewData) == 0 { |
|
return nil |
|
} |
|
cid := 0 |
|
if len(channelID) > 0 { |
|
cid = channelID[0] |
|
} |
|
for i, v := range AppReviewData { |
|
if v.PlatformID == cid { |
|
return AppReviewData[i] |
|
} |
|
} |
|
return nil |
|
} |
|
|
|
func GetRechargeFrequencyData(su int64, channelID ...int) *RechargeFrequency { |
|
if len(RechargeFrequencyData) == 0 { |
|
return nil |
|
} |
|
cid := 0 |
|
if len(channelID) > 0 { |
|
cid = channelID[0] |
|
} |
|
if cid != 0 { |
|
return nil |
|
} |
|
for i, v := range RechargeFrequencyData { |
|
if v.Channel == cid && su == v.Date { |
|
return RechargeFrequencyData[i] |
|
} |
|
} |
|
return nil |
|
} |
|
|
|
func GetKeepRechargeData(su, eu int64) []KeepData { |
|
if len(KeepRechargeData) == 0 { |
|
return nil |
|
} |
|
ret := []KeepData{} |
|
for i, v := range KeepRechargeData { |
|
if v.Time < su || v.Time > eu { |
|
continue |
|
} |
|
ret = append(ret, KeepRechargeData[i]) |
|
} |
|
return ret |
|
}
|
|
|