mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 20:35:16 +00:00
拼写错误修改 updata->update regist->register 更新需更新数据库 建议更新数据库文件 数据库将单表数据录入 方便选择性更新
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-2
@@ -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{},
|
||||
@@ -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()
|
||||
// 注册路由
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
代码解压后把fe的api文件内容粘贴进前端api文件夹下并修改为自己想要的名字即可
|
||||
|
||||
后端代码解压后同理,放到自己想要的 mvc对应路径 并且到 initRouter中注册自动生成的路由 到registTable中注册自动生成的model
|
||||
后端代码解压后同理,放到自己想要的 mvc对应路径 并且到 initRouter中注册自动生成的路由 到registerTable中注册自动生成的model
|
||||
|
||||
项目github:"https://github.com/piexlmax/gin-vue-admin"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user