Browse Source

提出api中的model到单独model分组 修改dashboard 拼写错误

QM303176530 5 years ago
parent
commit
5629ad968d

+ 4 - 4
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) {

+ 1 - 1
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) {

+ 7 - 13
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) {

+ 3 - 3
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) {

+ 1 - 1
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) {

+ 3 - 3
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) {

+ 10 - 27
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 {

+ 2 - 2
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) {

+ 7 - 18
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(&params)
 	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 {

+ 1 - 0
server/model/http_request.go

@@ -0,0 +1 @@
+package model

+ 60 - 0
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 ****************************************************/

+ 0 - 6
server/model/sys_common.go

@@ -1,6 +0,0 @@
-package model
-
-type PageInfo struct {
-	Page     int `json:"page"`
-	PageSize int `json:"pageSize"`
-}

+ 1 - 1
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()
         }

+ 1 - 1
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' })
                 }
             }
         },

+ 1 - 1
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

+ 4 - 4
web/src/view/layout/aside/historyComponent/history.vue

@@ -1,6 +1,6 @@
 <template>
           <div class="router-history">
-            <el-tabs v-model="activeValue" type="card" :closable="!(historys.length==1&&this.$route.name=='dashbord')" @tab-click="changeTab" @tab-remove="removeTab">
+            <el-tabs v-model="activeValue" type="card" :closable="!(historys.length==1&&this.$route.name=='dashboard')" @tab-click="changeTab" @tab-remove="removeTab">
               <el-tab-pane
                 v-for="item in historys"
                 :key="item.name"
@@ -17,13 +17,13 @@ export default {
     data(){
         return{
             historys:[],
-            activeValue:"dashbord"
+            activeValue:"dashboard"
         }
     },
     created(){
         const initHistorys = [
                 {
-                name:"dashbord",
+                name:"dashboard",
                 meta:{
                     title:"仪表盘"
                 }
@@ -49,7 +49,7 @@ export default {
            const index = this.historys.findIndex(item=>item.name == tab)
            if(this.$route.name == tab){
                if(this.historys.length==1){
-                   this.$router.push({name:"dashbord"})
+                   this.$router.push({name:"dashboard"})
                }else{
                     if(index<this.historys.length-1){
                         this.$router.push({name:this.historys[index+1].name})