mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-24 11:08:09 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07cb061ea5 | ||
|
|
5078403569 | ||
|
|
5e3e16025c | ||
|
|
4b5b0507e9 | ||
|
|
ccd76445f2 | ||
|
|
706c72b973 | ||
|
|
22fb2b5d0b | ||
|
|
16775cee45 | ||
|
|
2195c89099 | ||
|
|
199fc180b7 | ||
|
|
55112db749 | ||
|
|
da4637d285 | ||
|
|
a68e58f93b | ||
|
|
c814439f93 | ||
|
|
cc34268791 | ||
|
|
b94acb62ca | ||
|
|
c851e82762 | ||
|
|
870b144557 | ||
|
|
ac5b10e6c0 | ||
|
|
e1965be2ab | ||
|
|
b931925f75 | ||
|
|
e53cc4a9b5 | ||
|
|
b40d376e25 | ||
|
|
52f42616a2 | ||
|
|
01c519e894 | ||
|
|
93feb4779e |
+2
-1
@@ -14,4 +14,5 @@ config/settings.dev.*.yml.log
|
||||
temp/logs
|
||||
config/settings.dev.yml.log
|
||||
config/settings.b.dev.yml
|
||||
cmd/migrate/migration/version_local/*
|
||||
cmd/migrate/migration/version-local/*
|
||||
!cmd/migrate/migration/version-local/doc.go
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
)
|
||||
|
||||
// @Summary 登录日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param status query string false "status"
|
||||
// @Param dictCode query string false "dictCode"
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageIndex query int false "页码"
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/loginloglist [get]
|
||||
// @Security Bearer
|
||||
func GetLoginLogList(c *gin.Context) {
|
||||
var data models.LoginLog
|
||||
var err error
|
||||
var pageSize = 10
|
||||
var pageIndex = 1
|
||||
|
||||
size := c.Request.FormValue("pageSize")
|
||||
if size != "" {
|
||||
pageSize, err = tools.StringToInt(size)
|
||||
}
|
||||
|
||||
index := c.Request.FormValue("pageIndex")
|
||||
if index != "" {
|
||||
pageIndex, err = tools.StringToInt(index)
|
||||
}
|
||||
|
||||
data.Username = c.Request.FormValue("username")
|
||||
data.Status = c.Request.FormValue("status")
|
||||
data.Ipaddr = c.Request.FormValue("ipaddr")
|
||||
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
var mp = make(map[string]interface{}, 3)
|
||||
mp["list"] = result
|
||||
mp["count"] = count
|
||||
mp["pageIndex"] = pageIndex
|
||||
mp["pageSize"] = pageSize
|
||||
|
||||
var res app.Response
|
||||
res.Data = mp
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 通过编码获取登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param infoId path int true "infoId"
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/loginlog/{infoId} [get]
|
||||
// @Security Bearer
|
||||
func GetLoginLog(c *gin.Context) {
|
||||
var LoginLog models.LoginLog
|
||||
LoginLog.InfoId, _ = tools.StringToInt(c.Param("infoId"))
|
||||
result, err := LoginLog.Get()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
|
||||
var res app.Response
|
||||
res.Data = result
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 添加登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body models.LoginLog true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/loginlog [post]
|
||||
// @Security Bearer
|
||||
func InsertLoginLog(c *gin.Context) {
|
||||
var data models.LoginLog
|
||||
err := c.BindWith(&data, binding.JSON)
|
||||
tools.HasError(err, "", 500)
|
||||
result, err := data.Create()
|
||||
tools.HasError(err, "", -1)
|
||||
var res app.Response
|
||||
res.Data = result
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 修改登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body models.LoginLog true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/loginlog [put]
|
||||
// @Security Bearer
|
||||
func UpdateLoginLog(c *gin.Context) {
|
||||
var data models.LoginLog
|
||||
err := c.BindWith(&data, binding.JSON)
|
||||
tools.HasError(err, "", -1)
|
||||
result, err := data.Update(data.InfoId)
|
||||
tools.HasError(err, "", -1)
|
||||
var res app.Response
|
||||
res.Data = result
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 批量删除登录日志
|
||||
// @Description 删除数据
|
||||
// @Tags 登录日志
|
||||
// @Param infoId path string true "以逗号(,)分割的infoId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/loginlog/{infoId} [delete]
|
||||
func DeleteLoginLog(c *gin.Context) {
|
||||
var data models.LoginLog
|
||||
data.UpdateBy = tools.GetUserIdStr(c)
|
||||
IDS := tools.IdsStrToIdsIntGroup("infoId", c)
|
||||
_, err := data.BatchDelete(IDS)
|
||||
tools.HasError(err, "修改失败", 500)
|
||||
var res app.Response
|
||||
res.Msg = "删除成功"
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
)
|
||||
|
||||
// @Summary 登录日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param status query string false "status"
|
||||
// @Param dictCode query string false "dictCode"
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageIndex query int false "页码"
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/operloglist [get]
|
||||
// @Security Bearer
|
||||
func GetOperLogList(c *gin.Context) {
|
||||
var data models.SysOperLog
|
||||
var err error
|
||||
var pageSize = 10
|
||||
var pageIndex = 1
|
||||
|
||||
size := c.Request.FormValue("pageSize")
|
||||
if size != "" {
|
||||
pageSize, err = tools.StringToInt(size)
|
||||
}
|
||||
|
||||
index := c.Request.FormValue("pageIndex")
|
||||
if index != "" {
|
||||
pageIndex, err = tools.StringToInt(index)
|
||||
}
|
||||
|
||||
data.OperName = c.Request.FormValue("operName")
|
||||
data.Status = c.Request.FormValue("status")
|
||||
data.OperIp = c.Request.FormValue("operIp")
|
||||
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
var mp = make(map[string]interface{}, 3)
|
||||
mp["list"] = result
|
||||
mp["count"] = count
|
||||
mp["pageIndex"] = pageIndex
|
||||
mp["pageSize"] = pageSize
|
||||
|
||||
var res app.Response
|
||||
res.Data = mp
|
||||
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 通过编码获取登录日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 登录日志
|
||||
// @Param infoId path int true "infoId"
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/operlog/{infoId} [get]
|
||||
// @Security Bearer
|
||||
func GetOperLog(c *gin.Context) {
|
||||
var OperLog models.SysOperLog
|
||||
OperLog.OperId, _ = tools.StringToInt(c.Param("operId"))
|
||||
result, err := OperLog.Get()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
var res app.Response
|
||||
res.Data = result
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 添加操作日志
|
||||
// @Description 获取JSON
|
||||
// @Tags 操作日志
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body models.SysOperLog true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/operlog [post]
|
||||
// @Security Bearer
|
||||
func InsertOperLog(c *gin.Context) {
|
||||
var data models.SysOperLog
|
||||
err := c.BindWith(&data, binding.JSON)
|
||||
tools.HasError(err, "", 500)
|
||||
result, err := data.Create()
|
||||
tools.HasError(err, "", -1)
|
||||
var res app.Response
|
||||
res.Data = result
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
|
||||
// @Summary 批量删除操作日志
|
||||
// @Description 删除数据
|
||||
// @Tags 操作日志
|
||||
// @Param operId path string true "以逗号(,)分割的operId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/operlog/{operId} [delete]
|
||||
func DeleteOperLog(c *gin.Context) {
|
||||
var data models.SysOperLog
|
||||
data.UpdateBy = tools.GetUserIdStr(c)
|
||||
IDS := tools.IdsStrToIdsIntGroup("operId", c)
|
||||
_, err := data.BatchDelete(IDS)
|
||||
tools.HasError(err, "删除失败", 500)
|
||||
var res app.Response
|
||||
res.Msg = "删除成功"
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package syscategory
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
"go-admin/tools/app/msg"
|
||||
)
|
||||
|
||||
func GetSysCategoryList(c *gin.Context) {
|
||||
var data models.SysCategory
|
||||
var err error
|
||||
var pageSize = 10
|
||||
var pageIndex = 1
|
||||
|
||||
if size := c.Request.FormValue("pageSize"); size != "" {
|
||||
pageSize, err = tools.StringToInt(size)
|
||||
}
|
||||
if index := c.Request.FormValue("pageIndex"); index != "" {
|
||||
pageIndex, err = tools.StringToInt(index)
|
||||
}
|
||||
|
||||
data.Name = c.Request.FormValue("name")
|
||||
data.Status = c.Request.FormValue("status")
|
||||
|
||||
data.DataScope = tools.GetUserIdStr(c)
|
||||
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
app.PageOK(c, result, count, pageIndex, pageSize, "")
|
||||
}
|
||||
|
||||
func GetSysCategory(c *gin.Context) {
|
||||
var data models.SysCategory
|
||||
data.Id, _ = tools.StringToInt(c.Param("id"))
|
||||
result, err := data.Get()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
|
||||
app.OK(c, result, "")
|
||||
}
|
||||
|
||||
// @Summary 添加分类
|
||||
// @Description 获取JSON
|
||||
// @Tags 分类
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body models.SysCategory true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/syscategory [post]
|
||||
func InsertSysCategory(c *gin.Context) {
|
||||
var data models.SysCategory
|
||||
err := c.ShouldBindJSON(&data)
|
||||
data.CreateBy = tools.GetUserIdStr(c)
|
||||
tools.HasError(err, "", 500)
|
||||
result, err := data.Create()
|
||||
tools.HasError(err, "", -1)
|
||||
app.OK(c, result, "")
|
||||
}
|
||||
|
||||
func UpdateSysCategory(c *gin.Context) {
|
||||
var data models.SysCategory
|
||||
err := c.BindWith(&data, binding.JSON)
|
||||
tools.HasError(err, "数据解析失败", -1)
|
||||
data.UpdateBy = tools.GetUserIdStr(c)
|
||||
result, err := data.Update(data.Id)
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
app.OK(c, result, "")
|
||||
}
|
||||
|
||||
func DeleteSysCategory(c *gin.Context) {
|
||||
var data models.SysCategory
|
||||
data.UpdateBy = tools.GetUserIdStr(c)
|
||||
|
||||
IDS := tools.IdsStrToIdsIntGroup("id", c)
|
||||
_, err := data.BatchDelete(IDS)
|
||||
tools.HasError(err, msg.DeletedFail, 500)
|
||||
app.OK(c, nil, msg.DeletedSuccess)
|
||||
}
|
||||
@@ -46,17 +46,22 @@ func GetMenu(c *gin.Context) {
|
||||
app.OK(c, result, "")
|
||||
}
|
||||
|
||||
// GetMenuTreeRoleselect 角色修改中的菜单列表
|
||||
func GetMenuTreeRoleselect(c *gin.Context) {
|
||||
var Menu models.Menu
|
||||
var SysRole models.SysRole
|
||||
|
||||
id, err := tools.StringToInt(c.Param("roleId"))
|
||||
SysRole.RoleId = id
|
||||
result, err := Menu.SetMenuLable()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
var result *[]models.MenuLable
|
||||
menuIds := make([]int, 0)
|
||||
if id != 0 {
|
||||
menuIds, err = SysRole.GetRoleMeunId()
|
||||
if tools.GetRoleName(c) != "admin" {
|
||||
result, err = Menu.SetMenuLable()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
if id != 0 {
|
||||
menuIds, err = SysRole.GetRoleMeunId()
|
||||
tools.HasError(err, "抱歉未找到相关信息", -1)
|
||||
}
|
||||
}
|
||||
app.Custum(c, gin.H{
|
||||
"code": 200,
|
||||
|
||||
@@ -2,9 +2,9 @@ package system
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
mycasbin "go-admin/pkg/casbin"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/common/global"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
)
|
||||
@@ -88,7 +88,7 @@ func InsertRole(c *gin.Context) {
|
||||
tools.HasError(err, "", -1)
|
||||
}
|
||||
|
||||
_, err = mycasbin.LoadPolicy()
|
||||
_, err = global.LoadPolicy()
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
app.OK(c, data, "添加成功")
|
||||
@@ -118,7 +118,7 @@ func UpdateRole(c *gin.Context) {
|
||||
tools.HasError(err2, "修改失败(insert)", -1)
|
||||
}
|
||||
|
||||
_, err = mycasbin.LoadPolicy()
|
||||
_, err = global.LoadPolicy()
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
app.OK(c, result, "修改成功")
|
||||
@@ -156,7 +156,7 @@ func DeleteRole(c *gin.Context) {
|
||||
_, err := Role.BatchDelete(IDS)
|
||||
tools.HasError(err, "删除失败", -1)
|
||||
|
||||
_, err = mycasbin.LoadPolicy()
|
||||
_, err = global.LoadPolicy()
|
||||
tools.HasError(err, "", -1)
|
||||
|
||||
app.OK(c, "", "删除成功")
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
package sys_login_log
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/models/system"
|
||||
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/apis"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/tools"
|
||||
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type SysLoginLog struct {
|
||||
apis.Api
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) GetSysLoginLogList(c *gin.Context) {
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
d := new(dto.SysLoginLogSearch)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
req := d.Generate()
|
||||
|
||||
//查询列表
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
|
||||
list := make([]system.SysLoginLog, 0)
|
||||
var count int64
|
||||
serviceStudent := service.SysLoginLog{}
|
||||
serviceStudent.MsgID = msgID
|
||||
serviceStudent.Orm = db
|
||||
err = serviceStudent.GetSysLoginLogPage(req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) GetSysLoginLog(c *gin.Context) {
|
||||
control := new(dto.SysLoginLogById)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//查看详情
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object system.SysLoginLog
|
||||
|
||||
serviceSysLoginLog := service.SysLoginLog{}
|
||||
serviceSysLoginLog.MsgID = msgID
|
||||
serviceSysLoginLog.Orm = db
|
||||
err = serviceSysLoginLog.GetSysLoginLog(req, &object)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(c, object, "查看成功")
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) {
|
||||
control := new(dto.SysLoginLogControl)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//新增操作
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
// 设置创建人
|
||||
object.SetCreateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysLoginLog := service.SysLoginLog{}
|
||||
serviceSysLoginLog.Orm = db
|
||||
serviceSysLoginLog.MsgID = msgID
|
||||
err = serviceSysLoginLog.InsertSysLoginLog(object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
e.Error(c, http.StatusInternalServerError, err, "创建失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(c, object.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) {
|
||||
control := new(dto.SysLoginLogControl)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
req := control.Generate()
|
||||
//更新操作
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysLoginLog := service.SysLoginLog{}
|
||||
serviceSysLoginLog.Orm = db
|
||||
serviceSysLoginLog.MsgID = msgID
|
||||
err = serviceSysLoginLog.UpdateSysLoginLog(object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
e.OK(c, object.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
|
||||
control := new(dto.SysLoginLogById)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//删除操作
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
log.Errorf("MsgID[%s] Bind error: %s", msgID, err)
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
|
||||
// 设置编辑人
|
||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysLoginLog := service.SysLoginLog{}
|
||||
serviceSysLoginLog.Orm = db
|
||||
serviceSysLoginLog.MsgID = msgID
|
||||
err = serviceSysLoginLog.RemoveSysLoginLog(req, object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
e.OK(c, object.GetId(), "删除成功")
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package sys_opera_log
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/apis"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/tools"
|
||||
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
apis.Api
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) GetSysOperaLogList(c *gin.Context) {
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
d := new(dto.SysOperaLogSearch)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
req := d.Generate()
|
||||
|
||||
//查询列表
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
|
||||
list := make([]system.SysOperaLog, 0)
|
||||
var count int64
|
||||
serviceStudent := service.SysOperaLog{}
|
||||
serviceStudent.MsgID = msgID
|
||||
serviceStudent.Orm = db
|
||||
err = serviceStudent.GetSysOperaLogPage(req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.PageOK(c, list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) GetSysOperaLog(c *gin.Context) {
|
||||
control := new(dto.SysOperaLogById)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//查看详情
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object system.SysOperaLog
|
||||
|
||||
serviceSysOperlog := service.SysOperaLog{}
|
||||
serviceSysOperlog.MsgID = msgID
|
||||
serviceSysOperlog.Orm = db
|
||||
err = serviceSysOperlog.GetSysOperaLog(req, &object)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(c, object, "查看成功")
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) InsertSysOperaLog(c *gin.Context) {
|
||||
control := new(dto.SysOperaLogControl)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//新增操作
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
// 设置创建人
|
||||
object.SetCreateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysOperaLog := service.SysOperaLog{}
|
||||
serviceSysOperaLog.Orm = db
|
||||
serviceSysOperaLog.MsgID = msgID
|
||||
err = serviceSysOperaLog.InsertSysOperaLog(object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
e.Error(c, http.StatusInternalServerError, err, "创建失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(c, object.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) UpdateSysOperaLog(c *gin.Context) {
|
||||
control := new(dto.SysOperaLogControl)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
req := control.Generate()
|
||||
//更新操作
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysOperaLog := service.SysOperaLog{}
|
||||
serviceSysOperaLog.Orm = db
|
||||
serviceSysOperaLog.MsgID = msgID
|
||||
err = serviceSysOperaLog.UpdateSysOperaLog(object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
e.OK(c, object.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
|
||||
control := new(dto.SysOperaLogById)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//删除操作
|
||||
req := control.Generate()
|
||||
err = req.Bind(c)
|
||||
if err != nil {
|
||||
log.Errorf("MsgID[%s] Bind error: %s", msgID, err)
|
||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
var object common.ActiveRecord
|
||||
object, err = req.GenerateM()
|
||||
if err != nil {
|
||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||
return
|
||||
}
|
||||
|
||||
// 设置编辑人
|
||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
||||
|
||||
serviceSysOperaLog := service.SysOperaLog{}
|
||||
serviceSysOperaLog.Orm = db
|
||||
serviceSysOperaLog.MsgID = msgID
|
||||
err = serviceSysOperaLog.RemoveSysOperaLog(req, object)
|
||||
if err != nil {
|
||||
log.Error(err)
|
||||
return
|
||||
}
|
||||
e.OK(c, object.GetId(), "删除成功")
|
||||
}
|
||||
@@ -8,11 +8,20 @@ import (
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
// AuthInit jwt验证new
|
||||
func AuthInit() (*jwt.GinJWTMiddleware, error) {
|
||||
timeout := time.Hour
|
||||
if config.ApplicationConfig.Mode == "dev" {
|
||||
timeout = time.Duration(876010) * time.Hour
|
||||
} else {
|
||||
if config.JwtConfig.Timeout != 0 {
|
||||
timeout = time.Duration(config.JwtConfig.Timeout) * time.Second
|
||||
}
|
||||
}
|
||||
return jwt.New(&jwt.GinJWTMiddleware{
|
||||
Realm: "test zone",
|
||||
Key: []byte(config.ApplicationConfig.JwtSecret),
|
||||
Timeout: time.Hour,
|
||||
Timeout: timeout,
|
||||
MaxRefresh: time.Hour,
|
||||
PayloadFunc: handler.PayloadFunc,
|
||||
IdentityHandler: handler.IdentityHandler,
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/driver/postgres"
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
@@ -23,6 +24,8 @@ func getGormFromDb(driver string, db *sql.DB, config *gorm.Config) (*gorm.DB, er
|
||||
return gorm.Open(mysql.New(mysql.Config{Conn: db}), config)
|
||||
case "postgres":
|
||||
return gorm.Open(postgres.New(postgres.Config{Conn: db}), config)
|
||||
case "sqlite3":
|
||||
return gorm.Open(sqlite.Open(global.Source), config)
|
||||
default:
|
||||
return nil, errors.New("not support this db driver")
|
||||
}
|
||||
|
||||
@@ -8,7 +8,10 @@ import (
|
||||
"github.com/mssola/user_agent"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/log"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/config"
|
||||
@@ -90,29 +93,36 @@ func Authenticator(c *gin.Context) (interface{}, error) {
|
||||
msg = "登录失败"
|
||||
status = "1"
|
||||
LoginLogToDB(c, status, msg, username)
|
||||
global.RequestLogger.Println(e.Error())
|
||||
global.RequestLogger.Error(e)
|
||||
}
|
||||
return nil, jwt.ErrFailedAuthentication
|
||||
}
|
||||
|
||||
// Write log to database
|
||||
// LoginLogToDB Write log to database
|
||||
func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
|
||||
if config.LoggerConfig.EnabledDB {
|
||||
var loginlog models.LoginLog
|
||||
var loginLog system.SysLoginLog
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err)
|
||||
}
|
||||
ua := user_agent.New(c.Request.UserAgent())
|
||||
loginlog.Ipaddr = c.ClientIP()
|
||||
loginlog.Username = username
|
||||
loginLog.Ipaddr = c.ClientIP()
|
||||
loginLog.Username = username
|
||||
location := tools.GetLocation(c.ClientIP())
|
||||
loginlog.LoginLocation = location
|
||||
loginlog.LoginTime = tools.GetCurrentTime()
|
||||
loginlog.Status = status
|
||||
loginlog.Remark = c.Request.UserAgent()
|
||||
loginLog.LoginLocation = location
|
||||
loginLog.LoginTime = tools.GetCurrentTime()
|
||||
loginLog.Status = status
|
||||
loginLog.Remark = c.Request.UserAgent()
|
||||
browserName, browserVersion := ua.Browser()
|
||||
loginlog.Browser = browserName + " " + browserVersion
|
||||
loginlog.Os = ua.OS()
|
||||
loginlog.Msg = msg
|
||||
loginlog.Platform = ua.Platform()
|
||||
_, _ = loginlog.Create()
|
||||
loginLog.Browser = browserName + " " + browserVersion
|
||||
loginLog.Os = ua.OS()
|
||||
loginLog.Msg = msg
|
||||
loginLog.Platform = ua.Platform()
|
||||
serviceLoginLog := service.SysLoginLog{}
|
||||
serviceLoginLog.Orm = db
|
||||
_ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,21 +136,28 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
|
||||
// @Router /logout [post]
|
||||
// @Security Bearer
|
||||
func LogOut(c *gin.Context) {
|
||||
var loginlog models.LoginLog
|
||||
var loginLog system.SysLoginLog
|
||||
ua := user_agent.New(c.Request.UserAgent())
|
||||
loginlog.Ipaddr = c.ClientIP()
|
||||
loginLog.Ipaddr = c.ClientIP()
|
||||
location := tools.GetLocation(c.ClientIP())
|
||||
loginlog.LoginLocation = location
|
||||
loginlog.LoginTime = tools.GetCurrentTime()
|
||||
loginlog.Status = "0"
|
||||
loginlog.Remark = c.Request.UserAgent()
|
||||
loginLog.LoginLocation = location
|
||||
loginLog.LoginTime = tools.GetCurrentTime()
|
||||
loginLog.Status = "0"
|
||||
loginLog.Remark = c.Request.UserAgent()
|
||||
browserName, browserVersion := ua.Browser()
|
||||
loginlog.Browser = browserName + " " + browserVersion
|
||||
loginlog.Os = ua.OS()
|
||||
loginlog.Platform = ua.Platform()
|
||||
loginlog.Username = tools.GetUserName(c)
|
||||
loginlog.Msg = "退出成功"
|
||||
loginlog.Create()
|
||||
loginLog.Browser = browserName + " " + browserVersion
|
||||
loginLog.Os = ua.OS()
|
||||
loginLog.Platform = ua.Platform()
|
||||
loginLog.Username = tools.GetUserName(c)
|
||||
loginLog.Msg = "退出成功"
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err)
|
||||
}
|
||||
serviceLoginLog := service.SysLoginLog{}
|
||||
serviceLoginLog.Orm = db
|
||||
_ = serviceLoginLog.InsertSysLoginLog(loginLog.Generate())
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 200,
|
||||
|
||||
@@ -2,6 +2,7 @@ package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/common/middleware"
|
||||
)
|
||||
|
||||
func InitMiddleware(r *gin.Engine) {
|
||||
@@ -15,4 +16,6 @@ func InitMiddleware(r *gin.Engine) {
|
||||
r.Use(Options)
|
||||
// Secure is a middleware function that appends security
|
||||
r.Use(Secure)
|
||||
// 链路追踪
|
||||
r.Use(middleware.Trace())
|
||||
}
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/log"
|
||||
"go-admin/tools"
|
||||
config2 "go-admin/tools/config"
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
// 日志记录到文件
|
||||
// LoggerToFile 日志记录到文件
|
||||
func LoggerToFile() gin.HandlerFunc {
|
||||
|
||||
return func(c *gin.Context) {
|
||||
@@ -42,69 +44,74 @@ func LoggerToFile() gin.HandlerFunc {
|
||||
clientIP := c.ClientIP()
|
||||
|
||||
// 日志格式
|
||||
fmt.Printf("%s [INFO] %s %s %3d %13v %15s \r\n",
|
||||
startTime.Format("2006-01-02 15:04:05"),
|
||||
reqMethod,
|
||||
reqUri,
|
||||
statusCode,
|
||||
latencyTime,
|
||||
clientIP,
|
||||
)
|
||||
logData := map[string]interface{}{
|
||||
"statusCode": statusCode,
|
||||
"latencyTime": latencyTime,
|
||||
"clientIP": clientIP,
|
||||
"method": reqMethod,
|
||||
"uri": reqUri,
|
||||
}
|
||||
log.Info(logData)
|
||||
global.RequestLogger.Info(logData)
|
||||
|
||||
global.RequestLogger.Info(statusCode, latencyTime, clientIP, reqMethod, reqUri)
|
||||
|
||||
if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config2.LoggerConfig.EnabledDB {
|
||||
if c.Request.Method != "GET" && c.Request.Method != "OPTIONS" && config.LoggerConfig.EnabledDB {
|
||||
SetDBOperLog(c, clientIP, statusCode, reqUri, reqMethod, latencyTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 写入操作日志表
|
||||
// 该方法后续即将弃用
|
||||
// SetDBOperLog 写入操作日志表 fixme 该方法后续即将弃用
|
||||
func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string, reqMethod string, latencyTime time.Duration) {
|
||||
menu := models.Menu{}
|
||||
menu.Path = reqUri
|
||||
menu.Action = reqMethod
|
||||
menuList, _ := menu.Get()
|
||||
sysOperLog := models.SysOperLog{}
|
||||
sysOperLog.OperIp = clientIP
|
||||
sysOperLog.OperLocation = tools.GetLocation(clientIP)
|
||||
sysOperLog.Status = tools.IntToString(statusCode)
|
||||
sysOperLog.OperName = tools.GetUserName(c)
|
||||
sysOperLog.RequestMethod = c.Request.Method
|
||||
sysOperLog.OperUrl = reqUri
|
||||
sysOperaLog := system.SysOperaLog{}
|
||||
sysOperaLog.OperIp = clientIP
|
||||
sysOperaLog.OperLocation = tools.GetLocation(clientIP)
|
||||
sysOperaLog.Status = tools.IntToString(statusCode)
|
||||
sysOperaLog.OperName = tools.GetUserName(c)
|
||||
sysOperaLog.RequestMethod = c.Request.Method
|
||||
sysOperaLog.OperUrl = reqUri
|
||||
if reqUri == "/login" {
|
||||
sysOperLog.BusinessType = "10"
|
||||
sysOperLog.Title = "用户登录"
|
||||
sysOperLog.OperName = "-"
|
||||
sysOperaLog.BusinessType = "10"
|
||||
sysOperaLog.Title = "用户登录"
|
||||
sysOperaLog.OperName = "-"
|
||||
} else if strings.Contains(reqUri, "/api/v1/logout") {
|
||||
sysOperLog.BusinessType = "11"
|
||||
sysOperaLog.BusinessType = "11"
|
||||
} else if strings.Contains(reqUri, "/api/v1/getCaptcha") {
|
||||
sysOperLog.BusinessType = "12"
|
||||
sysOperLog.Title = "验证码"
|
||||
sysOperaLog.BusinessType = "12"
|
||||
sysOperaLog.Title = "验证码"
|
||||
} else {
|
||||
if reqMethod == "POST" {
|
||||
sysOperLog.BusinessType = "1"
|
||||
sysOperaLog.BusinessType = "1"
|
||||
} else if reqMethod == "PUT" {
|
||||
sysOperLog.BusinessType = "2"
|
||||
sysOperaLog.BusinessType = "2"
|
||||
} else if reqMethod == "DELETE" {
|
||||
sysOperLog.BusinessType = "3"
|
||||
sysOperaLog.BusinessType = "3"
|
||||
}
|
||||
}
|
||||
sysOperLog.Method = reqMethod
|
||||
sysOperaLog.Method = reqMethod
|
||||
if len(menuList) > 0 {
|
||||
sysOperLog.Title = menuList[0].Title
|
||||
sysOperaLog.Title = menuList[0].Title
|
||||
}
|
||||
b, _ := c.Get("body")
|
||||
sysOperLog.OperParam, _ = tools.StructToJsonStr(b)
|
||||
sysOperLog.CreateBy = tools.GetUserName(c)
|
||||
sysOperLog.OperTime = tools.GetCurrentTime()
|
||||
sysOperLog.LatencyTime = (latencyTime).String()
|
||||
sysOperLog.UserAgent = c.Request.UserAgent()
|
||||
sysOperaLog.OperParam, _ = tools.StructToJsonStr(b)
|
||||
sysOperaLog.CreateBy = tools.GetUserIdUint(c)
|
||||
sysOperaLog.OperTime = tools.GetCurrentTime()
|
||||
sysOperaLog.LatencyTime = (latencyTime).String()
|
||||
sysOperaLog.UserAgent = c.Request.UserAgent()
|
||||
if c.Err() == nil {
|
||||
sysOperLog.Status = "0"
|
||||
sysOperaLog.Status = "0"
|
||||
} else {
|
||||
sysOperLog.Status = "1"
|
||||
sysOperaLog.Status = "1"
|
||||
}
|
||||
_, _ = sysOperLog.Create()
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
db, err := tools.GetOrm(c)
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] 获取Orm失败, error:%s", msgID, err)
|
||||
}
|
||||
serviceOperaLog := service.SysOperaLog{}
|
||||
serviceOperaLog.Orm = db
|
||||
_ = serviceOperaLog.InsertSysOperaLog(sysOperaLog.Generate())
|
||||
}
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
mycasbin "go-admin/pkg/casbin"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/log"
|
||||
"go-admin/pkg/jwtauth"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
)
|
||||
|
||||
//权限检查中间件
|
||||
@@ -16,17 +17,21 @@ func AuthCheckRole() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
data, _ := c.Get(jwtauth.JwtPayloadKey)
|
||||
v := data.(jwtauth.MapClaims)
|
||||
e := mycasbin.Casbin()
|
||||
e := global.CasbinEnforcer
|
||||
var res bool
|
||||
var err error
|
||||
msgID := tools.GenerateMsgIDFromContext(c)
|
||||
//检查权限
|
||||
res, err := e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method)
|
||||
tools.HasError(err, "", 500)
|
||||
|
||||
fmt.Printf("%s [INFO] %s %s %s \r\n",
|
||||
tools.GetCurrentTimeStr(),
|
||||
c.Request.Method,
|
||||
c.Request.URL.Path,
|
||||
v["rolekey"],
|
||||
)
|
||||
if v["rolekey"] == "admin" {
|
||||
res = true
|
||||
log.Infof("msgID[%s] info:%s method:%s path:%s", msgID, v["rolekey"], c.Request.Method, c.Request.URL.Path)
|
||||
} else {
|
||||
res, err = e.Enforce(v["rolekey"], c.Request.URL.Path, c.Request.Method)
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] error:%s method:%s path:%s", msgID, err, c.Request.Method, c.Request.URL.Path)
|
||||
app.Error(c, 500, err, "")
|
||||
}
|
||||
}
|
||||
|
||||
if res {
|
||||
c.Next()
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
orm "go-admin/common/global"
|
||||
)
|
||||
|
||||
type LoginLog struct {
|
||||
InfoId int `json:"infoId" gorm:"primary_key;auto_increment;"` //主键
|
||||
Username string `json:"username" gorm:"size:128;"` //用户名
|
||||
Status string `json:"status" gorm:"size:4;"` //状态
|
||||
Ipaddr string `json:"ipaddr" gorm:"size:255;"` //ip地址
|
||||
LoginLocation string `json:"loginLocation" gorm:"size:255;"` //归属地
|
||||
Browser string `json:"browser" gorm:"size:255;"` //浏览器
|
||||
Os string `json:"os" gorm:"size:255;"` //系统
|
||||
Platform string `json:"platform" gorm:"size:255;"` // 固件
|
||||
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;"` //登录时间
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //创建人
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //更新者
|
||||
DataScope string `json:"dataScope" gorm:"-"` //数据
|
||||
Params string `json:"params" gorm:"-"` //
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
Msg string `json:"msg" gorm:"size:255;"`
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (LoginLog) TableName() string {
|
||||
return "sys_loginlog"
|
||||
}
|
||||
|
||||
func (e *LoginLog) Get() (LoginLog, error) {
|
||||
var doc LoginLog
|
||||
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
if e.Ipaddr != "" {
|
||||
table = table.Where("ipaddr = ?", e.Ipaddr)
|
||||
}
|
||||
if e.InfoId != 0 {
|
||||
table = table.Where("info_id = ?", e.InfoId)
|
||||
}
|
||||
|
||||
if err := table.First(&doc).Error; err != nil {
|
||||
return doc, err
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func (e *LoginLog) GetPage(pageSize int, pageIndex int) ([]LoginLog, int, error) {
|
||||
var doc []LoginLog
|
||||
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
if e.Ipaddr != "" {
|
||||
table = table.Where("ipaddr = ?", e.Ipaddr)
|
||||
}
|
||||
if e.Status != "" {
|
||||
table = table.Where("status = ?", e.Status)
|
||||
}
|
||||
if e.Username != "" {
|
||||
table = table.Where("userName = ?", e.Username)
|
||||
}
|
||||
|
||||
var count int64
|
||||
|
||||
if err := table.Order("info_id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
//table.Where("`deleted_at` IS NULL").Count(&count)
|
||||
return doc, int(count), nil
|
||||
}
|
||||
|
||||
func (e *LoginLog) Create() (LoginLog, error) {
|
||||
var doc LoginLog
|
||||
e.CreateBy = "0"
|
||||
e.UpdateBy = "0"
|
||||
result := orm.Eloquent.Table(e.TableName()).Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
}
|
||||
doc = *e
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func (e *LoginLog) Update(id int) (update LoginLog, err error) {
|
||||
|
||||
if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
//参数1:是要修改的数据
|
||||
//参数2:是修改的数据
|
||||
if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (e *LoginLog) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("info_id in (?)", id).Delete(&LoginLog{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/tools"
|
||||
@@ -145,10 +146,10 @@ func DiguiMenu(menulist *[]Menu, menu Menu) Menu {
|
||||
return menu
|
||||
}
|
||||
|
||||
func (e *Menu) SetMenuLable() (m []MenuLable, err error) {
|
||||
func (e *Menu) SetMenuLable() (m *[]MenuLable, err error) {
|
||||
menulist, err := e.Get()
|
||||
|
||||
m = make([]MenuLable, 0)
|
||||
ml := make([]MenuLable, 0)
|
||||
for i := 0; i < len(menulist); i++ {
|
||||
if menulist[i].ParentId != 0 {
|
||||
continue
|
||||
@@ -158,9 +159,9 @@ func (e *Menu) SetMenuLable() (m []MenuLable, err error) {
|
||||
e.Label = menulist[i].Title
|
||||
menusInfo := DiguiMenuLable(&menulist, e)
|
||||
|
||||
m = append(m, menusInfo)
|
||||
ml = append(ml, menusInfo)
|
||||
}
|
||||
return
|
||||
return &ml, err
|
||||
}
|
||||
|
||||
func DiguiMenuLable(menulist *[]Menu, menu MenuLable) MenuLable {
|
||||
@@ -216,8 +217,14 @@ func (e *MenuRole) Get() (Menus []MenuRole, err error) {
|
||||
}
|
||||
|
||||
func (e *Menu) GetByRoleName(rolename string) (Menus []Menu, err error) {
|
||||
table := orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id")
|
||||
table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename)
|
||||
var table *gorm.DB
|
||||
if rolename == "admin" {
|
||||
table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*")
|
||||
table = table.Where(" menu_type in ('M','C')")
|
||||
} else {
|
||||
table = orm.Eloquent.Table(e.TableName()).Select("sys_menu.*").Joins("left join sys_role_menu on sys_role_menu.menu_id=sys_menu.menu_id")
|
||||
table = table.Where("sys_role_menu.role_name=? and menu_type in ('M','C')", rolename)
|
||||
}
|
||||
if err = table.Order("sort").Find(&Menus).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
orm "go-admin/common/global"
|
||||
)
|
||||
|
||||
//sys_operlog
|
||||
type SysOperLog struct {
|
||||
OperId int `json:"operId" gorm:"primary_key;AUTO_INCREMENT"` //日志编码
|
||||
Title string `json:"title" gorm:"size:255;"` //操作模块
|
||||
BusinessType string `json:"businessType" gorm:"size:128;"` //操作类型
|
||||
BusinessTypes string `json:"businessTypes" gorm:"size:128;"`
|
||||
Method string `json:"method" gorm:"size:128;"` //函数
|
||||
RequestMethod string `json:"requestMethod" gorm:"size:128;"` //请求方式
|
||||
OperatorType string `json:"operatorType" gorm:"size:128;"` //操作类型
|
||||
OperName string `json:"operName" gorm:"size:128;"` //操作者
|
||||
DeptName string `json:"deptName" gorm:"size:128;"` //部门名称
|
||||
OperUrl string `json:"operUrl" gorm:"size:255;"` //访问地址
|
||||
OperIp string `json:"operIp" gorm:"size:128;"` //客户端ip
|
||||
OperLocation string `json:"operLocation" gorm:"size:128;"` //访问位置
|
||||
OperParam string `json:"operParam" gorm:"size:255;"` //请求参数
|
||||
Status string `json:"status" gorm:"size:4;"` //操作状态
|
||||
OperTime time.Time `json:"operTime" gorm:"type:timestamp;"` //操作时间
|
||||
JsonResult string `json:"jsonResult" gorm:"size:255;"` //返回数据
|
||||
CreateBy string `json:"createBy" gorm:"size:128;"` //创建人
|
||||
UpdateBy string `json:"updateBy" gorm:"size:128;"` //更新者
|
||||
DataScope string `json:"dataScope" gorm:"-"` //数据
|
||||
Params string `json:"params" gorm:"-"` //参数
|
||||
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||
LatencyTime string `json:"latencyime" gorm:"size:128;"` //耗时
|
||||
UserAgent string `json:"userAgent" gorm:"size:255;"` //ua
|
||||
BaseModel
|
||||
}
|
||||
|
||||
func (SysOperLog) TableName() string {
|
||||
return "sys_operlog"
|
||||
}
|
||||
|
||||
func (e *SysOperLog) Get() (SysOperLog, error) {
|
||||
var doc SysOperLog
|
||||
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
if e.OperIp != "" {
|
||||
table = table.Where("oper_ip = ?", e.OperIp)
|
||||
}
|
||||
if e.OperId != 0 {
|
||||
table = table.Where("oper_id = ?", e.OperId)
|
||||
}
|
||||
|
||||
if err := table.First(&doc).Error; err != nil {
|
||||
return doc, err
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func (e *SysOperLog) GetPage(pageSize int, pageIndex int) ([]SysOperLog, int, error) {
|
||||
var doc []SysOperLog
|
||||
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
if e.OperIp != "" {
|
||||
table = table.Where("oper_ip = ?", e.OperIp)
|
||||
}
|
||||
if e.Status != "" {
|
||||
table = table.Where("status = ?", e.Status)
|
||||
}
|
||||
if e.OperName != "" {
|
||||
table = table.Where("oper_name = ?", e.OperName)
|
||||
}
|
||||
if e.BusinessType != "" {
|
||||
table = table.Where("business_type = ?", e.BusinessType)
|
||||
}
|
||||
|
||||
var count int64
|
||||
|
||||
if err := table.Order("oper_id desc").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
//table.Where("`deleted_at` IS NULL").Count(&count)
|
||||
return doc, int(count), nil
|
||||
}
|
||||
|
||||
func (e *SysOperLog) Create() (SysOperLog, error) {
|
||||
var doc SysOperLog
|
||||
e.CreateBy = "0"
|
||||
e.UpdateBy = "0"
|
||||
result := orm.Eloquent.Table(e.TableName()).Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
}
|
||||
doc = *e
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
func (e *SysOperLog) Update(id int) (update SysOperLog, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).First(&update, id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
//参数1:是要修改的数据
|
||||
//参数2:是修改的数据
|
||||
if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (e *SysOperLog) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where(" oper_id in (?)", id).Delete(&SysOperLog{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"errors"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
orm "go-admin/common/global"
|
||||
@@ -22,9 +23,9 @@ type SysRole struct {
|
||||
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||
BaseModel
|
||||
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||
}
|
||||
|
||||
func (SysRole) TableName() string {
|
||||
|
||||
+17
-108
@@ -1,122 +1,31 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/tools"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysCategory struct {
|
||||
Id int `json:"id" gorm:"type:int(11);primary_key;AUTO_INCREMENT"` // 分类Id
|
||||
Name string `json:"name" gorm:"type:varchar(255);"` // 名称
|
||||
Img string `json:"img" gorm:"type:varchar(255);"` // 图片
|
||||
Sort string `json:"sort" gorm:"type:int(4);"` // 排序
|
||||
Status string `json:"status" gorm:"type:int(1);"` // 状态
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);"` // 备注
|
||||
CreateBy string `json:"createBy" gorm:"type:varchar(64);"` // 创建者
|
||||
UpdateBy string `json:"updateBy" gorm:"type:varchar(64);"` // 更新者
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"-"`
|
||||
BaseModel
|
||||
gorm.Model
|
||||
models.ControlBy
|
||||
|
||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||
Img string `json:"img" gorm:"type:varchar(255);comment:图标"` //
|
||||
Sort string `json:"sort" gorm:"type:int(4);comment:排序"` //
|
||||
Status string `json:"status" gorm:"type:int(1);comment:状态"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||
}
|
||||
|
||||
func (SysCategory) TableName() string {
|
||||
return "sys_category"
|
||||
return "sys_category"
|
||||
}
|
||||
|
||||
// 创建SysCategory
|
||||
func (e *SysCategory) Create() (SysCategory, error) {
|
||||
var doc SysCategory
|
||||
result := orm.Eloquent.Table(e.TableName()).Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
return doc, err
|
||||
}
|
||||
doc = *e
|
||||
return doc, nil
|
||||
func (e *SysCategory) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
// 获取SysCategory
|
||||
func (e *SysCategory) Get() (SysCategory, error) {
|
||||
var doc SysCategory
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
|
||||
if e.Id != 0 {
|
||||
table = table.Where("id = ?", e.Id)
|
||||
}
|
||||
|
||||
if e.Name != "" {
|
||||
table = table.Where("name = ?", e.Name)
|
||||
}
|
||||
|
||||
if e.Status != "" {
|
||||
table = table.Where("status = ?", e.Status)
|
||||
}
|
||||
|
||||
if err := table.First(&doc).Error; err != nil {
|
||||
return doc, err
|
||||
}
|
||||
return doc, nil
|
||||
}
|
||||
|
||||
// 获取SysCategory带分页
|
||||
func (e *SysCategory) GetPage(pageSize int, pageIndex int) ([]SysCategory, int, error) {
|
||||
var doc []SysCategory
|
||||
|
||||
table := orm.Eloquent.Table(e.TableName())
|
||||
|
||||
if e.Name != "" {
|
||||
table = table.Where("name = ?", e.Name)
|
||||
}
|
||||
|
||||
if e.Status != "" {
|
||||
table = table.Where("status = ?", e.Status)
|
||||
}
|
||||
|
||||
// 数据权限控制(如果不需要数据权限请将此处去掉)
|
||||
dataPermission := new(DataPermission)
|
||||
dataPermission.UserId, _ = tools.StringToInt(e.DataScope)
|
||||
table, err := dataPermission.GetDataScope(e.TableName(), table)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
var count int64
|
||||
|
||||
if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
//table.Where("`deleted_at` IS NULL").Count(&count)
|
||||
return doc, int(count), nil
|
||||
}
|
||||
|
||||
// 更新SysCategory
|
||||
func (e *SysCategory) Update(id int) (update SysCategory, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).First(&update).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
//参数1:是要修改的数据
|
||||
//参数2:是修改的数据
|
||||
if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 删除SysCategory
|
||||
func (e *SysCategory) Delete(id int) (success bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("id = ?", id).Delete(&SysCategory{}).Error; err != nil {
|
||||
success = false
|
||||
return
|
||||
}
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
//批量删除
|
||||
func (e *SysCategory) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("id in (?)", id).Delete(&SysCategory{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
func (e *SysCategory) GetId() interface{} {
|
||||
return e.ID
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/common/models"
|
||||
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysLoginLog struct {
|
||||
gorm.Model
|
||||
models.ControlBy
|
||||
|
||||
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` //
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` //
|
||||
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` //
|
||||
LoginLocation string `json:"loginLocation" gorm:"type:varchar(255);comment:归属地"` //
|
||||
Browser string `json:"browser" gorm:"type:varchar(255);comment:浏览器"` //
|
||||
Os string `json:"os" gorm:"type:varchar(255);comment:系统"` //
|
||||
Platform string `json:"platform" gorm:"type:varchar(255);comment:固件"` //
|
||||
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` //
|
||||
}
|
||||
|
||||
func (SysLoginLog) TableName() string {
|
||||
return "sys_login_log"
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysLoginLog) GetId() interface{} {
|
||||
return e.ID
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/common/models"
|
||||
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
gorm.Model
|
||||
models.ControlBy
|
||||
|
||||
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` //
|
||||
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` //
|
||||
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` //
|
||||
Method string `json:"method" gorm:"type:varchar(128);comment:函数"` //
|
||||
RequestMethod string `json:"requestMethod" gorm:"type:varchar(128);comment:请求方式"` //
|
||||
OperatorType string `json:"operatorType" gorm:"type:varchar(128);comment:操作类型"` //
|
||||
OperName string `json:"operName" gorm:"type:varchar(128);comment:操作者"` //
|
||||
DeptName string `json:"deptName" gorm:"type:varchar(128);comment:部门名称"` //
|
||||
OperUrl string `json:"operUrl" gorm:"type:varchar(255);comment:访问地址"` //
|
||||
OperIp string `json:"operIp" gorm:"type:varchar(128);comment:客户端ip"` //
|
||||
OperLocation string `json:"operLocation" gorm:"type:varchar(128);comment:访问位置"` //
|
||||
OperParam string `json:"operParam" gorm:"type:varchar(255);comment:请求参数"` //
|
||||
Status string `json:"status" gorm:"type:varchar(4);comment:操作状态"` //
|
||||
OperTime time.Time `json:"operTime" gorm:"type:timestamp;comment:操作时间"` //
|
||||
JsonResult string `json:"jsonResult" gorm:"type:varchar(255);comment:返回数据"` //
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` //
|
||||
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` //
|
||||
}
|
||||
|
||||
func (SysOperaLog) TableName() string {
|
||||
return "sys_opera_log"
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) Generate() models.ActiveRecord {
|
||||
o := *e
|
||||
return &o
|
||||
}
|
||||
|
||||
func (e *SysOperaLog) GetId() interface{} {
|
||||
return e.ID
|
||||
}
|
||||
@@ -27,7 +27,7 @@ func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int, error)
|
||||
|
||||
if config2.DatabaseConfig.Driver == "mysql" {
|
||||
table = orm.Eloquent.Table("information_schema.tables")
|
||||
table = table.Where("TABLE_NAME not in (select table_name from " + config2.GenConfig.DBName + ".sys_tables) ")
|
||||
table = table.Where("TABLE_NAME not in (select table_name from `" + config2.GenConfig.DBName + "`.sys_tables) ")
|
||||
table = table.Where("table_schema= ? ", config2.GenConfig.DBName)
|
||||
|
||||
if e.TableName != "" {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/transfer"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Monitor() {
|
||||
var r *gin.Engine
|
||||
h := global.Cfg.GetEngine()
|
||||
if h == nil {
|
||||
h = gin.New()
|
||||
global.Cfg.SetEngine(h)
|
||||
}
|
||||
switch h.(type) {
|
||||
case *gin.Engine:
|
||||
r = h.(*gin.Engine)
|
||||
default:
|
||||
log.Fatal("not support other engine")
|
||||
}
|
||||
//开发环境启动监控指标
|
||||
r.GET("/metrics", transfer.Handler(promhttp.Handler()))
|
||||
//健康检查
|
||||
r.GET("/health", func(c *gin.Context) {
|
||||
c.Status(http.StatusOK)
|
||||
})
|
||||
}
|
||||
@@ -51,7 +51,5 @@ func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddle
|
||||
}
|
||||
|
||||
// {{认证路由自动补充在此处请勿删除}}
|
||||
registerSysContentRouter(v1, authMiddleware)
|
||||
registerSysCategoryRouter(v1, authMiddleware)
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"go-admin/app/admin/middleware"
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/actions"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerSysCategoryRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerSysCategoryRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
r := v1.Group("/syscategory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
model := &models.SysCategory{}
|
||||
r.GET("", actions.PermissionAction(), actions.IndexAction(model, new(dto.SysCategorySearch), func() interface{} {
|
||||
list := make([]models.SysCategory, 0)
|
||||
return &list
|
||||
}))
|
||||
r.GET("/:id", actions.PermissionAction(), actions.ViewAction(new(dto.SysCategoryById), nil))
|
||||
r.POST("", actions.CreateAction(new(dto.SysCategoryControl)))
|
||||
r.PUT("/:id", actions.PermissionAction(), actions.UpdateAction(new(dto.SysCategoryControl)))
|
||||
r.DELETE("", actions.PermissionAction(), actions.DeleteAction(new(dto.SysCategoryById)))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/system/sys_login_log"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerSysLoginLogRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerSysLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
api := &sys_login_log.SysLoginLog{}
|
||||
r := v1.Group("/sys-login-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysLoginLogList)
|
||||
r.GET("/:id", api.GetSysLoginLog)
|
||||
r.POST("", api.InsertSysLoginLog)
|
||||
r.PUT("/:id", api.UpdateSysLoginLog)
|
||||
r.DELETE("", api.DeleteSysLoginLog)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/system/sys_opera_log"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerSysOperaLogRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerSysOperaLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
api := &sys_opera_log.SysOperaLog{}
|
||||
r := v1.Group("/sys-opera-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysOperaLogList)
|
||||
r.GET("/:id", api.GetSysOperaLog)
|
||||
r.POST("", api.InsertSysOperaLog)
|
||||
r.PUT("/:id", api.UpdateSysOperaLog)
|
||||
r.DELETE("", api.DeleteSysOperaLog)
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/syscategory"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerSysCategoryRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
|
||||
r := v1.Group("/syscategory").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("/:id", syscategory.GetSysCategory)
|
||||
r.POST("", syscategory.InsertSysCategory)
|
||||
r.PUT("", syscategory.UpdateSysCategory)
|
||||
r.DELETE("/:id", syscategory.DeleteSysCategory)
|
||||
}
|
||||
|
||||
l := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
l.GET("/syscategoryList", syscategory.GetSysCategoryList)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,11 @@ import (
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerSysContentRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerSysContentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package router
|
||||
import (
|
||||
"mime"
|
||||
|
||||
log2 "go-admin/app/admin/apis/log"
|
||||
"go-admin/app/admin/apis/monitor"
|
||||
"go-admin/app/admin/apis/public"
|
||||
"go-admin/app/admin/apis/system"
|
||||
@@ -112,8 +111,6 @@ func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
registerUserCenterRouter(v1, authMiddleware)
|
||||
registerPostRouter(v1, authMiddleware)
|
||||
registerMenuRouter(v1, authMiddleware)
|
||||
registerLoginLogRouter(v1, authMiddleware)
|
||||
registerOperLogRouter(v1, authMiddleware)
|
||||
}
|
||||
|
||||
func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
@@ -127,8 +124,6 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
|
||||
|
||||
v1auth.POST("/logout", handler.LogOut)
|
||||
v1auth.GET("/menuids", system.GetMenuIDS)
|
||||
|
||||
v1auth.GET("/operloglist", log2.GetOperLogList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +137,6 @@ func registerPageRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
|
||||
//v1auth.GET("/configList", system.GetConfigList)
|
||||
v1auth.GET("/postlist", system.GetPostList)
|
||||
v1auth.GET("/menulist", system.GetMenuList)
|
||||
v1auth.GET("/loginloglist", log2.GetLoginLogList)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,24 +149,6 @@ func registerUserCenterRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMid
|
||||
}
|
||||
}
|
||||
|
||||
func registerOperLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
operlog := v1.Group("/operlog").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
operlog.GET("/:operId", log2.GetOperLog)
|
||||
operlog.DELETE("/:operId", log2.DeleteOperLog)
|
||||
}
|
||||
}
|
||||
|
||||
func registerLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
loginlog := v1.Group("/loginlog").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
loginlog.GET("/:infoId", log2.GetLoginLog)
|
||||
loginlog.POST("", log2.InsertLoginLog)
|
||||
loginlog.PUT("", log2.UpdateLoginLog)
|
||||
loginlog.DELETE("/:infoId", log2.DeleteLoginLog)
|
||||
}
|
||||
}
|
||||
|
||||
func registerPostRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
post := v1.Group("/post").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/common/dto"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/tools"
|
||||
)
|
||||
|
||||
type SysCategorySearch struct {
|
||||
dto.Pagination `search:"-"`
|
||||
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
|
||||
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
|
||||
|
||||
|
||||
}
|
||||
|
||||
func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
func (m *SysCategorySearch) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *SysCategorySearch) Generate() dto.Index {
|
||||
o := *m
|
||||
return &o
|
||||
}
|
||||
|
||||
type SysCategoryControl struct {
|
||||
|
||||
ID uint `uri:"ID" comment:"标识"` // 标识
|
||||
|
||||
Name string `json:"name" comment:"名称"`
|
||||
|
||||
|
||||
Img string `json:"img" comment:"图标"`
|
||||
|
||||
|
||||
Sort string `json:"sort" comment:"排序"`
|
||||
|
||||
|
||||
Status string `json:"status" comment:"状态"`
|
||||
|
||||
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
|
||||
}
|
||||
|
||||
func (s *SysCategoryControl) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||
return err
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysCategoryControl) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysCategory{
|
||||
|
||||
Model: gorm.Model{ID: s.ID},
|
||||
Name: s.Name,
|
||||
Img: s.Img,
|
||||
Sort: s.Sort,
|
||||
Status: s.Status,
|
||||
Remark: s.Remark,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SysCategoryControl) GetId() interface{} {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
type SysCategoryById struct {
|
||||
dto.ObjectById
|
||||
}
|
||||
|
||||
func (s *SysCategoryById) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysCategoryById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &models.SysCategory{}, nil
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/tools"
|
||||
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysLoginLogSearch struct {
|
||||
dto.Pagination `search:"-"`
|
||||
|
||||
Username string `form:"username" search:"type:exact;column:username;table:sys_login_log" comment:"用户名"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:sys_login_log" comment:"状态"`
|
||||
Ipaddr string `form:"ipaddr" search:"type:exact;column:ipaddr;table:sys_login_log" comment:"ip地址"`
|
||||
LoginLocation string `form:"loginLocation" search:"type:exact;column:login_location;table:sys_login_log" comment:"归属地"`
|
||||
}
|
||||
|
||||
func (m *SysLoginLogSearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
func (m *SysLoginLogSearch) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *SysLoginLogSearch) Generate() dto.Index {
|
||||
o := *m
|
||||
return &o
|
||||
}
|
||||
|
||||
type SysLoginLogControl struct {
|
||||
ID uint `uri:"ID" comment:"主键"` // 主键
|
||||
Username string `json:"username" comment:"用户名"`
|
||||
Status string `json:"status" comment:"状态"`
|
||||
Ipaddr string `json:"ipaddr" comment:"ip地址"`
|
||||
LoginLocation string `json:"loginLocation" comment:"归属地"`
|
||||
Browser string `json:"browser" comment:"浏览器"`
|
||||
Os string `json:"os" comment:"系统"`
|
||||
Platform string `json:"platform" comment:"固件"`
|
||||
LoginTime time.Time `json:"loginTime" comment:"登录时间"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Msg string `json:"msg" comment:"信息"`
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||
return err
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysLoginLog{
|
||||
|
||||
Model: gorm.Model{ID: s.ID},
|
||||
Username: s.Username,
|
||||
Status: s.Status,
|
||||
Ipaddr: s.Ipaddr,
|
||||
LoginLocation: s.LoginLocation,
|
||||
Browser: s.Browser,
|
||||
Os: s.Os,
|
||||
Platform: s.Platform,
|
||||
LoginTime: s.LoginTime,
|
||||
Remark: s.Remark,
|
||||
Msg: s.Msg,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SysLoginLogControl) GetId() interface{} {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
type SysLoginLogById struct {
|
||||
dto.ObjectById
|
||||
}
|
||||
|
||||
func (s *SysLoginLogById) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysLoginLogById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysLoginLog{}, nil
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/common/dto"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/tools"
|
||||
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysOperaLogSearch struct {
|
||||
dto.Pagination `search:"-"`
|
||||
|
||||
Title string `form:"title" search:"type:contains;column:title;table:sys_opera_log" comment:"操作模块"`
|
||||
Method string `form:"method" search:"type:contains;column:method;table:sys_opera_log" comment:"函数"`
|
||||
RequestMethod string `form:"requestMethod" search:"type:contains;column:request_method;table:sys_opera_log" comment:"请求方式"`
|
||||
OperUrl string `form:"operUrl" search:"type:contains;column:oper_url;table:sys_opera_log" comment:"访问地址"`
|
||||
OperIp string `form:"operIp" search:"type:exact;column:oper_ip;table:sys_opera_log" comment:"客户端ip"`
|
||||
}
|
||||
|
||||
func (m *SysOperaLogSearch) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
func (m *SysOperaLogSearch) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBind(m)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *SysOperaLogSearch) Generate() dto.Index {
|
||||
o := *m
|
||||
return &o
|
||||
}
|
||||
|
||||
type SysOperaLogControl struct {
|
||||
ID uint `uri:"ID" comment:"编码"` // 编码
|
||||
Title string `json:"title" comment:"操作模块"`
|
||||
BusinessType string `json:"businessType" comment:"操作类型"`
|
||||
BusinessTypes string `json:"businessTypes" comment:""`
|
||||
Method string `json:"method" comment:"函数"`
|
||||
RequestMethod string `json:"requestMethod" comment:"请求方式"`
|
||||
OperatorType string `json:"operatorType" comment:"操作类型"`
|
||||
OperName string `json:"operName" comment:"操作者"`
|
||||
DeptName string `json:"deptName" comment:"部门名称"`
|
||||
OperUrl string `json:"operUrl" comment:"访问地址"`
|
||||
OperIp string `json:"operIp" comment:"客户端ip"`
|
||||
OperLocation string `json:"operLocation" comment:"访问位置"`
|
||||
OperParam string `json:"operParam" comment:"请求参数"`
|
||||
Status string `json:"status" comment:"操作状态"`
|
||||
OperTime time.Time `json:"operTime" comment:"操作时间"`
|
||||
JsonResult string `json:"jsonResult" comment:"返回数据"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
LatencyTime string `json:"latencyTime" comment:"耗时"`
|
||||
UserAgent string `json:"userAgent" comment:"ua"`
|
||||
}
|
||||
|
||||
func (s *SysOperaLogControl) Bind(ctx *gin.Context) error {
|
||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||
err := ctx.ShouldBindUri(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||
return err
|
||||
}
|
||||
err = ctx.ShouldBind(s)
|
||||
if err != nil {
|
||||
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SysOperaLogControl) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysOperaLog{
|
||||
Model: gorm.Model{ID: s.ID},
|
||||
Title: s.Title,
|
||||
BusinessType: s.BusinessType,
|
||||
BusinessTypes: s.BusinessTypes,
|
||||
Method: s.Method,
|
||||
RequestMethod: s.RequestMethod,
|
||||
OperatorType: s.OperatorType,
|
||||
OperName: s.OperName,
|
||||
DeptName: s.DeptName,
|
||||
OperUrl: s.OperUrl,
|
||||
OperIp: s.OperIp,
|
||||
OperLocation: s.OperLocation,
|
||||
OperParam: s.OperParam,
|
||||
Status: s.Status,
|
||||
OperTime: s.OperTime,
|
||||
JsonResult: s.JsonResult,
|
||||
Remark: s.Remark,
|
||||
LatencyTime: s.LatencyTime,
|
||||
UserAgent: s.UserAgent,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *SysOperaLogControl) GetId() interface{} {
|
||||
return s.ID
|
||||
}
|
||||
|
||||
type SysOperaLogById struct {
|
||||
dto.ObjectById
|
||||
}
|
||||
|
||||
func (s *SysOperaLogById) Generate() dto.Control {
|
||||
cp := *s
|
||||
return &cp
|
||||
}
|
||||
|
||||
func (s *SysOperaLogById) GenerateM() (common.ActiveRecord, error) {
|
||||
return &system.SysOperaLog{}, nil
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/app/admin/models/system"
|
||||
cDto "go-admin/common/dto"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/common/service"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SysLoginLog struct {
|
||||
service.Service
|
||||
}
|
||||
|
||||
// GetSysLoginLogPage 获取SysLoginLog列表
|
||||
func (e *SysLoginLog) GetSysLoginLogPage(c cDto.Index, list *[]system.SysLoginLog, count *int64) error {
|
||||
var err error
|
||||
var data system.SysLoginLog
|
||||
msgID := e.MsgID
|
||||
|
||||
err = e.Orm.Model(&data).
|
||||
Scopes(
|
||||
cDto.MakeCondition(c.GetNeedSearch()),
|
||||
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
|
||||
).
|
||||
Find(list).Limit(-1).Offset(-1).
|
||||
Count(count).Error
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSysLoginLog 获取SysLoginLog对象
|
||||
func (e *SysLoginLog) GetSysLoginLog(d cDto.Control, model *system.SysLoginLog) error {
|
||||
var err error
|
||||
var data system.SysLoginLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
First(model, d.GetId())
|
||||
err = db.Error
|
||||
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
err = errors.New("查看对象不存在或无权查看")
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.Error != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertSysLoginLog 创建SysLoginLog对象
|
||||
func (e *SysLoginLog) InsertSysLoginLog(model common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysLoginLog
|
||||
msgID := e.MsgID
|
||||
|
||||
err = e.Orm.Model(&data).
|
||||
Create(model).Error
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateSysLoginLog 修改SysLoginLog对象
|
||||
func (e *SysLoginLog) UpdateSysLoginLog(c common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysLoginLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
Where(c.GetId()).Updates(c)
|
||||
if db.Error != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.RowsAffected == 0 {
|
||||
return errors.New("无权更新该数据")
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveSysLoginLog 删除SysLoginLog
|
||||
func (e *SysLoginLog) RemoveSysLoginLog(d cDto.Control, c common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysLoginLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
Where(d.GetId()).Delete(c)
|
||||
if db.Error != nil {
|
||||
err = db.Error
|
||||
log.Errorf("MsgID[%s] Delete error: %s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.RowsAffected == 0 {
|
||||
err = errors.New("无权删除该数据")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/app/admin/models/system"
|
||||
cDto "go-admin/common/dto"
|
||||
"go-admin/common/log"
|
||||
common "go-admin/common/models"
|
||||
"go-admin/common/service"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type SysOperaLog struct {
|
||||
service.Service
|
||||
}
|
||||
|
||||
// GetSysOperaLogPage 获取SysOperaLog列表
|
||||
func (e *SysOperaLog) GetSysOperaLogPage(c cDto.Index, list *[]system.SysOperaLog, count *int64) error {
|
||||
var err error
|
||||
var data system.SysOperaLog
|
||||
msgID := e.MsgID
|
||||
|
||||
err = e.Orm.Model(&data).
|
||||
Scopes(
|
||||
cDto.MakeCondition(c.GetNeedSearch()),
|
||||
cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
|
||||
).
|
||||
Find(list).Limit(-1).Offset(-1).
|
||||
Count(count).Error
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSysOperaLog 获取SysOperaLog对象
|
||||
func (e *SysOperaLog) GetSysOperaLog(d cDto.Control, model *system.SysOperaLog) error {
|
||||
var err error
|
||||
var data system.SysOperaLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
First(model, d.GetId())
|
||||
err = db.Error
|
||||
if err != nil && errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
err = errors.New("查看对象不存在或无权查看")
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.Error != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertSysOperaLog 创建SysOperaLog对象
|
||||
func (e *SysOperaLog) InsertSysOperaLog(model common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysOperaLog
|
||||
msgID := e.MsgID
|
||||
|
||||
err = e.Orm.Model(&data).
|
||||
Create(model).Error
|
||||
if err != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateSysOperaLog 修改SysOperaLog对象
|
||||
func (e *SysOperaLog) UpdateSysOperaLog(c common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysOperaLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
Where(c.GetId()).Updates(c)
|
||||
if db.Error != nil {
|
||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.RowsAffected == 0 {
|
||||
return errors.New("无权更新该数据")
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveSysOperaLog 删除SysOperaLog
|
||||
func (e *SysOperaLog) RemoveSysOperaLog(d cDto.Control, c common.ActiveRecord) error {
|
||||
var err error
|
||||
var data system.SysOperaLog
|
||||
msgID := e.MsgID
|
||||
|
||||
db := e.Orm.Model(&data).
|
||||
Where(d.GetId()).Delete(c)
|
||||
if db.Error != nil {
|
||||
err = db.Error
|
||||
log.Errorf("MsgID[%s] Delete error: %s", msgID, err)
|
||||
return err
|
||||
}
|
||||
if db.RowsAffected == 0 {
|
||||
err = errors.New("无权删除该数据")
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
+1
-1
@@ -41,7 +41,7 @@ func (e *ExecJob) Run() {
|
||||
startTime := time.Now()
|
||||
var obj = jobList[e.InvokeTarget]
|
||||
if obj == nil {
|
||||
global.JobLogger.Warning(" ExecJob Run job nil", e)
|
||||
global.JobLogger.Warn(" ExecJob Run job nil")
|
||||
return
|
||||
}
|
||||
err := CallExec(obj.(JobsExec), e.Args)
|
||||
|
||||
+33
-17
@@ -3,8 +3,7 @@ package api
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go-admin/app/admin/router"
|
||||
"io/ioutil"
|
||||
"go-admin/tools/trace"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -14,9 +13,11 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"go-admin/app/admin/router"
|
||||
"go-admin/app/jobs"
|
||||
"go-admin/common/database"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/log"
|
||||
mycasbin "go-admin/pkg/casbin"
|
||||
"go-admin/pkg/logger"
|
||||
"go-admin/tools"
|
||||
@@ -24,10 +25,11 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
configYml string
|
||||
port string
|
||||
mode string
|
||||
StartCmd = &cobra.Command{
|
||||
configYml string
|
||||
port string
|
||||
mode string
|
||||
traceStart bool
|
||||
StartCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Start API server",
|
||||
Example: "go-admin server -c config/settings.yml",
|
||||
@@ -47,6 +49,7 @@ func init() {
|
||||
StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file")
|
||||
StartCmd.PersistentFlags().StringVarP(&port, "port", "p", "8000", "Tcp port server listening on")
|
||||
StartCmd.PersistentFlags().StringVarP(&mode, "mode", "m", "dev", "server mode ; eg:dev,test,prod")
|
||||
StartCmd.PersistentFlags().BoolVarP(&traceStart, "traceStart", "t", false, "start traceStart app dash")
|
||||
|
||||
//注册路由 fixme 其他应用的路由,在本目录新建文件放在init方法
|
||||
AppRouters = append(AppRouters, router.InitRouter)
|
||||
@@ -57,14 +60,16 @@ func setup() {
|
||||
//1. 读取配置
|
||||
config.Setup(configYml)
|
||||
//2. 设置日志
|
||||
logger.Setup()
|
||||
global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus")
|
||||
global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job")
|
||||
global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request")
|
||||
//3. 初始化数据库链接
|
||||
database.Setup(config.DatabaseConfig.Driver)
|
||||
//4. 接口访问控制加载
|
||||
mycasbin.Setup()
|
||||
global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_")
|
||||
|
||||
usageStr := `starting api server`
|
||||
global.Logger.Info(usageStr)
|
||||
log.Info(usageStr)
|
||||
|
||||
}
|
||||
|
||||
@@ -77,6 +82,11 @@ func run() error {
|
||||
engine = gin.New()
|
||||
}
|
||||
|
||||
if mode == "dev" {
|
||||
//监控
|
||||
AppRouters = append(AppRouters, router.Monitor)
|
||||
}
|
||||
|
||||
for _, f := range AppRouters {
|
||||
f()
|
||||
}
|
||||
@@ -91,20 +101,28 @@ func run() error {
|
||||
|
||||
}()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if traceStart {
|
||||
//链路追踪, fixme 页面显示需要自备梯子
|
||||
trace.Start()
|
||||
defer trace.Stop(ctx)
|
||||
}
|
||||
|
||||
go func() {
|
||||
// 服务连接
|
||||
if config.SslConfig.Enable {
|
||||
if err := srv.ListenAndServeTLS(config.SslConfig.Pem, config.SslConfig.KeyStr); err != nil && err != http.ErrServerClosed {
|
||||
global.Logger.Fatal("listen: ", err)
|
||||
log.Fatal("listen: ", err)
|
||||
}
|
||||
} else {
|
||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||
global.Logger.Fatal("listen: ", err)
|
||||
log.Fatal("listen: ", err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
content, _ := ioutil.ReadFile("./static/go-admin.txt")
|
||||
fmt.Println(tools.Red(string(content)))
|
||||
fmt.Println(tools.Red(string(global.LogoContent)))
|
||||
tip()
|
||||
fmt.Println(tools.Green("Server run at:"))
|
||||
fmt.Printf("- Local: http://localhost:%s/ \r\n", config.ApplicationConfig.Port)
|
||||
@@ -119,12 +137,10 @@ func run() error {
|
||||
<-quit
|
||||
fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrentTimeStr())
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
if err := srv.Shutdown(ctx); err != nil {
|
||||
global.Logger.Fatal("Server Shutdown:", err)
|
||||
log.Fatal("Server Shutdown:", err)
|
||||
}
|
||||
global.Logger.Println("Server exiting")
|
||||
log.Info("Server exiting")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package migration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/spf13/cast"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"github.com/spf13/cast"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var Migrate = &Migration{
|
||||
@@ -40,11 +40,12 @@ func (e *Migration) Migrate() {
|
||||
for k := range e.version {
|
||||
versions = append(versions, k)
|
||||
}
|
||||
sort.IntsAreSorted(versions)
|
||||
if !sort.IntsAreSorted(versions) {
|
||||
sort.Ints(versions)
|
||||
}
|
||||
var err error
|
||||
var count int64
|
||||
for _, v := range versions {
|
||||
fmt.Println(v)
|
||||
err = e.db.Debug().Table("sys_migration").Where("version = ?", v).Count(&count).Error
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package version_local
|
||||
|
||||
func init() {
|
||||
}
|
||||
|
||||
/**
|
||||
开发者项目的迁移脚本放在这个目录里,init写法参考version目录里的migrate或者自动生成
|
||||
*/
|
||||
@@ -1,9 +1,9 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
"runtime"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
@@ -25,8 +25,8 @@ func _1599190683659Tables(db *gorm.DB, version string) error {
|
||||
new(tools.SysTables),
|
||||
new(tools.SysColumns),
|
||||
new(models.Menu),
|
||||
new(models.LoginLog),
|
||||
new(models.SysOperLog),
|
||||
new(system.SysLoginLog),
|
||||
new(system.SysOperaLog),
|
||||
new(models.RoleMenu),
|
||||
new(models.SysRoleDept),
|
||||
new(models.SysUser),
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models/system"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -20,239 +20,6 @@ func init() {
|
||||
func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
|
||||
list1 := []models.RoleMenu{
|
||||
{RoleId: 1, MenuId: 2, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 3, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 43, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 44, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 45, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 46, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 51, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 52, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 56, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 57, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 58, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 59, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 60, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 61, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 62, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 63, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 64, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 66, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 67, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 68, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 69, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 70, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 71, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 72, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 73, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 74, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 75, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 76, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 77, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 78, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 79, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 80, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 81, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 82, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 83, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 84, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 85, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 86, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 87, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 89, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 90, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 91, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 92, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 93, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 94, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 95, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 96, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 97, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 103, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 104, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 105, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 106, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 107, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 108, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 109, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 110, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 111, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 112, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 113, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 114, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 115, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 116, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 117, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 118, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 119, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 120, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 121, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 122, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 123, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 138, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 142, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 201, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 202, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 203, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 204, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 205, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 206, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 211, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 212, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 213, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 214, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 215, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 216, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 217, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 220, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 221, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 222, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 223, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 224, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 225, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 226, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 227, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 228, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 229, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 230, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 231, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 232, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 233, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 234, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 235, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 236, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 237, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 238, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 239, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 240, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 241, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 242, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 243, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 244, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 245, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 246, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 247, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 248, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 249, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 250, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 251, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 252, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 253, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 254, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 255, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 256, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 257, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 258, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 259, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 260, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 261, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 262, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 263, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 264, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 267, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 269, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 459, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 460, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 461, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 462, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 463, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 464, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 465, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 466, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 467, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 468, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 469, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 470, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 471, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 473, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 474, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 475, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 476, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 477, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 478, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 479, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 480, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 481, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 482, RoleName: "admin"},
|
||||
{RoleId: 1, MenuId: 483, RoleName: "admin"},
|
||||
}
|
||||
list2 := []models.CasbinRule{
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menulist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menu", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/databytype/", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menu", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menu/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUserList", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUser/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUser/", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUser", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUser", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysUser/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/user/profile", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/rolelist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/role/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/role", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/role", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/role/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/configList", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menurole", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/roleMenuTreeselect/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menuTreeselect", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/rolemenu", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/rolemenu", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/rolemenu/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/deptList", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dept/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dept", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dept", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dept/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/datalist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/data/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/databytype/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/data", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/data/", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/data/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/typelist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/type/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/type", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/type", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/type/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/postlist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/post/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/post", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/post", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/post/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menu/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/menuids", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/loginloglist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/loginlog/:id", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/operloglist", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/getinfo", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/roledatascope", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/roleDeptTreeselect/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/deptTree", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/configKey/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/logout", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/user/avatar", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/user/pwd", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/dict/typeoptionselect", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysjob/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/sysjob", V2: "DELETE"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/syssettingList", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/syssetting/:id", V2: "GET"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/syssetting", V2: "POST"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/syssetting", V2: "PUT"},
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/syssetting/:id", V2: "DELETE"},
|
||||
}
|
||||
|
||||
list3 := []models.SysDept{
|
||||
{DeptId: 1, ParentId: 0, DeptPath: "/0/1", DeptName: "爱拓科技", Sort: 0, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
{DeptId: 7, ParentId: 1, DeptPath: "/0/1/7", DeptName: "研发部", Sort: 1, Leader: "aituo", Phone: "13782218188", Email: "atuo@aituo.com", Status: "0", CreateBy: "1", UpdateBy: "1", BaseModel: models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}},
|
||||
@@ -337,16 +104,7 @@ func _1599190683670Test(db *gorm.DB, version string) error {
|
||||
{2, "函数测试", "DEFAULT", 2, "0/5 * * * * ", "ExamplesOne", "参数", 1, 1, 1, 0, "", "", models.BaseModel{CreatedAt: time.Now(), UpdatedAt: time.Now()}, ""},
|
||||
}
|
||||
|
||||
err := tx.Create(list1).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = tx.Create(list2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = tx.Create(list3).Error
|
||||
err := tx.Create(list3).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
@@ -17,14 +18,16 @@ func init() {
|
||||
|
||||
func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
err := db.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
if tx.Migrator().HasColumn(&system.SysConfig{}, "config_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
list2 := []models.CasbinRule{
|
||||
{PType: "p", V0: "admin", V1: "/api/v1/config", V2: "GET"},
|
||||
}
|
||||
err = tx.Create(list2).Error
|
||||
err := tx.Create(list2).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -35,7 +38,7 @@ func _1602644950000Test(db *gorm.DB, version string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
return db.Create(&common.Migration{
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603465014697Test)
|
||||
}
|
||||
|
||||
func _1603465014697Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
err := tx.Debug().Model(&models.Menu{}).Where("path = ?", "/api/v1/syscategoryList").Update("path", "/api/v1/syscategory").Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package version
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/cmd/migrate/migration"
|
||||
common "go-admin/common/models"
|
||||
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, fileName, _, _ := runtime.Caller(0)
|
||||
migration.Migrate.SetVersion(migration.GetFilename(fileName), _1603516925109Test)
|
||||
}
|
||||
|
||||
func _1603516925109Test(db *gorm.DB, version string) error {
|
||||
return db.Transaction(func(tx *gorm.DB) error {
|
||||
_ = tx.Migrator().RenameTable("sys_operlog", "sys_opera_log")
|
||||
_ = tx.Migrator().RenameTable("sys_loginlog", "sys_login_log")
|
||||
|
||||
if tx.Migrator().HasColumn(&system.SysLoginLog{}, "info_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysLoginLog{}, "info_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if tx.Migrator().HasColumn(&system.SysOperaLog{}, "oper_id") {
|
||||
err := tx.Migrator().RenameColumn(&system.SysOperaLog{}, "oper_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
+21
-6
@@ -3,24 +3,27 @@ package migrate
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
tools2 "go-admin/tools"
|
||||
"strconv"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"go-admin/cmd/migrate/migration"
|
||||
_ "go-admin/cmd/migrate/migration/version"
|
||||
_ "go-admin/cmd/migrate/migration/version-local"
|
||||
"go-admin/common/database"
|
||||
"go-admin/common/global"
|
||||
"go-admin/common/models"
|
||||
"go-admin/pkg/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
var (
|
||||
configYml string
|
||||
generate bool
|
||||
goAdmin bool
|
||||
StartCmd = &cobra.Command{
|
||||
Use: "migrate",
|
||||
Short: "Initialize the database",
|
||||
@@ -34,16 +37,20 @@ var (
|
||||
func init() {
|
||||
StartCmd.PersistentFlags().StringVarP(&configYml, "config", "c", "config/settings.yml", "Start server with provided configuration file")
|
||||
StartCmd.PersistentFlags().BoolVarP(&generate, "generate", "g", false, "generate migration file")
|
||||
StartCmd.PersistentFlags().BoolVarP(&goAdmin, "goAdmin", "a", false, "generate go-admin migration file")
|
||||
}
|
||||
|
||||
func run() {
|
||||
usage := `start init`
|
||||
fmt.Println(usage)
|
||||
//1. 读取配置
|
||||
config.Setup(configYml)
|
||||
//2. 设置日志
|
||||
logger.Setup()
|
||||
|
||||
if !generate {
|
||||
//1. 读取配置
|
||||
config.Setup(configYml)
|
||||
//2. 设置日志
|
||||
global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus")
|
||||
global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job")
|
||||
global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request")
|
||||
_ = initDB()
|
||||
} else {
|
||||
_ = genFile()
|
||||
@@ -79,8 +86,16 @@ func genFile() error {
|
||||
}
|
||||
m := map[string]string{}
|
||||
m["GenerateTime"] = strconv.FormatInt(time.Now().UnixNano()/1e6, 10)
|
||||
m["Package"] = "version_local"
|
||||
if goAdmin {
|
||||
m["Package"] = "version"
|
||||
}
|
||||
var b1 bytes.Buffer
|
||||
err = t1.Execute(&b1, m)
|
||||
tools2.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go")
|
||||
if goAdmin {
|
||||
tools.FileCreate(b1, "./cmd/migrate/migration/version/"+m["GenerateTime"]+"_migrate.go")
|
||||
} else {
|
||||
tools.FileCreate(b1, "./cmd/migrate/migration/version-local/"+m["GenerateTime"]+"_migrate.go")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -9,10 +9,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
configYml string
|
||||
port string
|
||||
mode string
|
||||
StartCmd = &cobra.Command{
|
||||
StartCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Get version info",
|
||||
Example: "go-admin version",
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"database/sql"
|
||||
"net/http"
|
||||
|
||||
"go-admin/logger"
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
|
||||
@@ -3,7 +3,7 @@ package config
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"go-admin/logger"
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
)
|
||||
|
||||
type Conf interface {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
// +build !sqlite3
|
||||
|
||||
package database
|
||||
|
||||
// Setup 配置数据库
|
||||
func Setup(driver string) {
|
||||
dbType := driver
|
||||
if dbType == "mysql" {
|
||||
@@ -7,12 +10,6 @@ func Setup(driver string) {
|
||||
db.Setup()
|
||||
}
|
||||
|
||||
//TODO: 如果需要sqlite3请开启下面注释
|
||||
//if dbType == "sqlite3" {
|
||||
// var db = new(SqLite)
|
||||
// db.Setup()
|
||||
//}
|
||||
|
||||
if dbType == "postgres" {
|
||||
var db = new(PgSql)
|
||||
db.Setup()
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// +build sqlite3
|
||||
|
||||
package database
|
||||
|
||||
func Setup(driver string) {
|
||||
dbType := driver
|
||||
if dbType == "mysql" {
|
||||
var db = new(Mysql)
|
||||
db.Setup()
|
||||
}
|
||||
|
||||
if dbType == "sqlite3" {
|
||||
var db = new(SqLite)
|
||||
db.Setup()
|
||||
}
|
||||
|
||||
if dbType == "postgres" {
|
||||
var db = new(PgSql)
|
||||
db.Setup()
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package database
|
||||
|
||||
import "gorm.io/gorm"
|
||||
|
||||
// Database 数据库配置
|
||||
type Database interface {
|
||||
Setup()
|
||||
Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error)
|
||||
|
||||
@@ -2,9 +2,10 @@ package database
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
. "log"
|
||||
"time"
|
||||
|
||||
goAdminLogger "github.com/go-admin-team/go-admin-core/logger"
|
||||
"gorm.io/driver/mysql"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/logger"
|
||||
@@ -12,20 +13,22 @@ import (
|
||||
|
||||
"go-admin/common/config"
|
||||
"go-admin/common/global"
|
||||
goAdminLogger "go-admin/logger"
|
||||
"go-admin/common/log"
|
||||
"go-admin/tools"
|
||||
toolsConfig "go-admin/tools/config"
|
||||
)
|
||||
|
||||
// Mysql mysql配置结构体
|
||||
type Mysql struct {
|
||||
}
|
||||
|
||||
// Setup 配置步骤
|
||||
func (e *Mysql) Setup() {
|
||||
global.Source = e.GetConnect()
|
||||
global.Logger.Info(tools.Green(global.Source))
|
||||
log.Info(tools.Green(global.Source))
|
||||
db, err := sql.Open("mysql", global.Source)
|
||||
if err != nil {
|
||||
global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
}
|
||||
global.Cfg.SetDb(&config.DBConfig{
|
||||
Driver: "mysql",
|
||||
@@ -37,18 +40,18 @@ func (e *Mysql) Setup() {
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
log.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
} else {
|
||||
global.Logger.Info(tools.Green(e.GetDriver() + " connect success !"))
|
||||
log.Info(tools.Green(e.GetDriver() + " connect success !"))
|
||||
}
|
||||
|
||||
if global.Eloquent.Error != nil {
|
||||
global.Logger.Fatal(tools.Red(" database error :"), global.Eloquent.Error)
|
||||
log.Fatal(tools.Red(" database error :"), global.Eloquent.Error)
|
||||
}
|
||||
|
||||
if toolsConfig.LoggerConfig.EnabledDB {
|
||||
global.Eloquent.Logger = logger.New(
|
||||
log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags),
|
||||
New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags),
|
||||
logger.Config{
|
||||
SlowThreshold: time.Second,
|
||||
Colorful: true,
|
||||
@@ -58,16 +61,17 @@ func (e *Mysql) Setup() {
|
||||
}
|
||||
}
|
||||
|
||||
// 打开数据库连接
|
||||
// Open 打开数据库连接
|
||||
func (e *Mysql) Open(db *sql.DB, cfg *gorm.Config) (*gorm.DB, error) {
|
||||
return gorm.Open(mysql.New(mysql.Config{Conn: db}), cfg)
|
||||
}
|
||||
|
||||
// 获取数据库连接
|
||||
// GetConnect 获取数据库连接
|
||||
func (e *Mysql) GetConnect() string {
|
||||
return toolsConfig.DatabaseConfig.Source
|
||||
}
|
||||
|
||||
// GetDriver 获取连接
|
||||
func (e *Mysql) GetDriver() string {
|
||||
return toolsConfig.DatabaseConfig.Driver
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ package database
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"log"
|
||||
"go-admin/common/log"
|
||||
. "log"
|
||||
"time"
|
||||
|
||||
"gorm.io/driver/postgres"
|
||||
@@ -10,9 +11,9 @@ import (
|
||||
"gorm.io/gorm/logger"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
goAdminLogger "github.com/go-admin-team/go-admin-core/logger"
|
||||
"go-admin/common/config"
|
||||
"go-admin/common/global"
|
||||
goAdminLogger "go-admin/logger"
|
||||
"go-admin/tools"
|
||||
toolsConfig "go-admin/tools/config"
|
||||
)
|
||||
@@ -24,7 +25,7 @@ func (e *PgSql) Setup() {
|
||||
var err error
|
||||
|
||||
global.Source = e.GetConnect()
|
||||
log.Println(global.Source)
|
||||
log.Info(global.Source)
|
||||
db, err := sql.Open("postgresql", global.Source)
|
||||
if err != nil {
|
||||
global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
@@ -41,7 +42,7 @@ func (e *PgSql) Setup() {
|
||||
if err != nil {
|
||||
log.Fatalf("%s connect error %v", e.GetDriver(), err)
|
||||
} else {
|
||||
log.Printf("%s connect success!", e.GetDriver())
|
||||
log.Infof("%s connect success!", e.GetDriver())
|
||||
}
|
||||
|
||||
if global.Eloquent.Error != nil {
|
||||
@@ -50,7 +51,7 @@ func (e *PgSql) Setup() {
|
||||
|
||||
if toolsConfig.LoggerConfig.EnabledDB {
|
||||
global.Eloquent.Logger = logger.New(
|
||||
log.New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", log.LstdFlags),
|
||||
New(goAdminLogger.DefaultLogger.Options().Out, "\r\n", LstdFlags),
|
||||
logger.Config{
|
||||
SlowThreshold: time.Second,
|
||||
Colorful: true,
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"log"
|
||||
"database/sql"
|
||||
. "log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -12,8 +13,11 @@ import (
|
||||
"gorm.io/gorm/logger"
|
||||
"gorm.io/gorm/schema"
|
||||
|
||||
"go-admin/common/config"
|
||||
"go-admin/common/global"
|
||||
"go-admin/tools/config"
|
||||
"go-admin/common/log"
|
||||
"go-admin/tools"
|
||||
toolsConfig "go-admin/tools/config"
|
||||
)
|
||||
|
||||
type SqLite struct {
|
||||
@@ -23,8 +27,16 @@ func (e *SqLite) Setup() {
|
||||
var err error
|
||||
|
||||
global.Source = e.GetConnect()
|
||||
log.Println(global.Source)
|
||||
global.Eloquent, err = e.Open(e.GetDriver(), &gorm.Config{
|
||||
log.Info(global.Source)
|
||||
db, err := sql.Open("sqlite3", global.Source)
|
||||
if err != nil {
|
||||
global.Logger.Fatal(tools.Red(e.GetDriver()+" connect error :"), err)
|
||||
}
|
||||
global.Cfg.SetDb(&config.DBConfig{
|
||||
Driver: "sqlite3",
|
||||
DB: db,
|
||||
})
|
||||
global.Eloquent, err = e.Open(e.GetConnect(), &gorm.Config{
|
||||
NamingStrategy: schema.NamingStrategy{
|
||||
SingularTable: true,
|
||||
},
|
||||
@@ -33,32 +45,33 @@ func (e *SqLite) Setup() {
|
||||
if err != nil {
|
||||
log.Fatalf("%s connect error %v", e.GetDriver(), err)
|
||||
} else {
|
||||
log.Printf("%s connect success!", e.GetDriver())
|
||||
log.Infof("%s connect success!", e.GetDriver())
|
||||
}
|
||||
|
||||
if global.Eloquent.Error != nil {
|
||||
log.Fatalf("database error %v", global.Eloquent.Error)
|
||||
}
|
||||
|
||||
if config.LoggerConfig.EnabledDB {
|
||||
global.Eloquent.Logger = logger.New(log.New(os.Stdout, "\r\n", log.LstdFlags), logger.Config{
|
||||
SlowThreshold: time.Second,
|
||||
Colorful: true,
|
||||
LogLevel: logger.Info,
|
||||
})
|
||||
if toolsConfig.LoggerConfig.EnabledDB {
|
||||
global.Eloquent.Logger = logger.New(
|
||||
New(os.Stdout, "\r\n", LstdFlags), logger.Config{
|
||||
SlowThreshold: time.Second,
|
||||
Colorful: true,
|
||||
LogLevel: logger.Info,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// 打开数据库连接
|
||||
func (*SqLite) Open(conn string, cfg *gorm.Config) (db *gorm.DB, err error) {
|
||||
eloquent, err := gorm.Open(sqlite.Open(conn), cfg)
|
||||
return eloquent, err
|
||||
return gorm.Open(sqlite.Open(conn), cfg)
|
||||
}
|
||||
|
||||
func (e *SqLite) GetConnect() string {
|
||||
return config.DatabaseConfig.Source
|
||||
return toolsConfig.DatabaseConfig.Source
|
||||
}
|
||||
|
||||
func (e *SqLite) GetDriver() string {
|
||||
return config.DatabaseConfig.Driver
|
||||
return toolsConfig.DatabaseConfig.Driver
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package dto
|
||||
import (
|
||||
"go-admin/tools/config"
|
||||
|
||||
"github.com/matchstalk/go-admin-core/search"
|
||||
"github.com/go-admin-team/go-admin-core/search"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
|
||||
@@ -3,15 +3,16 @@ package global
|
||||
import (
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gogf/gf/os/glog"
|
||||
"github.com/robfig/cron/v3"
|
||||
"go-admin/common/config"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/common/config"
|
||||
"go-admin/pkg/logger"
|
||||
)
|
||||
|
||||
const (
|
||||
// go-admin Version Info
|
||||
Version = "1.2.1"
|
||||
Version = "1.2.2"
|
||||
)
|
||||
|
||||
var Cfg config.Conf = config.DefaultConfig()
|
||||
@@ -29,7 +30,7 @@ var (
|
||||
)
|
||||
|
||||
var (
|
||||
Logger *glog.Logger
|
||||
JobLogger *glog.Logger
|
||||
RequestLogger *glog.Logger
|
||||
Logger = &logger.Logger{}
|
||||
JobLogger = &logger.Logger{}
|
||||
RequestLogger = &logger.Logger{}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package global
|
||||
|
||||
import (
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/casbin/casbin/v2/log"
|
||||
)
|
||||
|
||||
func LoadPolicy() (*casbin.SyncedEnforcer, error) {
|
||||
if err := CasbinEnforcer.LoadPolicy(); err == nil {
|
||||
return CasbinEnforcer, err
|
||||
} else {
|
||||
log.LogPrintf("casbin rbac_model or policy init error, message: %v \r\n", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package global
|
||||
|
||||
// LogoContent go-admin ascii显示,减少静态文件依赖
|
||||
var LogoContent = []byte{10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 95, 95, 95, 95, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 32, 32, 32, 32, 32, 32, 32, 32, 44, 39, 32, 32, 44, 32, 96, 46, 32, 32, 44, 45, 45, 44, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 46, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 46, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 46, 39, 124, 32, 32, 32, 32, 32, 44, 45, 43, 45, 44, 46, 39, 32, 95, 32, 124, 44, 45, 45, 46, 39, 124, 32, 32, 32, 32, 32, 32, 32, 32, 32, 44, 45, 45, 45, 44, 10, 32, 32, 44, 45, 45, 45, 45, 46, 95, 44, 46, 32, 32, 39, 32, 32, 32, 44, 39, 92, 32, 32, 32, 44, 39, 32, 32, 46, 39, 32, 124, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 32, 124, 32, 58, 32, 32, 44, 45, 43, 45, 46, 32, 59, 32, 32, 32, 44, 32, 124, 124, 124, 32, 32, 124, 44, 32, 32, 32, 32, 32, 32, 44, 45, 43, 45, 46, 32, 47, 32, 32, 124, 10, 32, 47, 32, 32, 32, 47, 32, 32, 39, 32, 47, 32, 47, 32, 32, 32, 47, 32, 32, 32, 124, 44, 45, 45, 45, 46, 39, 32, 32, 32, 44, 32, 44, 45, 45, 46, 45, 45, 46, 32, 32, 32, 32, 32, 32, 124, 32, 32, 32, 124, 32, 124, 32, 44, 45, 45, 46, 39, 124, 39, 32, 32, 32, 124, 32, 32, 124, 124, 96, 45, 45, 39, 95, 32, 32, 32, 32, 32, 44, 45, 45, 46, 39, 124, 39, 32, 32, 32, 124, 10, 124, 32, 32, 32, 58, 32, 32, 32, 32, 32, 124, 46, 32, 32, 32, 59, 32, 44, 46, 32, 58, 124, 32, 32, 32, 124, 32, 32, 32, 32, 124, 47, 32, 32, 32, 32, 32, 32, 32, 92, 32, 32, 32, 44, 45, 45, 46, 95, 95, 124, 32, 124, 124, 32, 32, 32, 124, 32, 32, 44, 39, 44, 32, 124, 32, 32, 124, 44, 44, 39, 32, 44, 39, 124, 32, 32, 32, 124, 32, 32, 32, 124, 32, 32, 44, 34, 39, 32, 124, 10, 124, 32, 32, 32, 124, 32, 46, 92, 32, 32, 46, 39, 32, 32, 32, 124, 32, 124, 58, 32, 58, 58, 32, 32, 32, 58, 32, 32, 46, 39, 46, 45, 45, 46, 32, 32, 46, 45, 46, 32, 124, 32, 47, 32, 32, 32, 44, 39, 32, 32, 32, 124, 124, 32, 32, 32, 124, 32, 47, 32, 32, 124, 32, 124, 45, 45, 39, 32, 39, 32, 32, 124, 32, 124, 32, 32, 32, 124, 32, 32, 32, 124, 32, 47, 32, 32, 124, 32, 124, 10, 46, 32, 32, 32, 59, 32, 39, 59, 32, 32, 124, 39, 32, 32, 32, 124, 32, 46, 59, 32, 58, 58, 32, 32, 32, 124, 46, 39, 32, 32, 32, 92, 95, 95, 92, 47, 58, 32, 46, 32, 46, 46, 32, 32, 32, 39, 32, 32, 47, 32, 32, 124, 124, 32, 32, 32, 58, 32, 124, 32, 32, 124, 32, 44, 32, 32, 32, 32, 124, 32, 32, 124, 32, 58, 32, 32, 32, 124, 32, 32, 32, 124, 32, 124, 32, 32, 124, 32, 124, 10, 39, 32, 32, 32, 46, 32, 32, 32, 46, 32, 124, 124, 32, 32, 32, 58, 32, 32, 32, 32, 124, 96, 45, 45, 45, 39, 32, 32, 32, 32, 32, 44, 34, 32, 46, 45, 45, 46, 59, 32, 124, 39, 32, 32, 32, 59, 32, 124, 58, 32, 32, 124, 124, 32, 32, 32, 58, 32, 124, 32, 32, 124, 47, 32, 32, 32, 32, 32, 39, 32, 32, 58, 32, 124, 95, 95, 32, 124, 32, 32, 32, 124, 32, 124, 32, 32, 124, 47, 10, 32, 96, 45, 45, 45, 96, 45, 39, 124, 32, 124, 32, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 47, 32, 32, 47, 32, 32, 44, 46, 32, 32, 124, 124, 32, 32, 32, 124, 32, 39, 47, 32, 32, 39, 124, 32, 32, 32, 124, 32, 124, 96, 45, 39, 32, 32, 32, 32, 32, 32, 124, 32, 32, 124, 32, 39, 46, 39, 124, 124, 32, 32, 32, 124, 32, 124, 45, 45, 39, 10, 32, 46, 39, 95, 95, 47, 92, 95, 58, 32, 124, 32, 32, 96, 45, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 32, 58, 32, 32, 32, 46, 39, 32, 32, 32, 92, 32, 32, 32, 58, 32, 32, 32, 32, 58, 124, 124, 32, 32, 32, 59, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 59, 32, 32, 58, 32, 32, 32, 32, 59, 124, 32, 32, 32, 124, 47, 10, 32, 124, 32, 32, 32, 58, 32, 32, 32, 32, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 44, 32, 32, 32, 32, 32, 46, 45, 46, 47, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 39, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 124, 32, 32, 44, 32, 32, 32, 47, 32, 39, 45, 45, 45, 39, 10, 32, 32, 92, 32, 32, 32, 92, 32, 32, 47, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 96, 45, 45, 96, 45, 45, 45, 39, 32, 32, 32, 32, 32, 96, 45, 45, 45, 45, 39, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 45, 96, 45, 39, 10, 32, 32, 32, 96, 45, 45, 96, 45, 39, 10}
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package log
|
||||
|
||||
import "go-admin/logger"
|
||||
import "github.com/go-admin-team/go-admin-core/logger"
|
||||
|
||||
var (
|
||||
// Trace trace级日志输出
|
||||
Trace = logger.Trace
|
||||
// Trace trace级日志输出
|
||||
// Tracef trace级日志输出
|
||||
Tracef = logger.Tracef
|
||||
// Debug debug级日志输出
|
||||
Debug = logger.Debug
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/opentracing/opentracing-go"
|
||||
)
|
||||
|
||||
// Trace 链路追踪
|
||||
func Trace() gin.HandlerFunc {
|
||||
return func(ctx *gin.Context) {
|
||||
var sp opentracing.Span
|
||||
opName := ctx.Request.URL.Path
|
||||
// Attempt to join a trace by getting trace context from the headers.
|
||||
wireContext, err := opentracing.GlobalTracer().Extract(
|
||||
opentracing.TextMap,
|
||||
opentracing.HTTPHeadersCarrier(ctx.Request.Header))
|
||||
if err != nil {
|
||||
// If for whatever reason we can't join, go ahead an start a new root span.
|
||||
sp = opentracing.StartSpan(opName)
|
||||
} else {
|
||||
sp = opentracing.StartSpan(opName, opentracing.ChildOf(wireContext))
|
||||
}
|
||||
ctx.Set("traceSpan", sp)
|
||||
ctx.Next()
|
||||
sp.Finish()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
settings:
|
||||
application:
|
||||
# dev开发环境 test测试环境 prod线上环境
|
||||
mode: dev
|
||||
# 服务器ip,默认使用 0.0.0.0
|
||||
host: 0.0.0.0
|
||||
# 服务名称
|
||||
name: testApp
|
||||
# 端口号
|
||||
port: 8000 # 服务端口号
|
||||
readtimeout: 1
|
||||
writertimeout: 2
|
||||
# 数据权限功能开关
|
||||
enabledp: false
|
||||
logger:
|
||||
# 日志存放路径
|
||||
path: temp/logs
|
||||
# 控制台日志
|
||||
stdout: true
|
||||
# 日志等级
|
||||
level: all
|
||||
# 业务日志开关
|
||||
enabledbus: true
|
||||
# 请求日志开关
|
||||
enabledreq: false
|
||||
# 数据库日志开关 dev模式,将自动开启
|
||||
enableddb: false
|
||||
# 自动任务日志开关 dev模式,将自动开启
|
||||
enabledjob: false
|
||||
jwt:
|
||||
# token 密钥,生产环境时及的修改
|
||||
secret: go-admin
|
||||
# token 过期时间 单位:秒
|
||||
timeout: 3600
|
||||
database:
|
||||
# 数据库类型 mysql,sqlite3, postgres
|
||||
driver: sqlite3
|
||||
# 数据库连接sqlite3数据文件的路径
|
||||
source: sqlite3.db
|
||||
gen:
|
||||
# 代码生成读取的数据库名称
|
||||
dbname: dbname
|
||||
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
|
||||
frontpath: ../go-admin-ui/src
|
||||
@@ -1,56 +0,0 @@
|
||||
// Package log provides debug logging
|
||||
package log
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
// Default buffer size if any
|
||||
DefaultSize = 256
|
||||
// Default formatter
|
||||
DefaultFormat = TextFormat
|
||||
)
|
||||
|
||||
// Log is debug log interface for reading and writing logs
|
||||
type Log interface {
|
||||
// Read reads log entries from the logger
|
||||
Read(...ReadOption) ([]Record, error)
|
||||
// Write writes records to log
|
||||
Write(Record) error
|
||||
// Stream log records
|
||||
Stream() (Stream, error)
|
||||
}
|
||||
|
||||
// Record is log record entry
|
||||
type Record struct {
|
||||
// Timestamp of logged event
|
||||
Timestamp time.Time `json:"timestamp"`
|
||||
// Metadata to enrich log record
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
// Value contains log entry
|
||||
Message interface{} `json:"message"`
|
||||
}
|
||||
|
||||
// Stream returns a log stream
|
||||
type Stream interface {
|
||||
Chan() <-chan Record
|
||||
Stop() error
|
||||
}
|
||||
|
||||
// Format is a function which formats the output
|
||||
type FormatFunc func(Record) string
|
||||
|
||||
// TextFormat returns text format
|
||||
func TextFormat(r Record) string {
|
||||
t := r.Timestamp.Format("2006-01-02 15:04:05")
|
||||
return fmt.Sprintf("%s %v", t, r.Message)
|
||||
}
|
||||
|
||||
// JSONFormat is a json Format func
|
||||
func JSONFormat(r Record) string {
|
||||
b, _ := json.Marshal(r)
|
||||
return string(b)
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package log
|
||||
|
||||
import "time"
|
||||
|
||||
// Option used by the logger
|
||||
type Option func(*Options)
|
||||
|
||||
// Options are logger options
|
||||
type Options struct {
|
||||
// Name of the log
|
||||
Name string
|
||||
// Size is the size of ring buffer
|
||||
Size int
|
||||
// Format specifies the output format
|
||||
Format FormatFunc
|
||||
}
|
||||
|
||||
// Name of the log
|
||||
func Name(n string) Option {
|
||||
return func(o *Options) {
|
||||
o.Name = n
|
||||
}
|
||||
}
|
||||
|
||||
// Size sets the size of the ring buffer
|
||||
func Size(s int) Option {
|
||||
return func(o *Options) {
|
||||
o.Size = s
|
||||
}
|
||||
}
|
||||
|
||||
func Format(f FormatFunc) Option {
|
||||
return func(o *Options) {
|
||||
o.Format = f
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultOptions returns default options
|
||||
func DefaultOptions() Options {
|
||||
return Options{
|
||||
Size: DefaultSize,
|
||||
}
|
||||
}
|
||||
|
||||
// ReadOptions for querying the logs
|
||||
type ReadOptions struct {
|
||||
// Since what time in past to return the logs
|
||||
Since time.Time
|
||||
// Count specifies number of logs to return
|
||||
Count int
|
||||
// Stream requests continuous log stream
|
||||
Stream bool
|
||||
}
|
||||
|
||||
// ReadOption used for reading the logs
|
||||
type ReadOption func(*ReadOptions)
|
||||
|
||||
// Since sets the time since which to return the log records
|
||||
func Since(s time.Time) ReadOption {
|
||||
return func(o *ReadOptions) {
|
||||
o.Since = s
|
||||
}
|
||||
}
|
||||
|
||||
// Count sets the number of log records to return
|
||||
func Count(c int) ReadOption {
|
||||
return func(o *ReadOptions) {
|
||||
o.Count = c
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
"contact": {},
|
||||
"license": {
|
||||
"name": "MIT",
|
||||
"url": "https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md"
|
||||
"url": "https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
},
|
||||
|
||||
+7
-2
@@ -1,3 +1,5 @@
|
||||
// +build examples
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -10,6 +12,7 @@ import (
|
||||
"go-admin/common/global"
|
||||
mycasbin "go-admin/pkg/casbin"
|
||||
"go-admin/pkg/logger"
|
||||
"go-admin/tools/config"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -18,8 +21,10 @@ func main() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mycasbin.Setup()
|
||||
logger.Setup()
|
||||
global.CasbinEnforcer = mycasbin.Setup(global.Eloquent, "sys_")
|
||||
global.Logger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "bus")
|
||||
global.JobLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "job")
|
||||
global.RequestLogger.Logger = logger.SetupLogger(config.LoggerConfig.Path, "request")
|
||||
global.GinEngine = gin.Default()
|
||||
//router.InitRouter()
|
||||
log.Fatal(global.GinEngine.Run(":8000"))
|
||||
|
||||
@@ -9,21 +9,23 @@ require (
|
||||
github.com/casbin/gorm-adapter/v3 v3.0.2
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/gin-gonic/gin v1.6.3
|
||||
github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4
|
||||
github.com/go-redis/redis/v7 v7.4.0
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/gogf/gf v1.13.4
|
||||
github.com/google/uuid v1.1.1
|
||||
github.com/google/uuid v1.1.2
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/matchstalk/go-admin-core v1.2.0
|
||||
github.com/matchstalk/redisqueue v1.0.3
|
||||
github.com/mojocn/base64Captcha v1.3.1
|
||||
github.com/mssola/user_agent v0.5.2
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/opentracing/basictracer-go v1.1.0 // indirect
|
||||
github.com/opentracing/opentracing-go v1.1.0
|
||||
github.com/prometheus/client_golang v1.1.0
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/satori/go.uuid v1.2.0
|
||||
github.com/shamsher31/goimgext v1.0.0 // indirect
|
||||
github.com/shamsher31/goimgtype v1.0.0
|
||||
github.com/shirou/gopsutil v2.20.7+incompatible
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546 // indirect
|
||||
github.com/spf13/cast v1.3.1
|
||||
github.com/spf13/cobra v1.0.0
|
||||
github.com/spf13/viper v1.7.1
|
||||
@@ -35,4 +37,6 @@ require (
|
||||
gorm.io/driver/postgres v0.2.9
|
||||
gorm.io/driver/sqlite v1.0.9
|
||||
gorm.io/gorm v1.20.1
|
||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
|
||||
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 // indirect
|
||||
)
|
||||
|
||||
@@ -28,7 +28,6 @@ github.com/Azure/go-autorest/autorest/to v0.2.0/go.mod h1:GunWKJp1AEqgMaGLV+iocm
|
||||
github.com/Azure/go-autorest/autorest/validation v0.1.0/go.mod h1:Ha3z/SqBeaalWQvokg3NZAlQTalVMtOIAs1aGK7G6u8=
|
||||
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
|
||||
github.com/Azure/go-autorest/tracing v0.1.0/go.mod h1:ROEEAFwXycQw7Sn3DXNtEedEvdeRAgDr0izn4z5Ij88=
|
||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible h1:1G1pk05UrOh0NlF1oeaaix1x8XzrfjIDK47TY0Zehcw=
|
||||
@@ -37,7 +36,6 @@ github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw=
|
||||
github.com/Microsoft/hcsshim v0.8.7-0.20191101173118-65519b62243c/go.mod h1:7xhjOwRV2+0HXGmM0jxaEu+ZiXJFoVZOTfL/dmqbrD8=
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
|
||||
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks=
|
||||
@@ -49,7 +47,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
|
||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.0/go.mod h1:zpDJeKyp9ScW4NNrbdr+Eyxvry3ilGPewKoXw3XGN1k=
|
||||
github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod h1:uAXEEpARkRhCZfEvy/y0Jcc888f9tHCc1W7/UeEtreE=
|
||||
@@ -75,14 +72,14 @@ github.com/aws/aws-sdk-go v1.23.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod h1:AuiFmCCPBSrqvVMvuqFuk0qogytodnVFVSN5CeJB8Gc=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA=
|
||||
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||
github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
|
||||
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
|
||||
github.com/bsm/redislock v0.5.0 h1:ODM11/cbuUXQqLgZWK6XQnufaTjsBE2UcwBc2EAFNDA=
|
||||
github.com/bsm/redislock v0.5.0/go.mod h1:qagqKlV+xiLy26iV34Y3zRPxRcJjQYbV7pZfWFeSZ8M=
|
||||
github.com/bsm/redislock v0.6.0/go.mod h1:3Kgu+cXw0JrkZ5pmY/JbcFpixGZ5M9v9G2PGWYqku+k=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/bwmarrin/discordgo v0.20.2/go.mod h1:O9S4p+ofTFwB02em7jkpkV8M3R0/PUVOwN61zSZ0r4Q=
|
||||
github.com/caddyserver/certmagic v0.10.6/go.mod h1:Y8jcUBctgk/IhpAzlHKfimZNyXCkfGgRTC0orl8gROQ=
|
||||
@@ -95,12 +92,10 @@ github.com/cenkalti/backoff/v4 v4.0.0/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
|
||||
github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28 h1:LdXxtjzvZYhhUaonAaAKArG3pyC67kGL3YY+6hGG8G4=
|
||||
github.com/clbanning/mxj v1.8.5-0.20200714211355-ff02cfb8ea28/go.mod h1:BVjHeAH+rl9rs6f+QIpeRl0tfu10SXn1pUSa5PVGJng=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/cloudflare-go v0.10.2/go.mod h1:qhVI5MKwBGhdNU89ZRz2plgYutcJ5PCekLxXn56w6SY=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
|
||||
github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko=
|
||||
github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw=
|
||||
@@ -124,19 +119,16 @@ github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpu/goacmedns v0.0.1/go.mod h1:sesf/pNnCYwUevQEQfEwY0Y3DydlQWSGZbaMElOWxok=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9 h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc h1:VRRKCwnzqk8QCaRC4os14xoKDdbHqqlJtJA0oc1ZAjg=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
|
||||
github.com/dnaeon/go-vcr v0.0.0-20180814043457-aafff18a5cc2/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
|
||||
@@ -157,16 +149,15 @@ github.com/evanphx/json-patch/v5 v5.0.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2Vvl
|
||||
github.com/exoscale/egoscale v0.18.1/go.mod h1:Z7OOdzzTOz1Q1PjQXumlz9Wn/CddH0zSYdCF3rnBKXE=
|
||||
github.com/fastly/go-utils v0.0.0-20180712184237-d95a45783239/go.mod h1:Gdwt2ce0yfBxPvZrHkprdPPTTS3N5rwmLE8T22KBXlw=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/forestgiant/sliceutil v0.0.0-20160425183142-94783f95db6c/go.mod h1:pFdJbAhRf7rh6YYMUdIQGyzne6zYL1tCUW8QV2B3UfY=
|
||||
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsouza/go-dockerclient v1.6.0/go.mod h1:YWwtNPuL4XTX1SKJQk86cWPmmqwx+4np9qfPbb+znGc=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gin-contrib/gzip v0.0.1 h1:ezvKOL6jH+jlzdHNE4h9h8q8uMpDQjyl0NN0Jd7jozc=
|
||||
github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
|
||||
github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
||||
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
|
||||
@@ -177,10 +168,11 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/
|
||||
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
|
||||
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
|
||||
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
|
||||
github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0 h1:rdQovo0JtjoBTUQzzrTqnXxxFi4etuhvXrUZHwI9z7w=
|
||||
github.com/git-chglog/git-chglog v0.0.0-20190923122001-6050f20bcdb0/go.mod h1:Dcsy1kii/xFyNad5JqY/d0GO5mu91sungp5xotbm3Yk=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/go-acme/lego/v3 v3.4.0/go.mod h1:xYbLDuxq3Hy4bMUT1t9JIuz6GWIWb3m5X+TeTHYaT7M=
|
||||
github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4 h1:H7SmWlvnE2HGoKmPlsJwTYVMBEvw/9acP2UBuNzbx1g=
|
||||
github.com/go-admin-team/go-admin-core v1.2.2-0.20201029090859-1e8f5a438cf4/go.mod h1:uDLyMASlSXDnFD34V1U0w8tDaBdstc/JM3xhi+eGIEk=
|
||||
github.com/go-cmd/cmd v1.0.5/go.mod h1:y8q8qlK5wQibcw63djSl/ntiHUHXHGdCkPk0j4QeW4s=
|
||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
@@ -189,11 +181,11 @@ github.com/go-git/go-git-fixtures/v4 v4.0.1/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1
|
||||
github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJAozQrZuyM=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-ini/ini v1.44.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
|
||||
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
|
||||
github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M=
|
||||
github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg=
|
||||
@@ -211,7 +203,6 @@ github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/
|
||||
github.com/go-openapi/swag v0.19.2/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
|
||||
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
|
||||
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
|
||||
@@ -221,11 +212,10 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87
|
||||
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
|
||||
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
|
||||
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
|
||||
github.com/go-redis/redis v6.15.7+incompatible h1:3skhDh95XQMpnqeqNftPkQD9jL9e5e36z/1SUm6dy1U=
|
||||
github.com/go-redis/redis v6.15.7+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
|
||||
github.com/go-redis/redis/v7 v7.2.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
|
||||
github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4=
|
||||
github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg=
|
||||
github.com/go-redis/redis/v8 v8.1.0/go.mod h1:isLoQT/NFSP7V67lyvM9GmdvLdyZ7pEhsXvvyQtnQTo=
|
||||
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
|
||||
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
@@ -234,13 +224,11 @@ github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22
|
||||
github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
|
||||
github.com/gobwas/ws v1.0.3/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM=
|
||||
github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
|
||||
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||
github.com/gogf/gf v1.13.4 h1:+IWX/L/SNYjwp9C0tXABZ8vJfYaFKyx0cTAb2DE2a1Y=
|
||||
github.com/gogf/gf v1.13.4/go.mod h1:dGX0/BElXDBYbdJGascqfrWScj8IMeOietDjVD6/5Fc=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
||||
github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
@@ -257,51 +245,46 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
|
||||
github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0=
|
||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gophercloud/gophercloud v0.3.0/go.mod h1:vxM41WHh5uqHVBMZHzuwNOHh8XEoIEcSTewFxm1c5g8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gqcn/structs v1.1.1 h1:cyzGRwfmn3d1d54fwW3KUNyG9QxR0ldIeqwFGeBt638=
|
||||
github.com/gqcn/structs v1.1.1/go.mod h1:/aBhTBSsKQ2Ec9pbnYdGphtdWXHFn4KrCL0fXM/Adok=
|
||||
github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf h1:wIOAyJMMen0ELGiFzlmqxdcV1yGbkyHBAB6PolcNbLA=
|
||||
github.com/grokify/html-strip-tags-go v0.0.0-20190921062105-daaa06bf1aaf/go.mod h1:2Su6romC5/1VXOQMaWL2yb618ARB8iVo6/DR99A6d78=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
@@ -337,16 +320,11 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ=
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df/go.mod h1:QMZY7/J/KSQEhKWFeDesPjMj+wCHReeknARU3wqlyN4=
|
||||
github.com/imdario/mergo v0.3.8 h1:CGgOkSJeqMRmt0D9XLWExdT4m4F1vd3FV3VPt+0VxkQ=
|
||||
github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
|
||||
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
|
||||
github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
|
||||
@@ -359,13 +337,11 @@ github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsU
|
||||
github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk=
|
||||
github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
|
||||
github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
|
||||
github.com/jackc/pgconn v1.6.1 h1:lwofaXKPbIx6qEaK8mNm7uZuOwxHw+PnAFGDsDFpkRI=
|
||||
github.com/jackc/pgconn v1.6.1/go.mod h1:g8mKMqmSUO6AzAvha7vy07g1rbGOlc7iF0nU0ei83hc=
|
||||
github.com/jackc/pgconn v1.6.4 h1:S7T6cx5o2OqmxdHaXLH1ZeD1SbI8jBznyYE9Ec0RCQ8=
|
||||
github.com/jackc/pgconn v1.6.4/go.mod h1:w2pne1C2tZgP+TvjqLpOigGzNqjBgQW9dUw/4Chex78=
|
||||
github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
|
||||
github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
|
||||
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA=
|
||||
github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
@@ -378,7 +354,6 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:
|
||||
github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgproto3/v2 v2.0.2 h1:q1Hsy66zh4vuNsajBUF2PNqfAMMfxU5mk594lPE9vjY=
|
||||
github.com/jackc/pgproto3/v2 v2.0.2/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8 h1:Q3tB+ExeflWUW7AFcAhXqk40s9mnNYLk1nOkKNZ5GnU=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
|
||||
@@ -388,7 +363,6 @@ github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrU
|
||||
github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0=
|
||||
github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po=
|
||||
github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ=
|
||||
github.com/jackc/pgtype v1.4.0 h1:pHQfb4jh9iKqHyxPthq1fr+0HwSNIl3btYPbw2m2lbM=
|
||||
github.com/jackc/pgtype v1.4.0/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig=
|
||||
github.com/jackc/pgtype v1.4.2 h1:t+6LWm5eWPLX1H5Se702JSBcirq6uWa4jiG4wV1rAWY=
|
||||
github.com/jackc/pgtype v1.4.2/go.mod h1:JCULISAZBFGrHaOXIIFiyfzW5VY0GRitRr8NeJsrdig=
|
||||
@@ -398,7 +372,6 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ
|
||||
github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA=
|
||||
github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o=
|
||||
github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg=
|
||||
github.com/jackc/pgx/v4 v4.7.1 h1:aqUSOcStk6fik+lSE+tqfFhvt/EwT8q/oMtJbP9CjXI=
|
||||
github.com/jackc/pgx/v4 v4.7.1/go.mod h1:nu42q3aPjuC1M0Nak4bnoprKlXPINqopEKqbq5AZSC4=
|
||||
github.com/jackc/pgx/v4 v4.8.1 h1:SUbCLP2pXvf/Sr/25KsuI4aTxiFYIvpfk4l6aTSdyCw=
|
||||
github.com/jackc/pgx/v4 v4.8.1/go.mod h1:4HOLxrl8wToZJReD04/yB20GDwf4KBYETvlHciCnwW0=
|
||||
@@ -419,13 +392,9 @@ github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
|
||||
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
@@ -436,17 +405,13 @@ github.com/kolo/xmlrpc v0.0.0-20190717152603-07c4ee3fd181/go.mod h1:o03bZfuBwAXH
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.4/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
|
||||
github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
|
||||
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/labbsr0x/bindman-dns-webhook v1.0.2/go.mod h1:p6b+VCXIR8NYKpDr8/dg1HKfQoRHCdcsROXKvmoehKA=
|
||||
github.com/labbsr0x/goh v1.0.1/go.mod h1:8K2UhVoaWXcCU7Lxoa2omWnC8gyW8px7/lmO61c027w=
|
||||
@@ -461,7 +426,6 @@ github.com/lestrrat/go-strftime v0.0.0-20180220042222-ba3bf9c1d042/go.mod h1:TPp
|
||||
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
|
||||
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
|
||||
github.com/linode/linodego v0.10.0/go.mod h1:cziNP7pbvE3mXIPneHj0oRY8L1WtGEIKlZ8LANE4eXA=
|
||||
github.com/liquidweb/liquidweb-go v1.6.0/go.mod h1:UDcVnAMDkZxpw4Y7NOHkqoeiGacVLEIG/i5J9cyixzQ=
|
||||
@@ -476,15 +440,11 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
|
||||
github.com/marten-seemann/chacha20 v0.2.0/go.mod h1:HSdjFau7GzYRj+ahFNwsO3ouVJr1HFkWoEwNDb4TMtE=
|
||||
github.com/marten-seemann/qpack v0.1.0/go.mod h1:LFt1NU/Ptjip0C2CPkhimBz5CGE3WGDAUWqna+CNTrI=
|
||||
github.com/marten-seemann/qtls v0.4.1/go.mod h1:pxVXcHHw1pNIt8Qo0pwSYQEoZ8yYOOPXTCZLQQunvRc=
|
||||
github.com/matchstalk/go-admin-core v1.2.0 h1:yk8bnH7dVGDgyEliG2MchSyupdh24wc0sDUrxnu8sGY=
|
||||
github.com/matchstalk/go-admin-core v1.2.0/go.mod h1:iCxDnmPHR3+d/5Q+yrdt+QBXhmWhbj7+GeHcUjD9Rn8=
|
||||
github.com/matchstalk/redisqueue v1.0.3 h1:ZRrEhnvA6/YxLu2EbzdZYeQHQQYT8yZBAi1qv/USEQA=
|
||||
github.com/matchstalk/redisqueue v1.0.3/go.mod h1:5DZ3X4w9t+6Wv9vz9wmUt/i15gsOorGXRnqzGhBP6zI=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
@@ -498,15 +458,12 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-sqlite3 v1.14.0 h1:mLyGNKR8+Vv9CAU7PphKa2hkEqxxhn8i32J6FPj1/QA=
|
||||
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
|
||||
github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE=
|
||||
github.com/mattn/goveralls v0.0.5 h1:spfq8AyZ0cCk57Za6/juJ5btQxeE1FaEGMdfcI+XO48=
|
||||
github.com/mattn/goveralls v0.0.5/go.mod h1:Xg2LHi51faXLyKXwsndxiW6uxEEQT9+3sjGzzwU4xy0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
|
||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/micro/cli/v2 v2.1.2/go.mod h1:EguNh6DAoWKm9nmk+k/Rg0H3lQnDxqzu5x5srOtGtYg=
|
||||
github.com/micro/go-micro/v2 v2.9.1/go.mod h1:x55ZM3Puy0FyvvkR3e0ha0xsE9DFwfPSUMWAIbFY0SY=
|
||||
@@ -525,10 +482,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F
|
||||
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0=
|
||||
github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY=
|
||||
@@ -545,26 +500,27 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
|
||||
github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s=
|
||||
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nlopes/slack v0.6.1-0.20191106133607-d06c2a2b3249/go.mod h1:JzQ9m3PMAqcpeCam7UaHSuBuupz7CmpjehYMayT6YOk=
|
||||
github.com/nrdcg/auroradns v1.0.0/go.mod h1:6JPXKzIRzZzMqtTDgueIhTi6rFf1QvYE/HzqidhOhjw=
|
||||
github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ=
|
||||
github.com/nrdcg/goinwx v0.6.1/go.mod h1:XPiut7enlbEdntAqalBIqcYcTEVhpv/dKWgDCX2SwKQ=
|
||||
github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/olekukonko/tablewriter v0.0.1 h1:b3iUnf1v+ppJiOfNX4yxxqfWKMQPZR5yoh8urCTFX88=
|
||||
github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=
|
||||
github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.14.1/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg=
|
||||
github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.10.2/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
|
||||
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
|
||||
@@ -572,6 +528,9 @@ github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5X
|
||||
github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
|
||||
github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||
github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs=
|
||||
github.com/opentracing/basictracer-go v1.1.0 h1:Oa1fTSBvAl8pa3U+IJYqrKm0NALwH9OsgwOqDv4xJW0=
|
||||
github.com/opentracing/basictracer-go v1.1.0/go.mod h1:V2HZueSJEp879yv285Aap1BS69fQMD+MNP1mRs6mBQc=
|
||||
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
|
||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
||||
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
|
||||
github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
|
||||
@@ -586,28 +545,31 @@ github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
||||
github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8=
|
||||
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/common v0.6.0 h1:kRhiuYSXR3+uv2IbVbZhUxK5zVD/2pp3Gd2PpvPkpEo=
|
||||
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||
github.com/prometheus/procfs v0.0.5 h1:3+auTFlqw+ZaQYJARz6ArODtkaIwtvBTx3N2NehQlL8=
|
||||
github.com/prometheus/procfs v0.0.5/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDaekg4FpcdQ=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA=
|
||||
@@ -619,7 +581,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
|
||||
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
|
||||
github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
|
||||
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
|
||||
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sacloud/libsacloud v1.26.1/go.mod h1:79ZwATmHLIFZIMd7sxA3LwzVy/B77uj3LDoToVTxDoQ=
|
||||
@@ -635,18 +596,16 @@ github.com/shirou/gopsutil v2.19.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMT
|
||||
github.com/shirou/gopsutil v2.20.7+incompatible h1:Ymv4OD12d6zm+2yONe39VSmp2XooJe8za7ngOLW/o/w=
|
||||
github.com/shirou/gopsutil v2.20.7+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY=
|
||||
github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
|
||||
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/skratchdot/open-golang v0.0.0-20160302144031-75fb7ed4208c/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
@@ -666,14 +625,13 @@ github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk=
|
||||
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E=
|
||||
@@ -690,7 +648,6 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20200122045848-3419fae592fc/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/toolkits/concurrent v0.0.0-20150624120057-a4371d70e3e3/go.mod h1:QDlpd3qS71vYtakd2hmdpqhJ9nwv6mD6A30bQ1BPBFE=
|
||||
github.com/transip/gotransip v0.0.0-20190812104329-6d8d9179b66f/go.mod h1:i0f4R4o2HM0m3DZYQWsj6/MEowD57VzoH0v3d7igeFY=
|
||||
github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df h1:Y2l28Jr3vOEeYtxfVbMtVfOdAwuUqWaP9fvNKiBVeXY=
|
||||
github.com/tsuyoshiwada/go-gitcmd v0.0.0-20180205145712-5f1f5f9475df/go.mod h1:pnyouUty/nBr/zm3GYwTIt+qFTLWbdjeLjZmJdzJOu8=
|
||||
github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=
|
||||
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
|
||||
@@ -706,10 +663,8 @@ github.com/unrolled/secure v1.0.8/go.mod h1:fO+mEan+FLB0CdEnHf6Q4ZZVNqG+5fuLFnP8
|
||||
github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli v1.22.3 h1:FpNT6zq26xNpHZy08emi755QwzLPs6Pukqjlc7RfOMU=
|
||||
github.com/urfave/cli v1.22.3/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
|
||||
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
|
||||
github.com/urfave/negroni v1.0.0 h1:kIimOitoypq34K7TG7DUaJ9kq/N4Ofuwi1sjz0KipXc=
|
||||
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
@@ -730,6 +685,7 @@ go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
@@ -776,6 +732,7 @@ golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxT
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200908183739-ae8ad444f925/go.mod h1:1phAWC201xIgDyaFpmDeZkgf70Q4Pd/CNqfRtVPtxNw=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
|
||||
@@ -788,13 +745,14 @@ golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHl
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -828,9 +786,10 @@ golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200421231249-e086a090c8fd/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM=
|
||||
golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
@@ -873,6 +832,8 @@ golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -883,9 +844,10 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
|
||||
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80=
|
||||
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
@@ -926,8 +888,9 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200113040837-eac381796e91 h1:OOkytthzFBKHY5EfEgLUabprb0LtJVkQtNxAQ02+UE4=
|
||||
golang.org/x/tools v0.0.0-20200113040837-eac381796e91/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM=
|
||||
golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -972,21 +935,16 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.8.8 h1:5UtTowJZTz1j7NxVzDGKTz6Lm9IWm8DDF6b7a2wq9VY=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.8.8/go.mod h1:CaHjv79TCgAvXMSFJSVgonHXYWxnhzI3eoHtnX5UgUo=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ffmt.v1 v1.5.6 h1:4Bu3riZp5sAIXW2T/18JM9BkwJLodurXFR0f7PXp+cw=
|
||||
gopkg.in/ffmt.v1 v1.5.6/go.mod h1:LssvGOZFiBGoBcobkTqnyh+uN1VzIRoibW+c0JI/Ha4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
|
||||
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
|
||||
@@ -997,29 +955,25 @@ gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno=
|
||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/kyokomi/emoji.v1 v1.5.1 h1:beetH5mWDMzFznJ+Qzd5KVHp79YKhVUMcdO8LpRLeGw=
|
||||
gopkg.in/kyokomi/emoji.v1 v1.5.1/go.mod h1:N9AZ6hi1jHOPn34PsbpufQZUcKftSD7WgS2pgpmH4Lg=
|
||||
gopkg.in/ns1/ns1-go.v2 v2.0.0-20190730140822-b51389932cbc/go.mod h1:VV+3haRsgDiVLxyifmMBrBIuCWFBPYKbRssXB9z67Hw=
|
||||
gopkg.in/resty.v1 v1.9.1/go.mod h1:vo52Hzryw9PnPHcJfPsBiFW62XhNx5OczbV9y+IMpgc=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
||||
gopkg.in/telegram-bot-api.v4 v4.6.4/go.mod h1:5DpGO5dbumb40px+dXcwCpcjmeHNYLpk0bp3XRNvWDM=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v0.3.0 h1:LPEy7sEsoZHSPiUk9ySGJLEmWQfbj7MWqE4sTwG7nx4=
|
||||
gorm.io/driver/mysql v0.3.0/go.mod h1:A7H1JD9dKdcjeUTpTuWKEC+E1a74qzW7/zaXqKaTbfM=
|
||||
gorm.io/driver/mysql v0.3.2 h1:Kaa0S+IHW+4qow6dRAdekNYaKeGBboIkh44pYdLWjIE=
|
||||
gorm.io/driver/mysql v0.3.2/go.mod h1:jC/HyPAZJ0xqfGlOqYybd8oNPMtGrkNgvwjWuKDT7f0=
|
||||
gorm.io/driver/postgres v0.2.6 h1:hoE6SzA5wKOo6AYxz2V7ooxnzD6S6ToLAHHDDawt+b0=
|
||||
gorm.io/driver/postgres v0.2.6/go.mod h1:AsPyuhKFOplSmQwOPsycVKbe0dRxF8v18KZ7p9i8dIs=
|
||||
gorm.io/driver/postgres v0.2.9 h1:oMY4f4tLEUVg3eapqHFzVEplWKy1Gj1cGBEe9wJ1yWM=
|
||||
gorm.io/driver/postgres v0.2.9/go.mod h1:YATpayFLKALuiVXVRNbDfoEJwECHSMYzl1SmXJ2+CIg=
|
||||
@@ -1043,3 +997,7 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
|
||||
k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0 h1:ucqkfpjg9WzSUubAO62csmucvxl4/JeW3F4I4909XkM=
|
||||
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
|
||||
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67 h1:e1sMhtVq9AfcEy8AXNb8eSg6gbzfdpYhoNqnPJa+GzI=
|
||||
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package logger
|
||||
|
||||
import "context"
|
||||
|
||||
type loggerKey struct{}
|
||||
|
||||
func FromContext(ctx context.Context) (Logger, bool) {
|
||||
l, ok := ctx.Value(loggerKey{}).(Logger)
|
||||
return l, ok
|
||||
}
|
||||
|
||||
func NewContext(ctx context.Context, l Logger) context.Context {
|
||||
return context.WithValue(ctx, loggerKey{}, l)
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
dlog "go-admin/debug/log"
|
||||
)
|
||||
|
||||
func init() {
|
||||
lvl, err := GetLevel(os.Getenv("GO_ADMIN_LOG_LEVEL"))
|
||||
if err != nil {
|
||||
lvl = InfoLevel
|
||||
}
|
||||
|
||||
DefaultLogger = NewHelper(NewLogger(WithLevel(lvl)))
|
||||
}
|
||||
|
||||
type defaultLogger struct {
|
||||
sync.RWMutex
|
||||
opts Options
|
||||
}
|
||||
|
||||
// Init(opts...) should only overwrite provided options
|
||||
func (l *defaultLogger) Init(opts ...Option) error {
|
||||
for _, o := range opts {
|
||||
o(&l.opts)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *defaultLogger) String() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
func (l *defaultLogger) Fields(fields map[string]interface{}) Logger {
|
||||
l.Lock()
|
||||
l.opts.Fields = copyFields(fields)
|
||||
l.Unlock()
|
||||
return l
|
||||
}
|
||||
|
||||
func copyFields(src map[string]interface{}) map[string]interface{} {
|
||||
dst := make(map[string]interface{}, len(src))
|
||||
for k, v := range src {
|
||||
dst[k] = v
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// logCallerfilePath returns a package/file:line description of the caller,
|
||||
// preserving only the leaf directory name and file name.
|
||||
func logCallerfilePath(loggingFilePath string) string {
|
||||
// To make sure we trim the path correctly on Windows too, we
|
||||
// counter-intuitively need to use '/' and *not* os.PathSeparator here,
|
||||
// because the path given originates from Go stdlib, specifically
|
||||
// runtime.Caller() which (as of Mar/17) returns forward slashes even on
|
||||
// Windows.
|
||||
//
|
||||
// See https://github.com/golang/go/issues/3335
|
||||
// and https://github.com/golang/go/issues/18151
|
||||
//
|
||||
// for discussion on the issue on Go side.
|
||||
idx := strings.LastIndexByte(loggingFilePath, '/')
|
||||
if idx == -1 {
|
||||
return loggingFilePath
|
||||
}
|
||||
idx = strings.LastIndexByte(loggingFilePath[:idx], '/')
|
||||
if idx == -1 {
|
||||
return loggingFilePath
|
||||
}
|
||||
return loggingFilePath[idx+1:]
|
||||
}
|
||||
|
||||
func (l *defaultLogger) Log(level Level, v ...interface{}) {
|
||||
// TODO decide does we need to write message if log level not used?
|
||||
if !l.opts.Level.Enabled(level) {
|
||||
return
|
||||
}
|
||||
|
||||
l.RLock()
|
||||
fields := copyFields(l.opts.Fields)
|
||||
l.RUnlock()
|
||||
|
||||
fields["level"] = level.String()
|
||||
|
||||
if _, file, line, ok := runtime.Caller(l.opts.CallerSkipCount); ok {
|
||||
fields["file"] = fmt.Sprintf("%s:%d", logCallerfilePath(file), line)
|
||||
}
|
||||
|
||||
rec := dlog.Record{
|
||||
Timestamp: time.Now(),
|
||||
Message: fmt.Sprint(v...),
|
||||
Metadata: make(map[string]string, len(fields)),
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(fields))
|
||||
for k, v := range fields {
|
||||
keys = append(keys, k)
|
||||
rec.Metadata[k] = fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
sort.Strings(keys)
|
||||
metadata := ""
|
||||
|
||||
for _, k := range keys {
|
||||
metadata += fmt.Sprintf(" %s=%v", k, fields[k])
|
||||
}
|
||||
|
||||
t := rec.Timestamp.Format("2006-01-02 15:04:05")
|
||||
fmt.Printf("%s %s %v\n", t, metadata, rec.Message)
|
||||
}
|
||||
|
||||
func (l *defaultLogger) Logf(level Level, format string, v ...interface{}) {
|
||||
// TODO decide does we need to write message if log level not used?
|
||||
if level < l.opts.Level {
|
||||
return
|
||||
}
|
||||
|
||||
l.RLock()
|
||||
fields := copyFields(l.opts.Fields)
|
||||
l.RUnlock()
|
||||
|
||||
fields["level"] = level.String()
|
||||
|
||||
if _, file, line, ok := runtime.Caller(l.opts.CallerSkipCount); ok {
|
||||
fields["file"] = fmt.Sprintf("%s:%d", logCallerfilePath(file), line)
|
||||
}
|
||||
|
||||
rec := dlog.Record{
|
||||
Timestamp: time.Now(),
|
||||
Message: fmt.Sprintf(format, v...),
|
||||
Metadata: make(map[string]string, len(fields)),
|
||||
}
|
||||
|
||||
keys := make([]string, 0, len(fields))
|
||||
for k, v := range fields {
|
||||
keys = append(keys, k)
|
||||
rec.Metadata[k] = fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
sort.Strings(keys)
|
||||
metadata := ""
|
||||
|
||||
for _, k := range keys {
|
||||
metadata += fmt.Sprintf(" %s=%v", k, fields[k])
|
||||
}
|
||||
|
||||
t := rec.Timestamp.Format("2006-01-02 15:04:05")
|
||||
fmt.Printf("%s %s %v\n", t, metadata, rec.Message)
|
||||
}
|
||||
|
||||
func (l *defaultLogger) Options() Options {
|
||||
// not guard against options Context values
|
||||
l.RLock()
|
||||
opts := l.opts
|
||||
opts.Fields = copyFields(l.opts.Fields)
|
||||
l.RUnlock()
|
||||
return opts
|
||||
}
|
||||
|
||||
// NewLogger builds a new logger based on options
|
||||
func NewLogger(opts ...Option) Logger {
|
||||
// Default options
|
||||
options := Options{
|
||||
Level: InfoLevel,
|
||||
Fields: make(map[string]interface{}),
|
||||
Out: os.Stderr,
|
||||
CallerSkipCount: 2,
|
||||
Context: context.Background(),
|
||||
}
|
||||
|
||||
l := &defaultLogger{opts: options}
|
||||
if err := l.Init(opts...); err != nil {
|
||||
l.Log(FatalLevel, err)
|
||||
}
|
||||
|
||||
return l
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Helper struct {
|
||||
Logger
|
||||
fields map[string]interface{}
|
||||
}
|
||||
|
||||
func NewHelper(log Logger) *Helper {
|
||||
return &Helper{Logger: log}
|
||||
}
|
||||
|
||||
func (h *Helper) Info(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(InfoLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(InfoLevel, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Infof(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(InfoLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Trace(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(TraceLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(TraceLevel, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Tracef(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(TraceLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(TraceLevel, template, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Debug(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(DebugLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(DebugLevel, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Debugf(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(DebugLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(DebugLevel, template, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Warn(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(WarnLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(WarnLevel, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Warnf(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(WarnLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(WarnLevel, template, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Error(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(ErrorLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(ErrorLevel, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Errorf(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(ErrorLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(ErrorLevel, template, args...)
|
||||
}
|
||||
|
||||
func (h *Helper) Fatal(args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(FatalLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Log(FatalLevel, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func (h *Helper) Fatalf(template string, args ...interface{}) {
|
||||
if !h.Logger.Options().Level.Enabled(FatalLevel) {
|
||||
return
|
||||
}
|
||||
h.Logger.Fields(h.fields).Logf(FatalLevel, template, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func (h *Helper) WithError(err error) *Helper {
|
||||
fields := copyFields(h.fields)
|
||||
fields["error"] = err
|
||||
return &Helper{Logger: h.Logger, fields: fields}
|
||||
}
|
||||
|
||||
func (h *Helper) WithFields(fields map[string]interface{}) *Helper {
|
||||
nfields := copyFields(fields)
|
||||
for k, v := range h.fields {
|
||||
nfields[k] = v
|
||||
}
|
||||
return &Helper{Logger: h.Logger, fields: nfields}
|
||||
}
|
||||
-140
@@ -1,140 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Level int8
|
||||
|
||||
const (
|
||||
// TraceLevel level. Designates finer-grained informational events than the Debug.
|
||||
TraceLevel Level = iota - 2
|
||||
// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
|
||||
DebugLevel
|
||||
// InfoLevel is the default logging priority.
|
||||
// General operational entries about what's going on inside the application.
|
||||
InfoLevel
|
||||
// WarnLevel level. Non-critical entries that deserve eyes.
|
||||
WarnLevel
|
||||
// ErrorLevel level. Logs. Used for errors that should definitely be noted.
|
||||
ErrorLevel
|
||||
// FatalLevel level. Logs and then calls `logger.Exit(1)`. highest level of severity.
|
||||
FatalLevel
|
||||
)
|
||||
|
||||
func (l Level) String() string {
|
||||
switch l {
|
||||
case TraceLevel:
|
||||
return "trace"
|
||||
case DebugLevel:
|
||||
return "debug"
|
||||
case InfoLevel:
|
||||
return "info"
|
||||
case WarnLevel:
|
||||
return "warn"
|
||||
case ErrorLevel:
|
||||
return "error"
|
||||
case FatalLevel:
|
||||
return "fatal"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// LevelForGorm 转换成gorm日志级别
|
||||
func (l Level) LevelForGorm() int {
|
||||
switch l {
|
||||
case FatalLevel, ErrorLevel:
|
||||
return 2
|
||||
case WarnLevel:
|
||||
return 3
|
||||
case InfoLevel, DebugLevel, TraceLevel:
|
||||
return 4
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
// Enabled returns true if the given level is at or above this level.
|
||||
func (l Level) Enabled(lvl Level) bool {
|
||||
return lvl >= l
|
||||
}
|
||||
|
||||
// GetLevel converts a level string into a logger Level value.
|
||||
// returns an error if the input string does not match known values.
|
||||
func GetLevel(levelStr string) (Level, error) {
|
||||
switch levelStr {
|
||||
case TraceLevel.String():
|
||||
return TraceLevel, nil
|
||||
case DebugLevel.String():
|
||||
return DebugLevel, nil
|
||||
case InfoLevel.String():
|
||||
return InfoLevel, nil
|
||||
case WarnLevel.String():
|
||||
return WarnLevel, nil
|
||||
case ErrorLevel.String():
|
||||
return ErrorLevel, nil
|
||||
case FatalLevel.String():
|
||||
return FatalLevel, nil
|
||||
}
|
||||
return InfoLevel, fmt.Errorf("Unknown Level String: '%s', defaulting to InfoLevel", levelStr)
|
||||
}
|
||||
|
||||
func Info(args ...interface{}) {
|
||||
DefaultLogger.Log(InfoLevel, args...)
|
||||
}
|
||||
|
||||
func Infof(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
func Trace(args ...interface{}) {
|
||||
DefaultLogger.Log(TraceLevel, args...)
|
||||
}
|
||||
|
||||
func Tracef(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(TraceLevel, template, args...)
|
||||
}
|
||||
|
||||
func Debug(args ...interface{}) {
|
||||
DefaultLogger.Log(DebugLevel, args...)
|
||||
}
|
||||
|
||||
func Debugf(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(DebugLevel, template, args...)
|
||||
}
|
||||
|
||||
func Warn(args ...interface{}) {
|
||||
DefaultLogger.Log(WarnLevel, args...)
|
||||
}
|
||||
|
||||
func Warnf(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(WarnLevel, template, args...)
|
||||
}
|
||||
|
||||
func Error(args ...interface{}) {
|
||||
DefaultLogger.Log(ErrorLevel, args...)
|
||||
}
|
||||
|
||||
func Errorf(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(ErrorLevel, template, args...)
|
||||
}
|
||||
|
||||
func Fatal(args ...interface{}) {
|
||||
DefaultLogger.Log(FatalLevel, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func Fatalf(template string, args ...interface{}) {
|
||||
DefaultLogger.Logf(FatalLevel, template, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Returns true if the given level is at or lower the current logger level
|
||||
func V(lvl Level, log Logger) bool {
|
||||
l := DefaultLogger
|
||||
if log != nil {
|
||||
l = log
|
||||
}
|
||||
return l.Options().Level <= lvl
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// Package log provides a log interface
|
||||
package logger
|
||||
|
||||
var (
|
||||
// Default logger
|
||||
DefaultLogger Logger
|
||||
)
|
||||
|
||||
// Logger is a generic logging interface
|
||||
type Logger interface {
|
||||
// Init initialises options
|
||||
Init(options ...Option) error
|
||||
// The Logger options
|
||||
Options() Options
|
||||
// Fields set fields to always be logged
|
||||
Fields(fields map[string]interface{}) Logger
|
||||
// Log writes a log entry
|
||||
Log(level Level, v ...interface{})
|
||||
// Logf writes a formatted log entry
|
||||
Logf(level Level, format string, v ...interface{})
|
||||
// String returns the name of logger
|
||||
String() string
|
||||
}
|
||||
|
||||
func Init(opts ...Option) error {
|
||||
return DefaultLogger.Init(opts...)
|
||||
}
|
||||
|
||||
func Fields(fields map[string]interface{}) Logger {
|
||||
return DefaultLogger.Fields(fields)
|
||||
}
|
||||
|
||||
func Log(level Level, v ...interface{}) {
|
||||
DefaultLogger.Log(level, v...)
|
||||
}
|
||||
|
||||
func Logf(level Level, format string, v ...interface{}) {
|
||||
DefaultLogger.Logf(level, format, v...)
|
||||
}
|
||||
|
||||
func String() string {
|
||||
return DefaultLogger.String()
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLogger(t *testing.T) {
|
||||
l := NewLogger(WithLevel(TraceLevel))
|
||||
h1 := NewHelper(l).WithFields(map[string]interface{}{"key1": "val1"})
|
||||
h1.Trace("trace_msg1")
|
||||
h1.Warn("warn_msg1")
|
||||
|
||||
h2 := NewHelper(l).WithFields(map[string]interface{}{"key2": "val2"})
|
||||
h2.Trace("trace_msg2")
|
||||
h2.Warn("warn_msg2")
|
||||
|
||||
l.Fields(map[string]interface{}{"key3": "val4"}).Log(InfoLevel, "test_msg")
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Option func(*Options)
|
||||
|
||||
type Options struct {
|
||||
// The logging level the logger should log at. default is `InfoLevel`
|
||||
Level Level
|
||||
// fields to always be logged
|
||||
Fields map[string]interface{}
|
||||
// It's common to set this to a file, or leave it default which is `os.Stderr`
|
||||
Out io.Writer
|
||||
// Caller skip frame count for file:line info
|
||||
CallerSkipCount int
|
||||
// Alternative options
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// WithFields set default fields for the logger
|
||||
func WithFields(fields map[string]interface{}) Option {
|
||||
return func(args *Options) {
|
||||
args.Fields = fields
|
||||
}
|
||||
}
|
||||
|
||||
// WithLevel set default level for the logger
|
||||
func WithLevel(level Level) Option {
|
||||
return func(args *Options) {
|
||||
args.Level = level
|
||||
}
|
||||
}
|
||||
|
||||
// WithOutput set default output writer for the logger
|
||||
func WithOutput(out io.Writer) Option {
|
||||
return func(args *Options) {
|
||||
args.Out = out
|
||||
}
|
||||
}
|
||||
|
||||
// WithCallerSkipCount set frame count to skip
|
||||
func WithCallerSkipCount(c int) Option {
|
||||
return func(args *Options) {
|
||||
args.CallerSkipCount = c
|
||||
}
|
||||
}
|
||||
|
||||
func SetOption(k, v interface{}) Option {
|
||||
return func(o *Options) {
|
||||
if o.Context == nil {
|
||||
o.Context = context.Background()
|
||||
}
|
||||
o.Context = context.WithValue(o.Context, k, v)
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
// @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档
|
||||
// @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢!
|
||||
// @license.name MIT
|
||||
// @license.url https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md
|
||||
// @license.url https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md
|
||||
|
||||
// @securityDefinitions.apikey Bearer
|
||||
// @in header
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
package cache
|
||||
|
||||
import (
|
||||
"github.com/matchstalk/go-admin-core/cache"
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
)
|
||||
|
||||
var MemoryAdapter Adapter
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/matchstalk/go-admin-core/cache"
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
)
|
||||
|
||||
func TestInitMemory(t *testing.T) {
|
||||
|
||||
Vendored
+1
-1
@@ -3,8 +3,8 @@ package cache
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
"github.com/go-redis/redis/v7"
|
||||
"github.com/matchstalk/go-admin-core/cache"
|
||||
"github.com/matchstalk/redisqueue"
|
||||
)
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/matchstalk/go-admin-core/cache"
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
)
|
||||
|
||||
func TestInitRedis(t *testing.T) {
|
||||
|
||||
Vendored
+1
-1
@@ -3,7 +3,7 @@ package cache
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/matchstalk/go-admin-core/cache"
|
||||
"github.com/go-admin-team/go-admin-core/cache"
|
||||
)
|
||||
|
||||
type Adapter interface {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package mycasbin
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
)
|
||||
|
||||
// Logger is the implementation for a Logger using golang log.
|
||||
type Logger struct {
|
||||
enable int32
|
||||
}
|
||||
|
||||
func (l *Logger) EnableLog(enable bool) {
|
||||
i := 0
|
||||
if enable {
|
||||
i = 1
|
||||
}
|
||||
atomic.StoreInt32(&(l.enable), int32(i))
|
||||
}
|
||||
|
||||
func (l *Logger) IsEnabled() bool {
|
||||
return atomic.LoadInt32(&(l.enable)) != 0
|
||||
}
|
||||
|
||||
func (l *Logger) Print(v ...interface{}) {
|
||||
if l.IsEnabled() {
|
||||
logger.DefaultLogger.Log(logger.InfoLevel, v...)
|
||||
}
|
||||
}
|
||||
|
||||
func (l *Logger) Printf(format string, v ...interface{}) {
|
||||
if l.IsEnabled() {
|
||||
logger.DefaultLogger.Logf(logger.InfoLevel, format, v...)
|
||||
}
|
||||
}
|
||||
+7
-20
@@ -1,14 +1,11 @@
|
||||
package mycasbin
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/casbin/casbin/v2"
|
||||
"github.com/casbin/casbin/v2/log"
|
||||
"github.com/casbin/casbin/v2/model"
|
||||
gormAdapter "github.com/casbin/gorm-adapter/v3"
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
|
||||
"go-admin/common/global"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Initialize the model from a string.
|
||||
@@ -26,8 +23,8 @@ e = some(where (p.eft == allow))
|
||||
m = r.sub == p.sub && (keyMatch2(r.obj, p.obj) || keyMatch(r.obj, p.obj)) && (r.act == p.act || p.act == "*")
|
||||
`
|
||||
|
||||
func Setup() {
|
||||
Apter, err := gormAdapter.NewAdapterByDBUsePrefix(global.Eloquent, "sys_")
|
||||
func Setup(db *gorm.DB, prefix string) *casbin.SyncedEnforcer {
|
||||
Apter, err := gormAdapter.NewAdapterByDBUsePrefix(db, prefix)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -43,18 +40,8 @@ func Setup() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
global.CasbinEnforcer = e
|
||||
}
|
||||
|
||||
func Casbin() *casbin.SyncedEnforcer {
|
||||
return global.CasbinEnforcer
|
||||
}
|
||||
|
||||
func LoadPolicy() (*casbin.SyncedEnforcer, error) {
|
||||
if err := global.CasbinEnforcer.LoadPolicy(); err == nil {
|
||||
return global.CasbinEnforcer, err
|
||||
} else {
|
||||
log.Printf("casbin rbac_model or policy init error, message: %v \r\n", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
log.SetLogger(&Logger{})
|
||||
e.EnableLog(true)
|
||||
return e
|
||||
}
|
||||
|
||||
+3
-14
@@ -3,13 +3,13 @@ package jwtauth
|
||||
import (
|
||||
"crypto/rsa"
|
||||
"errors"
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
config2 "go-admin/tools/config"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dgrijalva/jwt-go"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
const JwtPayloadKey = "JWT_PAYLOAD"
|
||||
@@ -284,17 +284,6 @@ func (mw *GinJWTMiddleware) MiddlewareInit() error {
|
||||
mw.SigningAlgorithm = "HS256"
|
||||
}
|
||||
|
||||
mw.Timeout = time.Hour
|
||||
if config2.JwtConfig.Timeout != 0 {
|
||||
// TODO: token过期时长
|
||||
mw.Timeout = time.Duration(config2.JwtConfig.Timeout) * time.Second
|
||||
}
|
||||
|
||||
if config2.ApplicationConfig.Mode == "dev" {
|
||||
// TODO: dev mode token过期时长 为 10 年
|
||||
mw.Timeout = time.Duration(876010) * time.Hour
|
||||
}
|
||||
|
||||
if mw.TimeFunc == nil {
|
||||
mw.TimeFunc = time.Now
|
||||
}
|
||||
|
||||
+67
-32
@@ -1,38 +1,73 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/os/glog"
|
||||
"go-admin/common/global"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/config"
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
"os"
|
||||
)
|
||||
|
||||
var Logger *glog.Logger
|
||||
var JobLogger *glog.Logger
|
||||
var RequestLogger *glog.Logger
|
||||
|
||||
func Setup() {
|
||||
Logger = glog.New()
|
||||
_ = Logger.SetPath(config.LoggerConfig.Path + "/bus")
|
||||
Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout)
|
||||
Logger.SetFile("bus-{Ymd}.log")
|
||||
_ = Logger.SetLevelStr(config.LoggerConfig.Level)
|
||||
|
||||
JobLogger = glog.New()
|
||||
_ = JobLogger.SetPath(config.LoggerConfig.Path + "/job")
|
||||
JobLogger.SetStdoutPrint(false)
|
||||
JobLogger.SetFile("db-{Ymd}.log")
|
||||
_ = JobLogger.SetLevelStr(config.LoggerConfig.Level)
|
||||
|
||||
RequestLogger = glog.New()
|
||||
_ = RequestLogger.SetPath(config.LoggerConfig.Path + "/request")
|
||||
RequestLogger.SetStdoutPrint(false)
|
||||
RequestLogger.SetFile("access-{Ymd}.log")
|
||||
_ = RequestLogger.SetLevelStr(config.LoggerConfig.Level)
|
||||
|
||||
Logger.Info(tools.Green("Logger init success!"))
|
||||
|
||||
global.Logger = Logger.Line()
|
||||
global.JobLogger = JobLogger.Line()
|
||||
global.RequestLogger = RequestLogger.Line()
|
||||
// Logger 通用log个性化实现
|
||||
type Logger struct {
|
||||
logger.Logger
|
||||
}
|
||||
|
||||
// Info info级日志输出
|
||||
func (l *Logger) Info(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
}
|
||||
|
||||
// Infof info级日志输出
|
||||
func (l *Logger) Infof(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
// Trace trace级日志输出
|
||||
func (l *Logger) Trace(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
}
|
||||
|
||||
// Tracef trace级日志输出
|
||||
func (l *Logger) Tracef(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
// Debug debug级日志输出
|
||||
func (l *Logger) Debug(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
}
|
||||
|
||||
// Debugf debug级日志输出
|
||||
func (l *Logger) Debugf(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
// Warn warn级日志输出
|
||||
func (l *Logger) Warn(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
}
|
||||
|
||||
// Warnf warn级日志输出
|
||||
func (l *Logger) Warnf(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
// Error error级日志输出
|
||||
func (l *Logger) Error(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
}
|
||||
|
||||
// Errorf error级日志输出
|
||||
func (l *Logger) Errorf(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
}
|
||||
|
||||
// Fatal fatal级日志输出
|
||||
func (l *Logger) Fatal(args ...interface{}) {
|
||||
l.Log(logger.InfoLevel, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Fatalf fatal级日志输出
|
||||
func (l *Logger) Fatalf(template string, args ...interface{}) {
|
||||
l.Logf(logger.InfoLevel, template, args...)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/debug/writer"
|
||||
"github.com/go-admin-team/go-admin-core/logger"
|
||||
|
||||
"go-admin/common/log"
|
||||
)
|
||||
|
||||
//func Setup() (*glog.Logger, *glog.Logger) {
|
||||
// var Logger *glog.Logger
|
||||
// var JobLogger *glog.Logger
|
||||
// var RequestLogger *glog.Logger
|
||||
//
|
||||
// Logger = glog.New()
|
||||
// _ = Logger.SetPath(config.LoggerConfig.Path + "/bus")
|
||||
// Logger.SetStdoutPrint(config.LoggerConfig.EnabledBUS && config.LoggerConfig.Stdout)
|
||||
// Logger.SetFile("bus-{Ymd}.log")
|
||||
// _ = Logger.SetLevelStr(config.LoggerConfig.Level)
|
||||
//
|
||||
// JobLogger = glog.New()
|
||||
// _ = JobLogger.SetPath(config.LoggerConfig.Path + "/job")
|
||||
// JobLogger.SetStdoutPrint(false)
|
||||
// JobLogger.SetFile("db-{Ymd}.log")
|
||||
// _ = JobLogger.SetLevelStr(config.LoggerConfig.Level)
|
||||
//
|
||||
// RequestLogger = glog.New()
|
||||
// _ = RequestLogger.SetPath(config.LoggerConfig.Path + "/request")
|
||||
// RequestLogger.SetStdoutPrint(false)
|
||||
// RequestLogger.SetFile("access-{Ymd}.log")
|
||||
// _ = RequestLogger.SetLevelStr(config.LoggerConfig.Level)
|
||||
//
|
||||
// Logger.Info(tools.Green("Logger init success!"))
|
||||
// return Logger, JobLogger
|
||||
//}
|
||||
|
||||
// SetupLogger 日志
|
||||
func SetupLogger(path string, subPath string) logger.Logger {
|
||||
var setLogger logger.Logger
|
||||
output, err := writer.NewFileWriter(filepath.Join(path, subPath), "log")
|
||||
if err != nil {
|
||||
log.Fatal("request logger setup error: %s", err.Error)
|
||||
}
|
||||
setLogger = logger.NewHelper(logger.NewLogger(logger.WithOutput(output)))
|
||||
return setLogger
|
||||
}
|
||||
BIN
Binary file not shown.
@@ -1,15 +0,0 @@
|
||||
|
||||
____
|
||||
,---, ,' , `. ,--,
|
||||
,---. ,---,. ,---.'| ,-+-,.' _ |,--.'| ,---,
|
||||
,----._,. ' ,'\ ,' .' | | | : ,-+-. ; , ||| |, ,-+-. / |
|
||||
/ / ' / / / |,---.' , ,--.--. | | | ,--.'|' | ||`--'_ ,--.'|' |
|
||||
| : |. ; ,. :| | |/ \ ,--.__| || | ,', | |,,' ,'| | | ,"' |
|
||||
| | .\ .' | |: :: : .'.--. .-. | / ,' || | / | |--' ' | | | | / | |
|
||||
. ; '; |' | .; :: |.' \__\/: . .. ' / || : | | , | | : | | | | |
|
||||
' . . || : |`---' ," .--.; |' ; |: || : | |/ ' : |__ | | | |/
|
||||
`---`-'| | \ \ / / / ,. || | '/ '| | |`-' | | '.'|| | |--'
|
||||
.'__/\_: | `----' ; : .' \ : :|| ;/ ; : ;| |/
|
||||
| : : | , .-./\ \ / '---' | , / '---'
|
||||
\ \ / `--`---' `----' ---`-'
|
||||
`--`-'
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
package version
|
||||
package {{.Package}}
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
//"go-admin/app/admin/models"
|
||||
"gorm.io/gorm"
|
||||
"runtime"
|
||||
|
||||
@@ -20,21 +20,21 @@ func _{{.GenerateTime}}Test(db *gorm.DB, version string) error {
|
||||
// TODO: 这里开始写入要变更的内容
|
||||
|
||||
// TODO: 例如 修改表字段 使用过程中请删除此段代码
|
||||
err := db.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//err := tx.Migrator().RenameColumn(&models.SysConfig{}, "config_id", "id")
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
// TODO: 例如 新增表结构 使用过程中请删除此段代码
|
||||
err = db.Debug().Migrator().AutoMigrate(
|
||||
new(models.CasbinRule),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//err = tx.Debug().Migrator().AutoMigrate(
|
||||
// new(models.CasbinRule),
|
||||
// )
|
||||
//if err != nil {
|
||||
// return err
|
||||
//}
|
||||
|
||||
|
||||
return db.Create(&common.Migration{
|
||||
return tx.Create(&common.Migration{
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
|
||||
@@ -33,7 +33,7 @@ func DriverStringFunc() (id, b64s string, err error) {
|
||||
func DriverDigitFunc() (id, b64s string, err error) {
|
||||
e := configJsonBody{}
|
||||
e.Id = uuid.New().String()
|
||||
e.DriverDigit = base64Captcha.DefaultDriverDigit
|
||||
e.DriverDigit = base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80)
|
||||
driver := e.DriverDigit
|
||||
cap := base64Captcha.NewCaptcha(driver, store)
|
||||
return cap.Generate()
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package trace
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/signal"
|
||||
|
||||
"github.com/opentracing/opentracing-go"
|
||||
"sourcegraph.com/sourcegraph/appdash"
|
||||
appdashot "sourcegraph.com/sourcegraph/appdash/opentracing"
|
||||
"sourcegraph.com/sourcegraph/appdash/traceapp"
|
||||
|
||||
"go-admin/tools"
|
||||
)
|
||||
|
||||
var _server = &http.Server{}
|
||||
|
||||
// Start 启动
|
||||
func Start() {
|
||||
store := appdash.NewMemoryStore()
|
||||
|
||||
// Listen on any available TCP port locally.
|
||||
l, err := net.ListenTCP("tcp", &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 0})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
collectorPort := l.Addr().(*net.TCPAddr).Port
|
||||
collectorAdd := fmt.Sprintf(":%d", collectorPort)
|
||||
|
||||
// Start an Appdash collection server that will listen for spans and
|
||||
// annotations and add them to the local collector (stored in-memory).
|
||||
cs := appdash.NewServer(l, appdash.NewLocalCollector(store))
|
||||
go cs.Start()
|
||||
|
||||
// Print the URL at which the web UI will be running.
|
||||
appdashPort := 8700
|
||||
appdashURLStr := fmt.Sprintf("http://%s:%d", tools.GetLocaHonst(), appdashPort)
|
||||
appdashURL, err := url.Parse(appdashURLStr)
|
||||
if err != nil {
|
||||
log.Fatalf("Error parsing %s: %s", appdashURLStr, err)
|
||||
}
|
||||
|
||||
// Start the web UI in a separate goroutine.
|
||||
tapp, err := traceapp.New(nil, appdashURL)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
tapp.Store = store
|
||||
tapp.Queryer = store
|
||||
_server.Addr = fmt.Sprintf(":%d", appdashPort)
|
||||
_server.Handler = tapp
|
||||
go func() {
|
||||
err := _server.ListenAndServe()
|
||||
if err != nil {
|
||||
log.Fatalf("Trace server start error: %s", err.Error())
|
||||
}
|
||||
}()
|
||||
fmt.Println(tools.Green("Trace server run at:"))
|
||||
fmt.Printf("- Local: %s/traces\n", fmt.Sprintf("http://localhost:%d", appdashPort))
|
||||
fmt.Printf("- Network: %s/traces\n", fmt.Sprintf("http://%s:%d", tools.GetLocaHonst(), appdashPort))
|
||||
|
||||
tracer := appdashot.NewTracer(appdash.NewRemoteCollector(collectorAdd))
|
||||
opentracing.InitGlobalTracer(tracer)
|
||||
}
|
||||
|
||||
// Stop 停止
|
||||
func Stop(ctx context.Context) {
|
||||
quit := make(chan os.Signal)
|
||||
signal.Notify(quit, os.Interrupt)
|
||||
<-quit
|
||||
fmt.Printf("%s Shutdown Server ... \r\n", tools.GetCurrentTimeStr())
|
||||
err := _server.Shutdown(ctx)
|
||||
if err != nil {
|
||||
log.Fatalf("Trace server shutdown error: %s", err.Error())
|
||||
}
|
||||
log.Println("Trace server shutdown success")
|
||||
}
|
||||
Reference in New Issue
Block a user