12345678910111213141516171819202122232425262728293031323334353637383940 |
- package logic
- import (
- "database/sql"
- "fmt"
- "git.i2edu.net/i2/i2-bill-api/internal/logic/auth"
- "git.i2edu.net/i2/i2-bill-api/internal/utils"
- "testing"
- "time"
- )
- func TestCreateJWT(t *testing.T) {
- l := new(auth.LoginByWeixinLogic)
- payloads := map[string]interface{}{
- "userId": 35,
- "sessionKey": "sessionKey",
- }
- fmt.Println(l.CreateJWT(1626837985, "6hy789iu87", payloads, 604800))
- }
- func TestRflect(t *testing.T) {
- type Ref struct {
- CreateTime sql.NullTime `db:"create_time"`
- Id int64 `db:"id"`
- StartTime time.Time `db:"start_time"`
- StartAdress string `db:"start_adress"`
- }
- var T = Ref{CreateTime: sql.NullTime{time.Now(), false}, Id: 100, StartAdress: "地址", StartTime: time.Now().AddDate(1, 0, 0)}
- var ts []Ref
- ts = append(ts, T)
- row := utils.UnmarshalMysqlRows(ts)
- fmt.Println(row)
- }
- func TestTime(t *testing.T) {
- ts, _ := time.Parse("2006-01-02 15:04:05", "1970-01-01 00:00:00")
- fmt.Println(ts.Unix(), time.Now())
- }
|