first commit
This commit is contained in:
13
common/random.go
Normal file
13
common/random.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"github.com/sqids/sqids-go"
|
||||
)
|
||||
|
||||
func UniqID(unix int64) string {
|
||||
s, _ := sqids.New(sqids.Options{
|
||||
MinLength: 8,
|
||||
})
|
||||
id, _ := s.Encode([]uint64{uint64(unix)})
|
||||
return id
|
||||
}
|
||||
7
common/time.go
Normal file
7
common/time.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package common
|
||||
|
||||
import "time"
|
||||
|
||||
func Unix2Datetime(t int64) string {
|
||||
return time.Unix(t, 0).Format(time.DateTime)
|
||||
}
|
||||
Reference in New Issue
Block a user