diff --git a/app/admin/apis/sys_content/sys_content.go b/app/admin/apis/sys_content/sys_content.go deleted file mode 100644 index 4139767..0000000 --- a/app/admin/apis/sys_content/sys_content.go +++ /dev/null @@ -1,84 +0,0 @@ -package sys_content - -//import ( -// "github.com/gin-gonic/gin" -// "github.com/gin-gonic/gin/binding" -// -// "go-admin/app/admin/models" -// "go-admin/tools" -// "github.com/go-admin-team/go-admin-core/sdk/pkg/response" -// "github.com/go-admin-team/go-admin-core/sdk/pkg/response/msg" -//) -// -//func GetSysContentList(c *gin.Context) { -// var data models.SysContent -// var err error -// var pageSize = 10 -// var pageIndex = 1 -// -// if size := c.Request.FormValue("pageSize"); size != "" { -// pageSize, err = tools.StringToInt(size) -// } -// if index := c.Request.FormValue("pageIndex"); index != "" { -// pageIndex, err = tools.StringToInt(index) -// } -// -// data.CateId = c.Request.FormValue("cateId") -// data.Name = c.Request.FormValue("name") -// data.Status = c.Request.FormValue("status") -// -// data.DataScope = tools.GetUserIdStr(c) -// result, count, err := data.GetPage(pageSize, pageIndex) -// tools.HasError(err, "", -1) -// -// app.PageOK(c, result, count, pageIndex, pageSize, "") -//} -// -//func GetSysContent(c *gin.Context) { -// var data models.SysContent -// data.Id, _ = tools.StringToInt(c.Param("id")) -// result, err := data.Get() -// tools.HasError(err, "抱歉未找到相关信息", -1) -// -// app.OK(c, result, "") -//} -// -//// @Summary 添加内容管理 -//// @Description 获取JSON -//// @Tags 内容管理 -//// @Accept application/json -//// @Product application/json -//// @Param data body models.SysContent true "data" -//// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" -//// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" -//// @Router /api/v1/syscontent [post] -//func InsertSysContent(c *gin.Context) { -// var data models.SysContent -// err := c.ShouldBindJSON(&data) -// data.CreateBy = tools.GetUserIdStr(c) -// tools.HasError(err, "", 500) -// result, err := data.Create() -// tools.HasError(err, "", -1) -// app.OK(c, result, "") -//} -// -//func UpdateSysContent(c *gin.Context) { -// var data models.SysContent -// err := c.BindWith(&data, binding.JSON) -// tools.HasError(err, "数据解析失败", -1) -// data.UpdateBy = tools.GetUserIdStr(c) -// result, err := data.Update(data.Id) -// tools.HasError(err, "", -1) -// -// app.OK(c, result, "") -//} -// -//func DeleteSysContent(c *gin.Context) { -// var data models.SysContent -// data.UpdateBy = tools.GetUserIdStr(c) -// -// IDS := tools.IdsStrToIdsIntGroup("id", c) -// _, err := data.BatchDelete(IDS) -// tools.HasError(err, msg.DeletedFail, 500) -// app.OK(c, nil, msg.DeletedSuccess) -//} diff --git a/common/middleware/handler/auth.go b/common/middleware/handler/auth.go index a6373da..36d940e 100644 --- a/common/middleware/handler/auth.go +++ b/common/middleware/handler/auth.go @@ -55,7 +55,7 @@ func IdentityHandler(c *gin.Context) interface{} { // @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值 // @Accept application/json // @Product application/json -// @Param account body system.Login true "account" +// @Param account body Login true "account" // @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }" // @Router /login [post] func Authenticator(c *gin.Context) (interface{}, error) { @@ -149,27 +149,6 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { // @Security Bearer func LogOut(c *gin.Context) { LoginLogToDB(c, "2", "退出成功", user.GetUserName(c)) - //var loginLog system.SysLoginLog - //loginLog.Ipaddr = c.ClientIP() - //location := pkg.GetLocation(c.ClientIP()) - //loginLog.LoginLocation = location - //loginLog.LoginTime = pkg.GetCurrentTime() - //loginLog.Status = "2" - //loginLog.Remark = c.Request.UserAgent() - //browserName, browserVersion := ua.Browser() - //loginLog.Browser = browserName + " " + browserVersion - //loginLog.Os = ua.OS() - //loginLog.Platform = ua.Platform() - //loginLog.Username = user.GetUserName(c) - //loginLog.Msg = "退出成功" - //db, err := pkg.GetOrm(c) - //if err != nil { - // log.Errorf("获取Orm失败, error:%s", err) - //} - //serviceLoginLog := service.SysLoginLog{} - //serviceLoginLog.Orm = db - //_ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate()) - c.JSON(http.StatusOK, gin.H{ "code": 200, "msg": "退出成功", diff --git a/docs/docs.go b/docs/docs.go index 63e03d1..9afd04a 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1826,7 +1826,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.Login" + "$ref": "#/definitions/handler.Login" } } ], @@ -2230,24 +2230,7 @@ var doc = `{ } } }, - "response.Response": { - "type": "object", - "properties": { - "code": { - "type": "integer" - }, - "msg": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "system.Login": { + "handler.Login": { "type": "object", "required": [ "code", @@ -2270,6 +2253,23 @@ var doc = `{ } } }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "msg": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, "tools.Params": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 314ccfa..7d371bf 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1809,7 +1809,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.Login" + "$ref": "#/definitions/handler.Login" } } ], @@ -2213,24 +2213,7 @@ } } }, - "response.Response": { - "type": "object", - "properties": { - "code": { - "type": "integer" - }, - "msg": { - "type": "string" - }, - "requestId": { - "type": "string" - }, - "status": { - "type": "string" - } - } - }, - "system.Login": { + "handler.Login": { "type": "object", "required": [ "code", @@ -2253,6 +2236,23 @@ } } }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "msg": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, "tools.Params": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 15724fc..b8cbf28 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -254,18 +254,7 @@ definitions: username: type: string type: object - response.Response: - properties: - code: - type: integer - msg: - type: string - requestId: - type: string - status: - type: string - type: object - system.Login: + handler.Login: properties: code: type: string @@ -281,6 +270,17 @@ definitions: - username - uuid type: object + response.Response: + properties: + code: + type: integer + msg: + type: string + requestId: + type: string + status: + type: string + type: object tools.Params: properties: treeCode: @@ -1605,7 +1605,7 @@ paths: name: account required: true schema: - $ref: '#/definitions/system.Login' + $ref: '#/definitions/handler.Login' responses: "200": description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": diff --git a/main.go b/main.go index 0e874dd..7e2c69f 100644 --- a/main.go +++ b/main.go @@ -4,7 +4,7 @@ import ( "go-admin/cmd" ) -//go:generate swag init --parseDependency +//go:generate swag init --parseDependency --parseDepth=6 // @title go-admin API // @version 1.3.1 @@ -18,4 +18,4 @@ import ( // @name Authorization func main() { cmd.Execute() -} \ No newline at end of file +}