Commit a67e7ef5 by xuzhenhao

增加了token的授权

1 parent d69c7f30
......@@ -48,8 +48,11 @@ func UserLoginApi(c *gin.Context) {
Path: "/",
HttpOnly: true,
}
res := map[string]string{
"user_id": result.(map[string]interface{})["user_id"].(string),
}
http.SetCookie(c.Writer, cookie)
ReturnRespones(c, "0", result)
ReturnRespones(c, "0", res)
return
}
......
......@@ -7,6 +7,7 @@ import (
"github.com/satori/go.uuid"
"log"
db "loginserver/database"
"strings"
)
type UserLoginInfo struct {
......@@ -153,6 +154,7 @@ func GetUserAccessToken(userName string) (result string, err error) {
}
userId := userInfo.(UserInfo).Id
uuid := uuid.NewV4().String()
uuid = strings.Replace(uuid, '-', "", -1)
sql := ` replace into icesimba_user_token(user_id,user_token) values(?,?)`
_, err = db.Engine.Exec(sql, userId, uuid)
if err != nil {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!