package test import ( "fmt" "git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/resource/redisCli" "git.hilo.cn/hilo-common/utils" "github.com/jinzhu/now" "hilo-group/domain/cache/groupPower_c" "hilo-group/domain/model/groupPower_m" "hilo-group/domain/model/group_m" "hilo-group/domain/service/group_power_s" "testing" "time" ) func TestGetAllGroupPowerOwner(t *testing.T) { owners, _, err := groupPower_m.BatchGetAllGroupPowerUsers(domain.CreateModelNil(), 1, 1) println(owners, err) } func TestGetGroupPowerMonthStartTop1(t *testing.T) { res, err := groupPower_m.GetGroupPowerMonthStartTop1(domain.CreateModelNil(), 250) println(res, err) } func TestIsUseTRTC(t *testing.T) { if group_m.IsUseTRTC(domain.CreateModelNil(), "@TGS#3I57DMRIB") { fmt.Println("true--------------") } } func TestIsMaxMember(t *testing.T) { //maxNum := group_power_s.GetGroupPowerMaxMemberNum(domain.CreateModelNil(), 263, grade.Grade) fmt.Println("true--------------") } func TestDoCalcGroupPowerMonthRankAct(t *testing.T) { lastDayTime := time.Now().AddDate(0, 0, -1) _now := now.New(lastDayTime) calcMonth := _now.BeginningOfMonth().Format(utils.MONTH_FORMAT) beginDate, endDate := _now.BeginningOfMonth().Format("2006-01-02"), _now.EndOfMonth().Format("2006-01-02") _ = group_power_s.DoCalcGroupPowerMonthRankAct(domain.CreateModelNil(), calcMonth, beginDate, endDate, "") } func TestDoCalcGroupPowerMonthRankActbufa(t *testing.T) { lastDayTime := time.Now().AddDate(0, 0, -1) _now := now.New(lastDayTime) calcMonth := _now.BeginningOfMonth().Format(utils.MONTH_FORMAT) starDate := _now.BeginningOfMonth().Format(utils.COMPACT_MONTH_FORMAT) beginDate, endDate := _now.BeginningOfMonth().Format("2006-01-02"), _now.EndOfMonth().Format("2006-01-02") _ = group_power_s.BufaDoCalcGroupPowerMonthRankAct(domain.CreateModelNil(), calcMonth, beginDate, endDate, starDate) } func TestGetRandomImProvider(t *testing.T) { var times0, times1 int model := domain.CreateModelNil() confList, err := group_m.GetGroupImConf(model) if err != nil { model.Log.Errorf("GetRandomImProvider err:%v", err) return } for i := 0; i < 1000000; i++ { conf := group_m.GetRandomGroupImConf(confList) if conf.Provider == 0 { times0 += 1 } else if conf.Provider == 1 { times1 += 1 } } fmt.Printf("true--------------times0:%v\n", times0) fmt.Printf("true--------------times1:%v\n", times1) } func TestMonthStar(t *testing.T) { monthTime, err := time.Parse("200601", "202307") if err != nil { panic(err) } redisCli.InitCluster() res, err := groupPower_c.GetGroupPowerStarRankPeriod(domain.CreateModelNil(), "month", 242, 1, 0, 10, monthTime.Format("2006-01-02")) println(res) println(err) }