| | |
| | | "basic.com/dbapi.git" |
| | | "fmt" |
| | | "github.com/gin-gonic/gin" |
| | | "github.com/gin-gonic/gin/internal/json" |
| | | "time" |
| | | "webserver/extend/code" |
| | | "webserver/extend/util" |
| | |
| | | return |
| | | } |
| | | var api dbapi.UserApi |
| | | flag, userInfo := api.Login(userName, password) |
| | | flag, data := api.Login(userName, password) |
| | | if flag { |
| | | authDriver := auth.GenerateAuthDriver() |
| | | tokenStr := (*authDriver).Login(c.Request, c.Writer, util.Struct2Map(userInfo)) |
| | | loginedM := util.Struct2Map(data) |
| | | b, _ := json.Marshal(loginedM["data"]) |
| | | uMap :=make(map[string]interface{},0) |
| | | json.Unmarshal(b,uMap) |
| | | tokenStr := (*authDriver).Login(c.Request, c.Writer, uMap) |
| | | c.JSON(200,map[string]interface{}{ |
| | | "userInfo":userInfo.(map[string]interface{})["data"], |
| | | "userInfo":uMap, |
| | | "access_token":tokenStr, |
| | | "refresh_token":tokenStr, |
| | | "scope":"app", |