feat:增加用户资产和会员状态
This commit is contained in:
15
app/api/enterprise/api/home.go
Normal file
15
app/api/enterprise/api/home.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package api
|
||||||
|
|
||||||
|
import (
|
||||||
|
"SciencesServer/app/api/enterprise/controller/home"
|
||||||
|
"SciencesServer/app/basic/api"
|
||||||
|
"SciencesServer/app/session"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Home struct{}
|
||||||
|
|
||||||
|
func (*Home) Instance(c *gin.Context) {
|
||||||
|
data, err := home.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).Instance()
|
||||||
|
api.APIResponse(err, data)
|
||||||
|
}
|
@ -7,6 +7,7 @@ import (
|
|||||||
"SciencesServer/config"
|
"SciencesServer/config"
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Instance struct{}
|
type Instance struct{}
|
||||||
@ -19,6 +20,9 @@ type (
|
|||||||
InstanceLoginParams struct {
|
InstanceLoginParams struct {
|
||||||
UID uint64
|
UID uint64
|
||||||
Avatar, Name, Mobile string
|
Avatar, Name, Mobile string
|
||||||
|
Vip bool
|
||||||
|
VipDeadline time.Time
|
||||||
|
Currency float64
|
||||||
Identity, SelectIdentity int
|
Identity, SelectIdentity int
|
||||||
Status model.AccountStatusKind
|
Status model.AccountStatusKind
|
||||||
}
|
}
|
||||||
@ -39,6 +43,9 @@ func (c *Instance) Login() InstanceLoginCallback {
|
|||||||
_session.Avatar = params.Avatar
|
_session.Avatar = params.Avatar
|
||||||
_session.Name = params.Name
|
_session.Name = params.Name
|
||||||
_session.Mobile = params.Mobile
|
_session.Mobile = params.Mobile
|
||||||
|
_session.Vip = params.Vip
|
||||||
|
_session.VipDeadline = params.VipDeadline
|
||||||
|
_session.Currency = params.Currency
|
||||||
_session.Identity = params.Identity
|
_session.Identity = params.Identity
|
||||||
_session.SelectIdentity = params.SelectIdentity
|
_session.SelectIdentity = params.SelectIdentity
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
package account
|
package account
|
||||||
|
|
||||||
import (
|
import (
|
||||||
model3 "SciencesServer/app/api/enterprise/model"
|
"SciencesServer/app/api/enterprise/model"
|
||||||
model2 "SciencesServer/app/common/model"
|
model2 "SciencesServer/app/common/model"
|
||||||
"SciencesServer/app/handle"
|
"SciencesServer/app/handle"
|
||||||
"SciencesServer/config"
|
"SciencesServer/config"
|
||||||
|
"SciencesServer/serve/orm"
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"errors"
|
"errors"
|
||||||
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Login struct{ local string }
|
type Login struct{ local string }
|
||||||
@ -58,32 +60,47 @@ func loginForSmsCaptcha(params *LoginParams, local string) (*InstanceLoginParams
|
|||||||
}
|
}
|
||||||
var isExist bool
|
var isExist bool
|
||||||
// 查询账号信息
|
// 查询账号信息
|
||||||
mUserInstance := model3.NewUserInstance()
|
mUserInstance := model.NewUserInstance()
|
||||||
|
|
||||||
if isExist, err = model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "avatar", "name", "mobile", "status"},
|
if isExist, err = model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "avatar", "name", "mobile",
|
||||||
|
"is_vip", "vip_deadline", "status"},
|
||||||
model2.NewWhere("mobile", params.Captcha.Mobile)); err != nil {
|
model2.NewWhere("mobile", params.Captcha.Mobile)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
mUserIdentity := model3.NewUserIdentity()
|
mUserIdentity := model.NewUserIdentity()
|
||||||
|
// 用户资产信息
|
||||||
|
mUserAssets := new(model.UserAssets)
|
||||||
|
|
||||||
if isExist {
|
if isExist {
|
||||||
// 查询该区域下最后一次选中的信息
|
// 查询该区域下最后一次选中的信息
|
||||||
if err = mUserIdentity.LastChooseInfo(mUserInstance.UUID); err != nil {
|
if err = mUserIdentity.LastChooseInfo(mUserInstance.UUID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mUserAssets, err = model.NewUserAssets().Assets(mUserInstance.UUID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
goto RETURNS
|
goto RETURNS
|
||||||
}
|
}
|
||||||
mUserInstance.Name = params.Captcha.Mobile
|
if err = orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||||
mUserInstance.Mobile = params.Captcha.Mobile
|
mUserInstance.Name = params.Captcha.Mobile
|
||||||
mUserInstance.Password = utils.GetRandomString(12)
|
mUserInstance.Mobile = params.Captcha.Mobile
|
||||||
|
mUserInstance.Password = utils.GetRandomString(12)
|
||||||
|
|
||||||
if err = model2.Create(mUserInstance.UserInstance); err != nil {
|
if err = model2.Create(mUserInstance.UserInstance, tx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
mUserAssets.UID = mUserInstance.UUID
|
||||||
|
|
||||||
|
return model2.Create(mUserAssets.UserAssets, tx)
|
||||||
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
RETURNS:
|
RETURNS:
|
||||||
return &InstanceLoginParams{
|
return &InstanceLoginParams{
|
||||||
UID: mUserInstance.UUID,
|
UID: mUserInstance.UUID,
|
||||||
Avatar: mUserInstance.GetAvatarAttribute(config.SettingInfo.Domain), Name: mUserInstance.Name, Mobile: mUserInstance.Mobile,
|
Avatar: mUserInstance.GetAvatarAttribute(config.SettingInfo.Domain), Name: mUserInstance.Name, Mobile: mUserInstance.Mobile,
|
||||||
|
Vip: mUserInstance.VipStatus(), VipDeadline: mUserInstance.VipDeadline, Currency: mUserAssets.Currency,
|
||||||
Identity: mUserInstance.Identity, SelectIdentity: mUserIdentity.Identity,
|
Identity: mUserInstance.Identity, SelectIdentity: mUserIdentity.Identity,
|
||||||
Status: mUserInstance.Status,
|
Status: mUserInstance.Status,
|
||||||
}, nil
|
}, nil
|
||||||
@ -94,9 +111,10 @@ func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams,
|
|||||||
if !utils.ValidateMobile(params.Password.Account) {
|
if !utils.ValidateMobile(params.Password.Account) {
|
||||||
return nil, errors.New("操作错误,手机号码格式异常")
|
return nil, errors.New("操作错误,手机号码格式异常")
|
||||||
}
|
}
|
||||||
mUserInstance := model3.NewUserInstance()
|
mUserInstance := model.NewUserInstance()
|
||||||
|
|
||||||
isExist, err := model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "name", "avatar", "mobile", "password", "salt", "status"},
|
isExist, err := model2.FirstField(mUserInstance.UserInstance, []string{"id", "uuid", "name", "avatar", "mobile",
|
||||||
|
"is_vip", "vip_deadline", "password", "salt", "status"},
|
||||||
model2.NewWhere("mobile", params.Password.Account))
|
model2.NewWhere("mobile", params.Password.Account))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -107,8 +125,14 @@ func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams,
|
|||||||
if !mUserInstance.ValidatePassword(params.Password.Password) {
|
if !mUserInstance.ValidatePassword(params.Password.Password) {
|
||||||
return nil, errors.New("操作错误,账户或密码错误")
|
return nil, errors.New("操作错误,账户或密码错误")
|
||||||
}
|
}
|
||||||
|
// 用户资产信息
|
||||||
|
mUserAssets := new(model.UserAssets)
|
||||||
|
|
||||||
|
if mUserAssets, err = model.NewUserAssets().Assets(mUserInstance.UUID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
// 最后一次选中的身份信息
|
// 最后一次选中的身份信息
|
||||||
mUserIdentity := model3.NewUserIdentity()
|
mUserIdentity := model.NewUserIdentity()
|
||||||
|
|
||||||
if err = mUserIdentity.LastChooseInfo(mUserInstance.UUID); err != nil {
|
if err = mUserIdentity.LastChooseInfo(mUserInstance.UUID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -116,6 +140,7 @@ func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams,
|
|||||||
return &InstanceLoginParams{
|
return &InstanceLoginParams{
|
||||||
UID: mUserInstance.UUID,
|
UID: mUserInstance.UUID,
|
||||||
Avatar: mUserInstance.GetAvatarAttribute(config.SettingInfo.Domain), Name: mUserInstance.Name, Mobile: mUserInstance.Mobile,
|
Avatar: mUserInstance.GetAvatarAttribute(config.SettingInfo.Domain), Name: mUserInstance.Name, Mobile: mUserInstance.Mobile,
|
||||||
|
Vip: mUserInstance.VipStatus(), VipDeadline: mUserInstance.VipDeadline, Currency: mUserAssets.Currency,
|
||||||
Identity: mUserInstance.Identity, SelectIdentity: mUserIdentity.Identity,
|
Identity: mUserInstance.Identity, SelectIdentity: mUserIdentity.Identity,
|
||||||
Status: mUserInstance.Status,
|
Status: mUserInstance.Status,
|
||||||
}, nil
|
}, nil
|
||||||
|
24
app/api/enterprise/controller/home/instance.go
Normal file
24
app/api/enterprise/controller/home/instance.go
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package home
|
||||||
|
|
||||||
|
import "SciencesServer/app/session"
|
||||||
|
|
||||||
|
type Instance struct {
|
||||||
|
*session.Enterprise
|
||||||
|
local string
|
||||||
|
}
|
||||||
|
|
||||||
|
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||||
|
|
||||||
|
type InstanceInfo struct {
|
||||||
|
Currency float64 `json:"currency"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Instance) Instance() (*InstanceInfo, error) {
|
||||||
|
return &InstanceInfo{Currency: c.Currency}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewInstance() InstanceHandle {
|
||||||
|
return func(session *session.Enterprise, local string) *Instance {
|
||||||
|
return &Instance{Enterprise: session, local: local}
|
||||||
|
}
|
||||||
|
}
|
15
app/api/enterprise/controller/user/assets.go
Normal file
15
app/api/enterprise/controller/user/assets.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package user
|
||||||
|
|
||||||
|
import "SciencesServer/app/session"
|
||||||
|
|
||||||
|
type Assets struct {
|
||||||
|
*session.Enterprise
|
||||||
|
}
|
||||||
|
|
||||||
|
type AssetsHandle func(session *session.Enterprise) *Assets
|
||||||
|
|
||||||
|
func NewAssets() AssetsHandle {
|
||||||
|
return func(session *session.Enterprise) *Assets {
|
||||||
|
return &Assets{Enterprise: session}
|
||||||
|
}
|
||||||
|
}
|
@ -17,10 +17,13 @@ type InstanceHandle func(session *session.Enterprise) *Instance
|
|||||||
type (
|
type (
|
||||||
// InstanceInfo 基本信息
|
// InstanceInfo 基本信息
|
||||||
InstanceInfo struct {
|
InstanceInfo struct {
|
||||||
Avatar string `json:"avatar"` // 头像
|
Avatar string `json:"avatar"` // 头像
|
||||||
Name string `json:"name"` // 名称
|
Name string `json:"name"` // 名称
|
||||||
Identity int `json:"identity"` // 具体身份
|
Currency float64 `json:"currency"` // 创新币
|
||||||
SelectIdentity int `json:"select_identity"` // 最后一次选中的身份信息
|
Vip bool `json:"vip"` // Vip状态
|
||||||
|
VipDays int `json:"vip_days"` // Vip剩余天数
|
||||||
|
Identity int `json:"identity"` // 具体身份
|
||||||
|
SelectIdentity int `json:"select_identity"` // 最后一次选中的身份信息
|
||||||
}
|
}
|
||||||
// InstanceDetailInfo 详细信息
|
// InstanceDetailInfo 详细信息
|
||||||
InstanceDetailInfo struct {
|
InstanceDetailInfo struct {
|
||||||
@ -33,7 +36,16 @@ type (
|
|||||||
|
|
||||||
// Info 基本信息
|
// Info 基本信息
|
||||||
func (c *Instance) Info() *InstanceInfo {
|
func (c *Instance) Info() *InstanceInfo {
|
||||||
return &InstanceInfo{Avatar: c.Avatar, Name: c.Name, Identity: c.Identity, SelectIdentity: c.SelectIdentity}
|
out := &InstanceInfo{Avatar: c.Avatar, Name: c.Name,
|
||||||
|
Currency: c.Currency,
|
||||||
|
Vip: c.VipStatus(),
|
||||||
|
Identity: c.Identity,
|
||||||
|
SelectIdentity: c.SelectIdentity}
|
||||||
|
|
||||||
|
if out.Vip {
|
||||||
|
out.VipDays = utils.DiffTimeDays(time.Now(), c.VipDeadline)
|
||||||
|
}
|
||||||
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindMobile 绑定手机号码
|
// BindMobile 绑定手机号码
|
||||||
|
18
app/api/enterprise/model/user_assets.go
Normal file
18
app/api/enterprise/model/user_assets.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import "SciencesServer/app/common/model"
|
||||||
|
|
||||||
|
type UserAssets struct {
|
||||||
|
*model.UserAssets
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *UserAssets) Assets(uid uint64) (*UserAssets, error) {
|
||||||
|
if _, err := model.FirstField(m.UserAssets, []string{"id", "currency"}, model.NewWhere("uid", uid)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserAssets() *UserAssets {
|
||||||
|
return &UserAssets{model.NewUserAssets()}
|
||||||
|
}
|
@ -15,9 +15,11 @@ type UserInstance struct {
|
|||||||
Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"`
|
Name string `gorm:"column:name;type:varchar(20);default:'';comment:真实姓名" json:"name"`
|
||||||
Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
Mobile string `gorm:"column:mobile;index:idx_user_instance_mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
||||||
Gender
|
Gender
|
||||||
Identity int `gorm:"column:identity;type:int(8);default:0;comment:身份信息" json:"-"`
|
IsVip UserInstanceVip `gorm:"column:is_vip;type:tinyint(1);default:0;comment:是否会员" json:"is_vip"`
|
||||||
Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"`
|
VipDeadline time.Time `gorm:"column:vip_deadline;type:datetime;default:null;comment:会员过期时间" json:"vip_deadline"`
|
||||||
Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"`
|
Identity int `gorm:"column:identity;type:int(8);default:0;comment:身份信息" json:"-"`
|
||||||
|
Password string `gorm:"column:password;type:varchar(100);default:'';comment:密码" json:"-"`
|
||||||
|
Salt string `gorm:"column:salt;type:varchar(10);default:'';comment:盐值" json:"-"`
|
||||||
AccountStatus
|
AccountStatus
|
||||||
ModelDeleted
|
ModelDeleted
|
||||||
ModelAt
|
ModelAt
|
||||||
@ -33,6 +35,16 @@ const (
|
|||||||
UserInstanceSourceForWechat
|
UserInstanceSourceForWechat
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// UserInstanceVip 用户会员状态
|
||||||
|
type UserInstanceVip int
|
||||||
|
|
||||||
|
const (
|
||||||
|
// UserInstanceVipForNot 不是会员
|
||||||
|
UserInstanceVipForNot UserInstanceVip = iota
|
||||||
|
// UserInstanceVipForYes 是会员
|
||||||
|
UserInstanceVipForYes
|
||||||
|
)
|
||||||
|
|
||||||
func (m *UserInstance) TableName() string {
|
func (m *UserInstance) TableName() string {
|
||||||
return "user_instance"
|
return "user_instance"
|
||||||
}
|
}
|
||||||
@ -62,6 +74,10 @@ func (m *UserInstance) SetPasswordAttribute() {
|
|||||||
m.Password = utils.HashString([]byte(utils.Md5String(m.Password, m.Salt)))
|
m.Password = utils.HashString([]byte(utils.Md5String(m.Password, m.Salt)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *UserInstance) VipStatus() bool {
|
||||||
|
return m.IsVip == UserInstanceVipForYes && m.VipDeadline.After(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
func NewUserInstance() *UserInstance {
|
func NewUserInstance() *UserInstance {
|
||||||
return &UserInstance{}
|
return &UserInstance{}
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,22 @@ package session
|
|||||||
import (
|
import (
|
||||||
"SciencesServer/utils"
|
"SciencesServer/utils"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Enterprise 企业用户
|
// Enterprise 企业用户
|
||||||
type Enterprise struct {
|
type Enterprise struct {
|
||||||
Token string `json:"token"` // token
|
Token string `json:"token"` // token
|
||||||
UID uint64 `json:"uid"` // 唯一标识ID
|
UID uint64 `json:"uid"` // 唯一标识ID
|
||||||
IdentityUID uint64 `json:"identity_uid"` // 用户身份唯一ID
|
IdentityUID uint64 `json:"identity_uid"` // 用户身份唯一ID
|
||||||
Avatar string `json:"avatar"` // 头像
|
Avatar string `json:"avatar"` // 头像
|
||||||
Name string `json:"name"` // 名称
|
Name string `json:"name"` // 名称
|
||||||
Mobile string `json:"mobile"` // 手机号码
|
Mobile string `json:"mobile"` // 手机号码
|
||||||
Identity int `json:"identity"` // 总身份信息
|
Vip bool `json:"vip"` // VIP状态
|
||||||
SelectIdentity int `json:"select_identity"` // 选中身份信息
|
VipDeadline time.Time `json:"vip_deadline"` // VIP过期时间
|
||||||
|
Currency float64 `json:"currency"` // 货币-创新币
|
||||||
|
Identity int `json:"identity"` // 总身份信息
|
||||||
|
SelectIdentity int `json:"select_identity"` // 选中身份信息
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Enterprise) SetToken(token string) {
|
func (this *Enterprise) SetToken(token string) {
|
||||||
@ -29,6 +33,10 @@ func (this *Enterprise) UIDToString() string {
|
|||||||
return utils.UintToString(this.UID)
|
return utils.UintToString(this.UID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Enterprise) VipStatus() bool {
|
||||||
|
return this.Vip && this.VipDeadline.After(time.Now())
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Enterprise) MarshalBinary() ([]byte, error) {
|
func (this *Enterprise) MarshalBinary() ([]byte, error) {
|
||||||
return json.Marshal(this)
|
return json.Marshal(this)
|
||||||
}
|
}
|
||||||
|
@ -69,10 +69,7 @@ func (this *Serve) Run() {
|
|||||||
app.Init()
|
app.Init()
|
||||||
tools.Init()
|
tools.Init()
|
||||||
// 开启Elasticsearch
|
// 开启Elasticsearch
|
||||||
es.NewInstance(es.WithEsAddress([]string{""}),
|
es.NewInstance(es.WithEsAddress([]string{"http://192.168.0.188:9200"})).Init().Local()
|
||||||
es.WithEsUsername(""),
|
|
||||||
es.WithEsPassword(""),
|
|
||||||
).Init().Local()
|
|
||||||
// 开启web
|
// 开启web
|
||||||
web.NewWeb()(&web.WebConfig{
|
web.NewWeb()(&web.WebConfig{
|
||||||
Port: config.SettingInfo.Server.Port, ReadTimeout: config.SettingInfo.Server.ReadTimeout,
|
Port: config.SettingInfo.Server.Port, ReadTimeout: config.SettingInfo.Server.ReadTimeout,
|
||||||
|
@ -161,6 +161,12 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
|||||||
userV1.GET("/info", _api.Info)
|
userV1.GET("/info", _api.Info)
|
||||||
userV1.GET("/patent", _api.Patent)
|
userV1.GET("/patent", _api.Patent)
|
||||||
}
|
}
|
||||||
|
// Home 首页管理
|
||||||
|
homeV1 := v1.Group("/home")
|
||||||
|
{
|
||||||
|
_api := new(api2.Home)
|
||||||
|
homeV1.GET("", _api.Instance)
|
||||||
|
}
|
||||||
// Sys 配置管理
|
// Sys 配置管理
|
||||||
sysV1 := v1.Group("/sys")
|
sysV1 := v1.Group("/sys")
|
||||||
{
|
{
|
||||||
|
@ -66,3 +66,8 @@ func DiffTimeMonth(time1, time2 time.Time) int {
|
|||||||
month := math.Abs(float64(time1.Month()) - float64(time2.Month()))
|
month := math.Abs(float64(time1.Month()) - float64(time2.Month()))
|
||||||
return int(year)*12 + int(month) + 1
|
return int(year)*12 + int(month) + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DiffTimeDays(time1, time2 time.Time) int {
|
||||||
|
sub := time1.Sub(time2)
|
||||||
|
return int(math.Ceil(math.Abs(sub.Hours() / 24.0)))
|
||||||
|
}
|
||||||
|
9
utils/time_test.go
Normal file
9
utils/time_test.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package utils
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestDiffTimeDays(t *testing.T) {
|
||||||
|
time1 := DateTimeToTime("2022-05-06 23:59:59")
|
||||||
|
time2 := DateTimeToTime("2022-05-04 01:59:59")
|
||||||
|
t.Log(DiffTimeDays(time1, time2))
|
||||||
|
}
|
Reference in New Issue
Block a user