diff --git a/QMPlusServer/controller/api/sys_menu.go b/QMPlusServer/controller/api/sys_menu.go index f3553b48..211db428 100644 --- a/QMPlusServer/controller/api/sys_menu.go +++ b/QMPlusServer/controller/api/sys_menu.go @@ -13,7 +13,7 @@ import ( // @Summary 获取用户动态路由 // @Security ApiKeyAuth // @Produce application/json -// @Param data body api.RegistAndLoginStuct true "可以什么都不填" +// @Param data body api.RegisterAndLoginStuct true "可以什么都不填" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getMenu [post] func GetMenu(c *gin.Context) { @@ -74,7 +74,7 @@ func AddBaseMenu(c *gin.Context) { // @Summary 获取用户动态路由 // @Security ApiKeyAuth // @Produce application/json -// @Param data body api.RegistAndLoginStuct true "可以什么都不填" +// @Param data body api.RegisterAndLoginStuct true "可以什么都不填" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getBaseMenuTree [post] func GetBaseMenuTree(c *gin.Context) { diff --git a/QMPlusServer/controller/api/sys_user.go b/QMPlusServer/controller/api/sys_user.go index cf3f1a09..959b0c64 100644 --- a/QMPlusServer/controller/api/sys_user.go +++ b/QMPlusServer/controller/api/sys_user.go @@ -21,7 +21,7 @@ var ( USER_HEADER_BUCKET string = "qm-plus-img" ) -type RegistAndLoginStuct struct { +type RegisterAndLoginStuct struct { Username string `json:"username"` Password string `json:"password"` Captcha string `json:"captcha"` @@ -41,12 +41,12 @@ type RegestStuct struct { // @Produce application/json // @Param data body sysModel.SysUser true "用户注册接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" -// @Router /base/regist [post] -func Regist(c *gin.Context) { +// @Router /base/register [post] +func Register(c *gin.Context) { var R RegestStuct _ = c.ShouldBindJSON(&R) user := &sysModel.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId} - err, user := user.Regist() + err, user := user.Register() if err != nil { servers.ReportFormat(c, false, fmt.Sprintf("%v", err), gin.H{ "user": user, @@ -61,11 +61,11 @@ func Regist(c *gin.Context) { // @Tags Base // @Summary 用户登录 // @Produce application/json -// @Param data body api.RegistAndLoginStuct true "用户登录接口" +// @Param data body api.RegisterAndLoginStuct true "用户登录接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}" // @Router /base/login [post] func Login(c *gin.Context) { - var L RegistAndLoginStuct + var L RegisterAndLoginStuct _ = c.ShouldBindJSON(&L) if captcha.VerifyString(L.CaptchaId, L.Captcha) { U := &sysModel.SysUser{Username: L.Username, Password: L.Password} diff --git a/QMPlusServer/db/qmplus.sql b/QMPlusServer/db/qmplus.sql index 7624f993..91e2a4f4 100644 --- a/QMPlusServer/db/qmplus.sql +++ b/QMPlusServer/db/qmplus.sql @@ -95,7 +95,7 @@ CREATE TABLE `apis` ( -- Records of apis -- ---------------------------- INSERT INTO `apis` VALUES (1, '2019-09-28 11:23:49', '2019-09-28 17:06:16', NULL, NULL, '/base/login', '用户登录', 'base'); -INSERT INTO `apis` VALUES (2, '2019-09-28 11:32:46', '2019-09-28 17:06:11', NULL, NULL, '/base/regist', '用户注册', 'base'); +INSERT INTO `apis` VALUES (2, '2019-09-28 11:32:46', '2019-09-28 17:06:11', NULL, NULL, '/base/register', '用户注册', 'base'); INSERT INTO `apis` VALUES (3, '2019-09-28 11:33:41', '2019-09-28 17:06:04', NULL, NULL, '/api/createApi', '创建api', 'api'); INSERT INTO `apis` VALUES (4, '2019-09-28 14:09:04', '2019-09-28 17:05:59', NULL, NULL, '/api/getApiList', '获取api列表', 'api'); INSERT INTO `apis` VALUES (5, '2019-09-28 14:15:50', '2019-09-28 17:05:53', NULL, NULL, '/api/getApiById', '获取api详细信息', 'api'); @@ -212,7 +212,7 @@ CREATE TABLE `casbin_rule` ( -- Records of casbin_rule -- ---------------------------- INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/login', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/regist', 'POST', '', '', ''); +INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/register', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/createApi', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getApiList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getApiById', 'POST', '', '', ''); @@ -251,7 +251,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/deleteExaCustomer', 'P INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/getExaCustomer', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/getExaCustomerList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '9528', '/base/login', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', '9528', '/base/regist', 'POST', '', '', ''); +INSERT INTO `casbin_rule` VALUES ('p', '9528', '/base/register', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/createApi', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getApiList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getApiById', 'POST', '', '', ''); @@ -291,7 +291,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/getExaCustomer', 'POST INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/getExaCustomerList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '9528', '/autoCode/createTemp', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/base/login', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', '888', '/base/regist', 'POST', '', '', ''); +INSERT INTO `casbin_rule` VALUES ('p', '888', '/base/register', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/createApi', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getApiList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getApiById', 'POST', '', '', ''); @@ -4154,7 +4154,7 @@ CREATE TABLE `sys_apis` ( -- Records of sys_apis -- ---------------------------- INSERT INTO `sys_apis` VALUES (1, '2019-09-28 11:23:49', '2019-09-28 17:06:16', NULL, NULL, '/base/login', '用户登录', 'base', 'POST'); -INSERT INTO `sys_apis` VALUES (2, '2019-09-28 11:32:46', '2019-09-28 17:06:11', NULL, NULL, '/base/regist', '用户注册', 'base', 'POST'); +INSERT INTO `sys_apis` VALUES (2, '2019-09-28 11:32:46', '2019-09-28 17:06:11', NULL, NULL, '/base/register', '用户注册', 'base', 'POST'); INSERT INTO `sys_apis` VALUES (3, '2019-09-28 11:33:41', '2019-12-11 16:51:41', NULL, NULL, '/api/createApi', '创建api', 'api', 'POST'); INSERT INTO `sys_apis` VALUES (4, '2019-09-28 14:09:04', '2019-09-28 17:05:59', NULL, NULL, '/api/getApiList', '获取api列表', 'api', 'POST'); INSERT INTO `sys_apis` VALUES (5, '2019-09-28 14:15:50', '2019-09-28 17:05:53', NULL, NULL, '/api/getApiById', '获取api详细信息', 'api', 'POST'); diff --git a/QMPlusServer/docs/docs.go b/QMPlusServer/docs/docs.go index cd90ac5f..49d5e36a 100644 --- a/QMPlusServer/docs/docs.go +++ b/QMPlusServer/docs/docs.go @@ -475,7 +475,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -489,7 +489,7 @@ var doc = `{ } } }, - "/base/regist": { + "/base/register": { "post": { "produces": [ "application/json" @@ -1256,7 +1256,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -1292,7 +1292,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -1752,7 +1752,7 @@ var doc = `{ } } }, - "api.RegistAndLoginStuct": { + "api.RegisterAndLoginStuct": { "type": "object", "properties": { "captcha": { diff --git a/QMPlusServer/docs/swagger.json b/QMPlusServer/docs/swagger.json index caf46630..7c637dbf 100644 --- a/QMPlusServer/docs/swagger.json +++ b/QMPlusServer/docs/swagger.json @@ -458,7 +458,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -472,7 +472,7 @@ } } }, - "/base/regist": { + "/base/register": { "post": { "produces": [ "application/json" @@ -1239,7 +1239,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -1275,7 +1275,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegistAndLoginStuct" + "$ref": "#/definitions/api.RegisterAndLoginStuct" } } ], @@ -1735,7 +1735,7 @@ } } }, - "api.RegistAndLoginStuct": { + "api.RegisterAndLoginStuct": { "type": "object", "properties": { "captcha": { diff --git a/QMPlusServer/docs/swagger.yaml b/QMPlusServer/docs/swagger.yaml index f9ab111b..550db288 100644 --- a/QMPlusServer/docs/swagger.yaml +++ b/QMPlusServer/docs/swagger.yaml @@ -52,7 +52,7 @@ definitions: id: type: number type: object - api.RegistAndLoginStuct: + api.RegisterAndLoginStuct: properties: captcha: type: string @@ -580,7 +580,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegistAndLoginStuct' + $ref: '#/definitions/api.RegisterAndLoginStuct' type: object produces: - application/json @@ -592,7 +592,7 @@ paths: summary: 用户登录 tags: - Base - /base/regist: + /base/register: post: parameters: - description: 用户注册接口 @@ -1058,7 +1058,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegistAndLoginStuct' + $ref: '#/definitions/api.RegisterAndLoginStuct' type: object produces: - application/json @@ -1080,7 +1080,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegistAndLoginStuct' + $ref: '#/definitions/api.RegisterAndLoginStuct' type: object produces: - application/json diff --git a/QMPlusServer/init/registTable/regist_table.go b/QMPlusServer/init/registTerable/regist_table.go similarity index 90% rename from QMPlusServer/init/registTable/regist_table.go rename to QMPlusServer/init/registTerable/regist_table.go index 3be4c8e4..edfb7d7c 100644 --- a/QMPlusServer/init/registTable/regist_table.go +++ b/QMPlusServer/init/registTerable/regist_table.go @@ -1,4 +1,4 @@ -package registTable +package registerTable import ( "gin-vue-admin/init/initlog" @@ -8,7 +8,7 @@ import ( ) //注册数据库表专用 -func RegistTable(db *gorm.DB) { +func RegisterTable(db *gorm.DB) { db.AutoMigrate(sysModel.SysUser{}, sysModel.SysAuthority{}, sysModel.SysMenu{}, diff --git a/QMPlusServer/main.go b/QMPlusServer/main.go index da73277f..343e5b8f 100644 --- a/QMPlusServer/main.go +++ b/QMPlusServer/main.go @@ -7,7 +7,7 @@ import ( "gin-vue-admin/init/initRouter" "gin-vue-admin/init/initlog/qmlog" "gin-vue-admin/init/qmsql" - "gin-vue-admin/init/registTable" + "gin-vue-admin/init/registTerable" "os" //"runtime" ) @@ -42,7 +42,7 @@ func main() { _ = initRedis.InitRedis() } // 注册数据库表 - registTable.RegistTable(db) + registerTable.RegisterTable(db) // 程序结束前关闭数据库链接 defer qmsql.DEFAULTDB.Close() // 注册路由 diff --git a/QMPlusServer/model/sysModel/sys_user.go b/QMPlusServer/model/sysModel/sys_user.go index 7a697459..cc48b8af 100644 --- a/QMPlusServer/model/sysModel/sys_user.go +++ b/QMPlusServer/model/sysModel/sys_user.go @@ -26,7 +26,7 @@ type SysUser struct { //} //注册接口model方法 -func (u *SysUser) Regist() (err error, userInter *SysUser) { +func (u *SysUser) Register() (err error, userInter *SysUser) { var user SysUser //判断用户名是否注册 notResigt := qmsql.DEFAULTDB.Where("username = ?", u.Username).First(&user).RecordNotFound() diff --git a/QMPlusServer/router/sys_base.go b/QMPlusServer/router/sys_base.go index 5c25ee7a..58ef3318 100644 --- a/QMPlusServer/router/sys_base.go +++ b/QMPlusServer/router/sys_base.go @@ -8,10 +8,10 @@ import ( func InitBaseRouter(Router *gin.RouterGroup) (R gin.IRoutes) { BaseRouter := Router.Group("base") { - BaseRouter.POST("regist", api.Regist) + BaseRouter.POST("register", api.Register) BaseRouter.POST("login", api.Login) - BaseRouter.POST("captcha",api.Captcha) - BaseRouter.GET("captcha/:captchaId",api.CaptchaImg) + BaseRouter.POST("captcha", api.Captcha) + BaseRouter.GET("captcha/:captchaId", api.CaptchaImg) } return BaseRouter } diff --git a/QMPlusServer/tpl/readme.txt.tpl b/QMPlusServer/tpl/readme.txt.tpl index 1ad81281..00136fe8 100644 --- a/QMPlusServer/tpl/readme.txt.tpl +++ b/QMPlusServer/tpl/readme.txt.tpl @@ -1,6 +1,6 @@ 代码解压后把fe的api文件内容粘贴进前端api文件夹下并修改为自己想要的名字即可 -后端代码解压后同理,放到自己想要的 mvc对应路径 并且到 initRouter中注册自动生成的路由 到registTable中注册自动生成的model +后端代码解压后同理,放到自己想要的 mvc对应路径 并且到 initRouter中注册自动生成的路由 到registerTable中注册自动生成的model 项目github:"https://github.com/piexlmax/gin-vue-admin" diff --git a/QMPlusVuePage/src/api/user.js b/QMPlusVuePage/src/api/user.js index d503d993..fbe51f12 100644 --- a/QMPlusVuePage/src/api/user.js +++ b/QMPlusVuePage/src/api/user.js @@ -28,9 +28,9 @@ export const captcha = (data) => { // @Produce application/json // @Param data body {username:"string",password:"string"} // @Router /base/resige [post] -export const regist = (data) => { +export const register = (data) => { return service({ - url: "/base/regist", + url: "/base/register", method: 'post', data: data }) diff --git a/QMPlusVuePage/src/permission.js b/QMPlusVuePage/src/permission.js index 4e387411..940a9e57 100644 --- a/QMPlusVuePage/src/permission.js +++ b/QMPlusVuePage/src/permission.js @@ -3,7 +3,7 @@ import { store } from '@/store/index' let asyncRouterFlag = 0 -const whiteList = ['login', 'regist'] +const whiteList = ['login', 'register'] router.beforeEach(async(to, from, next) => { const token = store.getters['user/token'] diff --git a/QMPlusVuePage/src/router/index.js b/QMPlusVuePage/src/router/index.js index a481657c..95b80d3f 100644 --- a/QMPlusVuePage/src/router/index.js +++ b/QMPlusVuePage/src/router/index.js @@ -14,10 +14,10 @@ const baseRouters = [{ import ('@/view/login/login.vue') }, { - path: '/regist', - name: 'regist', + path: '/register', + name: 'register', component: () => - import ('@/view/login/regist.vue') + import ('@/view/login/register.vue') }, { path: "/404", diff --git a/QMPlusVuePage/src/view/login/login.vue b/QMPlusVuePage/src/view/login/login.vue index 592a7e39..58b52028 100644 --- a/QMPlusVuePage/src/view/login/login.vue +++ b/QMPlusVuePage/src/view/login/login.vue @@ -1,5 +1,5 @@