func added
This commit is contained in:
parent
ad5be72ce1
commit
a3a525c02b
1 changed files with 8 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package merch
|
|||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -23,3 +24,10 @@ func getUserId(c *gin.Context) int64 {
|
|||
id, _ := c.Get("userId")
|
||||
return id.(int64)
|
||||
}
|
||||
|
||||
func getPeriod(days int) time.Time {
|
||||
if days > 365 {
|
||||
days = 7
|
||||
}
|
||||
return time.Now().UTC().Add(-(time.Duration(days) * time.Hour * 24))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue