|
@@ -148,12 +148,20 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Val: append(totalFriend.Val, tf.Value),
|
|
|
}
|
|
|
}
|
|
|
+ totalFriendLen := len(totalFriendSum)
|
|
|
+ if totalFriendLen > 0 && totalFriendSum[0].Value > 0 {
|
|
|
+ totalFriend.Rate = float32((totalFriendSum[totalFriendLen-1].Value - totalFriendSum[0].Value) / totalFriendSum[0].Value)
|
|
|
+ }
|
|
|
for _, tg := range totalGroupSum {
|
|
|
totalGroup = types.ChartsUint{
|
|
|
Count: tg.Value,
|
|
|
Val: append(totalGroup.Val, tg.Value),
|
|
|
}
|
|
|
}
|
|
|
+ totalGroupLen := len(totalGroupSum)
|
|
|
+ if totalGroupLen > 0 && totalGroupSum[0].Value > 0 {
|
|
|
+ totalGroup.Rate = float32((totalGroupSum[totalGroupLen-1].Value - totalGroupSum[0].Value) / totalGroupSum[0].Value)
|
|
|
+ }
|
|
|
for _, ct := range consumeTokenSum {
|
|
|
addtimeLastTwoDigits := ct.Addtime % 100
|
|
|
consumeToken = types.ChartsUint{
|
|
@@ -168,6 +176,10 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Val: append(activeUser.Val, au.Value),
|
|
|
}
|
|
|
}
|
|
|
+ activeUserLen := len(activeUserSum)
|
|
|
+ if activeUserLen > 0 && activeUserSum[0].Value > 0 {
|
|
|
+ activeUser.Rate = float32((activeUserSum[activeUserLen-1].Value - activeUserSum[0].Value) / activeUserSum[0].Value)
|
|
|
+ }
|
|
|
for _, nu := range newUserSum {
|
|
|
addtimeLastTwoDigits := nu.Addtime % 100
|
|
|
newUser = types.ChartsInt{
|
|
@@ -176,6 +188,10 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Label: append(newUser.Label, fmt.Sprintf("%02d", addtimeLastTwoDigits)),
|
|
|
}
|
|
|
}
|
|
|
+ newUserLen := len(newUserSum)
|
|
|
+ if newUserLen > 0 && newUserSum[0].Value > 0 {
|
|
|
+ newUser.Rate = float32((newUserSum[newUserLen-1].Value - newUserSum[0].Value) / newUserSum[0].Value)
|
|
|
+ }
|
|
|
} else {
|
|
|
// 从天表统计数据
|
|
|
startAddTimeString := startTime.Format("20060102")
|
|
@@ -217,18 +233,29 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Val: append(sopRun.Val, sr.Value),
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
for _, tf := range totalFriendSum {
|
|
|
totalFriend = types.ChartsUint{
|
|
|
Count: tf.Value,
|
|
|
Val: append(totalFriend.Val, tf.Value),
|
|
|
}
|
|
|
}
|
|
|
+ totalFriendLen := len(totalFriendSum)
|
|
|
+ if totalFriendLen > 0 && totalFriendSum[0].Value > 0 {
|
|
|
+ totalFriend.Rate = float32((totalFriendSum[totalFriendLen-1].Value - totalFriendSum[0].Value) / totalFriendSum[0].Value)
|
|
|
+ }
|
|
|
+
|
|
|
for _, tg := range totalGroupSum {
|
|
|
totalGroup = types.ChartsUint{
|
|
|
Count: tg.Value,
|
|
|
Val: append(totalGroup.Val, tg.Value),
|
|
|
}
|
|
|
}
|
|
|
+ totalGroupLen := len(totalGroupSum)
|
|
|
+ if totalGroupLen > 0 && totalGroupSum[0].Value > 0 {
|
|
|
+ totalGroup.Rate = float32((totalGroupSum[totalGroupLen-1].Value - totalGroupSum[0].Value) / totalGroupSum[0].Value)
|
|
|
+ }
|
|
|
+
|
|
|
for _, ct := range consumeTokenSum {
|
|
|
addtimeLastTwoDigits := ct.Addtime % 100
|
|
|
consumeToken = types.ChartsUint{
|
|
@@ -243,6 +270,10 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Val: append(activeUser.Val, au.Value),
|
|
|
}
|
|
|
}
|
|
|
+ activeUserLen := len(activeUserSum)
|
|
|
+ if activeUserLen > 0 && activeUserSum[0].Value > 0 {
|
|
|
+ activeUser.Rate = float32((activeUserSum[activeUserLen-1].Value - activeUserSum[0].Value) / activeUserSum[0].Value)
|
|
|
+ }
|
|
|
for _, nu := range newUserSum {
|
|
|
addtimeLastTwoDigits := nu.Addtime % 100
|
|
|
newUser = types.ChartsInt{
|
|
@@ -251,6 +282,10 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Label: append(newUser.Label, fmt.Sprintf("%02d", addtimeLastTwoDigits)),
|
|
|
}
|
|
|
}
|
|
|
+ newUserLen := len(newUserSum)
|
|
|
+ if newUserLen > 0 && newUserSum[0].Value > 0 {
|
|
|
+ newUser.Rate = float32((newUserSum[newUserLen-1].Value - newUserSum[0].Value) / newUserSum[0].Value)
|
|
|
+ }
|
|
|
|
|
|
if isCurrentDay {
|
|
|
// 从小时表统计当天数据
|
|
@@ -300,10 +335,18 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Count: totalFriendOfDay,
|
|
|
Val: append(totalFriend.Val, totalFriendOfDay),
|
|
|
}
|
|
|
+ tfLen := len(totalFriend.Val)
|
|
|
+ if tfLen > 0 && totalFriend.Val[0] > 0 {
|
|
|
+ totalFriend.Rate = float32((totalFriend.Val[tfLen-1] - totalFriend.Val[0]) / totalFriend.Val[0])
|
|
|
+ }
|
|
|
totalGroup = types.ChartsUint{
|
|
|
Count: totalGroupOfDay,
|
|
|
Val: append(totalGroup.Val, totalGroupOfDay),
|
|
|
}
|
|
|
+ tgLen := len(totalGroup.Val)
|
|
|
+ if tgLen > 0 && totalGroup.Val[0] > 0 {
|
|
|
+ totalGroup.Rate = float32((totalGroup.Val[tgLen-1] - totalGroup.Val[0]) / totalGroup.Val[0])
|
|
|
+ }
|
|
|
consumeToken = types.ChartsUint{
|
|
|
Count: consumeToken.Count + consumeTokenOfDay,
|
|
|
Val: append(consumeToken.Val, consumeTokenOfDay),
|
|
@@ -313,11 +356,19 @@ func (l *GetChartsLogic) GetCharts(req *types.ChartsReq) (resp *types.ChartsResp
|
|
|
Count: activeUserOfDay,
|
|
|
Val: append(activeUser.Val, activeUserOfDay),
|
|
|
}
|
|
|
+ auLen := len(activeUser.Val)
|
|
|
+ if auLen > 0 && activeUser.Val[0] > 0 {
|
|
|
+ activeUser.Rate = float32((activeUser.Val[auLen-1] - activeUser.Val[0]) / activeUser.Val[0])
|
|
|
+ }
|
|
|
newUser = types.ChartsInt{
|
|
|
Count: newUserOfDay,
|
|
|
Val: append(newUser.Val, newUserOfDay),
|
|
|
Label: append(newUser.Label, "今日"),
|
|
|
}
|
|
|
+ nuLen := len(newUser.Val)
|
|
|
+ if nuLen > 0 && newUser.Val[0] > 0 {
|
|
|
+ newUser.Rate = float32((newUser.Val[nuLen-1] - newUser.Val[0]) / newUser.Val[0])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|