diff --git a/server/api/v1/exa_customer.go b/server/api/v1/exa_customer.go index b6d6015815e632c7640de12a82f8daa441080c44..17e6fcc53084229b0499010bb0f745e6a3878ac4 100644 --- a/server/api/v1/exa_customer.go +++ b/server/api/v1/exa_customer.go @@ -13,7 +13,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body dbModel.ExaCustomer true "创建客户" +// @Param data body model.ExaCustomer true "创建客户" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /customer/createExaCustomer [post] func CreateExaCustomer(c *gin.Context) { @@ -36,7 +36,7 @@ func CreateExaCustomer(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body dbModel.ExaCustomer true "删除客户" +// @Param data body model.ExaCustomer true "删除客户" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /customer/deleteExaCustomer [post] func DeleteExaCustomer(c *gin.Context) { @@ -55,7 +55,7 @@ func DeleteExaCustomer(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body dbModel.ExaCustomer true "创建客户" +// @Param data body model.ExaCustomer true "创建客户" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /customer/updateExaCustomer [post] func UpdateExaCustomer(c *gin.Context) { @@ -74,7 +74,7 @@ func UpdateExaCustomer(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body dbModel.ExaCustomer true "获取单一客户信息" +// @Param data body model.ExaCustomer true "获取单一客户信息" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /customer/getExaCustomer [post] func GetExaCustomer(c *gin.Context) { diff --git a/server/api/v1/exa_file_upload_download.go b/server/api/v1/exa_file_upload_download.go index 05c77664329633276f25feb93c42ddc7157e725a..552195cbfb532bcc891f50842f89d5b6d0ea078e 100644 --- a/server/api/v1/exa_file_upload_download.go +++ b/server/api/v1/exa_file_upload_download.go @@ -52,7 +52,7 @@ func UploadFile(c *gin.Context) { // @Summary 删除文件 // @Security ApiKeyAuth // @Produce application/json -// @Param data body dbModel.ExaFileUploadAndDownload true "传入文件里面id即可" +// @Param data body model.ExaFileUploadAndDownload true "传入文件里面id即可" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /fileUploadAndDownload/deleteFile [post] func DeleteFile(c *gin.Context) { diff --git a/server/api/v1/sys_api.go b/server/api/v1/sys_api.go index e7f63def1df1d3d7ef810edde726f3865865870e..fa7cb03b5354e9416500b0f2d23443879321a1fe 100644 --- a/server/api/v1/sys_api.go +++ b/server/api/v1/sys_api.go @@ -12,7 +12,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.CreateApiParams true "创建api" +// @Param data body model.SysApi true "创建api" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/createApi [post] func CreateApi(c *gin.Context) { @@ -31,7 +31,7 @@ func CreateApi(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysApi true "删除api" +// @Param data body model.SysApi true "删除api" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/deleteApi [post] func DeleteApi(c *gin.Context) { @@ -52,18 +52,12 @@ func DeleteApi(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取API列表" +// @Param data body model.SearchApiParams true "分页获取API列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiList [post] func GetApiList(c *gin.Context) { // 此结构体仅本方法使用 - type searchParams struct { - model.SysApi - model.PageInfo - OrderKey string `json:"orderKey"` - Desc bool `json:"desc"` - } - var sp searchParams + var sp model.SearchApiParams _ = c.ShouldBindJSON(&sp) err, list, total := sp.SysApi.GetInfoList(sp.PageInfo, sp.OrderKey, sp.Desc) if err != nil { @@ -83,11 +77,11 @@ func GetApiList(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取用户列表" +// @Param data body model.GetById true "根据id获取api" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiById [post] func GetApiById(c *gin.Context) { - var idInfo GetById + var idInfo model.GetById _ = c.ShouldBindJSON(&idInfo) err, api := new(model.SysApi).GetApiById(idInfo.Id) if err != nil { @@ -105,7 +99,7 @@ func GetApiById(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.CreateApiParams true "创建api" +// @Param data body model.SysApi true "创建api" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/updateApi [post] func UpdateApi(c *gin.Context) { diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index f934fda85926483b8a723310546232038b371f91..81d2d09de4ec2cd3237cf114c6b7050df86d7e4d 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -12,7 +12,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysAuthority true "创建角色" +// @Param data body model.SysAuthority true "创建角色" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/createAuthority [post] func CreateAuthority(c *gin.Context) { @@ -33,7 +33,7 @@ func CreateAuthority(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysAuthority true "删除角色" +// @Param data body model.SysAuthority true "删除角色" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/deleteAuthority [post] func DeleteAuthority(c *gin.Context) { @@ -77,7 +77,7 @@ func GetAuthorityList(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysAuthority true "设置角色资源权限" +// @Param data body model.SysAuthority true "设置角色资源权限" // @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" // @Router /authority/setDataAuthority [post] func SetDataAuthority(c *gin.Context) { diff --git a/server/api/v1/sys_auto_code.go b/server/api/v1/sys_auto_code.go index 2a59a7ce77ae90ae0ae9e9cbfed890cd29c49b5d..155cf34807df5bc6e0ff98a09e51af3e4c4b6b58 100644 --- a/server/api/v1/sys_auto_code.go +++ b/server/api/v1/sys_auto_code.go @@ -13,7 +13,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body autoCodeModel.AutoCodeStruct true "创建自动代码" +// @Param data body model.AutoCodeStruct true "创建自动代码" // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" // @Router /autoCode/createTemp [post] func CreateTemp(c *gin.Context) { diff --git a/server/api/v1/sys_casbin.go b/server/api/v1/sys_casbin.go index 61bc5a7c6e7bee517af46cb570602f5b9b75046b..9e77845bddca26050dac8482dab265ed3331c16c 100644 --- a/server/api/v1/sys_casbin.go +++ b/server/api/v1/sys_casbin.go @@ -12,7 +12,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.CasbinInReceive true "更改角色api权限" +// @Param data body model.CasbinInReceive true "更改角色api权限" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/UpdateCasbin [post] func UpdateCasbin(c *gin.Context) { @@ -31,7 +31,7 @@ func UpdateCasbin(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.CasbinInReceive true "获取权限列表" +// @Param data body model.CasbinInReceive true "获取权限列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/getPolicyPathByAuthorityId [post] func GetPolicyPathByAuthorityId(c *gin.Context) { @@ -46,7 +46,7 @@ func GetPolicyPathByAuthorityId(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.CasbinInReceive true "获取权限列表" +// @Param data body model.CasbinInReceive true "获取权限列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/CasbinTest [get] func CasbinTest(c *gin.Context) { diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go index 23011417e13be9035b646d8451f69bd3d5984600..22a3ffca5a6a95c3ef59337b72f19c70d868f345 100644 --- a/server/api/v1/sys_menu.go +++ b/server/api/v1/sys_menu.go @@ -55,7 +55,7 @@ func GetMenuList(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysBaseMenu true "新增菜单" +// @Param data body model.SysBaseMenu true "新增菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addBaseMenu [post] func AddBaseMenu(c *gin.Context) { @@ -86,21 +86,16 @@ func GetBaseMenuTree(c *gin.Context) { } } -type AddMenuAuthorityInfo struct { - Menus []model.SysBaseMenu - AuthorityId string -} - // @Tags authorityAndMenu // @Summary 增加menu和角色关联关系 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.AddMenuAuthorityInfo true "增加menu和角色关联关系" +// @Param data body model.AddMenuAuthorityInfo true "增加menu和角色关联关系" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addMenuAuthority [post] func AddMenuAuthority(c *gin.Context) { - var addMenuAuthorityInfo AddMenuAuthorityInfo + var addMenuAuthorityInfo model.AddMenuAuthorityInfo _ = c.ShouldBindJSON(&addMenuAuthorityInfo) err := new(model.SysMenu).AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId) @@ -111,20 +106,16 @@ func AddMenuAuthority(c *gin.Context) { } } -type AuthorityIdInfo struct { - AuthorityId string -} - // @Tags authorityAndMenu // @Summary 获取指定角色menu // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系" +// @Param data body model.AuthorityIdInfo true "增加menu和角色关联关系" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/GetMenuAuthority [post] func GetMenuAuthority(c *gin.Context) { - var authorityIdInfo AuthorityIdInfo + var authorityIdInfo model.AuthorityIdInfo _ = c.ShouldBindJSON(&authorityIdInfo) err, menus := new(model.SysMenu).GetMenuAuthority(authorityIdInfo.AuthorityId) if err != nil { @@ -134,20 +125,16 @@ func GetMenuAuthority(c *gin.Context) { } } -type IdInfo struct { - Id float64 -} - // @Tags menu // @Summary 删除菜单 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.IdInfo true "删除菜单" +// @Param data body model.GetById true "删除菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/deleteBaseMenu [post] func DeleteBaseMenu(c *gin.Context) { - var idInfo IdInfo + var idInfo model.GetById _ = c.ShouldBindJSON(&idInfo) err := new(model.SysBaseMenu).DeleteBaseMenu(idInfo.Id) if err != nil { @@ -163,7 +150,7 @@ func DeleteBaseMenu(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body sysModel.SysBaseMenu true "更新菜单" +// @Param data body model.SysBaseMenu true "更新菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/updateBaseMenu [post] func UpdateBaseMenu(c *gin.Context) { @@ -177,20 +164,16 @@ func UpdateBaseMenu(c *gin.Context) { } } -type GetById struct { - Id float64 `json:"id"` -} - // @Tags menu // @Summary 根据id获取菜单 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.GetById true "根据id获取菜单" +// @Param data body model.GetById true "根据id获取菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/getBaseMenuById [post] func GetBaseMenuById(c *gin.Context) { - var idInfo GetById + var idInfo model.GetById _ = c.ShouldBindJSON(&idInfo) err, menu := new(model.SysBaseMenu).GetBaseMenuById(idInfo.Id) if err != nil { diff --git a/server/api/v1/sys_system.go b/server/api/v1/sys_system.go index 5b44807427c178ab3715549885c4f5ccdc30295d..c4276bd9b2dee1b76fbff93d3ba046770d74ac9b 100644 --- a/server/api/v1/sys_system.go +++ b/server/api/v1/sys_system.go @@ -26,7 +26,7 @@ func GetSystemConfig(c *gin.Context) { // @Summary 设置配置文件内容 // @Security ApiKeyAuth // @Produce application/json -// @Param data body sysModel.System true "设置配置文件内容" +// @Param data body model.System true "设置配置文件内容" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /system/setSystemConfig [post] func SetSystemConfig(c *gin.Context) { @@ -45,7 +45,7 @@ func SetSystemConfig(c *gin.Context) { // @Summary 设置配置文件内容 // @Security ApiKeyAuth // @Produce application/json -// @Param data body sysModel.System true "设置配置文件内容" +// @Param data body model.System true "设置配置文件内容" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /system/ReloadSystem [post] func ReloadSystem(c *gin.Context) { diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go index 978e02b39d07aa3169ca637de3eeb58d9fc7d81e..2631e356b5ede95518da563984c025317373e9c7 100644 --- a/server/api/v1/sys_user.go +++ b/server/api/v1/sys_user.go @@ -11,7 +11,6 @@ import ( "github.com/dgrijalva/jwt-go" "github.com/gin-gonic/gin" "github.com/go-redis/redis" - uuid "github.com/satori/go.uuid" "mime/multipart" "time" ) @@ -20,10 +19,11 @@ const ( USER_HEADER_IMG_PATH string = "http://qmplusimg.henrongyi.top" USER_HEADER_BUCKET string = "qm-plus-img" ) + // @Tags Base // @Summary 用户注册账号 // @Produce application/json -// @Param data body sysModel.SysUser true "用户注册接口" +// @Param data body model.SysUser true "用户注册接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" // @Router /base/register [post] func Register(c *gin.Context) { @@ -45,7 +45,7 @@ func Register(c *gin.Context) { // @Tags Base // @Summary 用户登录 // @Produce application/json -// @Param data body api.RegisterAndLoginStruct true "用户登录接口" +// @Param data body model.RegisterAndLoginStruct true "用户登录接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}" // @Router /base/login [post] func Login(c *gin.Context) { @@ -118,21 +118,15 @@ func tokenNext(c *gin.Context, user model.SysUser) { } } -type ChangePasswordStutrc struct { - Username string `json:"username"` - Password string `json:"password"` - NewPassword string `json:"newPassword"` -} - // @Tags SysUser // @Summary 用户修改密码 // @Security ApiKeyAuth // @Produce application/json -// @Param data body api.ChangePasswordStutrc true "用户修改密码" +// @Param data body model.ChangePasswordStutrc true "用户修改密码" // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/changePassword [put] func ChangePassword(c *gin.Context) { - var params ChangePasswordStutrc + var params model.ChangePasswordStutrc _ = c.ShouldBindJSON(¶ms) U := &model.SysUser{Username: params.Username, Password: params.Password} if err, _ := U.ChangePassword(params.NewPassword); err != nil { @@ -206,21 +200,16 @@ func GetUserList(c *gin.Context) { } } -type SetUserAuth struct { - UUID uuid.UUID `json:"uuid"` - AuthorityId string `json:"authorityId"` -} - // @Tags SysUser // @Summary 设置用户权限 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body api.SetUserAuth true "设置用户权限" +// @Param data body model.SetUserAuth true "设置用户权限" // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/setUserAuthority [post] func SetUserAuthority(c *gin.Context) { - var sua SetUserAuth + var sua model.SetUserAuth _ = c.ShouldBindJSON(&sua) err := new(model.SysUser).SetUserAuthority(sua.UUID, sua.AuthorityId) if err != nil { diff --git a/server/model/http_request.go b/server/model/http_request.go new file mode 100644 index 0000000000000000000000000000000000000000..8b537907051181b86764a62df61c86a2eef305eb --- /dev/null +++ b/server/model/http_request.go @@ -0,0 +1 @@ +package model diff --git a/server/model/http_response.go b/server/model/http_response.go new file mode 100644 index 0000000000000000000000000000000000000000..f3a6d2ee80620cf005cc8cc4fb07d4d27644c25c --- /dev/null +++ b/server/model/http_response.go @@ -0,0 +1,60 @@ +package model + +import uuid "github.com/satori/go.uuid" + +/****************************** common start ****************************************************/ +// 分页公用入参结构体 +type PageInfo struct { + Page int `json:"page"` + PageSize int `json:"pageSize"` +} + +//根据id查询结构体 +type GetById struct { + Id float64 `json:"id"` +} + +/****************************** common end ****************************************************/ + +/****************************** api start ****************************************************/ +//api分页条件查询及排序结构体 +type SearchApiParams struct { + SysApi + PageInfo + OrderKey string `json:"orderKey"` + Desc bool `json:"desc"` +} + +/****************************** api end ****************************************************/ + +/****************************** Authority start ****************************************************/ + +// 添加角色和menu关系 +type AddMenuAuthorityInfo struct { + Menus []SysBaseMenu + AuthorityId string +} + +// 根据角色id获取角色 +type AuthorityIdInfo struct { + AuthorityId string +} + +/****************************** Authority end ****************************************************/ + +/****************************** user start ****************************************************/ + +// 修改密码结构体 +type ChangePasswordStutrc struct { + Username string `json:"username"` + Password string `json:"password"` + NewPassword string `json:"newPassword"` +} + +// 设置用户权限 +type SetUserAuth struct { + UUID uuid.UUID `json:"uuid"` + AuthorityId string `json:"authorityId"` +} + +/****************************** user end ****************************************************/ diff --git a/server/model/sys_common.go b/server/model/sys_common.go deleted file mode 100644 index 8dded357e13313002c0dbe303d18324b5253346c..0000000000000000000000000000000000000000 --- a/server/model/sys_common.go +++ /dev/null @@ -1,6 +0,0 @@ -package model - -type PageInfo struct { - Page int `json:"page"` - PageSize int `json:"pageSize"` -} diff --git a/web/src/permission.js b/web/src/permission.js index 940a9e577da9923736e8d590757e1360446e5d0e..3f9eefa87fbaa101bbab7c54cf9a774423c6c1f7 100644 --- a/web/src/permission.js +++ b/web/src/permission.js @@ -18,7 +18,7 @@ router.beforeEach(async(to, from, next) => { // 在白名单中的判断情况 if (whiteList.indexOf(to.name) > -1) { if (token) { - next({ path: '/layout/dashbord' }) + next({ path: '/layout/dashboard' }) } else { next() } diff --git a/web/src/store/module/user.js b/web/src/store/module/user.js index ec5fbe895dfc07d917d9ade11b19ca0685cb2675..3da55ea67977d62128693b89399a425743b2150c 100644 --- a/web/src/store/module/user.js +++ b/web/src/store/module/user.js @@ -51,7 +51,7 @@ export const user = { if (redirect) { router.push({ path: redirect }) } else { - router.push({ path: '/layout/dashbord' }) + router.push({ path: '/layout/dashboard' }) } } }, diff --git a/web/src/view/dashboard/index.vue b/web/src/view/dashboard/index.vue index 91b09b93343e35e9d13547ac1170000ce5eba751..b6b02927c321eb04070829692249158e8975a8e2 100644 --- a/web/src/view/dashboard/index.vue +++ b/web/src/view/dashboard/index.vue @@ -29,7 +29,7 @@ import { mapGetters } from 'vuex' import Animition from '@/view/dashboard/component/animition.vue' export default { - name: 'Dashbord', + name: 'Dashboard', data() { return { drawer: false diff --git a/web/src/view/layout/aside/historyComponent/history.vue b/web/src/view/layout/aside/historyComponent/history.vue index 0f80094449e61cb5e9651a0d8d01c0510d1fe60b..014443c74381e562d6f77f292e36285b02e24a0d 100644 --- a/web/src/view/layout/aside/historyComponent/history.vue +++ b/web/src/view/layout/aside/historyComponent/history.vue @@ -1,6 +1,6 @@