group_power_test.go 2.28 KB
Newer Older
hujiebin's avatar
hujiebin committed
1 2 3
package test

import (
chenweijian's avatar
chenweijian committed
4
	"fmt"
hujiebin's avatar
hujiebin committed
5
	"git.hilo.cn/hilo-common/domain"
chenweijian's avatar
chenweijian committed
6 7
	"git.hilo.cn/hilo-common/utils"
	"github.com/jinzhu/now"
hujiebin's avatar
hujiebin committed
8
	"hilo-group/domain/model/groupPower_m"
chenweijian's avatar
chenweijian committed
9
	"hilo-group/domain/model/group_m"
chenweijian's avatar
chenweijian committed
10
	"hilo-group/domain/service/group_power_s"
hujiebin's avatar
hujiebin committed
11
	"testing"
chenweijian's avatar
chenweijian committed
12
	"time"
hujiebin's avatar
hujiebin committed
13 14 15
)

func TestGetAllGroupPowerOwner(t *testing.T) {
chenweijian's avatar
chenweijian committed
16
	owners, _, err := groupPower_m.BatchGetAllGroupPowerUsers(domain.CreateModelNil(), 1, 1)
hujiebin's avatar
hujiebin committed
17 18
	println(owners, err)
}
19 20 21

func TestGetGroupPowerMonthStartTop1(t *testing.T) {
	res, err := groupPower_m.GetGroupPowerMonthStartTop1(domain.CreateModelNil(), 250)
chenweijian's avatar
chenweijian committed
22 23 24 25 26 27 28
	println(res, err)
}

func TestIsUseTRTC(t *testing.T) {
	if group_m.IsUseTRTC(domain.CreateModelNil(), "@TGS#3I57DMRIB") {
		fmt.Println("true--------------")
	}
29
}
chenweijian's avatar
chenweijian committed
30 31

func TestIsMaxMember(t *testing.T) {
chenweijian's avatar
chenweijian committed
32
	//maxNum := group_power_s.GetGroupPowerMaxMemberNum(domain.CreateModelNil(), 263, grade.Grade)
chenweijian's avatar
chenweijian committed
33 34
	fmt.Println("true--------------")
}
chenweijian's avatar
chenweijian committed
35 36 37 38 39 40

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")
chenweijian's avatar
chenweijian committed
41 42 43 44 45 46 47 48 49 50
	_ = 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)
chenweijian's avatar
chenweijian committed
51
}
chenweijian's avatar
chenweijian committed
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71

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)
}