增加权限获取,修改用户信息接口参数
parent
4660e0bdbb
commit
f41b150311
11
README.md
11
README.md
|
@ -778,7 +778,9 @@ mysql> select * from file_upload_and_downloads;
|
|||
gin-vue-admin提供代码自动生成功能,选择数据库表结构,可直接生成前端代码及后端代码,很方便
|
||||
比如周报的表结构如下:
|
||||
```
|
||||
// 周报
|
||||
{
|
||||
"id":100,
|
||||
"header":"周报",
|
||||
"contents":[
|
||||
{"title":"", "content":""},
|
||||
|
@ -789,6 +791,15 @@ gin-vue-admin提供代码自动生成功能,选择数据库表结构,可直
|
|||
{"file":"2db0df442ea6d92d75657712a29e5604_20211102201017.txt"}
|
||||
]
|
||||
}
|
||||
|
||||
// 评论
|
||||
{
|
||||
"id":100,
|
||||
"comments":[
|
||||
{""}
|
||||
]
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
# 反射reflect
|
||||
|
|
|
@ -0,0 +1,166 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"goweb-gin-demo/global"
|
||||
"goweb-gin-demo/model/common/request"
|
||||
"goweb-gin-demo/model/common/response"
|
||||
"goweb-gin-demo/model/web"
|
||||
webReq "goweb-gin-demo/model/web/request"
|
||||
webRes "goweb-gin-demo/model/web/response"
|
||||
"goweb-gin-demo/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
type AuthorityApi struct {
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 创建角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body web.SysAuthority true "权限id, 权限名, 父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /authority/createAuthority [post]
|
||||
func (a *AuthorityApi) CreateAuthority(c *gin.Context) {
|
||||
var authority web.SysAuthority
|
||||
_ = c.ShouldBindJSON(&authority)
|
||||
if err := utils.Verify(authority, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, authBack := authorityService.CreateAuthority(authority); err != nil {
|
||||
global.GLOBAL_LOG.Error("创建失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("创建失败"+err.Error(), c)
|
||||
} else {
|
||||
_ = menuService.AddMenuAuthority(webReq.DefaultMenu(), authority.AuthorityId)
|
||||
_ = casbinService.UpdateCasbin(authority.AuthorityId, webReq.DefaultCasbin())
|
||||
response.OkWithDetailed(webRes.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 拷贝角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body response.SysAuthorityCopyResponse true "旧角色id, 新权限id, 新权限名, 新父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拷贝成功"}"
|
||||
// @Router /authority/copyAuthority [post]
|
||||
func (a *AuthorityApi) CopyAuthority(c *gin.Context) {
|
||||
var copyInfo webRes.SysAuthorityCopyResponse
|
||||
_ = c.ShouldBindJSON(©Info)
|
||||
if err := utils.Verify(copyInfo, utils.OldAuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := utils.Verify(copyInfo.Authority, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, authBack := authorityService.CopyAuthority(copyInfo); err != nil {
|
||||
global.GLOBAL_LOG.Error("拷贝失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("拷贝失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithDetailed(webRes.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 删除角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body web.SysAuthority true "删除角色"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /authority/deleteAuthority [post]
|
||||
func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
|
||||
var authority web.SysAuthority
|
||||
_ = c.ShouldBindJSON(&authority)
|
||||
if err := utils.Verify(authority, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := authorityService.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色
|
||||
global.GLOBAL_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 更新角色信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body web.SysAuthority true "权限id, 权限名, 父角色id"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /authority/updateAuthority [post]
|
||||
func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
|
||||
var auth web.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
if err := utils.Verify(auth, utils.AuthorityVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, authority := authorityService.UpdateAuthority(auth); err != nil {
|
||||
global.GLOBAL_LOG.Error("更新失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("更新失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithDetailed(webRes.SysAuthorityResponse{Authority: authority}, "更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 分页获取角色列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.PageInfo true "页码, 每页大小"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /authority/getAuthorityList [post]
|
||||
func (a *AuthorityApi) GetAuthorityList(c *gin.Context) {
|
||||
var pageInfo request.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err, list, total := authorityService.GetAuthorityInfoList(pageInfo); err != nil {
|
||||
global.GLOBAL_LOG.Error("获取失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("获取失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithDetailed(response.PageResult{
|
||||
List: list,
|
||||
Total: total,
|
||||
Page: pageInfo.Page,
|
||||
PageSize: pageInfo.PageSize,
|
||||
}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Authority
|
||||
// @Summary 设置角色资源权限
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body web.SysAuthority true "设置角色资源权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Router /authority/setDataAuthority [post]
|
||||
func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
|
||||
var auth web.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
if err := utils.Verify(auth, utils.AuthorityIdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
}
|
||||
if err := authorityService.SetDataAuthority(auth); err != nil {
|
||||
global.GLOBAL_LOG.Error("设置失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("设置失败"+err.Error(), c)
|
||||
} else {
|
||||
response.OkWithMessage("设置成功", c)
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ type ApiGroup struct {
|
|||
BaseApi
|
||||
JwtApi
|
||||
AuthorityMenuApi
|
||||
AuthorityApi
|
||||
FileUploadAndDownloadApi
|
||||
SystemApi
|
||||
}
|
||||
|
@ -18,4 +19,6 @@ var menuService = service.ServiceGroupApp.MenuService
|
|||
var baseMenuService = service.ServiceGroupApp.BaseMenuService
|
||||
var systemConfigService = service.ServiceGroupApp.SystemConfigService
|
||||
var fileUploadAndDownloadService = service.ServiceGroupApp.FileUploadAndDownloadService
|
||||
var authorityService = service.ServiceGroupApp.AuthorityService
|
||||
var casbinService = service.ServiceGroupApp.CasbinService
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ type FileUploadAndDownloadApi struct {
|
|||
}
|
||||
|
||||
// @Tags FileUploadAndDownload
|
||||
// @Summary 上传文件示例
|
||||
// @Summary 上传文件
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
|
|
|
@ -275,12 +275,29 @@ func (b *BaseApi) DeleteUser(c *gin.Context) {
|
|||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body web.SysUser true "ID, 用户名, 昵称, 头像链接"
|
||||
// @Param data body web.SysSimpleUser true "ID, 用户名, 昵称, 密码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Router /user/setUserInfo [put]
|
||||
func (b *BaseApi) SetUserInfo(c *gin.Context) {
|
||||
var user web.SysUser
|
||||
_ = c.ShouldBindJSON(&user)
|
||||
|
||||
//TODO 为了周报数据需要转换一下,也更改了请求参数: @Param data body web.User true "ID, 用户名, 昵称, 头像"
|
||||
{
|
||||
//如果password不为空,那就加密
|
||||
if len(user.Password) != 0 {
|
||||
user.Password = utils.MD5V([]byte(user.Password))
|
||||
}
|
||||
|
||||
//修改用户权限
|
||||
if len(user.AuthorityId) != 0 {
|
||||
var sua systemReq.SetUserAuthorities
|
||||
sua.ID = user.ID
|
||||
sua.AuthorityIds = []string{ user.AuthorityId }
|
||||
userService.SetUserAuthorities(sua.ID, sua.AuthorityIds)
|
||||
}
|
||||
}
|
||||
|
||||
if err := utils.Verify(user, utils.IdVerify); err != nil {
|
||||
response.FailWithMessage(err.Error(), c)
|
||||
return
|
||||
|
|
|
@ -30,7 +30,7 @@ casbin:
|
|||
# system configuration
|
||||
system:
|
||||
env: 'develop' # Change to "develop" to skip authentication for development mode # public
|
||||
addr: 8889
|
||||
addr: 8888
|
||||
db-type: 'mysql'
|
||||
oss-type: 'local' # 控制oss选择走本期还是 七牛等其他仓 自行增加其他oss仓可以在 server/utils/upload/upload.go 中 NewOss函数配置
|
||||
use-multipoint: false
|
||||
|
@ -69,4 +69,4 @@ Timer:
|
|||
{ tableName: "sys_operation_records" , compareField: "created_at", interval: "2160h" },
|
||||
{ tableName: "jwt_blacklists" , compareField: "created_at", interval: "168h" }
|
||||
#{ tableName: "log2" , compareField: "created_at", interval: "2160h" }
|
||||
]
|
||||
]
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
package config
|
||||
|
||||
type Autocode struct {
|
||||
TransferRestart bool `mapstructure:"transfer-restart" json:"transferRestart" yaml:"transfer-restart"`
|
||||
Root string `mapstructure:"root" json:"root" yaml:"root"`
|
||||
Server string `mapstructure:"server" json:"server" yaml:"server"`
|
||||
SApi string `mapstructure:"server-api" json:"serverApi" yaml:"server-api"`
|
||||
SInitialize string `mapstructure:"server-initialize" json:"serverInitialize" yaml:"server-initialize"`
|
||||
SModel string `mapstructure:"server-model" json:"serverModel" yaml:"server-model"`
|
||||
SRequest string `mapstructure:"server-request" json:"serverRequest" yaml:"server-request"`
|
||||
SRouter string `mapstructure:"server-router" json:"serverRouter" yaml:"server-router"`
|
||||
SService string `mapstructure:"server-service" json:"serverService" yaml:"server-service"`
|
||||
Web string `mapstructure:"web" json:"web" yaml:"web"`
|
||||
WApi string `mapstructure:"web-api" json:"webApi" yaml:"web-api"`
|
||||
WForm string `mapstructure:"web-form" json:"webForm" yaml:"web-form"`
|
||||
WTable string `mapstructure:"web-table" json:"webTable" yaml:"web-table"`
|
||||
}
|
|
@ -8,8 +8,6 @@ type Server struct {
|
|||
Casbin Casbin `mapstructure:"casbin" json:"casbin" yaml:"casbin"`
|
||||
System System `mapstructure:"system" json:"system" yaml:"system"`
|
||||
Captcha Captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"`
|
||||
// auto
|
||||
AutoCode Autocode `mapstructure:"autoCode" json:"autoCode" yaml:"autoCode"`
|
||||
// gorm
|
||||
Mysql Mysql `mapstructure:"mysql" json:"mysql" yaml:"mysql"`
|
||||
// oss
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/songzhibin97/gkit/cache/local_cache"
|
||||
|
@ -58,7 +57,6 @@ func Viper(path ...string) *viper.Viper {
|
|||
}
|
||||
// root 适配性
|
||||
// 根据root位置去找到对应迁移位置,保证root路径有效
|
||||
global.GLOBAL_CONFIG.AutoCode.Root, _ = filepath.Abs("..")
|
||||
global.BlackCache = local_cache.NewCache(
|
||||
local_cache.SetDefaultExpire(time.Second * time.Duration(global.GLOBAL_CONFIG.JWT.ExpiresTime)),
|
||||
)
|
||||
|
|
325
docs/docs.go
325
docs/docs.go
|
@ -23,6 +23,234 @@ var doc = `{
|
|||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/authority/copyAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "拷贝角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "旧角色id, 新权限id, 新权限名, 新父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.SysAuthorityCopyResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"拷贝成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/createAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "创建角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "权限id, 权限名, 父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/deleteAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "删除角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "删除角色",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/getAuthorityList": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "分页获取角色列表",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "页码, 每页大小",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.PageInfo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/setDataAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "设置角色资源权限",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "设置角色资源权限",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"设置成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/updateAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "更新角色信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "权限id, 权限名, 父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/base/captcha": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -349,7 +577,7 @@ var doc = `{
|
|||
"tags": [
|
||||
"FileUploadAndDownload"
|
||||
],
|
||||
"summary": "上传文件示例",
|
||||
"summary": "上传文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
|
@ -1102,12 +1330,12 @@ var doc = `{
|
|||
"summary": "设置用户信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "ID, 用户名, 昵称, 头像链接",
|
||||
"description": "ID, 用户名, 昵称, 密码",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysUser"
|
||||
"$ref": "#/definitions/web.SysSimpleUser"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -1146,50 +1374,6 @@ var doc = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"config.Autocode": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"root": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverApi": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverInitialize": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverModel": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverRequest": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverRouter": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverService": {
|
||||
"type": "string"
|
||||
},
|
||||
"transferRestart": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"web": {
|
||||
"type": "string"
|
||||
},
|
||||
"webApi": {
|
||||
"type": "string"
|
||||
},
|
||||
"webForm": {
|
||||
"type": "string"
|
||||
},
|
||||
"webTable": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config.Captcha": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1397,10 +1581,6 @@ var doc = `{
|
|||
"aliyunOSS": {
|
||||
"$ref": "#/definitions/config.AliyunOSS"
|
||||
},
|
||||
"autoCode": {
|
||||
"description": "auto",
|
||||
"$ref": "#/definitions/config.Autocode"
|
||||
},
|
||||
"captcha": {
|
||||
"$ref": "#/definitions/config.Captcha"
|
||||
},
|
||||
|
@ -1689,6 +1869,18 @@ var doc = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"response.SysAuthorityCopyResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authority": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
},
|
||||
"oldAuthorityId": {
|
||||
"description": "旧角色ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"web.FileUploadAndDownload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1883,38 +2075,17 @@ var doc = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"web.SysUser": {
|
||||
"web.SysSimpleUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activeColor": {
|
||||
"description": "活跃颜色",
|
||||
"type": "string"
|
||||
},
|
||||
"authorities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
},
|
||||
"authority": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
},
|
||||
"authorityId": {
|
||||
"description": "用户角色ID",
|
||||
"type": "string"
|
||||
},
|
||||
"baseColor": {
|
||||
"description": "基础颜色",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"headerImg": {
|
||||
"description": "用户头像",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "主键ID",
|
||||
"type": "integer"
|
||||
|
@ -1923,8 +2094,8 @@ var doc = `{
|
|||
"description": "用户昵称",
|
||||
"type": "string"
|
||||
},
|
||||
"sideMode": {
|
||||
"description": "用户侧边主题",
|
||||
"password": {
|
||||
"description": "用户登录密码",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
|
@ -1934,10 +2105,6 @@ var doc = `{
|
|||
"userName": {
|
||||
"description": "用户登录名",
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"description": "用户UUID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,6 +4,234 @@
|
|||
"contact": {}
|
||||
},
|
||||
"paths": {
|
||||
"/authority/copyAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "拷贝角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "旧角色id, 新权限id, 新权限名, 新父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/response.SysAuthorityCopyResponse"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"拷贝成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/createAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "创建角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "权限id, 权限名, 父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/deleteAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "删除角色",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "删除角色",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/getAuthorityList": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "分页获取角色列表",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "页码, 每页大小",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/request.PageInfo"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/setDataAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "设置角色资源权限",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "设置角色资源权限",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"设置成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/authority/updateAuthority": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Authority"
|
||||
],
|
||||
"summary": "更新角色信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "权限id, 权限名, 父角色id",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/base/captcha": {
|
||||
"post": {
|
||||
"security": [
|
||||
|
@ -330,7 +558,7 @@
|
|||
"tags": [
|
||||
"FileUploadAndDownload"
|
||||
],
|
||||
"summary": "上传文件示例",
|
||||
"summary": "上传文件",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "file",
|
||||
|
@ -1083,12 +1311,12 @@
|
|||
"summary": "设置用户信息",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "ID, 用户名, 昵称, 头像链接",
|
||||
"description": "ID, 用户名, 昵称, 密码",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.SysUser"
|
||||
"$ref": "#/definitions/web.SysSimpleUser"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -1127,50 +1355,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"config.Autocode": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"root": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverApi": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverInitialize": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverModel": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverRequest": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverRouter": {
|
||||
"type": "string"
|
||||
},
|
||||
"serverService": {
|
||||
"type": "string"
|
||||
},
|
||||
"transferRestart": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"web": {
|
||||
"type": "string"
|
||||
},
|
||||
"webApi": {
|
||||
"type": "string"
|
||||
},
|
||||
"webForm": {
|
||||
"type": "string"
|
||||
},
|
||||
"webTable": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config.Captcha": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1378,10 +1562,6 @@
|
|||
"aliyunOSS": {
|
||||
"$ref": "#/definitions/config.AliyunOSS"
|
||||
},
|
||||
"autoCode": {
|
||||
"description": "auto",
|
||||
"$ref": "#/definitions/config.Autocode"
|
||||
},
|
||||
"captcha": {
|
||||
"$ref": "#/definitions/config.Captcha"
|
||||
},
|
||||
|
@ -1670,6 +1850,18 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"response.SysAuthorityCopyResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"authority": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
},
|
||||
"oldAuthorityId": {
|
||||
"description": "旧角色ID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"web.FileUploadAndDownload": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -1864,38 +2056,17 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"web.SysUser": {
|
||||
"web.SysSimpleUser": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"activeColor": {
|
||||
"description": "活跃颜色",
|
||||
"type": "string"
|
||||
},
|
||||
"authorities": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
}
|
||||
},
|
||||
"authority": {
|
||||
"$ref": "#/definitions/web.SysAuthority"
|
||||
},
|
||||
"authorityId": {
|
||||
"description": "用户角色ID",
|
||||
"type": "string"
|
||||
},
|
||||
"baseColor": {
|
||||
"description": "基础颜色",
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"headerImg": {
|
||||
"description": "用户头像",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "主键ID",
|
||||
"type": "integer"
|
||||
|
@ -1904,8 +2075,8 @@
|
|||
"description": "用户昵称",
|
||||
"type": "string"
|
||||
},
|
||||
"sideMode": {
|
||||
"description": "用户侧边主题",
|
||||
"password": {
|
||||
"description": "用户登录密码",
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
|
@ -1915,10 +2086,6 @@
|
|||
"userName": {
|
||||
"description": "用户登录名",
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"description": "用户UUID",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -14,35 +14,6 @@ definitions:
|
|||
endpoint:
|
||||
type: string
|
||||
type: object
|
||||
config.Autocode:
|
||||
properties:
|
||||
root:
|
||||
type: string
|
||||
server:
|
||||
type: string
|
||||
serverApi:
|
||||
type: string
|
||||
serverInitialize:
|
||||
type: string
|
||||
serverModel:
|
||||
type: string
|
||||
serverRequest:
|
||||
type: string
|
||||
serverRouter:
|
||||
type: string
|
||||
serverService:
|
||||
type: string
|
||||
transferRestart:
|
||||
type: boolean
|
||||
web:
|
||||
type: string
|
||||
webApi:
|
||||
type: string
|
||||
webForm:
|
||||
type: string
|
||||
webTable:
|
||||
type: string
|
||||
type: object
|
||||
config.Captcha:
|
||||
properties:
|
||||
imgHeight:
|
||||
|
@ -190,9 +161,6 @@ definitions:
|
|||
properties:
|
||||
aliyunOSS:
|
||||
$ref: '#/definitions/config.AliyunOSS'
|
||||
autoCode:
|
||||
$ref: '#/definitions/config.Autocode'
|
||||
description: auto
|
||||
captcha:
|
||||
$ref: '#/definitions/config.Captcha'
|
||||
casbin:
|
||||
|
@ -391,6 +359,14 @@ definitions:
|
|||
id:
|
||||
type: integer
|
||||
type: object
|
||||
response.SysAuthorityCopyResponse:
|
||||
properties:
|
||||
authority:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
oldAuthorityId:
|
||||
description: 旧角色ID
|
||||
type: string
|
||||
type: object
|
||||
web.FileUploadAndDownload:
|
||||
properties:
|
||||
createdAt:
|
||||
|
@ -530,37 +506,22 @@ definitions:
|
|||
description: 地址栏携带参数的值
|
||||
type: string
|
||||
type: object
|
||||
web.SysUser:
|
||||
web.SysSimpleUser:
|
||||
properties:
|
||||
activeColor:
|
||||
description: 活跃颜色
|
||||
type: string
|
||||
authorities:
|
||||
items:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
type: array
|
||||
authority:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
authorityId:
|
||||
description: 用户角色ID
|
||||
type: string
|
||||
baseColor:
|
||||
description: 基础颜色
|
||||
type: string
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
headerImg:
|
||||
description: 用户头像
|
||||
type: string
|
||||
id:
|
||||
description: 主键ID
|
||||
type: integer
|
||||
nickName:
|
||||
description: 用户昵称
|
||||
type: string
|
||||
sideMode:
|
||||
description: 用户侧边主题
|
||||
password:
|
||||
description: 用户登录密码
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
|
@ -568,9 +529,6 @@ definitions:
|
|||
userName:
|
||||
description: 用户登录名
|
||||
type: string
|
||||
uuid:
|
||||
description: 用户UUID
|
||||
type: string
|
||||
type: object
|
||||
web.System:
|
||||
properties:
|
||||
|
@ -580,6 +538,144 @@ definitions:
|
|||
info:
|
||||
contact: {}
|
||||
paths:
|
||||
/authority/copyAuthority:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 旧角色id, 新权限id, 新权限名, 新父角色id
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/response.SysAuthorityCopyResponse'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"拷贝成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 拷贝角色
|
||||
tags:
|
||||
- Authority
|
||||
/authority/createAuthority:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 权限id, 权限名, 父角色id
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"创建成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 创建角色
|
||||
tags:
|
||||
- Authority
|
||||
/authority/deleteAuthority:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 删除角色
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"删除成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 删除角色
|
||||
tags:
|
||||
- Authority
|
||||
/authority/getAuthorityList:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 页码, 每页大小
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/request.PageInfo'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"获取成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 分页获取角色列表
|
||||
tags:
|
||||
- Authority
|
||||
/authority/setDataAuthority:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 设置角色资源权限
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"设置成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 设置角色资源权限
|
||||
tags:
|
||||
- Authority
|
||||
/authority/updateAuthority:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: 权限id, 权限名, 父角色id
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/web.SysAuthority'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: '{"success":true,"data":{},"msg":"更新成功"}'
|
||||
schema:
|
||||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 更新角色信息
|
||||
tags:
|
||||
- Authority
|
||||
/base/captcha:
|
||||
post:
|
||||
consumes:
|
||||
|
@ -788,7 +884,7 @@ paths:
|
|||
type: string
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: 上传文件示例
|
||||
summary: 上传文件
|
||||
tags:
|
||||
- FileUploadAndDownload
|
||||
/jwt/jsonInBlacklist:
|
||||
|
@ -1226,12 +1322,12 @@ paths:
|
|||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: ID, 用户名, 昵称, 头像链接
|
||||
- description: ID, 用户名, 昵称, 密码
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/web.SysUser'
|
||||
$ref: '#/definitions/web.SysSimpleUser'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
|
BIN
goweb-gin-demo
BIN
goweb-gin-demo
Binary file not shown.
|
@ -40,6 +40,7 @@ func Routers() *gin.Engine {
|
|||
RouterGroup.InitMenuRouter(PrivateGroup)
|
||||
RouterGroup.InitSystemRouter(PrivateGroup)
|
||||
RouterGroup.InitFileUploadAndDownloadRouter(PrivateGroup)
|
||||
RouterGroup.InitAuthorityRouter(PrivateGroup)
|
||||
}
|
||||
|
||||
global.GLOBAL_LOG.Info("router register success")
|
||||
|
|
|
@ -1 +1 @@
|
|||
log/2021-11-02.log
|
||||
log/2021-11-03.log
|
|
@ -0,0 +1,49 @@
|
|||
[goweb-demo]2021/11/03 - 12:54:17.391 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 12:54:17.392 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 12:54:17.392 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 net.Listen error: listen tcp :8889: bind: address already in use
|
||||
[goweb-demo]2021/11/03 - 12:54:38.461 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 12:54:38.462 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 14:47:10.900 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 14:47:22.780 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 14:47:22.781 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 14:54:38.403 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 14:57:43.214 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 14:57:43.218 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:03:25.583 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 15:03:52.271 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 15:04:09.569 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 15:04:09.570 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:05:22.072 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 15:05:22.074 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:05:25.814 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 15:07:33.609 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 15:07:33.611 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:46:37.109 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 15:46:37.113 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:47:01.057 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 15:47:07.734 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 15:47:07.739 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 15:52:33.286 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 16:02:44.760 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 16:10:57.625 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:10:57.628 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 16:11:28.621 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 16:12:05.420 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 16:12:16.268 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:12:16.269 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 16:16:08.097 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 16:17:14.648 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:17:14.650 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 16:17:14.663 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:17:14.664 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 16:17:14.665 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 net.Listen error: listen tcp :8889: bind: address already in use
|
||||
[goweb-demo]2021/11/03 - 16:17:30.103 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 16:18:17.933 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8889: use of closed network connection
|
||||
[goweb-demo]2021/11/03 - 16:18:24.730 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:18:24.732 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8889"}
|
||||
[goweb-demo]2021/11/03 - 16:19:52.560 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/middleware/operation.go:72 create operation record error: {"err": "Error 1146: Table 'weekly_report.sys_operation_records' doesn't exist"}
|
||||
[goweb-demo]2021/11/03 - 16:35:57.599 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:35:57.601 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8888"}
|
||||
[goweb-demo]2021/11/03 - 16:37:11.018 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/initialize/router.go:46 router register success
|
||||
[goweb-demo]2021/11/03 - 16:37:11.021 [34minfo[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:31 server run success on {"address": ":8888"}
|
||||
[goweb-demo]2021/11/03 - 16:37:22.986 [31merror[0m /Users/zero/work/mygithub/goweb-gin-demo/core/server.go:38 accept tcp [::]:8888: use of closed network connection
|
|
@ -7,10 +7,10 @@ import (
|
|||
|
||||
type SysUser struct {
|
||||
global.GLOBAL_MODEL
|
||||
UUID uuid.UUID `json:"uuid" gorm:"comment:用户UUID"` // 用户UUID
|
||||
UUID uuid.UUID `json:"uuid" gorm:"comment:用户UUID"` // 用户UUID
|
||||
Username string `json:"userName" gorm:"comment:用户登录名"` // 用户登录名
|
||||
Password string `json:"-" gorm:"comment:用户登录密码"` // 用户登录密码
|
||||
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
|
||||
Password string `json:"password" gorm:"comment:用户登录密码"` // 用户登录密码
|
||||
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
|
||||
SideMode string `json:"sideMode" gorm:"default:dark;comment:用户侧边主题"` // 用户侧边主题
|
||||
HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
|
||||
BaseColor string `json:"baseColor" gorm:"default:#fff;comment:基础颜色"` // 基础颜色
|
||||
|
@ -19,3 +19,11 @@ type SysUser struct {
|
|||
Authority SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
|
||||
Authorities []SysAuthority `json:"authorities" gorm:"many2many:sys_user_authority;"`
|
||||
}
|
||||
|
||||
type SysSimpleUser struct {
|
||||
global.GLOBAL_MODEL
|
||||
Username string `json:"userName" gorm:"comment:用户登录名"` // 用户登录名
|
||||
Password string `json:"password" gorm:"comment:用户登录密码"` // 用户登录密码
|
||||
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
|
||||
AuthorityId string `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ type RouterGroup struct {
|
|||
web.MenuRouter
|
||||
web.SysRouter
|
||||
web.FileUploadAndDownloadRouter
|
||||
web.AuthorityRouter
|
||||
}
|
||||
|
||||
var RouterGroupApp = new(RouterGroup)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"goweb-gin-demo/api"
|
||||
"goweb-gin-demo/middleware"
|
||||
)
|
||||
|
||||
type AuthorityRouter struct {
|
||||
}
|
||||
|
||||
func (s *AuthorityRouter) InitAuthorityRouter(Router *gin.RouterGroup) {
|
||||
authorityRouter := Router.Group("authority").Use(middleware.OperationRecord())
|
||||
authorityRouterWithoutRecord := Router.Group("authority")
|
||||
var authorityApi = api.ApiGroupApp.ApiGroup.AuthorityApi
|
||||
{
|
||||
authorityRouter.POST("createAuthority", authorityApi.CreateAuthority) // 创建角色
|
||||
authorityRouter.POST("deleteAuthority", authorityApi.DeleteAuthority) // 删除角色
|
||||
authorityRouter.PUT("updateAuthority", authorityApi.UpdateAuthority) // 更新角色
|
||||
authorityRouter.POST("copyAuthority", authorityApi.CopyAuthority) // 拷贝角色
|
||||
authorityRouter.POST("setDataAuthority", authorityApi.SetDataAuthority) // 设置角色资源权限
|
||||
}
|
||||
{
|
||||
authorityRouterWithoutRecord.POST("getAuthorityList", authorityApi.GetAuthorityList) // 获取角色列表
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ type ServiceGroup struct {
|
|||
BaseMenuService
|
||||
SystemConfigService
|
||||
FileUploadAndDownloadService
|
||||
AuthorityService
|
||||
}
|
||||
|
||||
var ServiceGroupApp = new(ServiceGroup)
|
||||
|
|
Loading…
Reference in New Issue