This commit is contained in:
laodaming
2023-06-02 19:24:58 +08:00
parent 6c717ce30e
commit 92b29d8006
12 changed files with 609 additions and 17 deletions

View File

@@ -58,13 +58,13 @@ func CheckAuth(r *http.Request) UserInfo {
token = r.Header.Get("Auth-Key")
}
if token == "" {
logx.Debug("token is empty")
logx.Error("token is empty")
return UserInfo{}
}
//解析token
userInfo, err := ParseJwtToken(token)
if err != nil {
logx.Debug(err)
logx.Error(err)
return UserInfo{}
}
return userInfo

13
utils/format/price.go Normal file
View File

@@ -0,0 +1,13 @@
package format
import (
"fmt"
"strconv"
)
// 美分转美元
func FentoDollar(price int64) float64 {
str := fmt.Sprintf("%.2f", float64(price)/float64(100))
dollar, _ := strconv.ParseFloat(str, 64)
return dollar
}