更新2.1.2版本,优化部门、角色权限,增加上下级关系;增加登录、系统、短信日志;优化省市区编码

This commit is contained in:
孟帅
2023-01-25 11:49:21 +08:00
parent 11fad0132d
commit 93e0fe7250
190 changed files with 35896 additions and 7208 deletions

View File

@@ -82,6 +82,13 @@ type LogConfig struct {
SkipCode []string `json:"skipCode"`
}
// ServeLogConfig 服务日志配置
type ServeLogConfig struct {
Switch bool `json:"switch"`
Queue bool `json:"queue"`
LevelFormat []string `json:"levelFormat"`
}
// GenerateAppCrudTemplate curd模板
type GenerateAppCrudTemplate struct {
Group string `json:"group"`

View File

@@ -20,6 +20,8 @@ type AdminDept struct {
Leader interface{} // 负责人
Phone interface{} // 联系电话
Email interface{} // 邮箱
Level interface{} // 关系树等级
Tree interface{} // 关系树
Sort interface{} // 排序
Status interface{} // 部门状态
CreatedAt *gtime.Time // 创建时间

View File

@@ -14,6 +14,7 @@ import (
type SysLog struct {
g.Meta `orm:"table:hg_sys_log, do:true"`
Id interface{} // 日志ID
ReqId interface{} // 对外ID
AppId interface{} // 应用ID
MerchantId interface{} // 商户ID
MemberId interface{} // 用户ID
@@ -29,10 +30,9 @@ type SysLog struct {
ErrorCode interface{} // 报错code
ErrorMsg interface{} // 报错信息
ErrorData *gjson.Json // 报错日志
ReqId interface{} // 对外ID
Timestamp interface{} // 响应时间
UserAgent interface{} // UA信息
TakeUpTime interface{} // 请求耗时
Timestamp interface{} // 响应时间
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 修改时间

View File

@@ -0,0 +1,26 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// SysLoginLog is the golang structure of table hg_sys_login_log for DAO operations like Where/Data.
type SysLoginLog struct {
g.Meta `orm:"table:hg_sys_login_log, do:true"`
Id interface{} // 日志ID
ReqId interface{} // 请求ID
MemberId interface{} // 用户ID
Username interface{} // 用户名
Response *gjson.Json // 响应数据
LoginAt *gtime.Time // 登录时间
ErrMsg interface{} // 错误提示
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 修改时间
}

View File

@@ -11,20 +11,17 @@ import (
// SysProvinces is the golang structure of table hg_sys_provinces for DAO operations like Where/Data.
type SysProvinces struct {
g.Meta `orm:"table:hg_sys_provinces, do:true"`
Id interface{} // 省市区ID
Title interface{} // 栏目名称
ShortTitle interface{} // 缩写
Areacode interface{} // 区域编码
Zipcode interface{} // 邮政编码
Pinyin interface{} // 拼音
Lng interface{} // 经度
Lat interface{} // 纬度
Pid interface{} // 父栏目
Level interface{} // 关系树等级
Tree interface{} // 关系
Sort interface{} // 排序
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
g.Meta `orm:"table:hg_sys_provinces, do:true"`
Id interface{} // 省市区ID
Title interface{} // 栏目名称
Pinyin interface{} // 拼音
Lng interface{} // 经度
Lat interface{} // 纬度
Pid interface{} // 父栏目
Level interface{} // 关系树等级
Tree interface{} // 关系
Sort interface{} // 排序
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@@ -0,0 +1,26 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// SysServeLog is the golang structure of table hg_sys_serve_log for DAO operations like Where/Data.
type SysServeLog struct {
g.Meta `orm:"table:hg_sys_serve_log, do:true"`
Id interface{} // 日志ID
TraceId interface{} // 链路ID
LevelFormat interface{} // 日志级别
Content interface{} // 日志内容
Stack *gjson.Json // 打印堆栈
Line interface{} // 调用行
TriggerNs interface{} // 触发时间(ns)
Status interface{} // 状态
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 修改时间
}

View File

@@ -0,0 +1,24 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package do
import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
)
// SysSmsLog is the golang structure of table hg_sys_sms_log for DAO operations like Where/Data.
type SysSmsLog struct {
g.Meta `orm:"table:hg_sys_sms_log, do:true"`
Id interface{} // 主键
Event interface{} // 事件
Mobile interface{} // 手机号
Code interface{} // 验证码或短信内容
Times interface{} // 验证次数
Ip interface{} // ip地址
Status interface{} // 状态(1未验证,2已验证)
CreatedAt *gtime.Time // 创建时间
UpdatedAt *gtime.Time // 更新时间
}

View File

@@ -18,6 +18,8 @@ type AdminDept struct {
Leader string `json:"leader" description:"负责人"`
Phone string `json:"phone" description:"联系电话"`
Email string `json:"email" description:"邮箱"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系树"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"部门状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`

View File

@@ -12,6 +12,7 @@ import (
// SysLog is the golang structure for table sys_log.
type SysLog struct {
Id int64 `json:"id" description:"日志ID"`
ReqId string `json:"reqId" description:"对外ID"`
AppId string `json:"appId" description:"应用ID"`
MerchantId uint64 `json:"merchantId" description:"商户ID"`
MemberId int64 `json:"memberId" description:"用户ID"`
@@ -27,10 +28,9 @@ type SysLog struct {
ErrorCode int `json:"errorCode" description:"报错code"`
ErrorMsg string `json:"errorMsg" description:"报错信息"`
ErrorData *gjson.Json `json:"errorData" description:"报错日志"`
ReqId string `json:"reqId" description:"对外ID"`
Timestamp int64 `json:"timestamp" description:"响应时间"`
UserAgent string `json:"userAgent" description:"UA信息"`
TakeUpTime int64 `json:"takeUpTime" description:"请求耗时"`
Timestamp int64 `json:"timestamp" description:"响应时间"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`

View File

@@ -0,0 +1,24 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
)
// SysLoginLog is the golang structure for table sys_login_log.
type SysLoginLog struct {
Id int64 `json:"id" description:"日志ID"`
ReqId string `json:"reqId" description:"请求ID"`
MemberId int64 `json:"memberId" description:"用户ID"`
Username string `json:"username" description:"用户名"`
Response *gjson.Json `json:"response" description:"响应数据"`
LoginAt *gtime.Time `json:"loginAt" description:"登录时间"`
ErrMsg string `json:"errMsg" description:"错误提示"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}

View File

@@ -10,19 +10,16 @@ import (
// SysProvinces is the golang structure for table sys_provinces.
type SysProvinces struct {
Id int64 `json:"id" description:"省市区ID"`
Title string `json:"title" description:"栏目名称"`
ShortTitle string `json:"shortTitle" description:"缩写"`
Areacode int `json:"areacode" description:"区域编码"`
Zipcode int `json:"zipcode" description:"邮政编码"`
Pinyin string `json:"pinyin" description:"拼音"`
Lng string `json:"lng" description:"经度"`
Lat string `json:"lat" description:"纬度"`
Pid int64 `json:"pid" description:"父栏目"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"`
Id int64 `json:"id" description:"省市区ID"`
Title string `json:"title" description:"栏目名称"`
Pinyin string `json:"pinyin" description:"拼音"`
Lng string `json:"lng" description:"经度"`
Lat string `json:"lat" description:"纬度"`
Pid int64 `json:"pid" description:"父栏目"`
Level int `json:"level" description:"关系树等级"`
Tree string `json:"tree" description:"关系"`
Sort int `json:"sort" description:"排序"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"`
}

View File

@@ -0,0 +1,24 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/os/gtime"
)
// SysServeLog is the golang structure for table sys_serve_log.
type SysServeLog struct {
Id int64 `json:"id" description:"日志ID"`
TraceId string `json:"traceId" description:"链路ID"`
LevelFormat string `json:"levelFormat" description:"日志级别"`
Content string `json:"content" description:"日志内容"`
Stack *gjson.Json `json:"stack" description:"打印堆栈"`
Line string `json:"line" description:"调用行"`
TriggerNs int64 `json:"triggerNs" description:"触发时间(ns)"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}

View File

@@ -0,0 +1,22 @@
// =================================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// =================================================================================
package entity
import (
"github.com/gogf/gf/v2/os/gtime"
)
// SysSmsLog is the golang structure for table sys_sms_log.
type SysSmsLog struct {
Id int64 `json:"id" description:"主键"`
Event string `json:"event" description:"事件"`
Mobile string `json:"mobile" description:"手机号"`
Code string `json:"code" description:"验证码或短信内容"`
Times int64 `json:"times" description:"验证次数"`
Ip string `json:"ip" description:"ip地址"`
Status int `json:"status" description:"状态(1未验证,2已验证)"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"更新时间"`
}

View File

@@ -46,7 +46,7 @@ func DefaultPage(ctx context.Context) int {
// PageReq 分页
type PageReq struct {
Page int `json:"page" example:"10" d:"1" v:"min:1#页码最小值不能低于1" dc:"当前页码"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:100#|每页数量最小值不能低于1|最大值不能大于100" dc:"每页数量"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:200#|每页数量最小值不能低于1|最大值不能大于200" dc:"每页数量"`
}
type PageRes struct {
PageReq

View File

@@ -59,3 +59,9 @@ type CronStatusInp struct {
entity.SysCron
}
type CronStatusModel struct{}
// OnlineExecInp 在线执行
type OnlineExecInp struct {
entity.SysCron
}
type OnlineExecModel struct{}

View File

@@ -0,0 +1,90 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sysin
import (
"context"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/adminin"
"hotgo/internal/model/input/form"
)
// LoginLogDeleteInp 删除登录日志
type LoginLogDeleteInp struct {
Id interface{} `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type LoginLogDeleteModel struct{}
// LoginLogViewInp 获取指定登录日志信息
type LoginLogViewInp struct {
Id int64 `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type LoginLogViewModel struct {
entity.Test
}
// LoginLogListInp 获取登录日志列表
type LoginLogListInp struct {
form.PageReq
Username string `json:"username" dc:"用户名"`
Status int `json:"status" dc:"状态"`
LoginAt []*gtime.Time `json:"loginAt" dc:"登录时间"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
}
type LoginLogListModel struct {
Id int64 `json:"id" dc:"日志ID"`
ReqId string `json:"reqId" dc:"请求ID"`
MemberId int64 `json:"memberId" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
LoginAt *gtime.Time `json:"loginAt" dc:"登录时间"`
ErrMsg string `json:"errMsg" dc:"错误提示"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogId int64 `json:"sysLogId" dc:"日志ID"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
SysLogProvinceId int64 `json:"sysLogProvinceId" dc:"省编码"`
SysLogCityId int64 `json:"sysLogCityId" dc:"市编码"`
SysLogErrorCode int `json:"sysLogErrorCode" dc:"报错code"`
SysLogUserAgent string `json:"sysLogUserAgent" dc:"UA信息"`
Region string `json:"region" dc:"地区"`
Os string `json:"os" dc:"系统信息"`
Browser string `json:"browser" dc:"浏览器信息"`
}
func (in *LoginLogListInp) Filter(ctx context.Context) (err error) {
return
}
// LoginLogExportModel 导出登录日志
type LoginLogExportModel struct {
Id int64 `json:"id" dc:"日志ID"`
ReqId string `json:"reqId" dc:"请求ID"`
MemberId int64 `json:"memberId" dc:"用户ID"`
Username string `json:"username" dc:"用户名"`
LoginAt int64 `json:"loginAt" dc:"登录时间"`
ErrMsg string `json:"errMsg" dc:"错误提示"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogIp string `json:"sysLogIp" dc:"IP地址"`
SysLogProvinceId int64 `json:"sysLogProvinceId" dc:"省编码"`
SysLogCityId int64 `json:"sysLogCityId" dc:"市编码"`
SysLogErrorCode int `json:"sysLogErrorCode" dc:"报错code"`
SysLogUserAgent string `json:"sysLogUserAgent" dc:"UA信息"`
}
// LoginLogPushInp 解推送登录日志
type LoginLogPushInp struct {
Input adminin.MemberLoginInp
Response *adminin.MemberLoginModel
Err error
}

View File

@@ -13,11 +13,10 @@ import (
// ProvincesMaxSortInp 最大排序
type ProvincesMaxSortInp struct {
Id int64
}
type ProvincesMaxSortModel struct {
Sort int
Sort int `json:"sort" dc:"排序"`
}
// ProvincesEditInp 修改/新增字典数据
@@ -28,7 +27,7 @@ type ProvincesEditModel struct{}
// ProvincesDeleteInp 删除字典类型
type ProvincesDeleteInp struct {
Id interface{}
Id interface{} `json:"id" v:"required#省市区ID不能为空" dc:"省市区ID"`
}
type ProvincesDeleteModel struct{}
@@ -59,3 +58,26 @@ type ProvincesStatusInp struct {
entity.SysProvinces
}
type ProvincesStatusModel struct{}
// ProvincesChildrenListInp 获取省市区下级列表
type ProvincesChildrenListInp struct {
form.PageReq
form.StatusReq
Pid int64 `json:"pid" dc:"上级ID"`
Id int64 `json:"id" dc:"地区ID"`
Title string `json:"title" dc:"地区名称"`
}
type ProvincesChildrenListModel struct {
entity.SysProvinces
}
// ProvincesUniqueIdInp 获取省市区下级列表
type ProvincesUniqueIdInp struct {
OldId int64 `json:"oldId" dc:"原始ID"`
NewId int64 `json:"newId" dc:"新的ID"`
}
type ProvincesUniqueIdModel struct {
IsUnique bool `json:"unique" dc:"是否唯一"`
}

View File

@@ -0,0 +1,69 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sysin
import (
"context"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// ServeLogDeleteInp 删除服务日志
type ServeLogDeleteInp struct {
Id interface{} `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type ServeLogDeleteModel struct{}
// ServeLogViewInp 获取指定服务日志信息
type ServeLogViewInp struct {
Id int64 `json:"id" v:"required#日志ID不能为空" dc:"日志ID"`
}
type ServeLogViewModel struct {
entity.Test
}
// ServeLogListInp 获取服务日志列表
type ServeLogListInp struct {
form.PageReq
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
TriggerNs []int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
type ServeLogListModel struct {
Id int64 `json:"id" dc:"日志ID"`
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
Content string `json:"content" dc:"日志内容"`
Stack string `json:"stack" dc:"堆栈"`
Line string `json:"line" dc:"调用行"`
TriggerNs int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
SysLogId int64 `json:"sysLogId" dc:"访问日志ID"`
}
func (in *ServeLogListInp) Filter(ctx context.Context) (err error) {
return
}
// ServeLogExportModel 导出服务日志
type ServeLogExportModel struct {
Id int64 `json:"id" dc:"日志ID"`
Env string `json:"env" dc:"环境"`
TraceId string `json:"traceId" dc:"链路ID"`
LevelFormat string `json:"levelFormat" dc:"日志级别"`
Content string `json:"content" dc:"日志内容"`
Line string `json:"line" dc:"调用行"`
TriggerNs int64 `json:"triggerNs" dc:"触发时间(ns)"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}

View File

@@ -0,0 +1,76 @@
// Package sysin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2022 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sysin
import (
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// SmsLogMaxSortInp 最大排序
type SmsLogMaxSortInp struct {
Id int64
}
type SmsLogMaxSortModel struct {
Sort int
}
// SmsLogEditInp 修改/新增数据
type SmsLogEditInp struct {
entity.SysSmsLog
}
type SmsLogEditModel struct{}
// SmsLogDeleteInp 删除
type SmsLogDeleteInp struct {
Id interface{}
}
type SmsLogDeleteModel struct{}
// SmsLogViewInp 获取信息
type SmsLogViewInp struct {
Id int64
}
type SmsLogViewModel struct {
entity.SysSmsLog
}
// SmsLogListInp 获取列表
type SmsLogListInp struct {
form.PageReq
form.RangeDateReq
form.StatusReq
Title string
Content string
}
type SmsLogListModel struct {
entity.SysSmsLog
}
// SmsLogStatusInp 更新状态
type SmsLogStatusInp struct {
entity.SysSmsLog
}
type SmsLogStatusModel struct{}
// SendCodeInp 发送验证码
type SendCodeInp struct {
Event string `json:"event" description:"事件"` // 必填
Mobile string `json:"mobile" description:"手机号"` // 必填
Code string `json:"code" description:"验证码或短信内容"`
Template string `json:"-" description:"发信模板 "`
}
// VerifyCodeInp 效验验证码
type VerifyCodeInp struct {
Event string `json:"event" description:"事件"` // 必填
Mobile string `json:"mobile" description:"手机号"` // 必填
Code string `json:"code" description:"验证码或短信内容"` // 必填
}