Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cdca06289 | ||
|
|
836e42b364 | ||
|
|
0deb1bbedc |
File diff suppressed because one or more lines are too long
@@ -197,7 +197,7 @@ func ChannelSettlementCalc(ctx context.Context, req *proto.SettlementCalcReq) (*
|
||||
for _, parent := range ParentList {
|
||||
parent.CorrectValidData()
|
||||
for _, child := range ChildList {
|
||||
if child.ParentChannel == parent.Channel && child.SumDate.Equal(parent.SumDate) {
|
||||
if child.ParentChannel == parent.Channel && child.AppId == parent.AppId && child.SumDate.Equal(parent.SumDate) {
|
||||
channelmod.ChannelStatSummation(parent, child.CorrectValidData()) // 把子渠道的数据累加到父渠道上面
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ func SearchChannelSettlementStat2(ctx context.Context, req *proto.ChannelStatSet
|
||||
for _, parent := range ParentsChannelStatList {
|
||||
parent.CorrectValidData()
|
||||
for _, child := range ChildChannelStatList {
|
||||
if child.ParentChannel == parent.Channel && child.SumDate.Equal(parent.SumDate) {
|
||||
if child.ParentChannel == parent.Channel && child.AppId == parent.AppId && child.SumDate.Equal(parent.SumDate) {
|
||||
channelmod.ChannelStatSummation(parent, child) // 把子渠道的数据累加到父渠道上面
|
||||
}
|
||||
}
|
||||
@@ -854,7 +854,7 @@ func AddSettlementInfo2(ctx context.Context, req *proto.SettlementInfoAdd2, accT
|
||||
for _, parent := range ParentList {
|
||||
parent.CorrectValidData()
|
||||
for _, child := range ChildList {
|
||||
if child.ParentChannel == parent.Channel && child.SumDate.Equal(parent.SumDate) {
|
||||
if child.ParentChannel == parent.Channel && child.AppId == parent.AppId && child.SumDate.Equal(parent.SumDate) {
|
||||
channelmod.ChannelStatSummation(parent, child) // 把子渠道的数据累加到父渠道上面
|
||||
}
|
||||
}
|
||||
@@ -1138,7 +1138,7 @@ func DetailSettlementInfo(ctx context.Context, req proto.SettlementInfoDetail) (
|
||||
// 把子级记录汇总到一级记录上面
|
||||
for _, parent := range ParentsChannelStatList {
|
||||
for _, child := range ChildsChannelStatList {
|
||||
if child.ParentChannel == parent.Channel && child.SumDate.Equal(parent.SumDate) {
|
||||
if child.ParentChannel == parent.Channel && child.AppId == parent.AppId && child.SumDate.Equal(parent.SumDate) {
|
||||
channelmod.ChannelStatSummation(parent, child) // 把子渠道的数据累加到父渠道上面
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ func SearchChannelStat(ctx context.Context, req *proto.ChannelStatSearch) (*prot
|
||||
channelmod.ChannelStatSummation(&resp.TotalInfo, item)
|
||||
if req.WithChild != nil && *req.WithChild {
|
||||
for _, v := range ChannelStatList {
|
||||
if item.ParentChannel == v.Channel && v.SumDate.Equal(item.SumDate) {
|
||||
if item.ParentChannel == v.Channel && item.AppId == v.AppId && v.SumDate.Equal(item.SumDate) {
|
||||
channelmod.ChannelStatSummation(v, item)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package crossSer
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"sort"
|
||||
"stat/api/proto"
|
||||
@@ -20,6 +21,11 @@ import (
|
||||
"github.com/vicanso/go-charts/v2"
|
||||
)
|
||||
|
||||
// ErrNoRankData 排名数据为空。空数据集不能交给 go-charts 渲染: 坐标轴范围会退化成
|
||||
// math.MinInt64 与 NaN,产出一张刻度为 -9,223,372,036,854,776,000 的坏图。
|
||||
// 常见原因是 innerServers 未配置,跨服循环零次执行。
|
||||
var ErrNoRankData = errors.New("排名数据为空,无法生成图表(请检查 innerServers 配置)")
|
||||
|
||||
var Colors = []drawing.Color{
|
||||
drawing.ColorFromHex("0780cf"),
|
||||
drawing.ColorFromHex("765005"),
|
||||
@@ -353,6 +359,11 @@ func GetRankPhoto(reportTime time.Time, title string, getValue FuncGetStatValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 空数据集不能进入渲染: go-charts 会把坐标轴范围退化成 MinInt64/NaN,
|
||||
// 产出一张刻度为 -9,223,372,036,854,776,000 的坏图并照常发到群里。
|
||||
if len(statList) == 0 {
|
||||
return "", nil, ErrNoRankData
|
||||
}
|
||||
// sort
|
||||
sort.Sort(statList)
|
||||
// draw chart
|
||||
@@ -481,6 +492,10 @@ func GetRankDetail(reportTime time.Time, title string, getValue FuncGetStatValue
|
||||
}
|
||||
}
|
||||
}
|
||||
// 同 GetRankPhoto: 空数据集会渲染出坐标轴为 MinInt64/NaN 的坏图
|
||||
if len(statList) == 0 {
|
||||
return "", ErrNoRankData
|
||||
}
|
||||
// sort
|
||||
sort.Sort(statList)
|
||||
// draw chart
|
||||
|
||||
Reference in New Issue
Block a user