feat:增加用户资产和会员状态

This commit is contained in:
henry
2021-12-10 11:34:19 +08:00
parent 626f30a2bd
commit 2ee564d540
13 changed files with 188 additions and 31 deletions

View File

@ -66,3 +66,8 @@ func DiffTimeMonth(time1, time2 time.Time) int {
month := math.Abs(float64(time1.Month()) - float64(time2.Month()))
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
View 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))
}