You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.2 KiB
Go
67 lines
1.2 KiB
Go
package players
|
|
|
|
import (
|
|
"context"
|
|
"joybuywork/internal/repository/cache"
|
|
"joybuywork/internal/repository/dao"
|
|
"joybuywork/internal/repository/model"
|
|
"joybuywork/internal/repository/mtype"
|
|
"joybuywork/internal/repository/withdefault"
|
|
"github.com/rs/xid"
|
|
"testing"
|
|
"time"
|
|
|
|
_ "joybuywork/test"
|
|
)
|
|
|
|
func TestCollect(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
user, err := cache.NewFissionUser(ctx, 4458).FindById(256032827461812224)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
kg, err := NewKeepDog(ctx, user)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
num, add, err := kg.Collect()
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
t.Log(num, add)
|
|
}
|
|
|
|
func TestRewardSelect(t *testing.T) {
|
|
|
|
t.Run("create user run", func(t *testing.T) {
|
|
ctx := context.Background()
|
|
user := withdefault.FissionUser(&model.FissionUser{
|
|
CampaignID: 4330,
|
|
SubUserID: xid.New().String(),
|
|
UserType: mtype.FissionUserTypePlay,
|
|
Source: mtype.FissionUserSourceVisit,
|
|
JoinAt: time.Now().Unix(),
|
|
})
|
|
|
|
err := dao.FissionUser.WithContext(ctx).Create(user)
|
|
if err != nil {
|
|
t.Error(err)
|
|
return
|
|
}
|
|
|
|
kg, err := NewKeepDog(ctx, user)
|
|
if err != nil {
|
|
t.Error(err)
|
|
}
|
|
|
|
// 243328379302412289
|
|
kg.RewardSelect(243328379302412288)
|
|
|
|
})
|
|
|
|
}
|