From 8de8cbbde479eab80e4d9ed198caf4736a215808 Mon Sep 17 00:00:00 2001 From: v_anxiong Date: Thu, 1 Apr 2021 16:45:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?api/v1/sys=5Fapi.go=20api/v1/sys=5Fmenu.go?= =?UTF-8?q?=20api/v1/sys=5Fuser.go=20model/request/common.go=20=E5=85=B6?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=8F=82=E6=95=B0=E6=A0=A1=E9=AA=8C=E4=BB=A3?= =?UTF-8?q?=E7=A0=81Id=E6=94=B9=E6=88=90ID,=E4=BF=AE=E5=A4=8D=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=A0=A1=E9=AA=8C=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/v1/sys_api.go | 3 ++- server/api/v1/sys_menu.go | 9 +++++---- server/api/v1/sys_user.go | 7 ++++--- server/model/request/common.go | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/server/api/v1/sys_api.go b/server/api/v1/sys_api.go index aa5d3bd3..72fcc282 100644 --- a/server/api/v1/sys_api.go +++ b/server/api/v1/sys_api.go @@ -7,6 +7,7 @@ import ( "gin-vue-admin/model/response" "gin-vue-admin/service" "gin-vue-admin/utils" + "github.com/gin-gonic/gin" "go.uber.org/zap" ) @@ -100,7 +101,7 @@ func GetApiById(c *gin.Context) { response.FailWithMessage(err.Error(), c) return } - err, api := service.GetApiById(idInfo.Id) + err, api := service.GetApiById(idInfo.ID) if err != nil { global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) response.FailWithMessage("获取失败", c) diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go index 765c61cd..4f920d7b 100644 --- a/server/api/v1/sys_menu.go +++ b/server/api/v1/sys_menu.go @@ -7,6 +7,7 @@ import ( "gin-vue-admin/model/response" "gin-vue-admin/service" "gin-vue-admin/utils" + "github.com/gin-gonic/gin" "go.uber.org/zap" ) @@ -132,7 +133,7 @@ func DeleteBaseMenu(c *gin.Context) { response.FailWithMessage(err.Error(), c) return } - if err := service.DeleteBaseMenu(menu.Id); err != nil { + if err := service.DeleteBaseMenu(menu.ID); err != nil { global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) response.FailWithMessage("删除失败", c) } else { @@ -182,7 +183,7 @@ func GetBaseMenuById(c *gin.Context) { response.FailWithMessage(err.Error(), c) return } - if err, menu := service.GetBaseMenuById(idInfo.Id); err != nil { + if err, menu := service.GetBaseMenuById(idInfo.ID); err != nil { global.GVA_LOG.Error("获取失败!", zap.Any("err", err)) response.FailWithMessage("获取失败", c) } else { @@ -214,6 +215,6 @@ func GetMenuList(c *gin.Context) { Total: total, Page: pageInfo.Page, PageSize: pageInfo.PageSize, - },"获取成功", c) + }, "获取成功", c) } -} \ No newline at end of file +} diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go index 5712646c..7b5dd6a8 100644 --- a/server/api/v1/sys_user.go +++ b/server/api/v1/sys_user.go @@ -8,11 +8,12 @@ import ( "gin-vue-admin/model/response" "gin-vue-admin/service" "gin-vue-admin/utils" + "time" + "github.com/dgrijalva/jwt-go" "github.com/gin-gonic/gin" "github.com/go-redis/redis" "go.uber.org/zap" - "time" ) // @Tags Base @@ -217,11 +218,11 @@ func DeleteUser(c *gin.Context) { return } jwtId := getUserID(c) - if jwtId == uint(reqId.Id) { + if jwtId == uint(reqId.ID) { response.FailWithMessage("删除失败, 自杀失败", c) return } - if err := service.DeleteUser(reqId.Id); err != nil { + if err := service.DeleteUser(reqId.ID); err != nil { global.GVA_LOG.Error("删除失败!", zap.Any("err", err)) response.FailWithMessage("删除失败", c) } else { diff --git a/server/model/request/common.go b/server/model/request/common.go index b65941ae..7b5764dd 100644 --- a/server/model/request/common.go +++ b/server/model/request/common.go @@ -8,7 +8,7 @@ type PageInfo struct { // Find by id structure type GetById struct { - Id float64 `json:"id" form:"id"` + ID float64 `json:"id" form:"id"` } type IdsReq struct { From b5b6f31321369c2dffd77449dd64496ca40a32fe Mon Sep 17 00:00:00 2001 From: v_anxiong Date: Fri, 9 Apr 2021 17:10:49 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=89=8D=E5=90=8E=E7=AB=AF=E9=83=BD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=BA=86=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= =?UTF-8?q?,=E6=96=B9=E4=BE=BF=E5=AD=A6=E4=B9=A0=E5=92=8C=E7=90=86?= =?UTF-8?q?=E8=A7=A3,=E4=B9=9F=E6=AC=A2=E8=BF=8E=E5=90=84=E4=BD=8D?= =?UTF-8?q?=E5=A4=A7=E4=BD=AC=E8=BF=9B=E8=A1=8C=E8=A1=A5=E5=85=85,?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E6=88=91=E8=BF=99=E4=B8=AA=E8=8F=9C=E9=B8=9F?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E5=AD=A6=E4=B9=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/README.md | 44 +++++++++++++++++++++++++++++++++++++++++++ web/README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 server/README.md diff --git a/server/README.md b/server/README.md new file mode 100644 index 00000000..2305e494 --- /dev/null +++ b/server/README.md @@ -0,0 +1,44 @@ + +整理代码结构 +``` lua +web +├── api/v1 -- 主要API +| ├── sys_initdb.go -- ico +| └── sys_user.go -- +├── config -- 配置文件 设定操作的结构体 +| ├── auto_code.go -- ico captcha.go +| ├── ... -- ico captcha.go +| └── zap.go -- core +├── core -- 主要结构代码 +| ├── server_other.go -- ico captcha.go +| ├── ... -- ico captcha.go +| └── zap.go -- +├── docs -- 文档系统 +| ├── docs.go -- ico captcha.go +| ├── swagger.json -- json +| └── swagger.yaml -- yaml +├── global -- global +├── initialize -- initialize +├── middleware -- 中间键 +├── model -- global +│ ├── request -- 所有请求model结构体 +| | ├── common.go +| | ├── ... +| | └── sys_user.go -- yaml +| ├── response -- 返回数据 +| | ├── common.go +| | ├── ... +| | └── sys_user.go -- yaml +├── packfile -- 文件写入 +├── resource -- 资源文件 +├── router -- 路由 +├── service -- service层 +├── source -- 文件目录操作 +├── utils +├── config.yaml -- +├── Dockerfile -- docker配置 +├── go.mod -- mod 配置 +├── go.sum -- sum +├── latest_log -- vue-cli 配置 +└── main.go -- package.json +``` \ No newline at end of file diff --git a/web/README.md b/web/README.md index ac82884e..ad0c9d58 100644 --- a/web/README.md +++ b/web/README.md @@ -27,3 +27,52 @@ npm run lint ### Customize configuration See [Configuration Reference](https://cli.vuejs.org/config/). + +整理代码结构 +``` lua +web +├── public -- public +| ├── favicon.ico -- ico +| └── index.html -- index +├── src -- 源代码 +│ ├── api -- 所有请求 +│ ├── assets -- 主题 字体等静态资源 +| ├── components -- components组件 +| ├── directive -- 公用方法 +| ├── mixins -- 公用方法 +| ├── router -- 路由权限 +| ├── store -- store +| | ├── modules -- modules +| | | ├── dictionary.js -- 动态路由 +| | | ├── router.js -- 路由 +| | | └── user.js -- 用户权限菜单过滤 +| | ├── getters.js -- getters +| | └── index.js -- index +| ├── styles -- css +| ├── utils -- utils 组件 +| ├── view -- 主要view代码 +| | ├── about -- 关于我们 +| | ├── dashboard -- 面板 +| | ├── error -- 错误 +| | ├── example --上传案例 +| | ├── iconList -- icon列表 +| | ├── init -- 初始化数据 +| | ├── layout -- layout约束页面 +| | | ├── aside -- +| | | ├── bottomInfo -- bottomInfo +| | | ├── screenfull -- 全屏设置 +| | | └── index.vue -- base 约束 +| | ├── login --结算单管理 +| | ├── person --结算单管理 +| | ├── superAdmin -- 超级管理员操作 +| | └── home.vue -- page 入口页面 +│ ├── App.vue -- 入口页面 +│ ├── main.js -- 入口文件 加载组件 初始化等 +│ └── permission.js -- 跳转 +├── build.config.js -- 环境变量build配置 +├── openDocument.js -- 商用代码公司自用产品无需授权 +├── .babelrc -- babel-loader 配置 +├── .travis.yml -- 自动化CI配置 +├── vue.config.js -- vue-cli 配置 +└── package.json -- package.json +``` \ No newline at end of file