mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 12:32:25 +00:00
gin-vue-admin 2.0代码重构
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io/ioutil"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 断点续传到服务器
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "断点续传示例"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Router /fileUploadAndDownload/breakpointContinue [post]
|
||||
func BreakpointContinue(c *gin.Context) {
|
||||
fileMd5 := c.Request.FormValue("fileMd5")
|
||||
fileName := c.Request.FormValue("fileName")
|
||||
chunkMd5 := c.Request.FormValue("chunkMd5")
|
||||
chunkNumber, _ := strconv.Atoi(c.Request.FormValue("chunkNumber"))
|
||||
chunkTotal, _ := strconv.Atoi(c.Request.FormValue("chunkTotal"))
|
||||
_, FileHeader, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
response.Result(response.SUCCESS, nil, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
f, err := FileHeader.Open()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, nil, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
cen, _ := ioutil.ReadAll(f)
|
||||
defer f.Close()
|
||||
if flag := utils.CheckMd5(cen, chunkMd5); flag {
|
||||
err, file := new(model.ExaFile).FindOrCreateFile(fileMd5, fileName, chunkTotal)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, nil, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
err, pathc := utils.BreakPointContinue(cen, fileName, chunkNumber, chunkTotal, fileMd5)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, nil, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
err = file.CreateFileChunk(pathc, chunkNumber)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, nil, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, nil, "切片创建成功", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 查找文件
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "查找文件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
|
||||
// @Router /fileUploadAndDownload/findFile [post]
|
||||
func FindFile(c *gin.Context) {
|
||||
fileMd5 := c.Query("fileMd5")
|
||||
fileName := c.Query("fileName")
|
||||
chunkTotal, _ := strconv.Atoi(c.Query("chunkTotal"))
|
||||
err, file := new(model.ExaFile).FindOrCreateFile(fileMd5, fileName, chunkTotal)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, nil, fmt.Sprintf("查找失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"file": file}, "查找成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 查找文件
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "查找文件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
|
||||
// @Router /fileUploadAndDownload/findFile [post]
|
||||
func BreakpointContinueFinish(c *gin.Context) {
|
||||
fileMd5 := c.Query("fileMd5")
|
||||
fileName := c.Query("fileName")
|
||||
err, filePath := utils.MakeFile(fileName, fileMd5)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{"filePath": filePath}, fmt.Sprintf("文件创建失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"filePath": filePath}, "文件创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 删除切片
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "查找文件"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
|
||||
// @Router /fileUploadAndDownload/removeChunk [post]
|
||||
func RemoveChunk(c *gin.Context) {
|
||||
fileMd5 := c.Query("fileMd5")
|
||||
fileName := c.Query("fileName")
|
||||
filePath := c.Query("filePath")
|
||||
err := utils.RemoveChunk(fileMd5)
|
||||
err = new(model.ExaFile).DeleteFileChunk(fileMd5, fileName, filePath)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{"filePath": filePath}, fmt.Sprintf("缓存切片删除失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"filePath": filePath}, "缓存切片删除成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/middleware"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 创建客户
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body dbModel.ExaCustomer true "创建客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/createExaCustomer [post]
|
||||
func CreateExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*middleware.CustomClaims)
|
||||
cu.SysUserID = waitUse.ID
|
||||
cu.SysUserAuthorityID = waitUse.AuthorityId
|
||||
err := cu.CreateExaCustomer()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("创建失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 删除客户
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body dbModel.ExaCustomer true "删除客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/deleteExaCustomer [post]
|
||||
func DeleteExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
err := cu.DeleteExaCustomer()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 更新客户信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body dbModel.ExaCustomer true "创建客户"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/updateExaCustomer [post]
|
||||
func UpdateExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
err := cu.UpdateExaCustomer()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("更新失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "更新成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 获取单一客户信息
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body dbModel.ExaCustomer true "获取单一客户信息"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/getExaCustomer [post]
|
||||
func GetExaCustomer(c *gin.Context) {
|
||||
var cu model.ExaCustomer
|
||||
_ = c.ShouldBindJSON(&cu)
|
||||
err, customer := cu.GetExaCustomer()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"customer": customer,
|
||||
}, "创建", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 获取权限客户列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "获取权限客户列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /customer/getExaCustomerList [post]
|
||||
func GetExaCustomerList(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*middleware.CustomClaims)
|
||||
var cu model.ExaCustomer
|
||||
cu.SysUserAuthorityID = waitUse.AuthorityId
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, customerList, total := cu.GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("创建失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"customer": customerList,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
}, "创建成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/gin-gonic/gin"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 上传文件示例
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param file formData file true "上传文件示例"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Router /fileUploadAndDownload/upload [post]
|
||||
func UploadFile(c *gin.Context) {
|
||||
noSave := c.DefaultQuery("noSave", "0")
|
||||
_, header, err := c.Request.FormFile("file")
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("上传文件失败,%v", err), c)
|
||||
} else {
|
||||
//文件上传后拿到文件路径
|
||||
err, filePath, key := utils.Upload(header, USER_HEADER_BUCKET, USER_HEADER_IMG_PATH)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("接收返回值失败,%v", err), c)
|
||||
} else {
|
||||
//修改数据库后得到修改后的user并且返回供前端使用
|
||||
var file model.ExaFileUploadAndDownload
|
||||
file.Url = filePath
|
||||
file.Name = header.Filename
|
||||
s := strings.Split(file.Name, ".")
|
||||
file.Tag = s[len(s)-1]
|
||||
file.Key = key
|
||||
if noSave == "0" {
|
||||
err = file.Upload()
|
||||
}
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("修改数据库链接失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"file": file}, "上传成功", c)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 删除文件
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body dbModel.ExaFileUploadAndDownload true "传入文件里面id即可"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /fileUploadAndDownload/deleteFile [post]
|
||||
func DeleteFile(c *gin.Context) {
|
||||
var file model.ExaFileUploadAndDownload
|
||||
_ = c.ShouldBindJSON(&file)
|
||||
err, f := file.FindFile()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
err = utils.DeleteFile(USER_HEADER_BUCKET, f.Key)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败,%v", err), c)
|
||||
|
||||
} else {
|
||||
err = f.DeleteFile()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "删除成功", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags ExaFileUploadAndDownload
|
||||
// @Summary 分页文件列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取文件户列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /fileUploadAndDownload/getFileList [post]
|
||||
func GetFileList(c *gin.Context) {
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, list, total := new(model.ExaFileUploadAndDownload).GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"list": list,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
}, "获取数据成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type CreateApiParams struct {
|
||||
Path string `json:"path"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type DeleteApiParams struct {
|
||||
ID uint `json:"id"`
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 创建基础api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body api.CreateApiParams true "创建api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/createApi [post]
|
||||
func CreateApi(c *gin.Context) {
|
||||
var api model.SysApi
|
||||
_ = c.ShouldBindJSON(&api)
|
||||
err := api.CreateApi()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("创建失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "创建成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 删除指定api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysApi true "删除api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/deleteApi [post]
|
||||
func DeleteApi(c *gin.Context) {
|
||||
var a model.SysApi
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
err := a.DeleteApi()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
type AuthAndPathIn struct {
|
||||
AuthorityId string `json:"authorityId"`
|
||||
ApiIds []uint `json:"apiIds"`
|
||||
}
|
||||
|
||||
//条件搜索后端看此api
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 分页获取API列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo 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
|
||||
}
|
||||
var sp searchParams
|
||||
_ = c.ShouldBindJSON(&sp)
|
||||
err, list, total := sp.SysApi.GetInfoList(sp.PageInfo)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"list": list,
|
||||
"total": total,
|
||||
"page": sp.PageInfo.Page,
|
||||
"pageSize": sp.PageInfo.PageSize,
|
||||
}, "删除成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 根据id获取api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取用户列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/getApiById [post]
|
||||
func GetApiById(c *gin.Context) {
|
||||
var idInfo GetById
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
err, api := new(model.SysApi).GetApiById(idInfo.Id)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"api": api,
|
||||
}, "获取数据成功", c)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 创建基础api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body api.CreateApiParams true "创建api"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/updateApi [post]
|
||||
func UpdateApi(c *gin.Context) {
|
||||
var api model.SysApi
|
||||
_ = c.ShouldBindJSON(&api)
|
||||
err := api.UpdateApi()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("修改数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "修改数据成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 获取所有的Api 不分页
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /api/getAllApis [post]
|
||||
func GetAllApis(c *gin.Context) {
|
||||
err, apis := new(model.SysApi).GetAllApis()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"apis": apis,
|
||||
}, "获取数据成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags authority
|
||||
// @Summary 创建角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysAuthority true "创建角色"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /authority/createAuthority [post]
|
||||
func CreateAuthority(c *gin.Context) {
|
||||
var auth model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
err, authBack := auth.CreateAuthority()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("创建失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"authority": authBack,
|
||||
}, fmt.Sprintf("创建成功,%v", err), c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Summary 删除角色
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysAuthority true "删除角色"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /authority/deleteAuthority [post]
|
||||
func DeleteAuthority(c *gin.Context) {
|
||||
var a model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
//删除角色之前需要判断是否有用户正在使用此角色
|
||||
err := a.DeleteAuthority()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("删除失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "删除失败", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Summary 分页获取角色列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取用户列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /authority/getAuthorityList [post]
|
||||
func GetAuthorityList(c *gin.Context) {
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, list, total := new(model.SysAuthority).GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"list": list,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
}, "获取数据成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authority
|
||||
// @Summary 设置角色资源权限
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysAuthority true "设置角色资源权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
|
||||
// @Router /authority/setDataAuthority [post]
|
||||
func SetDataAuthority(c *gin.Context) {
|
||||
var auth model.SysAuthority
|
||||
_ = c.ShouldBindJSON(&auth)
|
||||
err := auth.SetDataAuthority()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("设置关联失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "获取数据成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
"os"
|
||||
)
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 自动代码模板
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body autoCodeModel.AutoCodeStruct true "创建自动代码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||
// @Router /autoCode/createTemp [post]
|
||||
func CreateTemp(c *gin.Context) {
|
||||
var a model.AutoCodeStruct
|
||||
_ = c.ShouldBindJSON(&a)
|
||||
err := a.CreateTemp()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("创建失败,%v", err), c)
|
||||
os.Remove("./ginvueadmin.zip")
|
||||
} else {
|
||||
c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", "ginvueadmin.zip")) //fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名
|
||||
c.Writer.Header().Add("Content-Type", "application/json")
|
||||
c.Writer.Header().Add("success", "true")
|
||||
c.File("./ginvueadmin.zip")
|
||||
os.Remove("./ginvueadmin.zip")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"gin-vue-admin/config"
|
||||
"gin-vue-admin/controller/servers"
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// 获取图片验证码id
|
||||
// @Tags base
|
||||
// @Summary 生成验证码
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha [post]
|
||||
func Captcha(c *gin.Context) {
|
||||
captchaId := captcha.NewLen(config.GinVueAdminconfig.Captcha.KeyLong)
|
||||
servers.ReportFormat(c, true, "验证码获取成功", gin.H{
|
||||
"captchaId": captchaId,
|
||||
"picPath": "/base/captcha/" + captchaId + ".png",
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags base
|
||||
// @Summary 生成验证码图片路径
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /base/captcha/:captchaId [get]
|
||||
func CaptchaImg(c *gin.Context) {
|
||||
servers.GinCapthcaServeHTTP(c.Writer, c.Request)
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags casbin
|
||||
// @Summary 更改角色api权限
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.CasbinInReceive true "更改角色api权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/casbinPUpdate [post]
|
||||
func CasbinPUpdate(c *gin.Context) {
|
||||
var cmr model.CasbinInReceive
|
||||
_ = c.ShouldBindJSON(&cmr)
|
||||
err := new(model.CasbinModel).CasbinPUpdate(cmr.AuthorityId, cmr.CasbinInfos)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("添加规则失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "添加规则成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags casbin
|
||||
// @Summary 获取权限列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.CasbinInReceive true "获取权限列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/getPolicyPathByAuthorityId [post]
|
||||
func GetPolicyPathByAuthorityId(c *gin.Context) {
|
||||
var cmr model.CasbinInReceive
|
||||
_ = c.ShouldBindJSON(&cmr)
|
||||
paths := new(model.CasbinModel).GetPolicyPathByAuthorityId(cmr.AuthorityId)
|
||||
response.Result(response.SUCCESS, gin.H{"paths": paths}, "获取规则成功", c)
|
||||
}
|
||||
|
||||
// @Tags casbin
|
||||
// @Summary casb RBAC RESTFUL测试路由
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.CasbinInReceive true "获取权限列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /casbin/CasbinTest [get]
|
||||
func CasbinTest(c *gin.Context) {
|
||||
// 测试restful以及占位符代码 随意书写
|
||||
pathParam := c.Param("pathParam")
|
||||
query := c.Query("query")
|
||||
response.Result(response.SUCCESS, gin.H{"pathParam": pathParam, "query": query}, "获取规则成功", c)
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags jwt
|
||||
// @Summary jwt加入黑名单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
|
||||
// @Router /jwt/jsonInBlacklist [post]
|
||||
func JsonInBlacklist(c *gin.Context) {
|
||||
token := c.Request.Header.Get("x-token")
|
||||
ModelJwt := model.JwtBlacklist{
|
||||
Jwt: token,
|
||||
}
|
||||
err := ModelJwt.JsonInBlacklist()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("jwt作废失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "jwt作废成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/middleware"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Summary 获取用户动态路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /menu/getMenu [post]
|
||||
func GetMenu(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*middleware.CustomClaims)
|
||||
err, menus := new(model.SysMenu).GetMenuTree(waitUse.AuthorityId)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 分页获取基础menu列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取基础menu列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getMenuList [post]
|
||||
func GetMenuList(c *gin.Context) {
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, menuList, total := new(model.SysBaseMenu).GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "获取数据成功", gin.H{
|
||||
"list": menuList,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 新增菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysBaseMenu true "新增菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/addBaseMenu [post]
|
||||
func AddBaseMenu(c *gin.Context) {
|
||||
var addMenu model.SysBaseMenu
|
||||
_ = c.ShouldBindJSON(&addMenu)
|
||||
err := addMenu.AddBaseMenu()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, fmt.Sprintf("添加成功,%v", err), gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Summary 获取用户动态路由
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body api.RegisterAndLoginStuct true "可以什么都不填"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /menu/getBaseMenuTree [post]
|
||||
func GetBaseMenuTree(c *gin.Context) {
|
||||
err, menus := new(model.SysBaseMenu).GetBaseMenuTree()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
|
||||
}
|
||||
}
|
||||
|
||||
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和角色关联关系"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/addMenuAuthority [post]
|
||||
func AddMenuAuthority(c *gin.Context) {
|
||||
var addMenuAuthorityInfo AddMenuAuthorityInfo
|
||||
_ = c.ShouldBindJSON(&addMenuAuthorityInfo)
|
||||
|
||||
err := new(model.SysMenu).AddMenuAuthority(addMenuAuthorityInfo.Menus, addMenuAuthorityInfo.AuthorityId)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("添加失败,%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, fmt.Sprintf("添加成功,%v", err), gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
type AuthorityIdInfo struct {
|
||||
AuthorityId string
|
||||
}
|
||||
|
||||
// @Tags authorityAndMenu
|
||||
// @Summary 获取指定角色menu
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body api.AuthorityIdInfo true "增加menu和角色关联关系"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/addMenuAuthority [post]
|
||||
func GetMenuAuthority(c *gin.Context) {
|
||||
var authorityIdInfo AuthorityIdInfo
|
||||
_ = c.ShouldBindJSON(&authorityIdInfo)
|
||||
err, menus := new(model.SysMenu).GetMenuAuthority(authorityIdInfo.AuthorityId)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("获取失败:%v", err), gin.H{"menus": menus})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "获取成功", gin.H{"menus": menus})
|
||||
}
|
||||
}
|
||||
|
||||
type IdInfo struct {
|
||||
Id float64
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 删除菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body api.IdInfo true "删除菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/deleteBaseMenu [post]
|
||||
func DeleteBaseMenu(c *gin.Context) {
|
||||
var idInfo IdInfo
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
err := new(model.SysBaseMenu).DeleteBaseMenu(idInfo.Id)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("删除失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "删除成功", gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags menu
|
||||
// @Summary 更新菜单
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysBaseMenu true "更新菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/updateBaseMenu [post]
|
||||
func UpdateBaseMenu(c *gin.Context) {
|
||||
var menu model.SysBaseMenu
|
||||
_ = c.ShouldBindJSON(&menu)
|
||||
err := menu.UpdateBaseMenu()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("修改失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "修改成功", gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
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获取菜单"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /menu/getBaseMenuById [post]
|
||||
func GetBaseMenuById(c *gin.Context) {
|
||||
var idInfo GetById
|
||||
_ = c.ShouldBindJSON(&idInfo)
|
||||
err, menu := new(model.SysBaseMenu).GetBaseMenuById(idInfo.Id)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("查询失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "查询成功", gin.H{"menu": menu})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags system
|
||||
// @Summary 获取配置文件内容
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /system/getSystemConfig [post]
|
||||
func GetSystemConfig(c *gin.Context) {
|
||||
err, config := new(model.System).GetSystemConfig()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"config": config}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags system
|
||||
// @Summary 设置配置文件内容
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.System true "设置配置文件内容"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /system/setSystemConfig [post]
|
||||
func SetSystemConfig(c *gin.Context) {
|
||||
var sys model.System
|
||||
_ = c.ShouldBindJSON(&sys)
|
||||
err := sys.SetSystemConfig()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("设置失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "设置成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
//本方法开发中 开发者windows系统 缺少linux系统所需的包 因此搁置
|
||||
// @Tags system
|
||||
// @Summary 设置配置文件内容
|
||||
// @Security ApiKeyAuth
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.System true "设置配置文件内容"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}"
|
||||
// @Router /system/ReloadSystem [post]
|
||||
func ReloadSystem(c *gin.Context) {
|
||||
var sys model.System
|
||||
_ = c.ShouldBindJSON(&sys)
|
||||
err := sys.SetSystemConfig()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("设置失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "设置成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/middleware"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/dchest/captcha"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-redis/redis"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"mime/multipart"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
USER_HEADER_IMG_PATH string = "http://qmplusimg.henrongyi.top"
|
||||
USER_HEADER_BUCKET string = "qm-plus-img"
|
||||
)
|
||||
|
||||
type RegisterAndLoginStuct struct {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Captcha string `json:"captcha"`
|
||||
CaptchaId string `json:"captchaId"`
|
||||
}
|
||||
|
||||
type RegestStuct struct {
|
||||
Username string `json:"userName"`
|
||||
Password string `json:"passWord"`
|
||||
NickName string `json:"nickName" gorm:"default:'QMPlusUser'"`
|
||||
HeaderImg string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
|
||||
AuthorityId string `json:"authorityId" gorm:"default:888"`
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户注册账号
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysUser true "用户注册接口"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
|
||||
// @Router /base/register [post]
|
||||
func Register(c *gin.Context) {
|
||||
var R RegestStuct
|
||||
_ = c.ShouldBindJSON(&R)
|
||||
user := &model.SysUser{Username: R.Username, NickName: R.NickName, Password: R.Password, HeaderImg: R.HeaderImg, AuthorityId: R.AuthorityId}
|
||||
err, user := user.Register()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"user": user,
|
||||
}, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"user": user,
|
||||
}, "注册成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags Base
|
||||
// @Summary 用户登录
|
||||
// @Produce application/json
|
||||
// @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 RegisterAndLoginStuct
|
||||
_ = c.ShouldBindJSON(&L)
|
||||
if captcha.VerifyString(L.CaptchaId, L.Captcha) {
|
||||
U := &model.SysUser{Username: L.Username, Password: L.Password}
|
||||
if err, user := U.Login(); err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("用户名密码错误或%v", err), c)
|
||||
} else {
|
||||
tokenNext(c, *user)
|
||||
}
|
||||
} else {
|
||||
response.Result(response.ERROR, gin.H{}, "验证码错误", c)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//登录以后签发jwt
|
||||
func tokenNext(c *gin.Context, user model.SysUser) {
|
||||
j := &middleware.JWT{
|
||||
[]byte(global.GVA_CONFIG.JWT.SigningKey), // 唯一签名
|
||||
}
|
||||
clams := middleware.CustomClaims{
|
||||
UUID: user.UUID,
|
||||
ID: user.ID,
|
||||
NickName: user.NickName,
|
||||
AuthorityId: user.AuthorityId,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
NotBefore: int64(time.Now().Unix() - 1000), // 签名生效时间
|
||||
ExpiresAt: int64(time.Now().Unix() + 60*60*24*7), // 过期时间 一周
|
||||
Issuer: "qmPlus", //签名的发行者
|
||||
},
|
||||
}
|
||||
token, err := j.CreateToken(clams)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, "获取token失败", c)
|
||||
} else {
|
||||
if global.GVA_CONFIG.System.UseMultipoint {
|
||||
var loginJwt model.JwtBlacklist
|
||||
loginJwt.Jwt = token
|
||||
err, jwtStr := loginJwt.GetRedisJWT(user.Username)
|
||||
if err == redis.Nil {
|
||||
err2 := loginJwt.SetRedisJWT(user.Username)
|
||||
if err2 != nil {
|
||||
response.Result(response.ERROR, gin.H{}, "设置登录状态失败", c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"user": user, "token": token, "expiresAt": clams.StandardClaims.ExpiresAt * 1000}, "登录成功", c)
|
||||
}
|
||||
} else if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("%v", err), c)
|
||||
} else {
|
||||
var blackjWT model.JwtBlacklist
|
||||
blackjWT.Jwt = jwtStr
|
||||
err3 := blackjWT.JsonInBlacklist()
|
||||
if err3 != nil {
|
||||
response.Result(response.ERROR, gin.H{}, "jwt作废失败", c)
|
||||
} else {
|
||||
err2 := loginJwt.SetRedisJWT(user.Username)
|
||||
if err2 != nil {
|
||||
response.Result(response.ERROR, gin.H{}, "设置登录状态失败", c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"user": user, "token": token, "expiresAt": clams.StandardClaims.ExpiresAt * 1000}, "登录成功", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"user": user, "token": token, "expiresAt": clams.StandardClaims.ExpiresAt * 1000}, "登录成功", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 "用户修改密码"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /user/changePassword [put]
|
||||
func ChangePassword(c *gin.Context) {
|
||||
var params ChangePasswordStutrc
|
||||
_ = c.ShouldBindJSON(¶ms)
|
||||
U := &model.SysUser{Username: params.Username, Password: params.Password}
|
||||
if err, _ := U.ChangePassword(params.NewPassword); err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, "修改失败,请检查用户名密码", c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "修改成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
type UserHeaderImg struct {
|
||||
HeaderImg multipart.File `json:"headerImg"`
|
||||
}
|
||||
|
||||
// @Tags SysUser
|
||||
// @Summary 用户上传头像
|
||||
// @Security ApiKeyAuth
|
||||
// @accept multipart/form-data
|
||||
// @Produce application/json
|
||||
// @Param headerImg formData file true "用户上传头像"
|
||||
// @Param username formData string true "用户上传头像"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
|
||||
// @Router /user/uploadHeaderImg [post]
|
||||
func UploadHeaderImg(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
//获取头像文件
|
||||
// 这里我们通过断言获取 claims内的所有内容
|
||||
waitUse := claims.(*middleware.CustomClaims)
|
||||
uuid := waitUse.UUID
|
||||
_, header, err := c.Request.FormFile("headerImg")
|
||||
//便于找到用户 以后从jwt中取
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("上传文件失败,%v", err), c)
|
||||
} else {
|
||||
//文件上传后拿到文件路径
|
||||
err, filePath, _ := utils.Upload(header, USER_HEADER_BUCKET, USER_HEADER_IMG_PATH)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("接收返回值失败,%v", err), c)
|
||||
} else {
|
||||
//修改数据库后得到修改后的user并且返回供前端使用
|
||||
err, user := new(model.SysUser).UploadHeaderImg(uuid, filePath)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("修改数据库链接失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{"user": user}, "上传成功", c)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// @Tags SysUser
|
||||
// @Summary 分页获取用户列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取用户列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /user/getUserList [post]
|
||||
func GetUserList(c *gin.Context) {
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, list, total := new(model.SysUser).GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取数据失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{
|
||||
"userList": list,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
}, "获取数据成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
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 "设置用户权限"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
|
||||
// @Router /user/setUserAuthority [post]
|
||||
func SetUserAuthority(c *gin.Context) {
|
||||
var sua SetUserAuth
|
||||
_ = c.ShouldBindJSON(&sua)
|
||||
err := new(model.SysUser).SetUserAuthority(sua.UUID, sua.AuthorityId)
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("修改失败,%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "修改成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags workflow
|
||||
// @Summary 注册工作流
|
||||
// @Produce application/json
|
||||
// @Param data body sysModel.SysWorkflow true "注册工作流接口"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
|
||||
// @Router /workflow/createWorkFlow [post]
|
||||
func CreateWorkFlow(c *gin.Context) {
|
||||
var wk model.SysWorkflow
|
||||
_ = c.ShouldBindJSON(&wk)
|
||||
err := wk.Create()
|
||||
if err != nil {
|
||||
response.Result(response.ERROR, gin.H{}, fmt.Sprintf("获取失败:%v", err), c)
|
||||
} else {
|
||||
response.Result(response.SUCCESS, gin.H{}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"casbinconfig": {
|
||||
"modelPath": "./resource/rbac_model.conf"
|
||||
},
|
||||
"jwt": {
|
||||
"signingKey": "qmPlus"
|
||||
},
|
||||
"mysqladmin": {
|
||||
"username": "root",
|
||||
"password": "Aa@6447985",
|
||||
"path": "127.0.0.1:3306",
|
||||
"dbname": "qmPlus",
|
||||
"config": "charset=utf8\u0026parseTime=True\u0026loc=Local",
|
||||
"maxIdleConns": 10,
|
||||
"maxOpenConns": 100,
|
||||
"logMode": true
|
||||
},
|
||||
"qiniu": {
|
||||
"accessKey": "25j8dYBZ2wuiy0yhwShytjZDTX662b8xiFguwxzZ",
|
||||
"secretKey": "pgdbqEsf7ooZh7W3xokP833h3dZ_VecFXPDeG5JY"
|
||||
},
|
||||
"redisadmin": {
|
||||
"addr": "127.0.0.1:6379",
|
||||
"password": "",
|
||||
"db": 0
|
||||
},
|
||||
"system": {
|
||||
"useMultipoint": false,
|
||||
"env": "develop",
|
||||
"addr": 8888
|
||||
},
|
||||
"captcha": {
|
||||
"keyLong": 6,
|
||||
"imgWidth": 120,
|
||||
"imgHeight": 40
|
||||
},
|
||||
"log": {
|
||||
"prefix": "[GIN-VUE-ADMIN]",
|
||||
"logFile": false,
|
||||
"stdout": ["DEBUG"],
|
||||
"file": ["WARNING"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/init"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func RunWindowsServer() {
|
||||
if global.GVA_CONFIG.System.UseMultipoint {
|
||||
// 初始化redis服务
|
||||
init.RegisterRedis()
|
||||
}
|
||||
Router := init.RegisterRouter()
|
||||
Router.Static("/form-generator", "./resource/page")
|
||||
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
|
||||
s := &http.Server{
|
||||
Addr: address,
|
||||
Handler: Router,
|
||||
ReadTimeout: 10 * time.Second,
|
||||
WriteTimeout: 10 * time.Second,
|
||||
MaxHeaderBytes: 1 << 20,
|
||||
}
|
||||
time.Sleep(10 * time.Microsecond)
|
||||
init.L.Debug("server run success on ", address)
|
||||
|
||||
fmt.Printf(`欢迎使用 Gin-Vue-Admin
|
||||
默认自动化文档地址:http://127.0.0.1%s/swagger/index.html
|
||||
默认前端文件运行地址:http://127.0.0.1:8080
|
||||
`, s.Addr)
|
||||
init.L.Error(s.ListenAndServe())
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/base/login', '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', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/casbinPUpdate', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/createExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/updateExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '8881', '/customer/deleteExaCustomer', 'POST', '', '', '');
|
||||
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/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', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/casbinPUpdate', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/createExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/updateExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '9528', '/customer/deleteExaCustomer', 'POST', '', '', '');
|
||||
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/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', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/deleteApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/updateApi', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/api/getAllApis', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/createAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/deleteAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/getAuthorityList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/setDataAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getBaseMenuTree', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/deleteBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/updateBaseMenu', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getBaseMenuById', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/changePassword', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/uploadHeaderImg', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/getInfoList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/getUserList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/user/setUserAuthority', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/upload', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/getFileList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/fileUploadAndDownload/deleteFile', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinPUpdate', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/getPolicyPathByAuthorityId', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/casbin/casbinTest/:pathParam', 'GET', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/jwt/jsonInBlacklist', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/system/getSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/system/setSystemConfig', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/createExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/updateExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/deleteExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/getExaCustomer', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/getExaCustomerList', 'POST', '', '', '');
|
||||
INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/createTemp', 'POST', '', '', '');
|
||||
@@ -0,0 +1,325 @@
|
||||
INSERT INTO `ch_cities` VALUES (1, '北京市', '北京市', 110100);
|
||||
INSERT INTO `ch_cities` VALUES (2, '天津市', '天津市', 120100);
|
||||
INSERT INTO `ch_cities` VALUES (3, '河北省', '石家庄市', 130100);
|
||||
INSERT INTO `ch_cities` VALUES (4, '河北省', '唐山市', 130200);
|
||||
INSERT INTO `ch_cities` VALUES (5, '河北省', '秦皇岛市', 130300);
|
||||
INSERT INTO `ch_cities` VALUES (6, '河北省', '邯郸市', 130400);
|
||||
INSERT INTO `ch_cities` VALUES (7, '河北省', '邢台市', 130500);
|
||||
INSERT INTO `ch_cities` VALUES (8, '河北省', '保定市', 130600);
|
||||
INSERT INTO `ch_cities` VALUES (9, '河北省', '张家口市', 130700);
|
||||
INSERT INTO `ch_cities` VALUES (10, '河北省', '承德市', 130800);
|
||||
INSERT INTO `ch_cities` VALUES (11, '河北省', '沧州市', 130900);
|
||||
INSERT INTO `ch_cities` VALUES (12, '河北省', '廊坊市', 131000);
|
||||
INSERT INTO `ch_cities` VALUES (13, '河北省', '衡水市', 131100);
|
||||
INSERT INTO `ch_cities` VALUES (14, '山西省', '太原市', 140100);
|
||||
INSERT INTO `ch_cities` VALUES (15, '山西省', '大同市', 140200);
|
||||
INSERT INTO `ch_cities` VALUES (16, '山西省', '阳泉市', 140300);
|
||||
INSERT INTO `ch_cities` VALUES (17, '山西省', '长治市', 140400);
|
||||
INSERT INTO `ch_cities` VALUES (18, '山西省', '晋城市', 140500);
|
||||
INSERT INTO `ch_cities` VALUES (19, '山西省', '朔州市', 140600);
|
||||
INSERT INTO `ch_cities` VALUES (20, '山西省', '晋中市', 140700);
|
||||
INSERT INTO `ch_cities` VALUES (21, '山西省', '运城市', 140800);
|
||||
INSERT INTO `ch_cities` VALUES (22, '山西省', '忻州市', 140900);
|
||||
INSERT INTO `ch_cities` VALUES (23, '山西省', '临汾市', 141000);
|
||||
INSERT INTO `ch_cities` VALUES (24, '山西省', '吕梁市', 141100);
|
||||
INSERT INTO `ch_cities` VALUES (25, '内蒙古自治区', '呼和浩特市', 150100);
|
||||
INSERT INTO `ch_cities` VALUES (26, '内蒙古自治区', '包头市', 150200);
|
||||
INSERT INTO `ch_cities` VALUES (27, '内蒙古自治区', '乌海市', 150300);
|
||||
INSERT INTO `ch_cities` VALUES (28, '内蒙古自治区', '赤峰市', 150400);
|
||||
INSERT INTO `ch_cities` VALUES (29, '内蒙古自治区', '通辽市', 150500);
|
||||
INSERT INTO `ch_cities` VALUES (30, '内蒙古自治区', '鄂尔多斯市', 150600);
|
||||
INSERT INTO `ch_cities` VALUES (31, '内蒙古自治区', '呼伦贝尔市', 150700);
|
||||
INSERT INTO `ch_cities` VALUES (32, '内蒙古自治区', '巴彦淖尔市', 150800);
|
||||
INSERT INTO `ch_cities` VALUES (33, '内蒙古自治区', '乌兰察布市', 150900);
|
||||
INSERT INTO `ch_cities` VALUES (34, '内蒙古自治区', '兴安盟', 152200);
|
||||
INSERT INTO `ch_cities` VALUES (35, '内蒙古自治区', '锡林郭勒盟', 152500);
|
||||
INSERT INTO `ch_cities` VALUES (36, '内蒙古自治区', '二连浩特市', 152501);
|
||||
INSERT INTO `ch_cities` VALUES (37, '内蒙古自治区', '锡林浩特市', 152502);
|
||||
INSERT INTO `ch_cities` VALUES (38, '内蒙古自治区', '阿拉善盟', 152900);
|
||||
INSERT INTO `ch_cities` VALUES (39, '辽宁省', '沈阳市', 210100);
|
||||
INSERT INTO `ch_cities` VALUES (40, '辽宁省', '大连市', 210200);
|
||||
INSERT INTO `ch_cities` VALUES (41, '辽宁省', '鞍山市', 210300);
|
||||
INSERT INTO `ch_cities` VALUES (42, '辽宁省', '抚顺市', 210400);
|
||||
INSERT INTO `ch_cities` VALUES (43, '辽宁省', '本溪市', 210500);
|
||||
INSERT INTO `ch_cities` VALUES (44, '辽宁省', '丹东市', 210600);
|
||||
INSERT INTO `ch_cities` VALUES (45, '辽宁省', '锦州市', 210700);
|
||||
INSERT INTO `ch_cities` VALUES (46, '辽宁省', '营口市', 210800);
|
||||
INSERT INTO `ch_cities` VALUES (47, '辽宁省', '阜新市', 210900);
|
||||
INSERT INTO `ch_cities` VALUES (48, '辽宁省', '辽阳市', 211000);
|
||||
INSERT INTO `ch_cities` VALUES (49, '辽宁省', '盘锦市', 211100);
|
||||
INSERT INTO `ch_cities` VALUES (50, '辽宁省', '铁岭市', 211200);
|
||||
INSERT INTO `ch_cities` VALUES (51, '辽宁省', '朝阳市', 211300);
|
||||
INSERT INTO `ch_cities` VALUES (52, '辽宁省', '葫芦岛市', 211400);
|
||||
INSERT INTO `ch_cities` VALUES (53, '吉林省', '长春市', 220100);
|
||||
INSERT INTO `ch_cities` VALUES (54, '吉林省', '吉林市', 220200);
|
||||
INSERT INTO `ch_cities` VALUES (55, '吉林省', '四平市', 220300);
|
||||
INSERT INTO `ch_cities` VALUES (56, '吉林省', '辽源市', 220400);
|
||||
INSERT INTO `ch_cities` VALUES (57, '吉林省', '通化市', 220500);
|
||||
INSERT INTO `ch_cities` VALUES (58, '吉林省', '白山市', 220600);
|
||||
INSERT INTO `ch_cities` VALUES (59, '吉林省', '松原市', 220700);
|
||||
INSERT INTO `ch_cities` VALUES (60, '吉林省', '白城市', 220800);
|
||||
INSERT INTO `ch_cities` VALUES (61, '吉林省', '延边朝鲜族自治州', 222400);
|
||||
INSERT INTO `ch_cities` VALUES (62, '黑龙江省', '哈尔滨市', 230100);
|
||||
INSERT INTO `ch_cities` VALUES (63, '黑龙江省', '齐齐哈尔市', 230200);
|
||||
INSERT INTO `ch_cities` VALUES (64, '黑龙江省', '鸡西市', 230300);
|
||||
INSERT INTO `ch_cities` VALUES (65, '黑龙江省', '鹤岗市', 230400);
|
||||
INSERT INTO `ch_cities` VALUES (66, '黑龙江省', '双鸭山市', 230500);
|
||||
INSERT INTO `ch_cities` VALUES (67, '黑龙江省', '大庆市', 230600);
|
||||
INSERT INTO `ch_cities` VALUES (68, '黑龙江省', '伊春市', 230700);
|
||||
INSERT INTO `ch_cities` VALUES (69, '黑龙江省', '佳木斯市', 230800);
|
||||
INSERT INTO `ch_cities` VALUES (70, '黑龙江省', '七台河市', 230900);
|
||||
INSERT INTO `ch_cities` VALUES (71, '黑龙江省', '牡丹江市', 231000);
|
||||
INSERT INTO `ch_cities` VALUES (72, '黑龙江省', '黑河市', 231100);
|
||||
INSERT INTO `ch_cities` VALUES (73, '黑龙江省', '绥化市', 231200);
|
||||
INSERT INTO `ch_cities` VALUES (74, '黑龙江省', '大兴安岭地区', 232700);
|
||||
INSERT INTO `ch_cities` VALUES (75, '上海市', '上海市', 310100);
|
||||
INSERT INTO `ch_cities` VALUES (76, '江苏省', '南京市', 320100);
|
||||
INSERT INTO `ch_cities` VALUES (77, '江苏省', '无锡市', 320200);
|
||||
INSERT INTO `ch_cities` VALUES (78, '江苏省', '徐州市', 320300);
|
||||
INSERT INTO `ch_cities` VALUES (79, '江苏省', '常州市', 320400);
|
||||
INSERT INTO `ch_cities` VALUES (80, '江苏省', '苏州市', 320500);
|
||||
INSERT INTO `ch_cities` VALUES (81, '江苏省', '昆山市', 320583);
|
||||
INSERT INTO `ch_cities` VALUES (82, '江苏省', '南通市', 320600);
|
||||
INSERT INTO `ch_cities` VALUES (83, '江苏省', '连云港市', 320700);
|
||||
INSERT INTO `ch_cities` VALUES (84, '江苏省', '淮安市', 320800);
|
||||
INSERT INTO `ch_cities` VALUES (85, '江苏省', '盐城市', 320900);
|
||||
INSERT INTO `ch_cities` VALUES (86, '江苏省', '扬州市', 321000);
|
||||
INSERT INTO `ch_cities` VALUES (87, '江苏省', '镇江市', 321100);
|
||||
INSERT INTO `ch_cities` VALUES (88, '江苏省', '泰州市', 321200);
|
||||
INSERT INTO `ch_cities` VALUES (89, '江苏省', '宿迁市', 321300);
|
||||
INSERT INTO `ch_cities` VALUES (90, '浙江省', '杭州市', 330100);
|
||||
INSERT INTO `ch_cities` VALUES (91, '浙江省', '宁波市', 330200);
|
||||
INSERT INTO `ch_cities` VALUES (92, '浙江省', '温州市', 330300);
|
||||
INSERT INTO `ch_cities` VALUES (93, '浙江省', '嘉兴市', 330400);
|
||||
INSERT INTO `ch_cities` VALUES (94, '浙江省', '湖州市', 330500);
|
||||
INSERT INTO `ch_cities` VALUES (95, '浙江省', '绍兴市', 330600);
|
||||
INSERT INTO `ch_cities` VALUES (96, '浙江省', '金华市', 330700);
|
||||
INSERT INTO `ch_cities` VALUES (97, '浙江省', '衢州市', 330800);
|
||||
INSERT INTO `ch_cities` VALUES (98, '浙江省', '舟山市', 330900);
|
||||
INSERT INTO `ch_cities` VALUES (99, '浙江省', '台州市', 331000);
|
||||
INSERT INTO `ch_cities` VALUES (100, '浙江省', '丽水市', 331100);
|
||||
INSERT INTO `ch_cities` VALUES (101, '安徽省', '合肥市', 340100);
|
||||
INSERT INTO `ch_cities` VALUES (102, '安徽省', '芜湖市', 340200);
|
||||
INSERT INTO `ch_cities` VALUES (103, '安徽省', '蚌埠市', 340300);
|
||||
INSERT INTO `ch_cities` VALUES (104, '安徽省', '淮南市', 340400);
|
||||
INSERT INTO `ch_cities` VALUES (105, '安徽省', '马鞍山市', 340500);
|
||||
INSERT INTO `ch_cities` VALUES (106, '安徽省', '淮北市', 340600);
|
||||
INSERT INTO `ch_cities` VALUES (107, '安徽省', '铜陵市', 340700);
|
||||
INSERT INTO `ch_cities` VALUES (108, '安徽省', '安庆市', 340800);
|
||||
INSERT INTO `ch_cities` VALUES (109, '安徽省', '黄山市', 341000);
|
||||
INSERT INTO `ch_cities` VALUES (110, '安徽省', '滁州市', 341100);
|
||||
INSERT INTO `ch_cities` VALUES (111, '安徽省', '阜阳市', 341200);
|
||||
INSERT INTO `ch_cities` VALUES (112, '安徽省', '宿州市', 341300);
|
||||
INSERT INTO `ch_cities` VALUES (113, '安徽省', '六安市', 341500);
|
||||
INSERT INTO `ch_cities` VALUES (114, '安徽省', '亳州市', 341600);
|
||||
INSERT INTO `ch_cities` VALUES (115, '安徽省', '池州市', 341700);
|
||||
INSERT INTO `ch_cities` VALUES (116, '安徽省', '宣城市', 341800);
|
||||
INSERT INTO `ch_cities` VALUES (117, '福建省', '福州市', 350100);
|
||||
INSERT INTO `ch_cities` VALUES (118, '福建省', '厦门市', 350200);
|
||||
INSERT INTO `ch_cities` VALUES (119, '福建省', '莆田市', 350300);
|
||||
INSERT INTO `ch_cities` VALUES (120, '福建省', '三明市', 350400);
|
||||
INSERT INTO `ch_cities` VALUES (121, '福建省', '泉州市', 350500);
|
||||
INSERT INTO `ch_cities` VALUES (122, '福建省', '漳州市', 350600);
|
||||
INSERT INTO `ch_cities` VALUES (123, '福建省', '南平市', 350700);
|
||||
INSERT INTO `ch_cities` VALUES (124, '福建省', '龙岩市', 350800);
|
||||
INSERT INTO `ch_cities` VALUES (125, '福建省', '宁德市', 350900);
|
||||
INSERT INTO `ch_cities` VALUES (126, '江西省', '南昌市', 360100);
|
||||
INSERT INTO `ch_cities` VALUES (127, '江西省', '景德镇市', 360200);
|
||||
INSERT INTO `ch_cities` VALUES (128, '江西省', '萍乡市', 360300);
|
||||
INSERT INTO `ch_cities` VALUES (129, '江西省', '九江市', 360400);
|
||||
INSERT INTO `ch_cities` VALUES (130, '江西省', '新余市', 360500);
|
||||
INSERT INTO `ch_cities` VALUES (131, '江西省', '鹰潭市', 360600);
|
||||
INSERT INTO `ch_cities` VALUES (132, '江西省', '赣州市', 360700);
|
||||
INSERT INTO `ch_cities` VALUES (133, '江西省', '吉安市', 360800);
|
||||
INSERT INTO `ch_cities` VALUES (134, '江西省', '宜春市', 360900);
|
||||
INSERT INTO `ch_cities` VALUES (135, '江西省', '抚州市', 361000);
|
||||
INSERT INTO `ch_cities` VALUES (136, '江西省', '上饶市', 361100);
|
||||
INSERT INTO `ch_cities` VALUES (137, '山东省', '济南市', 370100);
|
||||
INSERT INTO `ch_cities` VALUES (138, '山东省', '青岛市', 370200);
|
||||
INSERT INTO `ch_cities` VALUES (139, '山东省', '淄博市', 370300);
|
||||
INSERT INTO `ch_cities` VALUES (140, '山东省', '枣庄市', 370400);
|
||||
INSERT INTO `ch_cities` VALUES (141, '山东省', '滕州市', 370481);
|
||||
INSERT INTO `ch_cities` VALUES (142, '山东省', '东营市', 370500);
|
||||
INSERT INTO `ch_cities` VALUES (143, '山东省', '烟台市', 370600);
|
||||
INSERT INTO `ch_cities` VALUES (144, '山东省', '潍坊市', 370700);
|
||||
INSERT INTO `ch_cities` VALUES (145, '山东省', '济宁市', 370800);
|
||||
INSERT INTO `ch_cities` VALUES (146, '山东省', '泰安市', 370900);
|
||||
INSERT INTO `ch_cities` VALUES (147, '山东省', '威海市', 371000);
|
||||
INSERT INTO `ch_cities` VALUES (148, '山东省', '日照市', 371100);
|
||||
INSERT INTO `ch_cities` VALUES (149, '山东省', '莱芜市', 371200);
|
||||
INSERT INTO `ch_cities` VALUES (150, '山东省', '临沂市', 371300);
|
||||
INSERT INTO `ch_cities` VALUES (151, '山东省', '德州市', 371400);
|
||||
INSERT INTO `ch_cities` VALUES (152, '山东省', '聊城市', 371500);
|
||||
INSERT INTO `ch_cities` VALUES (153, '山东省', '滨州市', 371600);
|
||||
INSERT INTO `ch_cities` VALUES (154, '山东省', '菏泽市', 371700);
|
||||
INSERT INTO `ch_cities` VALUES (155, '河南省', '郑州市', 410100);
|
||||
INSERT INTO `ch_cities` VALUES (156, '河南省', '开封市', 410200);
|
||||
INSERT INTO `ch_cities` VALUES (157, '河南省', '洛阳市', 410300);
|
||||
INSERT INTO `ch_cities` VALUES (158, '河南省', '平顶山市', 410400);
|
||||
INSERT INTO `ch_cities` VALUES (159, '河南省', '安阳市', 410500);
|
||||
INSERT INTO `ch_cities` VALUES (160, '河南省', '鹤壁市', 410600);
|
||||
INSERT INTO `ch_cities` VALUES (161, '河南省', '新乡市', 410700);
|
||||
INSERT INTO `ch_cities` VALUES (162, '河南省', '焦作市', 410800);
|
||||
INSERT INTO `ch_cities` VALUES (163, '河南省', '濮阳市', 410900);
|
||||
INSERT INTO `ch_cities` VALUES (164, '河南省', '许昌市', 411000);
|
||||
INSERT INTO `ch_cities` VALUES (165, '河南省', '漯河市', 411100);
|
||||
INSERT INTO `ch_cities` VALUES (166, '河南省', '三门峡市', 411200);
|
||||
INSERT INTO `ch_cities` VALUES (167, '河南省', '南阳市', 411300);
|
||||
INSERT INTO `ch_cities` VALUES (168, '河南省', '商丘市', 411400);
|
||||
INSERT INTO `ch_cities` VALUES (169, '河南省', '信阳市', 411500);
|
||||
INSERT INTO `ch_cities` VALUES (170, '河南省', '周口市', 411600);
|
||||
INSERT INTO `ch_cities` VALUES (171, '河南省', '驻马店市', 411700);
|
||||
INSERT INTO `ch_cities` VALUES (172, '河南省', '济源市', 419001);
|
||||
INSERT INTO `ch_cities` VALUES (173, '湖北省', '武汉市', 420100);
|
||||
INSERT INTO `ch_cities` VALUES (174, '湖北省', '黄石市', 420200);
|
||||
INSERT INTO `ch_cities` VALUES (175, '湖北省', '十堰市', 420300);
|
||||
INSERT INTO `ch_cities` VALUES (176, '湖北省', '宜昌市', 420500);
|
||||
INSERT INTO `ch_cities` VALUES (177, '湖北省', '襄阳市', 420600);
|
||||
INSERT INTO `ch_cities` VALUES (178, '湖北省', '鄂州市', 420700);
|
||||
INSERT INTO `ch_cities` VALUES (179, '湖北省', '荆门市', 420800);
|
||||
INSERT INTO `ch_cities` VALUES (180, '湖北省', '孝感市', 420900);
|
||||
INSERT INTO `ch_cities` VALUES (181, '湖北省', '荆州市', 421000);
|
||||
INSERT INTO `ch_cities` VALUES (182, '湖北省', '黄冈市', 421100);
|
||||
INSERT INTO `ch_cities` VALUES (183, '湖北省', '咸宁市', 421200);
|
||||
INSERT INTO `ch_cities` VALUES (184, '湖北省', '随州市', 421300);
|
||||
INSERT INTO `ch_cities` VALUES (185, '湖北省', '恩施土家族苗族自治州', 422800);
|
||||
INSERT INTO `ch_cities` VALUES (186, '湖北省', '潜江市', 429005);
|
||||
INSERT INTO `ch_cities` VALUES (187, '湖南省', '长沙市', 430100);
|
||||
INSERT INTO `ch_cities` VALUES (188, '湖南省', '株洲市', 430200);
|
||||
INSERT INTO `ch_cities` VALUES (189, '湖南省', '湘潭市', 430300);
|
||||
INSERT INTO `ch_cities` VALUES (190, '湖南省', '衡阳市', 430400);
|
||||
INSERT INTO `ch_cities` VALUES (191, '湖南省', '邵阳市', 430500);
|
||||
INSERT INTO `ch_cities` VALUES (192, '湖南省', '岳阳市', 430600);
|
||||
INSERT INTO `ch_cities` VALUES (193, '湖南省', '常德市', 430700);
|
||||
INSERT INTO `ch_cities` VALUES (194, '湖南省', '张家界市', 430800);
|
||||
INSERT INTO `ch_cities` VALUES (195, '湖南省', '益阳市', 430900);
|
||||
INSERT INTO `ch_cities` VALUES (196, '湖南省', '郴州市', 431000);
|
||||
INSERT INTO `ch_cities` VALUES (197, '湖南省', '永州市', 431100);
|
||||
INSERT INTO `ch_cities` VALUES (198, '湖南省', '怀化市', 431200);
|
||||
INSERT INTO `ch_cities` VALUES (199, '湖南省', '娄底市', 431300);
|
||||
INSERT INTO `ch_cities` VALUES (200, '湖南省', '湘西土家族苗族自治州', 433100);
|
||||
INSERT INTO `ch_cities` VALUES (201, '广东省', '广州市', 440100);
|
||||
INSERT INTO `ch_cities` VALUES (202, '广东省', '韶关市', 440200);
|
||||
INSERT INTO `ch_cities` VALUES (203, '广东省', '深圳市', 440300);
|
||||
INSERT INTO `ch_cities` VALUES (204, '广东省', '珠海市', 440400);
|
||||
INSERT INTO `ch_cities` VALUES (205, '广东省', '汕头市', 440500);
|
||||
INSERT INTO `ch_cities` VALUES (206, '广东省', '佛山市', 440600);
|
||||
INSERT INTO `ch_cities` VALUES (207, '广东省', '江门市', 440700);
|
||||
INSERT INTO `ch_cities` VALUES (208, '广东省', '湛江市', 440800);
|
||||
INSERT INTO `ch_cities` VALUES (209, '广东省', '茂名市', 440900);
|
||||
INSERT INTO `ch_cities` VALUES (210, '广东省', '肇庆市', 441200);
|
||||
INSERT INTO `ch_cities` VALUES (211, '广东省', '惠州市', 441300);
|
||||
INSERT INTO `ch_cities` VALUES (212, '广东省', '梅州市', 441400);
|
||||
INSERT INTO `ch_cities` VALUES (213, '广东省', '汕尾市', 441500);
|
||||
INSERT INTO `ch_cities` VALUES (214, '广东省', '河源市', 441600);
|
||||
INSERT INTO `ch_cities` VALUES (215, '广东省', '阳江市', 441700);
|
||||
INSERT INTO `ch_cities` VALUES (216, '广东省', '清远市', 441800);
|
||||
INSERT INTO `ch_cities` VALUES (217, '广东省', '东莞市', 441900);
|
||||
INSERT INTO `ch_cities` VALUES (218, '广东省', '中山市', 442000);
|
||||
INSERT INTO `ch_cities` VALUES (219, '广东省', '潮州市', 445100);
|
||||
INSERT INTO `ch_cities` VALUES (220, '广东省', '揭阳市', 445200);
|
||||
INSERT INTO `ch_cities` VALUES (221, '广东省', '云浮市', 445300);
|
||||
INSERT INTO `ch_cities` VALUES (222, '广西壮族自治区', '南宁市', 450100);
|
||||
INSERT INTO `ch_cities` VALUES (223, '广西壮族自治区', '柳州市', 450200);
|
||||
INSERT INTO `ch_cities` VALUES (224, '广西壮族自治区', '桂林市', 450300);
|
||||
INSERT INTO `ch_cities` VALUES (225, '广西壮族自治区', '梧州市', 450400);
|
||||
INSERT INTO `ch_cities` VALUES (226, '广西壮族自治区', '北海市', 450500);
|
||||
INSERT INTO `ch_cities` VALUES (227, '广西壮族自治区', '防城港市', 450600);
|
||||
INSERT INTO `ch_cities` VALUES (228, '广西壮族自治区', '钦州市', 450700);
|
||||
INSERT INTO `ch_cities` VALUES (229, '广西壮族自治区', '贵港市', 450800);
|
||||
INSERT INTO `ch_cities` VALUES (230, '广西壮族自治区', '玉林市', 450900);
|
||||
INSERT INTO `ch_cities` VALUES (231, '广西壮族自治区', '百色市', 451000);
|
||||
INSERT INTO `ch_cities` VALUES (232, '广西壮族自治区', '贺州市', 451100);
|
||||
INSERT INTO `ch_cities` VALUES (233, '广西壮族自治区', '河池市', 451200);
|
||||
INSERT INTO `ch_cities` VALUES (234, '广西壮族自治区', '来宾市', 451300);
|
||||
INSERT INTO `ch_cities` VALUES (235, '广西壮族自治区', '崇左市', 451400);
|
||||
INSERT INTO `ch_cities` VALUES (236, '海南省', '海口市', 460100);
|
||||
INSERT INTO `ch_cities` VALUES (237, '海南省', '三亚市', 460200);
|
||||
INSERT INTO `ch_cities` VALUES (238, '海南省', '儋州市', 460400);
|
||||
INSERT INTO `ch_cities` VALUES (239, '重庆市', '重庆市', 500100);
|
||||
INSERT INTO `ch_cities` VALUES (240, '四川省', '成都市', 510100);
|
||||
INSERT INTO `ch_cities` VALUES (241, '四川省', '自贡市', 510300);
|
||||
INSERT INTO `ch_cities` VALUES (242, '四川省', '攀枝花市', 510400);
|
||||
INSERT INTO `ch_cities` VALUES (243, '四川省', '泸州市', 510500);
|
||||
INSERT INTO `ch_cities` VALUES (244, '四川省', '德阳市', 510600);
|
||||
INSERT INTO `ch_cities` VALUES (245, '四川省', '绵阳市', 510700);
|
||||
INSERT INTO `ch_cities` VALUES (246, '四川省', '广元市', 510800);
|
||||
INSERT INTO `ch_cities` VALUES (247, '四川省', '遂宁市', 510900);
|
||||
INSERT INTO `ch_cities` VALUES (248, '四川省', '内江市', 511000);
|
||||
INSERT INTO `ch_cities` VALUES (249, '四川省', '乐山市', 511100);
|
||||
INSERT INTO `ch_cities` VALUES (250, '四川省', '南充市', 511300);
|
||||
INSERT INTO `ch_cities` VALUES (251, '四川省', '眉山市', 511400);
|
||||
INSERT INTO `ch_cities` VALUES (252, '四川省', '宜宾市', 511500);
|
||||
INSERT INTO `ch_cities` VALUES (253, '四川省', '广安市', 511600);
|
||||
INSERT INTO `ch_cities` VALUES (254, '四川省', '达州市', 511700);
|
||||
INSERT INTO `ch_cities` VALUES (255, '四川省', '雅安市', 511800);
|
||||
INSERT INTO `ch_cities` VALUES (256, '四川省', '巴中市', 511900);
|
||||
INSERT INTO `ch_cities` VALUES (257, '四川省', '资阳市', 512000);
|
||||
INSERT INTO `ch_cities` VALUES (258, '四川省', '阿坝藏族羌族自治州', 513200);
|
||||
INSERT INTO `ch_cities` VALUES (259, '四川省', '甘孜藏族自治州', 513300);
|
||||
INSERT INTO `ch_cities` VALUES (260, '四川省', '凉山彝族自治州', 513400);
|
||||
INSERT INTO `ch_cities` VALUES (261, '贵州省', '贵阳市', 520100);
|
||||
INSERT INTO `ch_cities` VALUES (262, '贵州省', '六盘水市', 520200);
|
||||
INSERT INTO `ch_cities` VALUES (263, '贵州省', '遵义市', 520300);
|
||||
INSERT INTO `ch_cities` VALUES (264, '贵州省', '安顺市', 520400);
|
||||
INSERT INTO `ch_cities` VALUES (265, '贵州省', '毕节市', 520500);
|
||||
INSERT INTO `ch_cities` VALUES (266, '贵州省', '铜仁市', 520600);
|
||||
INSERT INTO `ch_cities` VALUES (267, '贵州省', '黔西南布依族苗族自治州', 522300);
|
||||
INSERT INTO `ch_cities` VALUES (268, '贵州省', '黔东南苗族侗族自治州', 522600);
|
||||
INSERT INTO `ch_cities` VALUES (269, '贵州省', '黔南布依族苗族自治州', 522700);
|
||||
INSERT INTO `ch_cities` VALUES (270, '云南省', '昆明市', 530100);
|
||||
INSERT INTO `ch_cities` VALUES (271, '云南省', '曲靖市', 530300);
|
||||
INSERT INTO `ch_cities` VALUES (272, '云南省', '玉溪市', 530400);
|
||||
INSERT INTO `ch_cities` VALUES (273, '云南省', '保山市', 530500);
|
||||
INSERT INTO `ch_cities` VALUES (274, '云南省', '昭通市', 530600);
|
||||
INSERT INTO `ch_cities` VALUES (275, '云南省', '丽江市', 530700);
|
||||
INSERT INTO `ch_cities` VALUES (276, '云南省', '普洱市', 530800);
|
||||
INSERT INTO `ch_cities` VALUES (277, '云南省', '临沧市', 530900);
|
||||
INSERT INTO `ch_cities` VALUES (278, '云南省', '楚雄彝族自治州', 532300);
|
||||
INSERT INTO `ch_cities` VALUES (279, '云南省', '红河哈尼族彝族自治州', 532500);
|
||||
INSERT INTO `ch_cities` VALUES (280, '云南省', '文山壮族苗族自治州', 532600);
|
||||
INSERT INTO `ch_cities` VALUES (281, '云南省', '西双版纳傣族自治州', 532800);
|
||||
INSERT INTO `ch_cities` VALUES (282, '云南省', '大理白族自治州', 532900);
|
||||
INSERT INTO `ch_cities` VALUES (283, '云南省', '德宏傣族景颇族自治州', 533100);
|
||||
INSERT INTO `ch_cities` VALUES (284, '云南省', '怒江傈僳族自治州', 533300);
|
||||
INSERT INTO `ch_cities` VALUES (285, '云南省', '迪庆藏族自治州', 533400);
|
||||
INSERT INTO `ch_cities` VALUES (286, '西藏自治区', '拉萨市', 540100);
|
||||
INSERT INTO `ch_cities` VALUES (287, '西藏自治区', '日喀则市', 540200);
|
||||
INSERT INTO `ch_cities` VALUES (288, '陕西省', '西安市', 610100);
|
||||
INSERT INTO `ch_cities` VALUES (289, '陕西省', '铜川市', 610200);
|
||||
INSERT INTO `ch_cities` VALUES (290, '陕西省', '宝鸡市', 610300);
|
||||
INSERT INTO `ch_cities` VALUES (291, '陕西省', '咸阳市', 610400);
|
||||
INSERT INTO `ch_cities` VALUES (292, '陕西省', '渭南市', 610500);
|
||||
INSERT INTO `ch_cities` VALUES (293, '陕西省', '延安市', 610600);
|
||||
INSERT INTO `ch_cities` VALUES (294, '陕西省', '汉中市', 610700);
|
||||
INSERT INTO `ch_cities` VALUES (295, '陕西省', '榆林市', 610800);
|
||||
INSERT INTO `ch_cities` VALUES (296, '陕西省', '安康市', 610900);
|
||||
INSERT INTO `ch_cities` VALUES (297, '陕西省', '商洛市', 611000);
|
||||
INSERT INTO `ch_cities` VALUES (298, '甘肃省', '兰州市', 620100);
|
||||
INSERT INTO `ch_cities` VALUES (299, '甘肃省', '嘉峪关市', 620200);
|
||||
INSERT INTO `ch_cities` VALUES (300, '甘肃省', '金昌市', 620300);
|
||||
INSERT INTO `ch_cities` VALUES (301, '甘肃省', '白银市', 620400);
|
||||
INSERT INTO `ch_cities` VALUES (302, '甘肃省', '天水市', 620500);
|
||||
INSERT INTO `ch_cities` VALUES (303, '甘肃省', '武威市', 620600);
|
||||
INSERT INTO `ch_cities` VALUES (304, '甘肃省', '张掖市', 620700);
|
||||
INSERT INTO `ch_cities` VALUES (305, '甘肃省', '平凉市', 620800);
|
||||
INSERT INTO `ch_cities` VALUES (306, '甘肃省', '酒泉市', 620900);
|
||||
INSERT INTO `ch_cities` VALUES (307, '甘肃省', '庆阳市', 621000);
|
||||
INSERT INTO `ch_cities` VALUES (308, '甘肃省', '定西市', 621100);
|
||||
INSERT INTO `ch_cities` VALUES (309, '甘肃省', '陇南市', 621200);
|
||||
INSERT INTO `ch_cities` VALUES (310, '甘肃省', '临夏回族自治州', 622900);
|
||||
INSERT INTO `ch_cities` VALUES (311, '甘肃省', '甘南藏族自治州', 623000);
|
||||
INSERT INTO `ch_cities` VALUES (312, '青海省', '西宁市', 630100);
|
||||
INSERT INTO `ch_cities` VALUES (313, '青海省', '海东市', 630200);
|
||||
INSERT INTO `ch_cities` VALUES (314, '青海省', '海西蒙古族藏族自治州', 632800);
|
||||
INSERT INTO `ch_cities` VALUES (315, '宁夏回族自治区', '银川市', 640100);
|
||||
INSERT INTO `ch_cities` VALUES (316, '宁夏回族自治区', '石嘴山市', 640200);
|
||||
INSERT INTO `ch_cities` VALUES (317, '宁夏回族自治区', '吴忠市', 640300);
|
||||
INSERT INTO `ch_cities` VALUES (318, '新疆维吾尔自治区', '乌鲁木齐市', 650100);
|
||||
INSERT INTO `ch_cities` VALUES (319, '新疆维吾尔自治区', '克拉玛依市', 650200);
|
||||
INSERT INTO `ch_cities` VALUES (320, '新疆维吾尔自治区', '哈密市', 650500);
|
||||
INSERT INTO `ch_cities` VALUES (321, '新疆维吾尔自治区', '昌吉回族自治州', 652300);
|
||||
INSERT INTO `ch_cities` VALUES (322, '新疆维吾尔自治区', '巴音郭楞蒙古自治州', 652800);
|
||||
INSERT INTO `ch_cities` VALUES (323, '新疆维吾尔自治区', '阿克苏地区', 652900);
|
||||
INSERT INTO `ch_cities` VALUES (324, '新疆维吾尔自治区', '喀什地区', 653100);
|
||||
INSERT INTO `ch_cities` VALUES (325, '新疆维吾尔自治区', '伊犁哈萨克自治州', 654000);
|
||||
@@ -0,0 +1,31 @@
|
||||
INSERT INTO `ch_provinces` VALUES (1, '北京市');
|
||||
INSERT INTO `ch_provinces` VALUES (2, '天津市');
|
||||
INSERT INTO `ch_provinces` VALUES (3, '河北省');
|
||||
INSERT INTO `ch_provinces` VALUES (4, '山西省');
|
||||
INSERT INTO `ch_provinces` VALUES (5, '内蒙古自治区');
|
||||
INSERT INTO `ch_provinces` VALUES (6, '辽宁省');
|
||||
INSERT INTO `ch_provinces` VALUES (7, '吉林省');
|
||||
INSERT INTO `ch_provinces` VALUES (8, '黑龙江省');
|
||||
INSERT INTO `ch_provinces` VALUES (9, '上海市');
|
||||
INSERT INTO `ch_provinces` VALUES (10, '江苏省');
|
||||
INSERT INTO `ch_provinces` VALUES (11, '浙江省');
|
||||
INSERT INTO `ch_provinces` VALUES (12, '安徽省');
|
||||
INSERT INTO `ch_provinces` VALUES (13, '福建省');
|
||||
INSERT INTO `ch_provinces` VALUES (14, '江西省');
|
||||
INSERT INTO `ch_provinces` VALUES (15, '山东省');
|
||||
INSERT INTO `ch_provinces` VALUES (16, '河南省');
|
||||
INSERT INTO `ch_provinces` VALUES (17, '湖北省');
|
||||
INSERT INTO `ch_provinces` VALUES (18, '湖南省');
|
||||
INSERT INTO `ch_provinces` VALUES (19, '广东省');
|
||||
INSERT INTO `ch_provinces` VALUES (20, '广西壮族自治区');
|
||||
INSERT INTO `ch_provinces` VALUES (21, '海南省');
|
||||
INSERT INTO `ch_provinces` VALUES (22, '重庆市');
|
||||
INSERT INTO `ch_provinces` VALUES (23, '四川省');
|
||||
INSERT INTO `ch_provinces` VALUES (24, '贵州省');
|
||||
INSERT INTO `ch_provinces` VALUES (25, '云南省');
|
||||
INSERT INTO `ch_provinces` VALUES (26, '西藏自治区');
|
||||
INSERT INTO `ch_provinces` VALUES (27, '陕西省');
|
||||
INSERT INTO `ch_provinces` VALUES (28, '甘肃省');
|
||||
INSERT INTO `ch_provinces` VALUES (29, '青海省');
|
||||
INSERT INTO `ch_provinces` VALUES (30, '宁夏回族自治区');
|
||||
INSERT INTO `ch_provinces` VALUES (31, '新疆维吾尔自治区');
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
INSERT INTO `exa_customers` VALUES (1, '2020-02-25 18:01:48', '2020-02-25 18:01:48', NULL, '测试客户123', '1761111111', 10, '888');
|
||||
@@ -0,0 +1,5 @@
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (7, '2019-10-26 22:46:32', '2019-10-26 22:46:32', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572101191logo.png', 'png', '1572101191logo.png');
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (10, '2019-10-26 23:10:44', '2019-10-26 23:10:44', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102643logo.png', 'png', '1572102643logo.png');
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (12, '2019-10-26 23:14:08', '2019-10-26 23:14:08', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102846logo.png', 'png', '1572102846logo.png');
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (13, '2019-10-26 23:18:17', '2019-10-26 23:18:17', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572103096logo.png', 'png', '1572103096logo.png');
|
||||
INSERT INTO `exa_file_upload_and_downloads` VALUES (15, '2019-12-15 14:31:00', '2019-12-15 14:31:00', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1576391451logo.png', 'png', '1576391451logo.png');
|
||||
@@ -0,0 +1,36 @@
|
||||
INSERT INTO `jwt_blacklists` VALUES (3, '2019-12-28 18:29:05', '2019-12-28 18:29:05', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzNzM2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1Mjc5MzZ9.T7ikGw-lgAAQlfMne7zPIF-PlfQMg37uBCYJ24Y_B38');
|
||||
INSERT INTO `jwt_blacklists` VALUES (4, '2019-12-28 18:31:02', '2019-12-28 18:31:02', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzODUzLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1MjgwNTN9.tDzUm4KNFeJCErNfZGfuF2tcuolga2f_2dE0nTl_UZU');
|
||||
INSERT INTO `jwt_blacklists` VALUES (5, '2019-12-28 18:31:25', '2019-12-28 18:31:25', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MTMzODcwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc1MjgwNzB9.mspXy9sqQO_5PusPReLalodo_ybWRKxb3Ownf2r2HxE');
|
||||
INSERT INTO `jwt_blacklists` VALUES (6, '2019-12-30 14:20:10', '2019-12-30 14:20:10', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkxNTc2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODU3NzZ9.AR2KYShboFKsHTjwohxEkA3lytttfZqRH849sl2fNdw');
|
||||
INSERT INTO `jwt_blacklists` VALUES (7, '2019-12-30 14:21:14', '2019-12-30 14:21:14', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkxNjE2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODU4MTZ9.h8zbDVHM_QbBI-ejGXeQpw0S9oYHJyP4U-TwsVFus9Q');
|
||||
INSERT INTO `jwt_blacklists` VALUES (8, '2019-12-30 14:21:57', '2019-12-30 14:21:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkxNjgxLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODU4ODF9.CSjolDGVpU0g7YG6TaPAlWAMdhtvnBhAi-XYYWZ6RLo');
|
||||
INSERT INTO `jwt_blacklists` VALUES (9, '2019-12-30 14:25:01', '2019-12-30 14:25:01', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkxODIyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODYwMjJ9.Y_s22Vh5J2ah6Kh1nZQQ8XIQspbT4I7tzc_YJqWrRWM');
|
||||
INSERT INTO `jwt_blacklists` VALUES (10, '2019-12-30 14:29:26', '2019-12-30 14:29:26', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkyMTU0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODYzNTR9.4HJdx-sfYE5TUUefdwi3yZ6dY_jG7WwEC_55WuGawY8');
|
||||
INSERT INTO `jwt_blacklists` VALUES (11, '2019-12-30 14:43:43', '2019-12-30 14:43:43', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkyMTcwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODYzNzB9.YEhupQVwjMVBB2eAcAoGG-vJczoxuUyn6KR-tDWU86I');
|
||||
INSERT INTO `jwt_blacklists` VALUES (12, '2019-12-30 14:55:13', '2019-12-30 14:55:13', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkzMDI3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODcyMjd9.r_sE_Z31cFdS2nCf3iyQjuiZe0Z3HPR07wKBGlUHsnk');
|
||||
INSERT INTO `jwt_blacklists` VALUES (13, '2019-12-30 14:58:31', '2019-12-30 14:58:31', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkzNzY2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODc5NjZ9.dYFlmyIKQZjzTCKu56wCmxXiW6zOayN_YgygCcvCyLk');
|
||||
INSERT INTO `jwt_blacklists` VALUES (14, '2019-12-30 14:58:38', '2019-12-30 14:58:38', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkzOTEwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODgxMTB9.pPmzsHU4UceZuPFT_G-SDdxe6FD3MuL47HkovpI-_0c');
|
||||
INSERT INTO `jwt_blacklists` VALUES (15, '2019-12-30 14:58:58', '2019-12-30 14:58:58', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4MjkzOTE4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1Nzc2ODgxMTh9.irf98R0belbXtb8x9SxsvuhiYsbHMPbHbFDxaaH0z6Q');
|
||||
INSERT INTO `jwt_blacklists` VALUES (16, '2020-01-06 16:32:31', '2020-01-06 16:32:31', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTAzMjk5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTc0OTl9.jgLfjvek7sQyuZ2TABQvLOyu_ifNw_KYzfY3VTLL4fw');
|
||||
INSERT INTO `jwt_blacklists` VALUES (17, '2020-01-06 16:33:08', '2020-01-06 16:33:08', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA0MzU4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTg1NTh9.89r6xHZUBDjfmNpmF02RjQXYTBGUiJvOEDP8pydNt-A');
|
||||
INSERT INTO `jwt_blacklists` VALUES (18, '2020-01-06 16:33:18', '2020-01-06 16:33:18', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA0MzkyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTg1OTJ9.6Yv9ZYhN-TH9H4SoZEAkjevKVX0vLHL1lVQGFpfBr2U');
|
||||
INSERT INTO `jwt_blacklists` VALUES (19, '2020-01-06 16:36:06', '2020-01-06 16:36:06', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA0NDA5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTg2MDl9._9zRRK76XH_KgrW1X9P5GTLW9dwfIixB4QUsC7M3RHA');
|
||||
INSERT INTO `jwt_blacklists` VALUES (20, '2020-01-06 16:44:06', '2020-01-06 16:44:06', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA0NTcxLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTg3NzF9.5ki0TZooCorK81xWpYa-OO3RR-Bpp5am_uNCNPh4250');
|
||||
INSERT INTO `jwt_blacklists` VALUES (21, '2020-01-06 16:45:50', '2020-01-06 16:45:50', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1MDUwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTkyNTB9.A0n5faE0X0TyRb_1RvAQBLooY-peapPTD0LnJD03Ul0');
|
||||
INSERT INTO `jwt_blacklists` VALUES (22, '2020-01-06 16:46:24', '2020-01-06 16:46:24', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1MTU0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTkzNTR9.VtqTOJ-MQY2K3w4tM7HgT0z73CEOd3CDqmYqKCjXxnc');
|
||||
INSERT INTO `jwt_blacklists` VALUES (23, '2020-01-06 16:47:20', '2020-01-06 16:47:20', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1MTg3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTkzODd9.fwL1QakF30SHSaGDkPo3weIg0l7kiAGwNq_fKsFxquc');
|
||||
INSERT INTO `jwt_blacklists` VALUES (24, '2020-01-06 16:47:57', '2020-01-06 16:47:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1MjQ0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk0NDR9.VoKdA0-brmUlQ5bYufIdMWrS-cCQ2ARm7_jeVtfvCpc');
|
||||
INSERT INTO `jwt_blacklists` VALUES (25, '2020-01-06 16:49:08', '2020-01-06 16:49:08', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1Mjg1LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk0ODV9.a8-zmyIlJJGdonhXAzNvNH9C-nMa-Voq4bhTbiVKJzE');
|
||||
INSERT INTO `jwt_blacklists` VALUES (26, '2020-01-06 16:49:32', '2020-01-06 16:49:32', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1MzUyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk1NTJ9.l4e3rjtrDgRsqnQwizJ-ZXVUVM8ywSJcNJkkEVYbdzU');
|
||||
INSERT INTO `jwt_blacklists` VALUES (27, '2020-01-06 16:49:58', '2020-01-06 16:49:58', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1Mzc3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk1Nzd9.mXUPYvmXbntrdywpBNM0j9sP991cwfhc9b0KvUM4dG4');
|
||||
INSERT INTO `jwt_blacklists` VALUES (28, '2020-01-06 16:50:56', '2020-01-06 16:50:56', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NDExLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk2MTF9.Z21e8nWHKV5XvYg61CZCz3nMK25m_FmlxncxGMpMS0k');
|
||||
INSERT INTO `jwt_blacklists` VALUES (29, '2020-01-06 16:52:03', '2020-01-06 16:52:03', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NDY0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk2NjR9.qzptIyCcL_SPm6TGwXML8Rih3qYqj9GLUpWzTpSPPuI');
|
||||
INSERT INTO `jwt_blacklists` VALUES (30, '2020-01-06 16:52:36', '2020-01-06 16:52:36', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NTI3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk3Mjd9.D9e8qbx44CLX0ZInwNlIqTGS_sSE069TRIDkQAk7tVY');
|
||||
INSERT INTO `jwt_blacklists` VALUES (31, '2020-01-06 16:54:35', '2020-01-06 16:54:35', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NTY1LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk3NjV9.D4EZmVAJ96kxcyIfWkT_LA81t1JCuQZcYmQkkoNhtPo');
|
||||
INSERT INTO `jwt_blacklists` VALUES (32, '2020-01-06 16:55:40', '2020-01-06 16:55:40', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NjgzLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk4ODN9.SJL2fFMbe5VL2YWBzMlrhxbBIJhIHTUeodkEpgH1Xgo');
|
||||
INSERT INTO `jwt_blacklists` VALUES (33, '2020-01-06 16:57:28', '2020-01-06 16:57:28', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1NzU4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgyOTk5NTh9.6y12UkOeW7vz7gGTcYaN3Y-2Ut2QmjgU9WEuy_pneGM');
|
||||
INSERT INTO `jwt_blacklists` VALUES (34, '2020-01-06 16:59:02', '2020-01-06 16:59:02', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1ODU1LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgzMDAwNTV9.G0q9X7Ld3cN_BO-K219b7tFAHgtpiAwqLPoxVNKsEl8');
|
||||
INSERT INTO `jwt_blacklists` VALUES (35, '2020-01-06 16:59:26', '2020-01-06 16:59:26', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTc4OTA1OTQ2LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1NzgzMDAxNDZ9.cmBgWiztsnh7zF3OUNIDQKv8wzGJF7fllUv-4LlYxu8');
|
||||
INSERT INTO `jwt_blacklists` VALUES (36, '2020-03-21 14:46:14', '2020-03-21 14:46:14', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg1Mzc3ODY3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODQ3NzIwNjd9.DLhWhD1FdcWLyFLcXQynKJnenbVHrSiKhlDGFRzgo5k');
|
||||
INSERT INTO `jwt_blacklists` VALUES (37, '2020-03-31 14:24:35', '2020-03-31 14:24:35', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MTM4MTA4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU1MzIzMDh9.Ro2F2dZLfOk2Z_OPRbweOuCpchr6HlHfQIF5qjfc8y4');
|
||||
INSERT INTO `jwt_blacklists` VALUES (38, '2020-04-01 16:07:57', '2020-04-01 16:07:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MjQwNzQyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU2MzQ5NDJ9.9qaOFu7D5cq4vxTfLi4pyO_JGcKjVAEJIcoStJWJlYg');
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
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/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');
|
||||
INSERT INTO `sys_apis` VALUES (7, '2019-09-28 14:19:26', '2019-09-28 17:05:44', NULL, NULL, '/api/deleteApi', '删除Api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (8, '2019-09-28 14:19:48', '2019-09-28 17:05:39', NULL, NULL, '/api/updateApi', '更新Api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (10, '2019-09-30 15:05:38', '2019-09-30 15:05:38', NULL, NULL, '/api/getAllApis', '获取所有api', 'api', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (11, '2019-09-30 15:23:09', '2019-09-30 15:23:09', NULL, NULL, '/authority/createAuthority', '创建角色', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (12, '2019-09-30 15:23:33', '2019-09-30 15:23:33', NULL, NULL, '/authority/deleteAuthority', '删除角色', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (13, '2019-09-30 15:23:57', '2019-09-30 15:23:57', NULL, NULL, '/authority/getAuthorityList', '获取角色列表', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (14, '2019-09-30 15:24:20', '2019-09-30 15:24:20', NULL, NULL, '/menu/getMenu', '获取菜单树', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (15, '2019-09-30 15:24:50', '2019-09-30 15:24:50', NULL, NULL, '/menu/getMenuList', '分页获取基础menu列表', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (16, '2019-09-30 15:25:07', '2019-09-30 15:25:07', NULL, NULL, '/menu/addBaseMenu', '新增菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (17, '2019-09-30 15:25:25', '2019-09-30 15:25:25', NULL, NULL, '/menu/getBaseMenuTree', '获取用户动态路由', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (18, '2019-09-30 15:25:53', '2019-09-30 15:25:53', NULL, NULL, '/menu/addMenuAuthority', '增加menu和角色关联关系', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (19, '2019-09-30 15:26:20', '2019-09-30 15:26:20', NULL, NULL, '/menu/getMenuAuthority', '获取指定角色menu', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (20, '2019-09-30 15:26:43', '2019-09-30 15:26:43', NULL, NULL, '/menu/deleteBaseMenu', '删除菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (21, '2019-09-30 15:28:05', '2019-09-30 15:28:05', NULL, NULL, '/menu/updateBaseMenu', '更新菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (22, '2019-09-30 15:28:21', '2019-09-30 15:28:21', NULL, NULL, '/menu/getBaseMenuById', '根据id获取菜单', 'menu', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (23, '2019-09-30 15:29:19', '2019-09-30 15:29:19', NULL, NULL, '/user/changePassword', '修改密码', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (24, '2019-09-30 15:29:33', '2019-09-30 15:29:33', NULL, NULL, '/user/uploadHeaderImg', '上传头像', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (25, '2019-09-30 15:30:00', '2019-09-30 15:30:00', NULL, NULL, '/user/getInfoList', '分页获取用户列表', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (28, '2019-10-09 15:15:17', '2019-10-09 15:17:07', NULL, NULL, '/user/getUserList', '获取用户列表', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (29, '2019-10-09 23:01:40', '2019-10-09 23:01:40', NULL, NULL, '/user/setUserAuthority', '修改用户角色', 'user', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (30, '2019-10-26 20:14:38', '2019-10-26 20:14:38', NULL, NULL, '/fileUploadAndDownload/upload', '文件上传示例', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (31, '2019-10-26 20:14:59', '2019-10-26 20:14:59', NULL, NULL, '/fileUploadAndDownload/getFileList', '获取上传文件列表', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (32, '2019-12-12 13:28:47', '2019-12-12 13:28:47', NULL, NULL, '/casbin/casbinPUpdate', '更改角色api权限', 'casbin', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (33, '2019-12-12 13:28:59', '2019-12-12 13:28:59', NULL, NULL, '/casbin/getPolicyPathByAuthorityId', '获取权限列表', 'casbin', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (34, '2019-12-12 17:02:15', '2019-12-12 17:02:15', NULL, NULL, '/fileUploadAndDownload/deleteFile', '删除文件', 'fileUploadAndDownload', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (35, '2019-12-28 18:18:07', '2019-12-28 18:18:07', NULL, NULL, '/jwt/jsonInBlacklist', 'jwt加入黑名单', 'jwt', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (36, '2020-01-06 17:56:36', '2020-01-06 17:56:36', NULL, NULL, '/authority/setDataAuthority', '设置角色资源权限', 'authority', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (37, '2020-01-13 14:04:05', '2020-01-13 14:04:05', NULL, NULL, '/system/getSystemConfig', '获取配置文件内容', 'system', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (38, '2020-01-13 15:02:06', '2020-01-13 15:02:06', NULL, NULL, '/system/setSystemConfig', '设置配置文件内容', 'system', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (39, '2020-02-25 15:32:39', '2020-02-25 15:32:39', NULL, NULL, '/customer/createExaCustomer', '创建客户', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (40, '2020-02-25 15:32:51', '2020-02-25 15:34:56', NULL, NULL, '/customer/updateExaCustomer', '更新客户', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (41, '2020-02-25 15:33:57', '2020-02-25 15:33:57', NULL, NULL, '/customer/deleteExaCustomer', '删除客户', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (42, '2020-02-25 15:36:48', '2020-02-25 15:37:16', NULL, NULL, '/customer/getExaCustomer', '获取单一客户', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (43, '2020-02-25 15:37:06', '2020-02-25 15:37:06', NULL, NULL, '/customer/getExaCustomerList', '获取客户列表', 'customer', 'POST');
|
||||
INSERT INTO `sys_apis` VALUES (44, '2020-03-12 14:36:54', '2020-03-12 14:56:50', NULL, NULL, '/casbin/casbinTest/:pathParam', 'RESTFUL模式测试', 'casbin', 'GET');
|
||||
INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28', NULL, NULL, '/autoCode/createTemp', '自动化代码', 'autoCode', 'POST');
|
||||
@@ -0,0 +1,3 @@
|
||||
INSERT INTO `sys_authorities` VALUES (2, '2019-09-08 16:18:45', '2019-09-08 16:18:45', NULL, '888', '普通用户', '0');
|
||||
INSERT INTO `sys_authorities` VALUES (6, '2019-09-18 22:23:33', '2019-09-18 22:23:33', NULL, '9528', '测试角色', '0');
|
||||
INSERT INTO `sys_authorities` VALUES (8, '2019-12-28 18:19:13', '2019-12-28 18:19:13', NULL, '8881', '普通用户子角色', '888');
|
||||
@@ -0,0 +1,28 @@
|
||||
INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 0, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', '仪表盘', '1');
|
||||
INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 0, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', '测试菜单', '2');
|
||||
INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', '3');
|
||||
INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', '1');
|
||||
INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', '2');
|
||||
INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', '3');
|
||||
INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', '4');
|
||||
INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', '4');
|
||||
INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', '6');
|
||||
INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', '1');
|
||||
INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', '2');
|
||||
INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', '3');
|
||||
INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', '4');
|
||||
INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', '5');
|
||||
INSERT INTO `sys_base_menus` VALUES (29, '2019-12-04 10:05:57', '2019-12-12 16:51:39', '2019-12-12 17:00:50', 0, 0, 'workflow', 'workflow', 0, 'view/workflow/index.vue', '工作流', 'share', '工作流', '6');
|
||||
INSERT INTO `sys_base_menus` VALUES (30, '2019-12-04 10:06:36', '2019-12-04 10:06:36', '2019-12-12 17:00:48', 0, 29, 'workflowCreate', 'workflowCreate', 0, 'view/workflow/workflowCreate/workflowCreate', '创建工作流', '', '创建工作流', '1');
|
||||
INSERT INTO `sys_base_menus` VALUES (31, '2019-12-17 10:08:02', '2019-12-17 10:08:58', '2019-12-17 10:09:27', 0, 0, 'testtest', 'testtest', 0, 'view/test/index.vue', '测试menu', '', '测试menu', '8');
|
||||
INSERT INTO `sys_base_menus` VALUES (32, '2020-01-13 14:03:21', '2020-01-13 14:05:19', '2020-03-29 21:31:23', 0, 3, 'system', 'system', 0, 'view/superAdmin/system/system.vue', '配置管理', 'setting', '配置管理', '5');
|
||||
INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', '6');
|
||||
INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', '7');
|
||||
INSERT INTO `sys_base_menus` VALUES (35, '2020-03-22 17:13:38', '2020-03-22 17:13:38', '2020-03-22 17:13:49', 0, 0, 'autoCode', 'autoCode', 0, 'view/superAdmin/autoCode/index.vue', '代码构建工具', 's-platform', '代码构建工具', '6');
|
||||
INSERT INTO `sys_base_menus` VALUES (36, '2020-03-22 17:14:24', '2020-03-22 17:15:23', '2020-03-29 21:31:18', 0, 3, 'autoCode', 'autoCode', 0, 'view/superAdmin/autoCode/index.vue', '自动化代码', 'cpu', '自动化代码', '6');
|
||||
INSERT INTO `sys_base_menus` VALUES (37, '2020-03-28 23:43:39', '2020-03-28 23:43:39', '2020-03-29 21:31:15', 0, 3, 'formCreate', 'formCreate', 0, 'view/superAdmin/formCreate/index.vue', '表单生成器', 'setting', '表单生成器', '8');
|
||||
INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', '5');
|
||||
INSERT INTO `sys_base_menus` VALUES (39, '2020-03-29 21:34:06', '2020-03-30 13:56:24', '2020-03-30 15:58:32', 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-order', '系统配置', '0');
|
||||
INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', '1');
|
||||
INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', '2');
|
||||
INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', '3');
|
||||
@@ -0,0 +1,8 @@
|
||||
INSERT INTO `sys_data_authority_id` VALUES (2, 2);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (2, 6);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (2, 8);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (6, 2);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (6, 6);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (8, 2);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (8, 6);
|
||||
INSERT INTO `sys_data_authority_id` VALUES (8, 8);
|
||||
@@ -0,0 +1,53 @@
|
||||
INSERT INTO `sys_menus` VALUES (231, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 999, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
|
||||
INSERT INTO `sys_menus` VALUES (232, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 999, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
|
||||
INSERT INTO `sys_menus` VALUES (451, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 8881, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
|
||||
INSERT INTO `sys_menus` VALUES (452, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 8881, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
|
||||
INSERT INTO `sys_menus` VALUES (453, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 8881, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
|
||||
INSERT INTO `sys_menus` VALUES (454, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 8881, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
|
||||
INSERT INTO `sys_menus` VALUES (455, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 8881, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
|
||||
INSERT INTO `sys_menus` VALUES (456, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 8881, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
|
||||
INSERT INTO `sys_menus` VALUES (458, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 8881, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
|
||||
INSERT INTO `sys_menus` VALUES (459, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 8881, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
|
||||
INSERT INTO `sys_menus` VALUES (460, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 8881, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
|
||||
INSERT INTO `sys_menus` VALUES (461, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 8881, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
|
||||
INSERT INTO `sys_menus` VALUES (462, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 8881, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
|
||||
INSERT INTO `sys_menus` VALUES (463, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 8881, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
|
||||
INSERT INTO `sys_menus` VALUES (464, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 8881, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
|
||||
INSERT INTO `sys_menus` VALUES (465, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 8881, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
|
||||
INSERT INTO `sys_menus` VALUES (466, '2020-02-24 19:48:37', '2020-03-27 20:05:39', NULL, 0, 8881, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
|
||||
INSERT INTO `sys_menus` VALUES (503, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 9528, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
|
||||
INSERT INTO `sys_menus` VALUES (504, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 9528, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
|
||||
INSERT INTO `sys_menus` VALUES (505, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 9528, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
|
||||
INSERT INTO `sys_menus` VALUES (506, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 9528, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
|
||||
INSERT INTO `sys_menus` VALUES (507, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 9528, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
|
||||
INSERT INTO `sys_menus` VALUES (508, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 9528, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
|
||||
INSERT INTO `sys_menus` VALUES (509, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 9528, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
|
||||
INSERT INTO `sys_menus` VALUES (512, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 9528, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
|
||||
INSERT INTO `sys_menus` VALUES (513, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 9528, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
|
||||
INSERT INTO `sys_menus` VALUES (514, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 9528, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
|
||||
INSERT INTO `sys_menus` VALUES (515, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 9528, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
|
||||
INSERT INTO `sys_menus` VALUES (516, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 9528, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
|
||||
INSERT INTO `sys_menus` VALUES (517, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 9528, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
|
||||
INSERT INTO `sys_menus` VALUES (518, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 9528, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
|
||||
INSERT INTO `sys_menus` VALUES (519, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 9528, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
|
||||
INSERT INTO `sys_menus` VALUES (520, '2020-02-24 19:48:37', '2020-03-27 20:05:38', NULL, 0, 9528, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
|
||||
INSERT INTO `sys_menus` VALUES (560, '2019-09-19 22:05:18', '2020-04-02 22:33:49', NULL, 0, 888, 'dashbord', 'dashbord', 0, 'view/dashbord/index.vue', '仪表盘', 'setting', 0, '1', '仪表盘', '1');
|
||||
INSERT INTO `sys_menus` VALUES (561, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 888, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', 0, '2', '测试菜单', '2');
|
||||
INSERT INTO `sys_menus` VALUES (562, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 888, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', 0, '3', '超级管理员', '3');
|
||||
INSERT INTO `sys_menus` VALUES (563, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 888, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', 3, '4', '角色管理', '1');
|
||||
INSERT INTO `sys_menus` VALUES (564, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 888, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', 3, '5', '菜单管理', '2');
|
||||
INSERT INTO `sys_menus` VALUES (565, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 888, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 3, '6', 'api管理', '3');
|
||||
INSERT INTO `sys_menus` VALUES (566, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 888, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', 3, '17', '用户管理', '4');
|
||||
INSERT INTO `sys_menus` VALUES (567, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 888, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', 0, '18', '个人信息', '4');
|
||||
INSERT INTO `sys_menus` VALUES (568, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 888, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', 0, '38', '系统工具', '5');
|
||||
INSERT INTO `sys_menus` VALUES (569, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 888, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', 38, '40', '代码生成器', '1');
|
||||
INSERT INTO `sys_menus` VALUES (570, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 888, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', 38, '41', '表单生成器', '2');
|
||||
INSERT INTO `sys_menus` VALUES (571, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 888, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', 38, '42', '系统配置', '3');
|
||||
INSERT INTO `sys_menus` VALUES (572, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 888, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', 0, '19', '示例文件', '6');
|
||||
INSERT INTO `sys_menus` VALUES (573, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 888, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', 19, '20', '表格示例', '1');
|
||||
INSERT INTO `sys_menus` VALUES (574, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 888, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', 19, '21', '表单示例', '2');
|
||||
INSERT INTO `sys_menus` VALUES (575, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 888, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', 19, '22', '富文本编辑器', '3');
|
||||
INSERT INTO `sys_menus` VALUES (576, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 888, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 19, '23', 'excel导入导出', '4');
|
||||
INSERT INTO `sys_menus` VALUES (577, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 888, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', 19, '26', '上传下载', '5');
|
||||
INSERT INTO `sys_menus` VALUES (578, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 888, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', 19, '33', '断点续传', '6');
|
||||
INSERT INTO `sys_menus` VALUES (579, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 888, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', 19, '34', '客户列表(资源示例)', '7');
|
||||
@@ -0,0 +1,2 @@
|
||||
INSERT INTO `sys_users` VALUES (10, '2019-09-13 17:23:46', '2019-10-21 11:16:03', NULL, 0x63653064363638352D633135662D343132362D613562342D383930626339643233353664, NULL, NULL, '超级管理员', 'http://qmplusimg.henrongyi.top/1571627762timg.jpg', 888, NULL, 'admin', 'e10adc3949ba59abbe56e057f20f883e', NULL, NULL);
|
||||
INSERT INTO `sys_users` VALUES (11, '2019-09-13 17:27:29', '2019-09-13 17:27:29', NULL, 0x66643665663739622D393434632D343838382D383337372D616265326432363038383538, NULL, NULL, 'QMPlusUser', 'http://qmplusimg.henrongyi.top/1572075907logo.png', 9528, NULL, 'a303176530', '3ec063004a6f31642261936a379fde3d', NULL, NULL);
|
||||
@@ -0,0 +1 @@
|
||||
INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20:21', NULL, '测试改版1', 'test', '123123');
|
||||
+2184
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,16 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"gin-vue-admin/init"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
var (
|
||||
GVA_DB *gorm.DB
|
||||
GVA_REDIS *redis.Client
|
||||
GVA_LOG init.Logger
|
||||
GVA_CONFIG init.Config
|
||||
GVA_VP *viper.Viper
|
||||
)
|
||||
@@ -0,0 +1,26 @@
|
||||
package response
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type response struct {
|
||||
code int
|
||||
data interface{}
|
||||
msg string
|
||||
}
|
||||
|
||||
const (
|
||||
ERROR = 7
|
||||
SUCCESS = 0
|
||||
)
|
||||
|
||||
func Result(code int, data interface{}, msg string, c *gin.Context) {
|
||||
// 开始时间
|
||||
c.JSON(http.StatusOK, response{
|
||||
code,
|
||||
data,
|
||||
msg,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
module gin-vue-admin
|
||||
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
|
||||
github.com/casbin/casbin v1.9.1
|
||||
github.com/casbin/gorm-adapter v1.0.0
|
||||
github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.9
|
||||
github.com/gin-gonic/gin v1.6.1
|
||||
github.com/go-openapi/spec v0.19.7 // indirect
|
||||
github.com/go-openapi/swag v0.19.8 // indirect
|
||||
github.com/go-redis/redis v6.15.7+incompatible
|
||||
github.com/go-sql-driver/mysql v1.5.0 // indirect
|
||||
github.com/golang/protobuf v1.3.5 // indirect
|
||||
github.com/jehiah/go-strftime v0.0.0-20171201141054-1d33003b3869 // indirect
|
||||
github.com/jinzhu/gorm v1.9.12
|
||||
github.com/lestrrat/go-envload v0.0.0-20180220120943-6ed08b54a570 // indirect
|
||||
github.com/lestrrat/go-file-rotatelogs v0.0.0-20180223000712-d3151e2a480f
|
||||
github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042 // indirect
|
||||
github.com/lib/pq v1.3.0 // indirect
|
||||
github.com/mailru/easyjson v0.7.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.2.2 // indirect
|
||||
github.com/onsi/ginkgo v1.7.0 // indirect
|
||||
github.com/onsi/gomega v1.4.3 // indirect
|
||||
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
|
||||
github.com/pelletier/go-toml v1.6.0 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/qiniu/api.v7 v7.2.5+incompatible
|
||||
github.com/qiniu/x v7.0.8+incompatible // indirect
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/spf13/afero v1.2.2 // indirect
|
||||
github.com/spf13/cast v1.3.1 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.6.2
|
||||
github.com/swaggo/gin-swagger v1.2.0
|
||||
github.com/swaggo/swag v1.6.5
|
||||
github.com/tebeka/strftime v0.1.3 // indirect
|
||||
github.com/unrolled/secure v1.0.7
|
||||
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 // indirect
|
||||
golang.org/x/net v0.0.0-20200320220750-118fecf932d8 // indirect
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect
|
||||
golang.org/x/tools v0.0.0-20200324003944-a576cf524670 // indirect
|
||||
gopkg.in/ini.v1 v1.55.0 // indirect
|
||||
qiniupkg.com/x v7.0.8+incompatible // indirect
|
||||
)
|
||||
@@ -0,0 +1,103 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
MysqlAdmin MysqlAdmin `json:"mysqlAdmin"`
|
||||
Qiniu Qiniu `json:"qiniu"`
|
||||
CasbinConfig CasbinConfig `json:"casbinConfig"`
|
||||
RedisAdmin RedisAdmin `json:"redisAdmin"`
|
||||
System System `json:"system"`
|
||||
JWT JWT `json:"jwt"`
|
||||
Captcha Captcha `json:"captcha"`
|
||||
Log Log `json:"log"`
|
||||
}
|
||||
|
||||
type System struct { // 系统配置
|
||||
UseMultipoint bool `json:"useMultipoint"`
|
||||
Env string `json:"env"`
|
||||
Addr int `json:"addr"`
|
||||
}
|
||||
|
||||
type JWT struct { // jwt签名
|
||||
SigningKey string `json:"signingKey"`
|
||||
}
|
||||
|
||||
type CasbinConfig struct { //casbin配置
|
||||
ModelPath string `json:"modelPath"` // casbin model地址配置
|
||||
}
|
||||
|
||||
type MysqlAdmin struct { // mysql admin 数据库配置
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Path string `json:"path"`
|
||||
Dbname string `json:"dbname"`
|
||||
Config string `json:"config"`
|
||||
MaxIdleConns int `json:"maxIdleConns"`
|
||||
MaxOpenConns int `json:"maxOpenConns"`
|
||||
LogMode bool `json:"maxOpenConns"`
|
||||
}
|
||||
|
||||
type RedisAdmin struct { // Redis admin 数据库配置
|
||||
Addr string `json:"addr"`
|
||||
Password string `json:"password"`
|
||||
DB int `json:"db"`
|
||||
}
|
||||
type Qiniu struct { // 七牛 密钥配置
|
||||
AccessKey string `json:"accessKey"`
|
||||
SecretKey string `json:"secretKey"`
|
||||
}
|
||||
|
||||
type Captcha struct { // 验证码配置
|
||||
KeyLong int `json:"keyLong"`
|
||||
ImgWidth int `json:"imgWidth"`
|
||||
ImgHeight int `json:"imgHeight"`
|
||||
}
|
||||
|
||||
/**
|
||||
Log Config
|
||||
|
||||
"CRITICAL"
|
||||
"ERROR"
|
||||
"WARNING"
|
||||
"NOTICE"
|
||||
"INFO"
|
||||
"DEBUG"
|
||||
*/
|
||||
type Log struct {
|
||||
// log 打印的前缀
|
||||
Prefix string `json:"prefix"`
|
||||
// 是否显示打印log的文件具体路径
|
||||
LogFile bool `json:"logFile"`
|
||||
// 在控制台打印log的级别, []默认不打印
|
||||
Stdout []string `json:"stdout"`
|
||||
// 在文件中打印log的级别 []默认不打印
|
||||
File []string `json:"file"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
v := viper.New()
|
||||
v.SetConfigName("config") // 设置配置文件名 (不带后缀)
|
||||
v.AddConfigPath("/") // 第一个搜索路径
|
||||
v.SetConfigType("json")
|
||||
err := v.ReadInConfig() // 搜索路径,并读取配置数据
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("Fatal error config file: %s \n", err))
|
||||
}
|
||||
v.WatchConfig()
|
||||
v.OnConfigChange(func(e fsnotify.Event) {
|
||||
fmt.Println("config file changed:", e.Name)
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
})
|
||||
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
global.GVA_VP = v
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package init
|
||||
|
||||
// Custom Logger
|
||||
type Logger interface {
|
||||
Debug(v ...interface{})
|
||||
Info(v ...interface{})
|
||||
Warning(v ...interface{})
|
||||
Error(v ...interface{})
|
||||
Critical(v ...interface{})
|
||||
Fatal(v ...interface{})
|
||||
}
|
||||
|
||||
var L Logger
|
||||
|
||||
func SetLogger(logger Logger) {
|
||||
L = logger
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
_ "github.com/jinzhu/gorm/dialects/mysql"
|
||||
)
|
||||
|
||||
//初始化数据库并产生数据库全局变量
|
||||
func RegisterMysql(admin MysqlAdmin) {
|
||||
if db, err := gorm.Open("mysql", admin.Username+":"+admin.Password+"@("+admin.Path+")/"+admin.Dbname+"?"+admin.Config); err != nil {
|
||||
L.Error("DEFAULTDB数据库启动异常", err)
|
||||
} else {
|
||||
global.GVA_DB = db
|
||||
global.GVA_DB.DB().SetMaxIdleConns(admin.MaxIdleConns)
|
||||
global.GVA_DB.DB().SetMaxOpenConns(admin.MaxOpenConns)
|
||||
global.GVA_DB.LogMode(admin.LogMode)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package qmlog
|
||||
|
||||
// Register logger
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gin-vue-admin/init"
|
||||
"gin-vue-admin/utils"
|
||||
rotatelogs "github.com/lestrrat/go-file-rotatelogs"
|
||||
oplogging "github.com/op/go-logging"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
logDir = "log"
|
||||
logSoftLink = "api.log"
|
||||
module = "gin-vue-admin"
|
||||
)
|
||||
|
||||
var (
|
||||
configNotFound = errors.New("logger prefix not found")
|
||||
|
||||
defaultFormatter = `%{time:2006/01/02 - 15:04:05.000} %{longfile} %{color:bold}▶ [%{level:.6s}] %{message}%{color:reset}`
|
||||
)
|
||||
|
||||
type Logger struct {
|
||||
logger *oplogging.Logger
|
||||
}
|
||||
|
||||
func NewLogger() error {
|
||||
c := init.GinVueAdminconfig.Log
|
||||
if c.Prefix == "" {
|
||||
return configNotFound
|
||||
}
|
||||
logger := oplogging.MustGetLogger(module)
|
||||
var backends []oplogging.Backend
|
||||
backends = registerStdout(c, backends)
|
||||
backends = registerFile(c, backends)
|
||||
|
||||
oplogging.SetBackend(backends...)
|
||||
init.SetLogger(logger)
|
||||
return nil
|
||||
}
|
||||
|
||||
func registerStdout(c init.Log, backends []oplogging.Backend) []oplogging.Backend {
|
||||
for _, v := range c.Stdout {
|
||||
level, err := oplogging.LogLevel(v)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
backends = append(backends, createBackend(os.Stdout, c, level))
|
||||
}
|
||||
|
||||
return backends
|
||||
}
|
||||
|
||||
func registerFile(c init.Log, backends []oplogging.Backend) []oplogging.Backend {
|
||||
if len(c.File) > 0 {
|
||||
if ok, _ := utils.PathExists(logDir); !ok {
|
||||
// directory not exist
|
||||
fmt.Println("create log directory")
|
||||
_ = os.Mkdir(logDir, os.ModePerm)
|
||||
}
|
||||
apiLogPath := logDir + string(os.PathSeparator) + logSoftLink
|
||||
fileWriter, err := rotatelogs.New(
|
||||
apiLogPath+".%Y-%m-%d-%H-%M.log",
|
||||
// generate soft link, point to latest log file
|
||||
rotatelogs.WithLinkName(apiLogPath),
|
||||
// maximum time to save log files
|
||||
rotatelogs.WithMaxAge(7*24*time.Hour),
|
||||
// time period of log file switching
|
||||
rotatelogs.WithRotationTime(24*time.Hour),
|
||||
)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return backends
|
||||
}
|
||||
for _, v := range c.File {
|
||||
level, err := oplogging.LogLevel(v)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
continue
|
||||
}
|
||||
backends = append(backends, createBackend(fileWriter, c, level))
|
||||
}
|
||||
}
|
||||
|
||||
return backends
|
||||
}
|
||||
|
||||
func createBackend(w io.Writer, c init.Log, level oplogging.Level) oplogging.Backend {
|
||||
backend := oplogging.NewLogBackend(w, c.Prefix, 0)
|
||||
stdoutWriter := false
|
||||
if w == os.Stdout {
|
||||
stdoutWriter = true
|
||||
}
|
||||
format := getLogFormatter(c, stdoutWriter)
|
||||
backendLeveled := oplogging.AddModuleLevel(oplogging.NewBackendFormatter(backend, format))
|
||||
backendLeveled.SetLevel(level, module)
|
||||
return backendLeveled
|
||||
}
|
||||
|
||||
func getLogFormatter(c init.Log, stdoutWriter bool) oplogging.Formatter {
|
||||
pattern := defaultFormatter
|
||||
if !stdoutWriter {
|
||||
// Color is only required for console output
|
||||
// Other writers don't need %{color} tag
|
||||
pattern = strings.Replace(pattern, "%{color:bold}", "", -1)
|
||||
pattern = strings.Replace(pattern, "%{color:reset}", "", -1)
|
||||
}
|
||||
if !c.LogFile {
|
||||
// Remove %{logfile} tag
|
||||
pattern = strings.Replace(pattern, "%{longfile}", "", -1)
|
||||
}
|
||||
return oplogging.MustStringFormatter(pattern)
|
||||
}
|
||||
|
||||
func (l Logger) Debug(v ...interface{}) {
|
||||
l.logger.Debug(v)
|
||||
}
|
||||
|
||||
func (l Logger) Info(v ...interface{}) {
|
||||
l.logger.Info(v)
|
||||
}
|
||||
|
||||
func (l Logger) Warning(v ...interface{}) {
|
||||
l.logger.Warning(v)
|
||||
}
|
||||
|
||||
func (l Logger) Error(v ...interface{}) {
|
||||
l.logger.Error(v)
|
||||
}
|
||||
|
||||
func (l Logger) Critical(v ...interface{}) {
|
||||
l.logger.Critical(v)
|
||||
}
|
||||
|
||||
func (l Logger) Fatal(v ...interface{}) {
|
||||
l.logger.Fatal(v)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/go-redis/redis"
|
||||
)
|
||||
|
||||
func RegisterRedis() {
|
||||
client := redis.NewClient(&redis.Options{
|
||||
Addr: GinVueAdminconfig.RedisAdmin.Addr,
|
||||
Password: GinVueAdminconfig.RedisAdmin.Password, // no password set
|
||||
DB: GinVueAdminconfig.RedisAdmin.DB, // use default DB
|
||||
})
|
||||
pong, err := client.Ping().Result()
|
||||
if err != nil {
|
||||
L.Error(err)
|
||||
} else {
|
||||
L.Info("redis connect ping response:", pong)
|
||||
global.GVA_REDIS = client
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
"gin-vue-admin/model"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
//注册数据库表专用
|
||||
func RegisterTable(db *gorm.DB) {
|
||||
db.AutoMigrate(model.SysUser{},
|
||||
model.SysAuthority{},
|
||||
model.SysMenu{},
|
||||
model.SysApi{},
|
||||
model.SysBaseMenu{},
|
||||
model.JwtBlacklist{},
|
||||
model.SysWorkflow{},
|
||||
model.SysWorkflowStepInfo{},
|
||||
model.ExaFileUploadAndDownload{},
|
||||
model.ExaFile{},
|
||||
model.ExaFileChunk{},
|
||||
model.ExaCustomer{},
|
||||
)
|
||||
L.Debug("register table success")
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package init
|
||||
|
||||
import (
|
||||
_ "gin-vue-admin/docs"
|
||||
"gin-vue-admin/middleware"
|
||||
"gin-vue-admin/router"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/swaggo/gin-swagger"
|
||||
"github.com/swaggo/gin-swagger/swaggerFiles"
|
||||
)
|
||||
|
||||
//初始化总路由
|
||||
func RegisterRouter() *gin.Engine {
|
||||
var Router = gin.Default()
|
||||
|
||||
//Router.Use(middleware.LoadTls()) // 打开就能玩https了
|
||||
// 如果不需要日志 请关闭这里
|
||||
Router.Use(middleware.Logger())
|
||||
L.Debug("use middleware logger")
|
||||
// 跨域
|
||||
Router.Use(middleware.Cors())
|
||||
L.Debug("use middleware cors")
|
||||
Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
|
||||
L.Debug("register swagger handler")
|
||||
// 方便统一添加路由组前缀 多服务器上线使用
|
||||
ApiGroup := Router.Group("")
|
||||
router.InitUserRouter(ApiGroup) // 注册用户路由
|
||||
router.InitBaseRouter(ApiGroup) // 注册基础功能路由 不做鉴权
|
||||
router.InitMenuRouter(ApiGroup) // 注册menu路由
|
||||
router.InitAuthorityRouter(ApiGroup) // 注册角色路由
|
||||
router.InitApiRouter(ApiGroup) // 注册功能api路由
|
||||
router.InitFileUploadAndDownloadRouter(ApiGroup) // 文件上传下载功能路由
|
||||
router.InitWorkflowRouter(ApiGroup) // 工作流相关路由
|
||||
router.InitCasbinRouter(ApiGroup) // 权限相关路由
|
||||
router.InitJwtRouter(ApiGroup) // jwt相关路由
|
||||
router.InitSystemRouter(ApiGroup) // system相关路由
|
||||
router.InitCustomerRouter(ApiGroup) // 客户路由
|
||||
router.InitAutoCodeRouter(ApiGroup) // 创建自动化代码
|
||||
L.Info("router register success")
|
||||
return Router
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"gin-vue-admin/core"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/init"
|
||||
"gin-vue-admin/init/qmlog"
|
||||
"os"
|
||||
//"runtime"
|
||||
)
|
||||
|
||||
// @title Swagger Example API
|
||||
// @version 0.0.1
|
||||
// @description This is a sample Server pets
|
||||
// @securityDefinitions.apikey ApiKeyAuth
|
||||
// @in header
|
||||
// @name x-token
|
||||
// @BasePath /
|
||||
|
||||
var (
|
||||
mysqlHost = os.Getenv("MYSQLHOST")
|
||||
mysqlPort = os.Getenv("MYSQLPORT")
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := qmlog.NewLogger(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// 可以通过环境变量来覆盖配置值
|
||||
// 未设定有效的环境变量时,使用配置值
|
||||
mysqlConfig := init.GinVueAdminconfig.MysqlAdmin
|
||||
// 链接初始化数据库
|
||||
init.RegisterMysql(mysqlConfig) // 链接初始化数据库
|
||||
|
||||
// 注册数据库表
|
||||
init.RegisterTable(global.GVA_DB)
|
||||
// 程序结束前关闭数据库链接
|
||||
defer global.GVA_DB.Close()
|
||||
|
||||
core.RunWindowsServer()
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//拦截器
|
||||
func CasbinHandler() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
claims, _ := c.Get("claims")
|
||||
waitUse := claims.(*CustomClaims)
|
||||
//获取请求的URI
|
||||
obj := c.Request.URL.RequestURI()
|
||||
//获取请求方法
|
||||
act := c.Request.Method
|
||||
//获取用户的角色
|
||||
sub := waitUse.AuthorityId
|
||||
e := model.Casbin()
|
||||
//判断策略中是否存在
|
||||
if e.Enforce(sub, obj, act) {
|
||||
c.Next()
|
||||
} else {
|
||||
response.Result(response.ERROR, gin.H{}, "权限不足", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// 处理跨域请求,支持options访问
|
||||
func Cors() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
method := c.Request.Method
|
||||
c.Header("Access-Control-Allow-Origin", "*")
|
||||
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token")
|
||||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS")
|
||||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")
|
||||
c.Header("Access-Control-Allow-Credentials", "true")
|
||||
|
||||
//放行所有OPTIONS方法
|
||||
if method == "OPTIONS" {
|
||||
c.AbortWithStatus(http.StatusNoContent)
|
||||
}
|
||||
// 处理请求
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/global/response"
|
||||
"gin-vue-admin/model"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"time"
|
||||
)
|
||||
|
||||
func JWTAuth() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localSstorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
|
||||
token := c.Request.Header.Get("x-token")
|
||||
ModelToken := model.JwtBlacklist{
|
||||
Jwt: token,
|
||||
}
|
||||
if token == "" {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "未登录或非法访问", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
if ModelToken.IsBlacklist(token) {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "您的帐户异地登陆或令牌失效", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
j := NewJWT()
|
||||
// parseToken 解析token包含的信息
|
||||
claims, err := j.ParseToken(token)
|
||||
if err != nil {
|
||||
if err == TokenExpired {
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, "授权已过期", c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
response.Result(response.ERROR, gin.H{
|
||||
"reload": true,
|
||||
}, err.Error(), c)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
c.Set("claims", claims)
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
type JWT struct {
|
||||
SigningKey []byte
|
||||
}
|
||||
|
||||
var (
|
||||
TokenExpired error = errors.New("Token is expired")
|
||||
TokenNotValidYet error = errors.New("Token not active yet")
|
||||
TokenMalformed error = errors.New("That's not even a token")
|
||||
TokenInvalid error = errors.New("Couldn't handle this token:")
|
||||
)
|
||||
|
||||
type CustomClaims struct {
|
||||
UUID uuid.UUID
|
||||
ID uint
|
||||
NickName string
|
||||
AuthorityId string
|
||||
jwt.StandardClaims
|
||||
}
|
||||
|
||||
func NewJWT() *JWT {
|
||||
return &JWT{
|
||||
[]byte(global.GVA_CONFIG.JWT.SigningKey),
|
||||
}
|
||||
}
|
||||
|
||||
//创建一个token
|
||||
func (j *JWT) CreateToken(claims CustomClaims) (string, error) {
|
||||
token := jwt.NewWithClaims(jwt.SigningMethodHS256, claims)
|
||||
return token.SignedString(j.SigningKey)
|
||||
}
|
||||
|
||||
//解析 token
|
||||
func (j *JWT) ParseToken(tokenString string) (*CustomClaims, error) {
|
||||
token, err := jwt.ParseWithClaims(tokenString, &CustomClaims{}, func(token *jwt.Token) (i interface{}, e error) {
|
||||
return j.SigningKey, nil
|
||||
})
|
||||
if err != nil {
|
||||
if ve, ok := err.(*jwt.ValidationError); ok {
|
||||
if ve.Errors&jwt.ValidationErrorMalformed != 0 {
|
||||
return nil, TokenMalformed
|
||||
} else if ve.Errors&jwt.ValidationErrorExpired != 0 {
|
||||
// Token is expired
|
||||
return nil, TokenExpired
|
||||
} else if ve.Errors&jwt.ValidationErrorNotValidYet != 0 {
|
||||
return nil, TokenNotValidYet
|
||||
} else {
|
||||
return nil, TokenInvalid
|
||||
}
|
||||
}
|
||||
}
|
||||
if token != nil {
|
||||
if claims, ok := token.Claims.(*CustomClaims); ok && token.Valid {
|
||||
return claims, nil
|
||||
}
|
||||
return nil, TokenInvalid
|
||||
|
||||
} else {
|
||||
return nil, TokenInvalid
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 更新token
|
||||
func (j *JWT) RefreshToken(tokenString string) (string, error) {
|
||||
jwt.TimeFunc = func() time.Time {
|
||||
return time.Unix(0, 0)
|
||||
}
|
||||
token, err := jwt.ParseWithClaims(tokenString, &CustomClaims{}, func(token *jwt.Token) (interface{}, error) {
|
||||
return j.SigningKey, nil
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if claims, ok := token.Claims.(*CustomClaims); ok && token.Valid {
|
||||
jwt.TimeFunc = time.Now
|
||||
claims.StandardClaims.ExpiresAt = time.Now().Add(1 * time.Hour).Unix()
|
||||
return j.CreateToken(*claims)
|
||||
}
|
||||
return "", TokenInvalid
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/unrolled/secure"
|
||||
)
|
||||
|
||||
// 用https把这个中间件在router里面use一下就好
|
||||
|
||||
func LoadTls() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
middleware := secure.New(secure.Options{
|
||||
SSLRedirect: true,
|
||||
SSLHost: "localhost:443",
|
||||
})
|
||||
err := middleware.Process(c.Writer, c.Request)
|
||||
if err != nil {
|
||||
//如果出现错误,请不要继续。
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
// 继续往下处理
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"gin-vue-admin/init"
|
||||
"net/http/httputil"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Logger() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// request time
|
||||
start := time.Now()
|
||||
// request path
|
||||
path := c.Request.URL.Path
|
||||
logFlag := true
|
||||
if strings.Contains(path, "swagger") {
|
||||
logFlag = false
|
||||
}
|
||||
// request ip
|
||||
clientIP := c.ClientIP()
|
||||
// method
|
||||
method := c.Request.Method
|
||||
// copy request content
|
||||
req, _ := httputil.DumpRequest(c.Request, true)
|
||||
if logFlag {
|
||||
init.L.Debug(
|
||||
"Request:", method, clientIP, path, string(req))
|
||||
}
|
||||
// replace writer
|
||||
cusWriter := &responseBodyWriter{
|
||||
ResponseWriter: c.Writer,
|
||||
body: bytes.NewBufferString(""),
|
||||
}
|
||||
c.Writer = cusWriter
|
||||
// handle request
|
||||
c.Next()
|
||||
// ending time
|
||||
end := time.Now()
|
||||
//execute time
|
||||
latency := end.Sub(start)
|
||||
statusCode := c.Writer.Status()
|
||||
if logFlag {
|
||||
init.L.Debug(
|
||||
"Response:",
|
||||
statusCode,
|
||||
latency,
|
||||
cusWriter.body.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type responseBodyWriter struct {
|
||||
gin.ResponseWriter
|
||||
body *bytes.Buffer
|
||||
}
|
||||
|
||||
func (w responseBodyWriter) Write(b []byte) (int, error) {
|
||||
w.body.Write(b)
|
||||
return w.ResponseWriter.Write(b)
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
//文件结构体
|
||||
type ExaFile struct {
|
||||
gorm.Model
|
||||
FileName string
|
||||
FileMd5 string
|
||||
FilePath string
|
||||
ExaFileChunk []ExaFileChunk
|
||||
ChunkTotal int
|
||||
IsFinish bool
|
||||
}
|
||||
|
||||
//切片结构体
|
||||
type ExaFileChunk struct {
|
||||
gorm.Model
|
||||
ExaFileId uint
|
||||
FileChunkNumber int
|
||||
FileChunkPath string
|
||||
}
|
||||
|
||||
//文件合成完成
|
||||
func (f *ExaFile) FileCreateComplete(FileMd5 string, FileName string, FilePath string) error {
|
||||
var file ExaFile
|
||||
upDateFile := make(map[string]interface{})
|
||||
upDateFile["FilePath"] = FilePath
|
||||
upDateFile["IsFinish"] = true
|
||||
err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", FileMd5, FileName).First(&file).Updates(upDateFile).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//第一次上传或者断点续传时候检测当前文件属性,没有则创建,有则返回文件的当前切片
|
||||
func (f *ExaFile) FindOrCreateFile(FileMd5 string, FileName string, ChunkTotal int) (err error, file ExaFile) {
|
||||
var cfile ExaFile
|
||||
cfile.FileMd5 = FileMd5
|
||||
cfile.FileName = FileName
|
||||
cfile.ChunkTotal = ChunkTotal
|
||||
notHaveSameMd5Finish := global.GVA_DB.Where("file_md5 = ? AND is_finish = ?", FileMd5, true).First(&file).RecordNotFound()
|
||||
if notHaveSameMd5Finish {
|
||||
err = global.GVA_DB.Where("file_md5 = ? AND file_name = ?", FileMd5, FileName).Preload("ExaFileChunk").FirstOrCreate(&file, cfile).Error
|
||||
return err, file
|
||||
} else {
|
||||
cfile.IsFinish = true
|
||||
cfile.FilePath = file.FilePath
|
||||
err = global.GVA_DB.Create(&cfile).Error
|
||||
return err, cfile
|
||||
}
|
||||
}
|
||||
|
||||
// 创建文件切片记录
|
||||
func (f *ExaFile) CreateFileChunk(FileChunkPath string, FileChunkNumber int) error {
|
||||
var chunk ExaFileChunk
|
||||
chunk.FileChunkPath = FileChunkPath
|
||||
chunk.ExaFileId = f.ID
|
||||
chunk.FileChunkNumber = FileChunkNumber
|
||||
err := global.GVA_DB.Create(&chunk).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// 删除文件切片记录
|
||||
func (f *ExaFile) DeleteFileChunk(fileMd5 string, fileName string, filePath string) error {
|
||||
var chunks []ExaFileChunk
|
||||
var file ExaFile
|
||||
err := global.GVA_DB.Where("file_md5 = ? AND file_name = ?", fileMd5, fileName).First(&file).Update("IsFinish", true).Update("file_path", filePath).Error
|
||||
err = global.GVA_DB.Where("exa_file_id = ?", file.ID).Delete(&chunks).Unscoped().Error
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type ExaCustomer struct {
|
||||
gorm.Model
|
||||
CustomerName string `json:"customerName"`
|
||||
CustomerPhoneData string `json:"customerPhoneData"`
|
||||
SysUserID uint `json:"sysUserId"`
|
||||
SysUserAuthorityID string `json:"sysUserAuthorityID"`
|
||||
SysUser SysUser `json:"sysUser"`
|
||||
}
|
||||
|
||||
//创建用户
|
||||
func (e *ExaCustomer) CreateExaCustomer() (err error) {
|
||||
err = global.GVA_DB.Create(e).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//删除用户
|
||||
func (e *ExaCustomer) DeleteExaCustomer() (err error) {
|
||||
err = global.GVA_DB.Delete(e).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//更新用户
|
||||
func (e *ExaCustomer) UpdateExaCustomer() (err error) {
|
||||
err = global.GVA_DB.Save(e).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//获取用户信息
|
||||
func (e *ExaCustomer) GetExaCustomer() (err error, customer ExaCustomer) {
|
||||
err = global.GVA_DB.Where("id = ?", e.ID).First(&customer).Error
|
||||
return
|
||||
}
|
||||
|
||||
//获取用户列表
|
||||
// 分页获取数据
|
||||
func (e *ExaCustomer) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var a SysAuthority
|
||||
a.AuthorityId = e.SysUserAuthorityID
|
||||
err, auth := a.GetAuthorityInfo()
|
||||
var dataId []string
|
||||
for _, v := range auth.DataAuthorityId {
|
||||
dataId = append(dataId, v.AuthorityId)
|
||||
}
|
||||
var CustomerList []ExaCustomer
|
||||
err = db.Where("sys_user_authority_id in (?)", dataId).Find(&CustomerList).Count(&total).Error
|
||||
if err != nil {
|
||||
return err, CustomerList, total
|
||||
} else {
|
||||
err = db.Limit(limit).Offset(offset).Preload("SysUser").Where("sys_user_authority_id in (?)", dataId).Find(&CustomerList).Error
|
||||
}
|
||||
return err, CustomerList, total
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type ExaFileUploadAndDownload struct {
|
||||
gorm.Model
|
||||
Name string `json:"name"`
|
||||
Url string `json:"url"`
|
||||
Tag string `json:"tag"`
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
func (f *ExaFileUploadAndDownload) Upload() error {
|
||||
err := global.GVA_DB.Create(f).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *ExaFileUploadAndDownload) DeleteFile() error {
|
||||
err := global.GVA_DB.Where("id = ?", f.ID).Unscoped().Delete(f).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func (f *ExaFileUploadAndDownload) FindFile() (error, ExaFileUploadAndDownload) {
|
||||
var file ExaFileUploadAndDownload
|
||||
err := global.GVA_DB.Where("id = ?", f.ID).First(&file).Error
|
||||
return err, file
|
||||
}
|
||||
|
||||
// 分页获取数据
|
||||
func (f *ExaFileUploadAndDownload) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var fileLists []ExaFileUploadAndDownload
|
||||
err = db.Limit(limit).Offset(offset).Order("updated_at desc").Find(&fileLists).Error
|
||||
return err, fileLists, total
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type SysApi struct {
|
||||
gorm.Model
|
||||
Path string `json:"path"`
|
||||
Description string `json:"description"`
|
||||
ApiGroup string `json:"apiGroup"`
|
||||
Method string `json:"method" gorm:"default:'POST'"`
|
||||
}
|
||||
|
||||
//新增基础api
|
||||
func (a *SysApi) CreateApi() (err error) {
|
||||
findOne := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).Error
|
||||
if findOne == nil {
|
||||
return errors.New("存在相同api")
|
||||
} else {
|
||||
err = global.GVA_DB.Create(a).Error
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//删除基础api
|
||||
func (a *SysApi) DeleteApi() (err error) {
|
||||
err = global.GVA_DB.Delete(a).Error
|
||||
new(CasbinModel).clearCasbin(1, a.Path)
|
||||
return err
|
||||
}
|
||||
|
||||
//更新api
|
||||
func (a *SysApi) UpdateApi() (err error) {
|
||||
var oldA SysApi
|
||||
flag := global.GVA_DB.Where("path = ?", a.Path).Find(&SysApi{}).RecordNotFound()
|
||||
if !flag {
|
||||
return errors.New("存在相同api路径")
|
||||
}
|
||||
err = global.GVA_DB.Where("id = ?", a.ID).First(&oldA).Error
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
err = new(CasbinModel).CasbinApiUpdate(oldA.Path, a.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
} else {
|
||||
err = global.GVA_DB.Save(a).Error
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//获取选中角色所拥有的api
|
||||
func (a *SysApi) GetApiById(id float64) (err error, api SysApi) {
|
||||
err = global.GVA_DB.Where("id = ?", id).First(&api).Error
|
||||
return
|
||||
}
|
||||
|
||||
// 获取所有api信息
|
||||
func (a *SysApi) GetAllApis() (err error, apis []SysApi) {
|
||||
err = global.GVA_DB.Find(&apis).Error
|
||||
return
|
||||
}
|
||||
|
||||
// 分页获取数据
|
||||
func (a *SysApi) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var apiList []SysApi
|
||||
|
||||
if a.Path != "" {
|
||||
db = db.Where("path LIKE ?", "%"+a.Path+"%")
|
||||
}
|
||||
|
||||
if a.Description != "" {
|
||||
db = db.Where("description LIKE ?", "%"+a.Description+"%")
|
||||
}
|
||||
|
||||
if a.Method != "" {
|
||||
db = db.Where("method = ?", a.Method)
|
||||
}
|
||||
|
||||
err = db.Find(&apiList).Count(&total).Error
|
||||
|
||||
if err != nil {
|
||||
return err, apiList, total
|
||||
} else {
|
||||
err = db.Limit(limit).Offset(offset).Order("api_group", true).Find(&apiList).Error
|
||||
}
|
||||
return err, apiList, total
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/pkg/errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysAuthority struct {
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
DeletedAt *time.Time `sql:"index"`
|
||||
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key"`
|
||||
AuthorityName string `json:"authorityName"`
|
||||
ParentId string `json:"parentId"`
|
||||
DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;association_jointable_foreignkey:data_authority_id"`
|
||||
Children []SysAuthority `json:"children"`
|
||||
SysBaseMenus []SysBaseMenu `json:"menus" gorm:"many2many:sys_authority_menus;"`
|
||||
}
|
||||
|
||||
// 创建角色
|
||||
func (a *SysAuthority) CreateAuthority() (err error, authority *SysAuthority) {
|
||||
err = global.GVA_DB.Create(a).Error
|
||||
return err, a
|
||||
}
|
||||
|
||||
// 删除角色
|
||||
func (a *SysAuthority) DeleteAuthority() (err error) {
|
||||
err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error
|
||||
if err != nil {
|
||||
err = global.GVA_DB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error
|
||||
if err != nil {
|
||||
err = global.GVA_DB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error
|
||||
new(CasbinModel).clearCasbin(0, a.AuthorityId)
|
||||
} else {
|
||||
err = errors.New("此角色存在子角色不允许删除")
|
||||
}
|
||||
} else {
|
||||
err = errors.New("此角色有用户正在使用禁止删除")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// 分页获取数据
|
||||
func (a *SysAuthority) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var authority []SysAuthority
|
||||
err = db.Limit(limit).Offset(offset).Preload("DataAuthorityId").Where("parent_id = 0").Find(&authority).Error
|
||||
if len(authority) > 0 {
|
||||
for k, _ := range authority {
|
||||
err = findChildrenAuthority(&authority[k])
|
||||
}
|
||||
}
|
||||
return err, authority, total
|
||||
}
|
||||
}
|
||||
|
||||
func findChildrenAuthority(authority *SysAuthority) (err error) {
|
||||
err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error
|
||||
if len(authority.Children) > 0 {
|
||||
for k, _ := range authority.Children {
|
||||
err = findChildrenAuthority(&authority.Children[k])
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *SysAuthority) SetDataAuthority() error {
|
||||
var s SysAuthority
|
||||
global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", a.AuthorityId)
|
||||
err := global.GVA_DB.Model(&s).Association("DataAuthorityId").Replace(&a.DataAuthorityId).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *SysAuthority) SetMuneAuthority() error {
|
||||
var s SysAuthority
|
||||
global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", a.AuthorityId)
|
||||
err := global.GVA_DB.Model(&s).Association("SysBaseMenus").Replace(&a.SysBaseMenus).Error
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *SysAuthority) GetAuthorityInfo() (err error, sa SysAuthority) {
|
||||
err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error
|
||||
return err, sa
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
)
|
||||
|
||||
// menu需要构建的点有点多 这里关联关系表直接把所有数据拿过来 用代码实现关联 后期实现主外键模式
|
||||
type SysMenu struct {
|
||||
SysBaseMenu
|
||||
MenuId string `json:"menuId"`
|
||||
AuthorityId string `json:"-"`
|
||||
Children []SysMenu `json:"children"`
|
||||
}
|
||||
|
||||
// 为角色增加menu树
|
||||
func (m *SysMenu) AddMenuAuthority(menus []SysBaseMenu, authorityId string) (err error) {
|
||||
var menu SysMenu
|
||||
global.GVA_DB.Where("authority_id = ? ", authorityId).Unscoped().Delete(&SysMenu{})
|
||||
for _, v := range menus {
|
||||
menu.SysBaseMenu = v
|
||||
menu.AuthorityId = authorityId
|
||||
menu.MenuId = fmt.Sprintf("%v", v.ID)
|
||||
menu.ID = 0
|
||||
err = global.GVA_DB.Create(&menu).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
var auth SysAuthority
|
||||
auth.AuthorityId = authorityId
|
||||
auth.SysBaseMenus = menus
|
||||
auth.SetMuneAuthority()
|
||||
return nil
|
||||
}
|
||||
|
||||
// 查看当前角色树
|
||||
func (m *SysMenu) GetMenuAuthority(authorityId string) (err error, menus []SysMenu) {
|
||||
err = global.GVA_DB.Where("authority_id = ?", authorityId).Find(&menus).Error
|
||||
return err, menus
|
||||
}
|
||||
|
||||
//获取动态路由树
|
||||
func (m *SysMenu) GetMenuTree(authorityId string) (err error, menus []SysMenu) {
|
||||
err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", authorityId, 0).Order("sort", true).Find(&menus).Error
|
||||
for i := 0; i < len(menus); i++ {
|
||||
err = getChildrenList(&menus[i])
|
||||
}
|
||||
return err, menus
|
||||
}
|
||||
|
||||
func getChildrenList(menu *SysMenu) (err error) {
|
||||
err = global.GVA_DB.Where("authority_id = ? AND parent_id = ?", menu.AuthorityId, menu.MenuId).Order("sort", true).Find(&menu.Children).Error
|
||||
for i := 0; i < len(menu.Children); i++ {
|
||||
err = getChildrenList(&menu.Children[i])
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/utils"
|
||||
"html/template"
|
||||
"os"
|
||||
)
|
||||
|
||||
// 初始版本自动化代码工具
|
||||
type AutoCodeStruct struct {
|
||||
StructName string `json:"structName"`
|
||||
PackageName string `json:"packageName"`
|
||||
Abbreviation string `json:"abbreviation"`
|
||||
Fields []Field `json:"fields"`
|
||||
}
|
||||
|
||||
type Field struct {
|
||||
FieldName string `json:"fieldName"`
|
||||
FieldType string `json:"fieldType"`
|
||||
FieldJson string `json:"fieldJson"`
|
||||
ColumnName string `json:"columnName"`
|
||||
}
|
||||
|
||||
func (a *AutoCodeStruct) CreateTemp() (err error) {
|
||||
basePath := "./template"
|
||||
modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
apiTmpl, err := template.ParseFiles(basePath + "/te/api.go.tpl")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
routerTmpl, err := template.ParseFiles(basePath + "/te/router.go.tpl")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
feapiTmpl, err := template.ParseFiles(basePath + "/fe/api.js.tpl")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
readmeTmpl, err := template.ParseFiles(basePath + "/readme.txt.tpl")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//自动化总目录
|
||||
_autoCode := "./autoCode/"
|
||||
//自动化后台代码目录
|
||||
_te := "./autoCode/te/"
|
||||
_dir := _te + a.PackageName
|
||||
_modeldir := _te + a.PackageName + "/model"
|
||||
_apidir := _te + a.PackageName + "/api"
|
||||
_routerdir := _te + a.PackageName + "/router"
|
||||
//自动化前台代码目录
|
||||
_fe := "./autoCode/fe/"
|
||||
_fe_dir := _fe + a.PackageName
|
||||
_fe_apidir := _fe + a.PackageName + "/api"
|
||||
err = createDir(_autoCode, _te, _dir, _modeldir, _apidir, _routerdir, _fe, _fe_dir, _fe_apidir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
model, err := os.OpenFile(_te+a.PackageName+"/model/model.go", os.O_CREATE|os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
api, err := os.OpenFile(_te+a.PackageName+"/api/api.go", os.O_CREATE|os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
router, err := os.OpenFile(_te+a.PackageName+"/router/router.go", os.O_CREATE|os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
feapi, err := os.OpenFile(_fe+a.PackageName+"/api/api.js", os.O_CREATE|os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
readme, err := os.OpenFile(_autoCode+"readme.txt", os.O_CREATE|os.O_WRONLY, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// 生成代码
|
||||
{
|
||||
err = modelTmpl.Execute(model, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = apiTmpl.Execute(api, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = routerTmpl.Execute(router, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = feapiTmpl.Execute(feapi, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = readmeTmpl.Execute(readme, a)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
_ = model.Close()
|
||||
_ = api.Close()
|
||||
_ = router.Close()
|
||||
_ = feapi.Close()
|
||||
_ = readme.Close()
|
||||
fileList := []string{
|
||||
_te + a.PackageName + "/model/model.go",
|
||||
_te + a.PackageName + "/api/api.go",
|
||||
_te + a.PackageName + "/router/router.go",
|
||||
_fe + a.PackageName + "/api/api.js",
|
||||
_autoCode + "readme.txt",
|
||||
}
|
||||
err = utils.ZipFiles("./ginvueadmin.zip", fileList, ".", ".")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.RemoveAll(_autoCode)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//批量创建文件夹
|
||||
func createDir(dirs ...string) (err error) {
|
||||
for _, v := range dirs {
|
||||
exist, err := utils.PathExists(v)
|
||||
if err != nil {
|
||||
//log.L.Info(fmt.Sprintf("get dir error![%v]\n", err))
|
||||
return err
|
||||
}
|
||||
if exist {
|
||||
//log.L.Info(fmt.Sprintf("has dir![%v]\n"+_dir))
|
||||
} else {
|
||||
//log.L.Info(fmt.Sprintf("no dir![%v]\n"+_dir))
|
||||
// 创建文件夹
|
||||
err = os.Mkdir(v, os.ModePerm)
|
||||
if err != nil {
|
||||
//log.L.Error(fmt.Sprintf("mkdir error![%v]\n",err))
|
||||
} else {
|
||||
//log.L.Info("mkdir success!\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type SysBaseMenu struct {
|
||||
gorm.Model
|
||||
MenuLevel uint `json:"-"`
|
||||
ParentId string `json:"parentId"`
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Hidden bool `json:"hidden"`
|
||||
Component string `json:"component"`
|
||||
Sort string `json:"sort"`
|
||||
Meta `json:"meta"`
|
||||
NickName string `json:"nickName"`
|
||||
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
|
||||
Children []SysBaseMenu `json:"children"`
|
||||
}
|
||||
|
||||
type Meta struct {
|
||||
Title string `json:"title"`
|
||||
Icon string `json:"icon"`
|
||||
}
|
||||
|
||||
//增加基础路由
|
||||
func (b *SysBaseMenu) AddBaseMenu() (err error) {
|
||||
findOne := global.GVA_DB.Where("name = ?", b.Name).Find(&SysBaseMenu{}).Error
|
||||
if findOne != nil {
|
||||
b.NickName = b.Title
|
||||
err = global.GVA_DB.Create(b).Error
|
||||
} else {
|
||||
err = errors.New("存在重复name,请修改name")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//删除基础路由
|
||||
func (b *SysBaseMenu) DeleteBaseMenu(id float64) (err error) {
|
||||
err = global.GVA_DB.Where("parent_id = ?", id).First(&SysBaseMenu{}).Error
|
||||
if err != nil {
|
||||
err = global.GVA_DB.Where("id = ?", id).Delete(&b).Error
|
||||
err = global.GVA_DB.Where("menu_id = ?", id).Unscoped().Delete(&SysMenu{}).Error
|
||||
} else {
|
||||
return errors.New("此菜单存在子菜单不可删除")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
//更新路由
|
||||
func (b *SysBaseMenu) UpdateBaseMenu() (err error) {
|
||||
upDateMap := make(map[string]interface{})
|
||||
upDateMap["parent_id"] = b.ParentId
|
||||
upDateMap["path"] = b.Path
|
||||
upDateMap["name"] = b.Name
|
||||
upDateMap["hidden"] = b.Hidden
|
||||
upDateMap["component"] = b.Component
|
||||
upDateMap["title"] = b.Title
|
||||
upDateMap["icon"] = b.Icon
|
||||
upDateMap["sort"] = b.Sort
|
||||
upDateMap["nick_name"] = b.Title
|
||||
err = global.GVA_DB.Where("id = ?", b.ID).Find(&SysBaseMenu{}).Updates(upDateMap).Error
|
||||
err1 := global.GVA_DB.Where("menu_id = ?", b.ID).Find(&[]SysMenu{}).Updates(upDateMap).Error
|
||||
fmt.Printf("菜单修改时候,关联菜单err1:%v,err:%v", err1, err)
|
||||
return err
|
||||
}
|
||||
|
||||
//当前选中角色所拥有的路由
|
||||
func (b *SysBaseMenu) GetBaseMenuById(id float64) (err error, menu SysBaseMenu) {
|
||||
err = global.GVA_DB.Where("id = ?", id).First(&menu).Error
|
||||
return
|
||||
}
|
||||
|
||||
//获取路由分页
|
||||
func (b *SysBaseMenu) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var menuList []SysBaseMenu
|
||||
err = db.Limit(limit).Offset(offset).Where("parent_id = 0").Order("sort", true).Find(&menuList).Error
|
||||
for i := 0; i < len(menuList); i++ {
|
||||
err = getBaseChildrenList(&menuList[i])
|
||||
}
|
||||
return err, menuList, total
|
||||
}
|
||||
}
|
||||
|
||||
//获取基础路由树
|
||||
func (m *SysBaseMenu) GetBaseMenuTree() (err error, menus []SysBaseMenu) {
|
||||
err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error
|
||||
for i := 0; i < len(menus); i++ {
|
||||
err = getBaseChildrenList(&menus[i])
|
||||
}
|
||||
return err, menus
|
||||
}
|
||||
|
||||
func getBaseChildrenList(menu *SysBaseMenu) (err error) {
|
||||
err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error
|
||||
for i := 0; i < len(menu.Children); i++ {
|
||||
err = getBaseChildrenList(&menu.Children[i])
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gin-vue-admin/global"
|
||||
"github.com/casbin/casbin"
|
||||
"github.com/casbin/casbin/util"
|
||||
gormadapter "github.com/casbin/gorm-adapter"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CasbinModel struct {
|
||||
ID uint `json:"id" gorm:"column:_id"`
|
||||
Ptype string `json:"ptype" gorm:"column:ptype"`
|
||||
AuthorityId string `json:"rolename" gorm:"column:v0"`
|
||||
Path string `json:"path" gorm:"column:v1"`
|
||||
Method string `json:"method" gorm:"column:v2"`
|
||||
}
|
||||
|
||||
// 供入参使用
|
||||
type CasbinInfo struct {
|
||||
Path string `json:"path"`
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
// 供入参使用
|
||||
type CasbinInReceive struct {
|
||||
AuthorityId string `json:"authorityId"`
|
||||
CasbinInfos []CasbinInfo `json:"casbinInfos"`
|
||||
}
|
||||
|
||||
// 更新权限
|
||||
func (c *CasbinModel) CasbinPUpdate(AuthorityId string, casbinInfos []CasbinInfo) error {
|
||||
c.clearCasbin(0, AuthorityId)
|
||||
for _, v := range casbinInfos {
|
||||
cm := CasbinModel{
|
||||
ID: 0,
|
||||
Ptype: "p",
|
||||
AuthorityId: AuthorityId,
|
||||
Path: v.Path,
|
||||
Method: v.Method,
|
||||
}
|
||||
addflag := c.AddCasbin(cm)
|
||||
if addflag == false {
|
||||
return errors.New("存在相同api,添加失败,请联系管理员")
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// API更新随动
|
||||
func (c *CasbinModel) CasbinApiUpdate(oldPath string, newPath string) error {
|
||||
var cs []CasbinModel
|
||||
err := global.GVA_DB.Table("casbin_rule").Where("v1 = ?", oldPath).Find(&cs).Update("v1", newPath).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//添加权限
|
||||
func (c *CasbinModel) AddCasbin(cm CasbinModel) bool {
|
||||
e := Casbin()
|
||||
return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method)
|
||||
}
|
||||
|
||||
//获取权限列表
|
||||
func (c *CasbinModel) GetPolicyPathByAuthorityId(AuthorityId string) []string {
|
||||
e := Casbin()
|
||||
var pathList []string
|
||||
list := e.GetFilteredPolicy(0, AuthorityId)
|
||||
for _, v := range list {
|
||||
pathList = append(pathList, v[1])
|
||||
}
|
||||
return pathList
|
||||
}
|
||||
|
||||
//清除匹配的权限
|
||||
func (c *CasbinModel) clearCasbin(v int, p string) bool {
|
||||
e := Casbin()
|
||||
return e.RemoveFilteredPolicy(v, p)
|
||||
|
||||
}
|
||||
|
||||
// 自定义规则函数
|
||||
func ParamsMatch(fullNameKey1 string, key2 string) bool {
|
||||
key1 := strings.Split(fullNameKey1, "?")[0]
|
||||
//剥离路径后再使用casbin的keyMatch2
|
||||
return util.KeyMatch2(key1, key2)
|
||||
}
|
||||
|
||||
// 自定义规则函数
|
||||
func ParamsMatchFunc(args ...interface{}) (interface{}, error) {
|
||||
name1 := args[0].(string)
|
||||
name2 := args[1].(string)
|
||||
|
||||
return (bool)(ParamsMatch(name1, name2)), nil
|
||||
}
|
||||
|
||||
//持久化到数据库 引入自定义规则
|
||||
func Casbin() *casbin.Enforcer {
|
||||
a := gormadapter.NewAdapterByDB(global.GVA_DB)
|
||||
e := casbin.NewEnforcer(global.GVA_CONFIG.CasbinConfig.ModelPath, a)
|
||||
e.AddFunction("ParamsMatch", ParamsMatchFunc)
|
||||
e.LoadPolicy()
|
||||
return e
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type JwtBlacklist struct {
|
||||
gorm.Model
|
||||
Jwt string `gorm:"type:text"`
|
||||
}
|
||||
|
||||
func (j *JwtBlacklist) JsonInBlacklist() (err error) {
|
||||
err = global.GVA_DB.Create(j).Error
|
||||
return
|
||||
}
|
||||
|
||||
//判断JWT是否在黑名单内部
|
||||
func (j *JwtBlacklist) IsBlacklist(Jwt string) bool {
|
||||
isNotFound := global.GVA_DB.Where("jwt = ?", Jwt).First(j).RecordNotFound()
|
||||
return !isNotFound
|
||||
}
|
||||
|
||||
//判断当前用户是否在线
|
||||
func (j *JwtBlacklist) GetRedisJWT(userName string) (err error, RedisJWT string) {
|
||||
RedisJWT, err = global.GVA_REDIS.Get(userName).Result()
|
||||
return err, RedisJWT
|
||||
}
|
||||
|
||||
//设置当前用户在线
|
||||
func (j *JwtBlacklist) SetRedisJWT(userName string) (err error) {
|
||||
err = global.GVA_REDIS.Set(userName, j.Jwt, 1000*1000*1000*60*60*24*7).Err()
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/init"
|
||||
"gin-vue-admin/utils"
|
||||
)
|
||||
|
||||
//配置文件结构体
|
||||
type System struct {
|
||||
Config init.Config
|
||||
}
|
||||
|
||||
//读取配置文件
|
||||
func (s *System) GetSystemConfig() (err error, conf init.Config) {
|
||||
return nil, global.GVA_CONFIG
|
||||
}
|
||||
|
||||
//设置配置文件
|
||||
func (s *System) SetSystemConfig() (err error) {
|
||||
confs := utils.StructToMap(s.Config)
|
||||
for k, v := range confs {
|
||||
global.GVA_VP.Set(k, v)
|
||||
}
|
||||
err = global.GVA_VP.WriteConfig()
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/utils"
|
||||
"github.com/jinzhu/gorm"
|
||||
"github.com/pkg/errors"
|
||||
uuid "github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
type SysUser struct {
|
||||
gorm.Model
|
||||
UUID uuid.UUID `json:"uuid"`
|
||||
Username string `json:"userName"`
|
||||
Password string `json:"-"`
|
||||
NickName string `json:"nickName" gorm:"default:'QMPlusUser'"`
|
||||
HeaderImg string `json:"headerImg" gorm:"default:'http://www.henrongyi.top/avatar/lufu.jpg'"`
|
||||
Authority SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
|
||||
AuthorityId string `json:"authorityId" gorm:"default:888"`
|
||||
}
|
||||
|
||||
//type Propertie struct {
|
||||
// gorm.Model
|
||||
//}
|
||||
|
||||
//注册接口model方法
|
||||
func (u *SysUser) Register() (err error, userInter *SysUser) {
|
||||
var user SysUser
|
||||
//判断用户名是否注册
|
||||
notResigt := global.GVA_DB.Where("username = ?", u.Username).First(&user).RecordNotFound()
|
||||
//notResigt为false表明读取到了 不能注册
|
||||
if !notResigt {
|
||||
return errors.New("用户名已注册"), nil
|
||||
} else {
|
||||
// 否则 附加uuid 密码md5简单加密 注册
|
||||
u.Password = utils.MD5V([]byte(u.Password))
|
||||
u.UUID = uuid.NewV4()
|
||||
err = global.GVA_DB.Create(u).Error
|
||||
}
|
||||
return err, u
|
||||
}
|
||||
|
||||
//修改用户密码
|
||||
func (u *SysUser) ChangePassword(newPassword string) (err error, userInter *SysUser) {
|
||||
var user SysUser
|
||||
//后期修改jwt+password模式
|
||||
u.Password = utils.MD5V([]byte(u.Password))
|
||||
err = global.GVA_DB.Where("username = ? AND password = ?", u.Username, u.Password).First(&user).Update("password", utils.MD5V([]byte(newPassword))).Error
|
||||
return err, u
|
||||
}
|
||||
|
||||
//用户更新接口
|
||||
func (u *SysUser) SetUserAuthority(uuid uuid.UUID, AuthorityId string) (err error) {
|
||||
err = global.GVA_DB.Where("uuid = ?", uuid).First(&SysUser{}).Update("authority_id", AuthorityId).Error
|
||||
return err
|
||||
}
|
||||
|
||||
//用户登录
|
||||
func (u *SysUser) Login() (err error, userInter *SysUser) {
|
||||
var user SysUser
|
||||
u.Password = utils.MD5V([]byte(u.Password))
|
||||
err = global.GVA_DB.Where("username = ? AND password = ?", u.Username, u.Password).First(&user).Error
|
||||
if err != nil {
|
||||
return err, &user
|
||||
}
|
||||
err = global.GVA_DB.Where("authority_id = ?", user.AuthorityId).First(&user.Authority).Error
|
||||
return err, &user
|
||||
}
|
||||
|
||||
// 用户头像上传更新地址
|
||||
func (u *SysUser) UploadHeaderImg(uuid uuid.UUID, filePath string) (err error, userInter *SysUser) {
|
||||
var user SysUser
|
||||
err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error
|
||||
return err, &user
|
||||
}
|
||||
|
||||
// 分页获取数据
|
||||
func (u *SysUser) GetInfoList(info PageInfo) (err error, list interface{}, total int) {
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db := global.GVA_DB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var userList []SysUser
|
||||
err = db.Limit(limit).Offset(offset).Preload("Authority").Find(&userList).Error
|
||||
return err, userList, total
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
//工作流属性表
|
||||
type SysWorkflow struct {
|
||||
gorm.Model
|
||||
WorkflowNickName string `json:"workflowNickName"` // 工作流名称
|
||||
WorkflowName string `json:"workflowName"` // 工作流英文id
|
||||
WorkflowDescription string `json:"workflowDescription"` // 工作流描述
|
||||
WorkflowStepInfo []SysWorkflowStepInfo `json:"workflowStep"` // 工作流步骤
|
||||
}
|
||||
|
||||
// 工作流状态表
|
||||
type SysWorkflowStepInfo struct {
|
||||
gorm.Model
|
||||
SysWorkflowID uint `json:"workflowID"` // 所属工作流ID
|
||||
IsStrat bool `json:"isStrat"` // 是否是开始流节点
|
||||
StepName string `json:"stepName"` // 工作流名称
|
||||
StepNo float64 `json:"stepNo"` // 步骤id (第几步)
|
||||
StepAuthorityID string `json:"stepAuthorityID"` // 操作者级别id
|
||||
IsEnd bool `json:"isEnd"` // 是否是完结流节点
|
||||
}
|
||||
|
||||
//创建工作流
|
||||
func (wk *SysWorkflow) Create() error {
|
||||
err := global.GVA_DB.Create(&wk).Error
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
import "github.com/jinzhu/gorm"
|
||||
|
||||
// 工作流流转表
|
||||
type SysWorkFlowProcess struct {
|
||||
gorm.Model
|
||||
ApplicationID uint // 当前工作流所属申请的ID
|
||||
CurrentNode string // 当前进度节点
|
||||
HistoricalNode string //上一个进度节点
|
||||
CurrentUser string // 当前进度操作人
|
||||
HistoricalUser string // 上一个进度的操作人
|
||||
State bool // 状态 是否是正在进行的状态
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=0,maximum-scale=0,user-scalable=yes,shrink-to-fit=no"><link rel="icon" href="/form-generator/favicon.ico"><title>form-generator</title><style>.pre-loader{position:absolute;top:calc(50% - 32px);left:calc(50% - 32px);width:64px;height:64px;border-radius:50%;perspective:800px}.pre-loader .inner{position:absolute;box-sizing:border-box;width:100%;height:100%;border-radius:50%}.pre-loader .inner.one{left:0;top:0;-webkit-animation:rotate-one 1s linear infinite;animation:rotate-one 1s linear infinite;border-bottom:3px solid #bc9048}.pre-loader .inner.two{right:0;top:0;-webkit-animation:rotate-two 1s linear infinite;animation:rotate-two 1s linear infinite;border-right:3px solid #74aeff}.pre-loader .inner.three{right:0;bottom:0;-webkit-animation:rotate-three 1s linear infinite;animation:rotate-three 1s linear infinite;border-top:3px solid #caef74}@keyframes rotate-one{0%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(0);transform:rotateX(35deg) rotateY(-45deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(-45deg) rotateZ(360deg)}}@keyframes rotate-two{0%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(0);transform:rotateX(50deg) rotateY(10deg) rotateZ(0)}100%{-webkit-transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg);transform:rotateX(50deg) rotateY(10deg) rotateZ(360deg)}}@keyframes rotate-three{0%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(0);transform:rotateX(35deg) rotateY(55deg) rotateZ(0)}100%{-webkit-transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg);transform:rotateX(35deg) rotateY(55deg) rotateZ(360deg)}}</style><link href="https://cdn.bootcss.com/element-ui/2.12.0/theme-chalk/index.css" rel="stylesheet"><link href="https://cdn.bootcss.com/monaco-editor/0.18.0/min/vs/editor/editor.main.css" rel="stylesheet"><script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script><script src="https://cdn.bootcss.com/vue-router/3.1.3/vue-router.min.js"></script><script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script><link href="/form-generator/css/index.d8b172cd.css" rel="preload" as="style"><link href="/form-generator/js/chunk-vendors.788511b0.js" rel="preload" as="script"><link href="/form-generator/js/index.b3720c41.js" rel="preload" as="script"><link href="/form-generator/css/index.d8b172cd.css" rel="stylesheet"></head><body><noscript><strong>抱歉,javascript被禁用,请开启后重试。</strong></noscript><div id="app"></div><div class="pre-loader" id="pre-loader"><div class="inner one"></div><div class="inner two"></div><div class="inner three"></div></div><script>var require={paths:{vs:"https://cdn.bootcss.com/monaco-editor/0.18.0/min/vs"}}</script><script src="https://cdn.bootcss.com/js-beautify/1.10.2/beautifier.min.js"></script><script src="https://cdn.bootcss.com/monaco-editor/0.18.0/min/vs/loader.js"></script><script src="https://cdn.bootcss.com/monaco-editor/0.18.0/min/vs/editor/editor.main.nls.js"></script><script src="https://cdn.bootcss.com/monaco-editor/0.18.0/min/vs/editor/editor.main.js"></script><script src="/form-generator/js/chunk-vendors.788511b0.js"></script><script src="/form-generator/js/index.b3720c41.js"></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
<!doctype html><html lang="zh"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/form-generator/favicon.ico"><title>form-generator-preview</title><link href="https://cdn.bootcss.com/element-ui/2.12.0/theme-chalk/index.css" rel="stylesheet"><script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script><script src="https://cdn.bootcss.com/vue-router/3.1.3/vue-router.min.js"></script><script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script><style>body{margin:0;padding:0;overflow-x:hidden;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;height:calc(100vh - 33px);padding:12px;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}input,textarea{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji}</style><link href="/form-generator/js/chunk-vendors.788511b0.js" rel="preload" as="script"><link href="/form-generator/js/preview.7fecf17e.js" rel="preload" as="script"></head><body><noscript><strong>抱歉,javascript被禁用,请开启后重试。</strong></noscript><div id="previewApp"></div><script src="/form-generator/js/chunk-vendors.788511b0.js"></script><script src="/form-generator/js/preview.7fecf17e.js"></script></body></html>
|
||||
@@ -0,0 +1,14 @@
|
||||
[request_definition]
|
||||
r = sub, obj, act
|
||||
|
||||
[policy_definition]
|
||||
p = sub, obj, act
|
||||
|
||||
[role_definition]
|
||||
g = _, _
|
||||
|
||||
[policy_effect]
|
||||
e = some(where (p.eft == allow))
|
||||
|
||||
[matchers]
|
||||
m = r.sub == p.sub && r.obj == p.obj && r.act == p.act
|
||||
@@ -0,0 +1,84 @@
|
||||
import service from '@/utils/request'
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 创建{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "创建{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /{{.Abbreviation}}/create{{.StructName}} [post]
|
||||
export const create{{.StructName}} = (data) => {
|
||||
return service({
|
||||
url: "/{{.Abbreviation}}/create{{.StructName}}",
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 删除{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "删除{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /{{.Abbreviation}}/delete{{.StructName}} [post]
|
||||
export const delete{{.StructName}} = (data) => {
|
||||
return service({
|
||||
url: "/{{.Abbreviation}}/delete{{.StructName}}",
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 更新{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "更新{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /{{.Abbreviation}}/update{{.StructName}} [post]
|
||||
export const update{{.StructName}} = (data) => {
|
||||
return service({
|
||||
url: "/{{.Abbreviation}}/update{{.StructName}}",
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 用id查询{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "用id查询{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /{{.Abbreviation}}/find{{.StructName}} [post]
|
||||
export const find{{.StructName}} = (data) => {
|
||||
return service({
|
||||
url: "/{{.Abbreviation}}/find{{.StructName}}",
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 分页获取{{.StructName}}列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取{{.StructName}}列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /{{.Abbreviation}}/get{{.StructName}}List [post]
|
||||
export const get{{.StructName}}List = (data) => {
|
||||
return service({
|
||||
url: "/{{.Abbreviation}}/get{{.StructName}}List",
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
代码解压后把fe的api文件内容粘贴进前端api文件夹下并修改为自己想要的名字即可
|
||||
|
||||
后端代码解压后同理,放到自己想要的 mvc对应路径 并且到 initRouter中注册自动生成的路由 到registerTable中注册自动生成的model
|
||||
|
||||
项目github:"https://github.com/piexlmax/gin-vue-admin"
|
||||
|
||||
希望大家给个star多多鼓励
|
||||
|
||||
暂时不保存大家生成的结构体 只为方便一次性使用
|
||||
@@ -0,0 +1,116 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
// 请自行引入model路径
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 创建{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "创建{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /{{.Abbreviation}}/create{{.StructName}} [post]
|
||||
func Create{{.StructName}}(c *gin.Context) {
|
||||
var {{.Abbreviation}} {{.PackageName}}.{{.StructName}}
|
||||
_ = c.ShouldBindJSON(&{{.Abbreviation}})
|
||||
err := {{.Abbreviation}}.Create{{.StructName}}()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("创建失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "创建成功", gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 删除{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "删除{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /{{.Abbreviation}}/delete{{.StructName}} [post]
|
||||
func Delete{{.StructName}}(c *gin.Context) {
|
||||
var {{.Abbreviation}} {{.PackageName}}.{{.StructName}}
|
||||
_ = c.ShouldBindJSON(&{{.Abbreviation}})
|
||||
err := {{.Abbreviation}}.Delete{{.StructName}}()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("删除失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "创建成功", gin.H{})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 更新{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "更新{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||
// @Router /{{.Abbreviation}}/update{{.StructName}} [post]
|
||||
func Update{{.StructName}}(c *gin.Context) {
|
||||
var {{.Abbreviation}} {{.PackageName}}.{{.StructName}}
|
||||
_ = c.ShouldBindJSON(&{{.Abbreviation}})
|
||||
err,re{{.Abbreviation}} := {{.Abbreviation}}.Update{{.StructName}}()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("更新失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "更新成功", gin.H{
|
||||
"re{{.Abbreviation}}":re{{.Abbreviation}},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 用id查询{{.StructName}}
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body {{.PackageName}}.{{.StructName}} true "用id查询{{.StructName}}"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||
// @Router /{{.Abbreviation}}/find{{.StructName}} [post]
|
||||
func Find{{.StructName}}(c *gin.Context) {
|
||||
var {{.Abbreviation}} {{.PackageName}}.{{.StructName}}
|
||||
_ = c.ShouldBindJSON(&{{.Abbreviation}})
|
||||
err,re{{.Abbreviation}} := {{.Abbreviation}}.FindById()
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("查询失败:%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "查询成功", gin.H{
|
||||
"re{{.Abbreviation}}":re{{.Abbreviation}},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Tags {{.StructName}}
|
||||
// @Summary 分页获取{{.StructName}}列表
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body model.PageInfo true "分页获取{{.StructName}}列表"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||
// @Router /{{.Abbreviation}}/get{{.StructName}}List [post]
|
||||
func Get{{.StructName}}List(c *gin.Context) {
|
||||
var pageInfo model.PageInfo
|
||||
_ = c.ShouldBindJSON(&pageInfo)
|
||||
err, list, total := new({{.PackageName}}.{{.StructName}}).GetInfoList(pageInfo)
|
||||
if err != nil {
|
||||
servers.ReportFormat(c, false, fmt.Sprintf("获取数据失败,%v", err), gin.H{})
|
||||
} else {
|
||||
servers.ReportFormat(c, true, "获取数据成功", gin.H{
|
||||
"{{.PackageName}}List": list,
|
||||
"total": total,
|
||||
"page": pageInfo.Page,
|
||||
"pageSize": pageInfo.PageSize,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// 自动生成模板{{.StructName}}
|
||||
package {{.PackageName}}
|
||||
|
||||
import (
|
||||
"gin-vue-admin/init/qmsql"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type {{.StructName}} struct {
|
||||
gorm.Model {{range .Fields}}
|
||||
{{.FieldName}} {{.FieldType}} `json:"{{.FieldJson}}"{{if .ColumnName}} gorm:"column:{{.ColumnName}}"{{end}}`{{ end }}
|
||||
}
|
||||
|
||||
// 创建{{.StructName}}
|
||||
func ({{.Abbreviation}} *{{.StructName}})Create{{.StructName}}()(err error){
|
||||
err = qmsql.DEFAULTDB.Create({{.Abbreviation}}).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// 删除{{.StructName}}
|
||||
func ({{.Abbreviation}} *{{.StructName}})Delete{{.StructName}}()(err error){
|
||||
err = qmsql.DEFAULTDB.Delete({{.Abbreviation}}).Error
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新{{.StructName}}
|
||||
func ({{.Abbreviation}} *{{.StructName}})Update{{.StructName}}()(err error, re{{.Abbreviation}} {{.StructName}}){
|
||||
err = qmsql.DEFAULTDB.Save({{.Abbreviation}}).Error
|
||||
return err, *{{.Abbreviation}}
|
||||
}
|
||||
|
||||
// 根据ID查看单条{{.StructName}}
|
||||
func ({{.Abbreviation}} *{{.StructName}})FindById()(err error,re{{.Abbreviation}} {{.StructName}}){
|
||||
err = qmsql.DEFAULTDB.Where("id = ?",{{.Abbreviation}}.ID).First(&re{{.Abbreviation}}).Error
|
||||
return err,re{{.Abbreviation}}
|
||||
}
|
||||
|
||||
// 分页获取{{.StructName}}
|
||||
func ({{.Abbreviation}} *{{.StructName}})GetInfoList(info PageInfo)(err error, list interface{}, total int){
|
||||
limit := info.PageSize
|
||||
offset := info.PageSize * (info.Page - 1)
|
||||
db:=qmsql.DEFAULTDB
|
||||
if err != nil {
|
||||
return
|
||||
} else {
|
||||
var re{{.StructName}}List []{{.StructName}}
|
||||
err = db.Limit(limit).Offset(offset).Find(&re{{.StructName}}List).Error
|
||||
return err, re{{.StructName}}List, total
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/controller/api"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Init{{.StructName}}Router(Router *gin.RouterGroup) {
|
||||
{{.StructName}}Router := Router.Group("{{.Abbreviation}}").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
{{.StructName}}Router.POST("create{{.StructName}}", api.Create{{.StructName}}) // 新建{{.StructName}}
|
||||
{{.StructName}}Router.POST("delete{{.StructName}}", api.Delete{{.StructName}}) //删除{{.StructName}}
|
||||
{{.StructName}}Router.POST("update{{.StructName}}", api.Update{{.StructName}}) //更新{{.StructName}}
|
||||
{{.StructName}}Router.POST("find{{.StructName}} ", api.Find{{.StructName}}) // 根据ID获取{{.StructName}}
|
||||
{{.StructName}}Router.POST("get{{.StructName}}List", api.Get{{.StructName}}List) //获取{{.StructName}}列表
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitCustomerRouter(Router *gin.RouterGroup) {
|
||||
ApiRouter := Router.Group("customer").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
ApiRouter.POST("createExaCustomer", v1.CreateExaCustomer) // 创建客户
|
||||
ApiRouter.POST("updateExaCustomer", v1.UpdateExaCustomer) // 更新客户
|
||||
ApiRouter.POST("deleteExaCustomer", v1.DeleteExaCustomer) // 删除客户
|
||||
ApiRouter.POST("getExaCustomer", v1.GetExaCustomer) // 获取单一客户信息
|
||||
ApiRouter.POST("getExaCustomerList", v1.GetExaCustomerList) // 获取客户列表
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitFileUploadAndDownloadRouter(Router *gin.RouterGroup) {
|
||||
FileUploadAndDownloadGroup := Router.Group("fileUploadAndDownload")
|
||||
//.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
FileUploadAndDownloadGroup.POST("/upload", v1.UploadFile) // 上传文件
|
||||
FileUploadAndDownloadGroup.POST("/getFileList", v1.GetFileList) // 获取上传文件列表
|
||||
FileUploadAndDownloadGroup.POST("/deleteFile", v1.DeleteFile) // 删除指定文件
|
||||
FileUploadAndDownloadGroup.POST("/breakpointContinue", v1.BreakpointContinue) // 断点续传
|
||||
FileUploadAndDownloadGroup.GET("/findFile", v1.FindFile) // 查询当前文件成功的切片
|
||||
FileUploadAndDownloadGroup.POST("/breakpointContinueFinish", v1.BreakpointContinueFinish) // 查询当前文件成功的切片
|
||||
FileUploadAndDownloadGroup.POST("/removeChunk", v1.RemoveChunk) // 查询当前文件成功的切片
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitApiRouter(Router *gin.RouterGroup) {
|
||||
ApiRouter := Router.Group("api").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
ApiRouter.POST("createApi", v1.CreateApi) //创建Api
|
||||
ApiRouter.POST("deleteApi", v1.DeleteApi) //删除Api
|
||||
ApiRouter.POST("getApiList", v1.GetApiList) //获取Api列表
|
||||
ApiRouter.POST("getApiById", v1.GetApiById) //获取单条Api消息
|
||||
ApiRouter.POST("updateApi", v1.UpdateApi) //更新api
|
||||
ApiRouter.POST("getAllApis", v1.GetAllApis) // 获取所有api
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitAuthorityRouter(Router *gin.RouterGroup) {
|
||||
AuthorityRouter := Router.Group("authority").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
AuthorityRouter.POST("createAuthority", v1.CreateAuthority) //创建角色
|
||||
AuthorityRouter.POST("deleteAuthority", v1.DeleteAuthority) //删除角色
|
||||
AuthorityRouter.POST("getAuthorityList", v1.GetAuthorityList) //获取角色列表
|
||||
AuthorityRouter.POST("setDataAuthority", v1.SetDataAuthority) //设置角色资源权限
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitAutoCodeRouter(Router *gin.RouterGroup) {
|
||||
AutoCodeRouter := Router.Group("autoCode").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
AutoCodeRouter.POST("createTemp", v1.CreateTemp) //创建自动化代码
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitBaseRouter(Router *gin.RouterGroup) (R gin.IRoutes) {
|
||||
BaseRouter := Router.Group("base")
|
||||
{
|
||||
BaseRouter.POST("register", v1.Register)
|
||||
BaseRouter.POST("login", v1.Login)
|
||||
BaseRouter.POST("captcha", v1.Captcha)
|
||||
BaseRouter.GET("captcha/:captchaId", v1.CaptchaImg)
|
||||
}
|
||||
return BaseRouter
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitCasbinRouter(Router *gin.RouterGroup) {
|
||||
CasbinRouter := Router.Group("casbin").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
CasbinRouter.POST("casbinPUpdate", v1.CasbinPUpdate)
|
||||
CasbinRouter.POST("getPolicyPathByAuthorityId", v1.GetPolicyPathByAuthorityId)
|
||||
CasbinRouter.GET("casbinTest/:pathParam", v1.CasbinTest)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitJwtRouter(Router *gin.RouterGroup) {
|
||||
ApiRouter := Router.Group("jwt").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
ApiRouter.POST("jsonInBlacklist", v1.JsonInBlacklist) //jwt加入黑名单
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitMenuRouter(Router *gin.RouterGroup) (R gin.IRoutes) {
|
||||
MenuRouter := Router.Group("menu").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
MenuRouter.POST("getMenu", v1.GetMenu) //获取菜单树
|
||||
MenuRouter.POST("getMenuList", v1.GetMenuList) // 分页获取基础menu列表
|
||||
MenuRouter.POST("addBaseMenu", v1.AddBaseMenu) // 新增菜单
|
||||
MenuRouter.POST("getBaseMenuTree", v1.GetBaseMenuTree) // 获取用户动态路由
|
||||
MenuRouter.POST("addMenuAuthority", v1.AddMenuAuthority) // 增加menu和角色关联关系
|
||||
MenuRouter.POST("getMenuAuthority", v1.GetMenuAuthority) // 获取指定角色menu
|
||||
MenuRouter.POST("deleteBaseMenu", v1.DeleteBaseMenu) // 删除菜单
|
||||
MenuRouter.POST("updateBaseMenu", v1.UpdateBaseMenu) // 更新菜单
|
||||
MenuRouter.POST("getBaseMenuById", v1.GetBaseMenuById) //根据id获取菜单
|
||||
}
|
||||
return MenuRouter
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitSystemRouter(Router *gin.RouterGroup) {
|
||||
UserRouter := Router.Group("system").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
UserRouter.POST("getSystemConfig", v1.GetSystemConfig) // 获取配置文件内容
|
||||
UserRouter.POST("setSystemConfig", v1.SetSystemConfig) // 设置配置文件内容
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitUserRouter(Router *gin.RouterGroup) {
|
||||
UserRouter := Router.Group("user")
|
||||
//.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
UserRouter.POST("changePassword", v1.ChangePassword) // 修改密码
|
||||
UserRouter.POST("uploadHeaderImg", v1.UploadHeaderImg) //上传头像
|
||||
UserRouter.POST("getUserList", v1.GetUserList) // 分页获取用户列表
|
||||
UserRouter.POST("setUserAuthority", v1.SetUserAuthority) //设置用户权限
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"gin-vue-admin/api/v1"
|
||||
"gin-vue-admin/middleware"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func InitWorkflowRouter(Router *gin.RouterGroup) {
|
||||
WorkflowRouter := Router.Group("workflow").Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
|
||||
{
|
||||
WorkflowRouter.POST("createWorkFlow", v1.CreateWorkFlow) // 创建工作流
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ArrayToString(array []interface{}) string {
|
||||
return strings.Replace(strings.Trim(fmt.Sprint(array), "[]"), " ", ",", -1)
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// 前端传来文件片与当前片为什么文件的第几片
|
||||
// 后端拿到以后比较次分片是否上传 或者是否为不完全片
|
||||
// 前端发送每片多大
|
||||
// 前端告知是否为最后一片且是否完成
|
||||
|
||||
const breakpointDir = "./breakpointDir/"
|
||||
const finishDir = "./fileDir/"
|
||||
|
||||
func BreakPointContinue(content []byte, fileName string, contentNumber int, contentTotal int, fileMd5 string) (error, string) {
|
||||
path := breakpointDir + fileMd5 + "/"
|
||||
err := os.MkdirAll(path, os.ModePerm)
|
||||
if err != nil {
|
||||
return err, path
|
||||
}
|
||||
err, pathc := makeFileContent(content, fileName, path, contentNumber)
|
||||
return err, pathc
|
||||
|
||||
}
|
||||
|
||||
func CheckMd5(content []byte, chunkMd5 string) (CanUpload bool) {
|
||||
fileMd5 := MD5V(content)
|
||||
if fileMd5 == chunkMd5 {
|
||||
return true // "可以继续上传"
|
||||
} else {
|
||||
return false // "切片不完整,废弃"
|
||||
}
|
||||
}
|
||||
|
||||
func makeFileContent(content []byte, fileName string, FileDir string, contentNumber int) (error, string) {
|
||||
path := FileDir + fileName + "_" + strconv.Itoa(contentNumber)
|
||||
f, err := os.Create(path)
|
||||
defer f.Close()
|
||||
if err != nil {
|
||||
return err, path
|
||||
} else {
|
||||
_, err = f.Write(content)
|
||||
if err != nil {
|
||||
return err, path
|
||||
}
|
||||
}
|
||||
return nil, path
|
||||
}
|
||||
|
||||
func MakeFile(fileName string, FileMd5 string) (error, string) {
|
||||
rd, err := ioutil.ReadDir(breakpointDir + FileMd5)
|
||||
if err != nil {
|
||||
return err, finishDir + fileName
|
||||
}
|
||||
_ = os.MkdirAll(finishDir, os.ModePerm)
|
||||
fd, _ := os.OpenFile(finishDir+fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
|
||||
for k, _ := range rd {
|
||||
content, _ := ioutil.ReadFile(breakpointDir + FileMd5 + "/" + fileName + "_" + strconv.Itoa(k))
|
||||
_, err = fd.Write(content)
|
||||
if err != nil {
|
||||
_ = os.Remove(finishDir + fileName)
|
||||
return err, finishDir + fileName
|
||||
}
|
||||
}
|
||||
defer fd.Close()
|
||||
return nil, finishDir + fileName
|
||||
}
|
||||
|
||||
func RemoveChunk(FileMd5 string) error {
|
||||
err := os.RemoveAll(breakpointDir + FileMd5)
|
||||
return err
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/cipher"
|
||||
"crypto/des"
|
||||
)
|
||||
|
||||
func padding(src []byte, blocksize int) []byte {
|
||||
n := len(src)
|
||||
padnum := blocksize - n%blocksize
|
||||
pad := bytes.Repeat([]byte{byte(padnum)}, padnum)
|
||||
dst := append(src, pad...)
|
||||
return dst
|
||||
}
|
||||
|
||||
func unpadding(src []byte) []byte {
|
||||
n := len(src)
|
||||
unpadnum := int(src[n-1])
|
||||
dst := src[:n-unpadnum]
|
||||
return dst
|
||||
}
|
||||
|
||||
func EncryptDES(src []byte) []byte {
|
||||
key := []byte("qimiao66")
|
||||
block, _ := des.NewCipher(key)
|
||||
src = padding(src, block.BlockSize())
|
||||
blockmode := cipher.NewCBCEncrypter(block, key)
|
||||
blockmode.CryptBlocks(src, src)
|
||||
return src
|
||||
}
|
||||
|
||||
func DecryptDES(src []byte) []byte {
|
||||
key := []byte("qimiao66")
|
||||
block, _ := des.NewCipher(key)
|
||||
blockmode := cipher.NewCBCDecrypter(block, key)
|
||||
blockmode.CryptBlocks(src, src)
|
||||
src = unpadding(src)
|
||||
return src
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package tools
|
||||
|
||||
import "os"
|
||||
|
||||
func PathExists(path string) (bool, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
return true, nil
|
||||
}
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// 空值校验工具 仅用于检验空字符串 其余类型请勿使用
|
||||
|
||||
package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
func HasGap(input interface{}) error {
|
||||
getType := reflect.TypeOf(input)
|
||||
getValue := reflect.ValueOf(input)
|
||||
// 获取方法字段
|
||||
for i := 0; i < getType.NumField(); i++ {
|
||||
field := getType.Field(i)
|
||||
value := getValue.Field(i).Interface()
|
||||
switch value.(type) {
|
||||
case string:
|
||||
if value == "" {
|
||||
fmt.Printf("%s为空", field.Name)
|
||||
return errors.New(fmt.Sprintf("%s为空", field.Name))
|
||||
}
|
||||
default:
|
||||
if value == nil {
|
||||
fmt.Printf("%s为空", field.Name)
|
||||
return errors.New(fmt.Sprintf("%s为空", field.Name))
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取方法
|
||||
// 1. 先获取interface的reflect.Type,然后通过.NumMethod进行遍历
|
||||
//for i := 0; i < getType.NumMethod(); i++ {
|
||||
// m := getType.Method(i)
|
||||
// fmt.Printf("%s: %v\n", m.Name, m.Type)
|
||||
//}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
func MD5V(str []byte) string {
|
||||
h := md5.New()
|
||||
h.Write(str)
|
||||
return hex.EncodeToString(h.Sum(nil))
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package servers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"gin-vue-admin/config"
|
||||
"github.com/qiniu/api.v7/auth/qbox"
|
||||
"github.com/qiniu/api.v7/storage"
|
||||
"mime/multipart"
|
||||
"time"
|
||||
)
|
||||
|
||||
var accessKey string = config.GinVueAdminconfig.Qiniu.AccessKey // 你在七牛云的accessKey 这里是我个人测试号的key 仅供测试使用 恳请大家不要乱传东西
|
||||
var secretKey string = config.GinVueAdminconfig.Qiniu.SecretKey // 你在七牛云的secretKey 这里是我个人测试号的key 仅供测试使用 恳请大家不要乱传东西
|
||||
|
||||
// 接收两个参数 一个文件流 一个 bucket 你的七牛云标准空间的名字
|
||||
func Upload(file *multipart.FileHeader, bucket string, urlPath string) (err error, path string, key string) {
|
||||
putPolicy := storage.PutPolicy{
|
||||
Scope: bucket,
|
||||
}
|
||||
mac := qbox.NewMac(accessKey, secretKey)
|
||||
upToken := putPolicy.UploadToken(mac)
|
||||
cfg := storage.Config{}
|
||||
// 空间对应的机房
|
||||
cfg.Zone = &storage.ZoneHuadong
|
||||
// 是否使用https域名
|
||||
cfg.UseHTTPS = false
|
||||
// 上传是否使用CDN上传加速
|
||||
cfg.UseCdnDomains = false
|
||||
formUploader := storage.NewFormUploader(&cfg)
|
||||
ret := storage.PutRet{}
|
||||
putExtra := storage.PutExtra{
|
||||
Params: map[string]string{
|
||||
"x:name": "github logo",
|
||||
},
|
||||
}
|
||||
f, e := file.Open()
|
||||
if e != nil {
|
||||
fmt.Println(e)
|
||||
return e, "", ""
|
||||
}
|
||||
dataLen := file.Size
|
||||
fileKey := fmt.Sprintf("%d%s", time.Now().Unix(), file.Filename) // 文件名格式 自己可以改 建议保证唯一性
|
||||
err = formUploader.Put(context.Background(), &ret, upToken, fileKey, f, dataLen, &putExtra)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
//qmlog.QMLog.Info(err)
|
||||
return err, "", ""
|
||||
}
|
||||
return err, urlPath + "/" + ret.Key, ret.Key
|
||||
}
|
||||
|
||||
func DeleteFile(bucket string, key string) error {
|
||||
|
||||
mac := qbox.NewMac(accessKey, secretKey)
|
||||
cfg := storage.Config{
|
||||
// 是否使用https域名进行资源管理
|
||||
UseHTTPS: false,
|
||||
}
|
||||
// 指定空间所在的区域,如果不指定将自动探测
|
||||
// 如果没有特殊需求,默认不需要指定
|
||||
//cfg.Zone=&storage.ZoneHuabei
|
||||
bucketManager := storage.NewBucketManager(mac, &cfg)
|
||||
err := bucketManager.Delete(bucket, key)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"archive/zip"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ZipFiles(filename string, files []string, oldform, newform string) error {
|
||||
|
||||
newZipFile, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer newZipFile.Close()
|
||||
|
||||
zipWriter := zip.NewWriter(newZipFile)
|
||||
defer zipWriter.Close()
|
||||
|
||||
// 把files添加到zip中
|
||||
for _, file := range files {
|
||||
|
||||
zipfile, err := os.Open(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer zipfile.Close()
|
||||
|
||||
// 获取file的基础信息
|
||||
info, err := zipfile.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
header, err := zip.FileInfoHeader(info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
//使用上面的FileInforHeader() 就可以把文件保存的路径替换成我们自己想要的了,如下面
|
||||
header.Name = strings.Replace(file, oldform, newform, -1)
|
||||
|
||||
// 优化压缩
|
||||
// 更多参考see http://golang.org/pkg/archive/zip/#pkg-constants
|
||||
header.Method = zip.Deflate
|
||||
|
||||
writer, err := zipWriter.CreateHeader(header)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err = io.Copy(writer, zipfile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user