mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-19 12:20:24 +08:00
重新实现套餐相关功能
This commit is contained in:
39
internal/db/models/user_plan_bandwidth_stat_dao_test.go
Normal file
39
internal/db/models/user_plan_bandwidth_stat_dao_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package models_test
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/iwind/TeaGo/bootstrap"
|
||||
"github.com/iwind/TeaGo/dbs"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUserPlanBandwidthStatDAO_FindMonthlyPercentile(t *testing.T) {
|
||||
var dao = models.NewUserPlanBandwidthStatDAO()
|
||||
var tx *dbs.Tx
|
||||
|
||||
{
|
||||
resultBytes, err := dao.FindMonthlyPercentile(tx, 20, timeutil.Format("Ym"), 100, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("result bytes0:", resultBytes)
|
||||
}
|
||||
|
||||
{
|
||||
resultBytes, err := dao.FindMonthlyPercentile(tx, 20, timeutil.Format("Ym"), 95, false)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("result bytes1:", resultBytes)
|
||||
}
|
||||
|
||||
{
|
||||
resultBytes, err := dao.FindMonthlyPercentile(tx, 20, timeutil.Format("Ym"), 95, true)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log("result bytes2:", resultBytes)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user