Compare commits
1 Commits
ds
...
bb3a7fc957
| Author | SHA1 | Date | |
|---|---|---|---|
| bb3a7fc957 |
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ type Authorization struct {
|
|||||||
Platform string `bson:"p" json:"p"`
|
Platform string `bson:"p" json:"p"`
|
||||||
Uid string `bson:"u" json:"u"`
|
Uid string `bson:"u" json:"u"`
|
||||||
Alias string `bson:"al" json:"al"`
|
Alias string `bson:"al" json:"al"`
|
||||||
CreatedTime int64 `bson:"ct" json:"ct"`
|
CreatedTime primitive.DateTime `bson:"ct" json:"ct"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (auth *Authorization) ToStrings() []string {
|
func (auth *Authorization) ToStrings() []string {
|
||||||
@ -31,7 +30,6 @@ func (auth *Authorization) ToStrings() []string {
|
|||||||
"u", auth.Uid,
|
"u", auth.Uid,
|
||||||
"al", auth.Alias,
|
"al", auth.Alias,
|
||||||
"inv", auth.invalidated,
|
"inv", auth.invalidated,
|
||||||
"ct", strconv.FormatInt(auth.CreatedTime, 10),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,14 +39,12 @@ func (auth *Authorization) Valid() bool {
|
|||||||
|
|
||||||
func MakeAuthrizationFromStringMap(src map[string]string) Authorization {
|
func MakeAuthrizationFromStringMap(src map[string]string) Authorization {
|
||||||
accid, _ := primitive.ObjectIDFromHex(src["a"])
|
accid, _ := primitive.ObjectIDFromHex(src["a"])
|
||||||
ct, _ := strconv.ParseInt(src["ct"], 10, 0)
|
|
||||||
return Authorization{
|
return Authorization{
|
||||||
Account: accid,
|
Account: accid,
|
||||||
Platform: src["p"],
|
Platform: src["p"],
|
||||||
Uid: src["u"],
|
Uid: src["u"],
|
||||||
Alias: src["al"],
|
Alias: src["al"],
|
||||||
invalidated: src["inv"],
|
invalidated: src["inv"],
|
||||||
CreatedTime: ct,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user