Commit 849f944f authored by shajiaiming's avatar shajiaiming

fix

parent c3fde027
......@@ -14,7 +14,7 @@ func JWT() gin.HandlerFunc {
var data interface{}
code = e.SUCCESS
token := c.GetHeader("token")
token := c.Request.Header.Get("Token")
if token == "" {
code = e.INVALID_PARAMS
} else {
......
......@@ -26,10 +26,10 @@ const (
ERROR_GET_ARTICLE_FAIL = 10018
ERROR_GEN_ARTICLE_POSTER_FAIL = 10019
ERROR_AUTH_CHECK_TOKEN_FAIL = 20001
ERROR_AUTH_CHECK_TOKEN_TIMEOUT = 20002
ERROR_AUTH_TOKEN = 20003
ERROR_AUTH = 20004
ERROR_AUTH_CHECK_TOKEN_FAIL = 40001
ERROR_AUTH_CHECK_TOKEN_TIMEOUT = 40002
ERROR_AUTH_TOKEN = 40003
ERROR_AUTH = 40004
ERROR_UPLOAD_SAVE_IMAGE_FAIL = 30001
ERROR_UPLOAD_CHECK_IMAGE_FAIL = 30002
......
......@@ -22,7 +22,7 @@ func GenerateToken(username, password string) (string, error) {
EncodeMD5(password),
jwt.StandardClaims{
ExpiresAt: expireTime.Unix(),
Issuer: "gin-blog",
Issuer: "bwallet",
},
}
......
......@@ -8,6 +8,7 @@ import (
"bwallet/pkg/qrcode"
"bwallet/routers/api"
"bwallet/routers/api/v1"
"bwallet/middleware/jwt"
)
func InitRouter() *gin.Engine {
......@@ -24,7 +25,7 @@ func InitRouter() *gin.Engine {
r.POST("/upload", api.UploadImage)
apiv1 := r.Group("/api")
//apiv1.Use(jwt.JWT())
apiv1.Use(jwt.JWT())
{
apiv1.GET("/coins", v1.GetCoins)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment