-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from OTOT-dev/change-db
Change db
- Loading branch information
Showing
25 changed files
with
315 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
.idea | ||
.vscode | ||
|
||
*.db | ||
|
||
tmp | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
package api | ||
package auth | ||
|
||
import ( | ||
"auth-server/middleware" | ||
"auth-server/model" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
type AuthApi struct{} | ||
type Apis struct{} | ||
|
||
func (AuthApi) Login(c *gin.Context) { | ||
// Login 用户登录 | ||
// @description 用户登录 | ||
// @version 1.0 | ||
// @tags 身份认证 | ||
// @BasePath /auth | ||
// @router /login [post] | ||
// @param bodyParams body model.LoginUser true "请求体参数" | ||
func (Apis) Login(c *gin.Context) { | ||
var param model.LoginUser | ||
if err := c.ShouldBindJSON(¶m); err != nil { | ||
middleware.Fail(c, model.ErrParam.AddErr(err)) | ||
return | ||
} | ||
err := authService.Login(param, c) | ||
middleware.Auto(c, err, nil) | ||
return | ||
} | ||
|
||
func (AuthApi) Register(c *gin.Context) { | ||
func (Apis) Register(c *gin.Context) { | ||
var param model.User | ||
if err := c.ShouldBindJSON(¶m); err != nil { | ||
middleware.Fail(c, model.ErrParam.AddErr(err)) | ||
return | ||
} | ||
err := authService.Register(¶m) | ||
middleware.Auto(c, err, nil) | ||
return | ||
} | ||
|
||
func (AuthApi) Logout(c *gin.Context) { | ||
func (Apis) Logout(c *gin.Context) { | ||
err := authService.Logout(c) | ||
middleware.Auto(c, err, nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package auth | ||
|
||
import "auth-server/services" | ||
|
||
var authService services.AuthService |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package v1 | ||
|
||
import "auth-server/services" | ||
|
||
var userService services.UserService |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.