parent
6eff55d020
commit
3d6b7bd8d5
@ -1,16 +1,53 @@
|
|||||||
package LoginController
|
package LoginController
|
||||||
|
|
||||||
import "github.com/gin-gonic/gin"
|
import (
|
||||||
|
"dsSupport/Model"
|
||||||
|
"dsSupport/MyModel/Login/LoginDao"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
//模块的路由配置
|
//模块的路由配置
|
||||||
func Routers(r *gin.RouterGroup) {
|
func Routers(r *gin.RouterGroup) {
|
||||||
rr := r.Group("/login")
|
rr := r.Group("/login")
|
||||||
//配置接口
|
//配置接口
|
||||||
rr.POST("/DoLogin", DoLogin)
|
rr.POST("/DoLogin", DoLogin)
|
||||||
//rr.GET("/GetBaseBusiness", GetBaseBusiness)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Summary 登录
|
||||||
|
// @Description 登录
|
||||||
|
// @Tags 登录
|
||||||
|
// @Accept application/x-www-form-urlencoded
|
||||||
|
// @Produce json
|
||||||
|
// @Param loginName formData string true "登录名"
|
||||||
|
// @Param loginPwd formData string true "登录密码"
|
||||||
|
// @Success 200 {object} Model.Res
|
||||||
|
// @Router /support/accessSystem/GetPositionTreeInfo [post]
|
||||||
func DoLogin(c *gin.Context) {
|
func DoLogin(c *gin.Context) {
|
||||||
|
//登录名
|
||||||
|
loginName := c.PostForm("loginName")
|
||||||
|
//登录密码
|
||||||
|
loginPwd := c.PostForm("loginPwd")
|
||||||
|
|
||||||
|
success, _, _, _, err := LoginDao.Login(loginName, loginPwd)
|
||||||
|
if err != nil {
|
||||||
|
c.JSON(http.StatusOK, Model.Res{
|
||||||
|
Success: false,
|
||||||
|
Message: err.Error(),
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if success {
|
||||||
|
c.JSON(http.StatusOK, Model.Res{
|
||||||
|
Success: true,
|
||||||
|
Message: "登录成功!",
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
c.JSON(http.StatusOK, Model.Res{
|
||||||
|
Success: false,
|
||||||
|
Message: "用户名或密码不正确!",
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue