update constant

This commit is contained in:
Nam Huynh 2021-08-09 11:43:47 +07:00
parent d9852ad3e5
commit 1f592675a4
4 changed files with 12 additions and 12 deletions

6
constant.go Normal file
View File

@ -0,0 +1,6 @@
package fcm
const (
logDBName = "log_fcm"
maxTokensPerSend = 1000
)

View File

@ -6,11 +6,6 @@ import (
"github.com/thoas/go-funk"
)
const (
logDBName = "fcm"
maxTokensPerSend = 1000
)
// base64Decode ...
func base64Decode(text string) []byte {
sDec, _ := b64.StdEncoding.DecodeString(text)

2
log.go
View File

@ -35,7 +35,7 @@ func (s Service) saveLog(doc Log) {
// Assign data
doc.ID = mongodb.NewObjectID()
doc.CreatedAt = Now()
doc.CreatedAt = now()
if _, err := s.DB.Collection(logDBName).InsertOne(ctx, doc); err != nil {
pretty.Println("*** FCM create log error", err.Error())

11
time.go
View File

@ -10,14 +10,13 @@ import "time"
const timezoneHCM = "Asia/Ho_Chi_Minh"
// GetHCMLocation ...
func GetHCMLocation() *time.Location {
// getHCMLocation ...
func getHCMLocation() *time.Location {
l, _ := time.LoadLocation(timezoneHCM)
return l
}
// Now ...
func Now() time.Time {
return time.Now().In(GetHCMLocation())
// now ...
func now() time.Time {
return time.Now().In(getHCMLocation())
}