feat: 按原型更新商务明细与游戏分析并清理临时资料
This commit is contained in:
@@ -22,7 +22,8 @@ func (r *serverAnalysisFake) Aggregate(_ context.Context, s AnalyticsScope, f Se
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
func (r *serverAnalysisFake) Servers(_ context.Context, _, _ []string, _ string, limit int) ([]*ServerOption, error) {
|
||||
func (r *serverAnalysisFake) Servers(_ context.Context, viewer UserScope, _, _ []string, _ string, limit int) ([]*ServerOption, error) {
|
||||
r.scope.Viewer = viewer
|
||||
r.limit = limit
|
||||
return []*ServerOption{}, nil
|
||||
}
|
||||
@@ -67,3 +68,20 @@ func TestServerAnalysisSummaryZerosSortingAndLimits(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestServerAnalysisCancelSortRestoresIdentityOrder(t *testing.T) {
|
||||
rows := []*ServerAnalysisRow{
|
||||
{ServerAnalysisKey: ServerAnalysisKey{SourceDB: "lx", GameID: 1, ServerNum: "002"}, Pay: "5"},
|
||||
{ServerAnalysisKey: ServerAnalysisKey{SourceDB: "lx", GameID: 1, ServerNum: "001"}, Pay: "10"},
|
||||
{ServerAnalysisKey: ServerAnalysisKey{SourceDB: "lx", GameID: 1, ServerNum: "003"}, Pay: "20"},
|
||||
}
|
||||
if err := sortServerAnalysis(rows, "totalPay", true); err != nil || rows[0].ServerNum != "002" {
|
||||
t.Fatal("升序错误")
|
||||
}
|
||||
if err := sortServerAnalysis(rows, "totalPay", false); err != nil || rows[0].ServerNum != "003" {
|
||||
t.Fatal("降序错误")
|
||||
}
|
||||
if err := sortServerAnalysis(rows, "", false); err != nil || rows[0].ServerNum != "001" {
|
||||
t.Fatal("取消排序应恢复稳定的区服顺序")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user