* 1. 获取用户token 2. */
(c *gin.Context)
| 112 | */ |
| 113 | |
| 114 | func getUserProfile(c *gin.Context) { |
| 115 | response := gin.H{"code": http.StatusOK} |
| 116 | defer c.JSON(http.StatusOK, response) |
| 117 | var user *User |
| 118 | if user = mydb.getUserProfile(c.GetString("username")); user == nil { |
| 119 | response["code"] = http.StatusBadRequest |
| 120 | response["message"] = "user not found" |
| 121 | return |
| 122 | } |
| 123 | response["result"] = user |
| 124 | } |
| 125 | |
| 126 | func createUser(c *gin.Context) { |
| 127 | response := gin.H{"code": http.StatusOK} |
nothing calls this directly
no test coverage detected