This commit is contained in:
孟帅
2023-10-21 18:02:24 +08:00
parent d2d18dd69a
commit 088203c1cb
24 changed files with 497 additions and 514 deletions

View File

@@ -7,5 +7,5 @@ package consts
// VersionApp HotGo版本
const (
VersionApp = "2.9.3"
VersionApp = "2.9.8"
)

View File

@@ -3,7 +3,7 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.8.9
// @AutoGenerate Version 2.9.3
package sys
import (

View File

@@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package websocket
import (
@@ -19,7 +18,7 @@ var Send = send{}
type send struct{}
// SendToTag 发送标签消息
func (c *send) SendToTag(ctx context.Context, req base.SendToTagReq) (res *base.SendToTagRes, err error) {
func (c *send) SendToTag(ctx context.Context, req *base.SendToTagReq) (res *base.SendToTagRes, err error) {
simple.SafeGo(ctx, func(ctx context.Context) {
websocket.SendToTag(req.Tag, &websocket.WResponse{
Event: req.Response.Event,

View File

@@ -1,4 +1,4 @@
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
// Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
@@ -9,6 +9,7 @@ package cmd
import (
"context"
"fmt"
"path/filepath"
"runtime"
"strings"
@@ -33,10 +34,11 @@ type cRun struct {
}
type cRunApp struct {
File string // Go run file name.
Path string // Directory storing built binary.
Options string // Extra "go run" options.
Args string // Custom arguments.
File string // Go run file name.
Path string // Directory storing built binary.
Options string // Extra "go run" options.
Args string // Custom arguments.
WatchPaths []string // Watch paths for live reload.
}
const (
@@ -46,15 +48,17 @@ const (
gf run main.go
gf run main.go --args "server -p 8080"
gf run main.go -mod=vendor
gf run main.go -w "manifest/config/*.yaml"
`
cRunDc = `
The "run" command is used for running go codes with hot-compiled-like feature,
which compiles and runs the go codes asynchronously when codes change.
`
cRunFileBrief = `building file path.`
cRunPathBrief = `output directory path for built binary file. it's "manifest/output" in default`
cRunExtraBrief = `the same options as "go run"/"go build" except some options as follows defined`
cRunArgsBrief = `custom arguments for your process`
cRunFileBrief = `building file path.`
cRunPathBrief = `output directory path for built binary file. it's "manifest/output" in default`
cRunExtraBrief = `the same options as "go run"/"go build" except some options as follows defined`
cRunArgsBrief = `custom arguments for your process`
cRunWatchPathsBrief = `watch additional paths for live reload, separated by ",". i.e. "manifest/config/*.yaml"`
)
var (
@@ -63,24 +67,26 @@ var (
func init() {
gtag.Sets(g.MapStrStr{
`cRunUsage`: cRunUsage,
`cRunBrief`: cRunBrief,
`cRunEg`: cRunEg,
`cRunDc`: cRunDc,
`cRunFileBrief`: cRunFileBrief,
`cRunPathBrief`: cRunPathBrief,
`cRunExtraBrief`: cRunExtraBrief,
`cRunArgsBrief`: cRunArgsBrief,
`cRunUsage`: cRunUsage,
`cRunBrief`: cRunBrief,
`cRunEg`: cRunEg,
`cRunDc`: cRunDc,
`cRunFileBrief`: cRunFileBrief,
`cRunPathBrief`: cRunPathBrief,
`cRunExtraBrief`: cRunExtraBrief,
`cRunArgsBrief`: cRunArgsBrief,
`cRunWatchPathsBrief`: cRunWatchPathsBrief,
})
}
type (
cRunInput struct {
g.Meta `name:"run"`
File string `name:"FILE" arg:"true" brief:"{cRunFileBrief}" v:"required"`
Path string `name:"path" short:"p" brief:"{cRunPathBrief}" d:"./"`
Extra string `name:"extra" short:"e" brief:"{cRunExtraBrief}"`
Args string `name:"args" short:"a" brief:"{cRunArgsBrief}"`
g.Meta `name:"run"`
File string `name:"FILE" arg:"true" brief:"{cRunFileBrief}" v:"required"`
Path string `name:"path" short:"p" brief:"{cRunPathBrief}" d:"./"`
Extra string `name:"extra" short:"e" brief:"{cRunExtraBrief}"`
Args string `name:"args" short:"a" brief:"{cRunArgsBrief}"`
WatchPaths string `name:"watchPaths" short:"w" brief:"{cRunWatchPathsBrief}"`
}
cRunOutput struct{}
)
@@ -92,24 +98,27 @@ func (c cRun) Index(ctx context.Context, in cRunInput) (out *cRunOutput, err err
}
app := &cRunApp{
File: in.File,
Path: in.Path,
Options: in.Extra,
Args: in.Args,
File: in.File,
Path: in.Path,
Options: in.Extra,
Args: in.Args,
WatchPaths: strings.Split(in.WatchPaths, ","),
}
dirty := gtype.NewBool()
_, err = gfsnotify.Add(gfile.RealPath("."), func(event *gfsnotify.Event) {
if gfile.ExtName(event.Path) != "go" {
if gfile.ExtName(event.Path) != "go" && !matchWatchPaths(app.WatchPaths, event.Path) {
return
}
// Variable `dirty` is used for running the changes only one in one second.
if !dirty.Cas(false, true) {
return
}
// With some delay in case of multiple code changes in very short interval.
gtimer.SetTimeout(ctx, 1500*gtime.MS, func(ctx context.Context) {
defer dirty.Set(false)
mlog.Printf(`go file changes: %s`, event.String())
mlog.Printf(`watched file changes: %s`, event.String())
app.Run(ctx)
})
})
@@ -152,7 +161,6 @@ func (app *cRunApp) Run(ctx context.Context) {
if process != nil {
if err := process.Kill(); err != nil {
mlog.Debugf("kill process error: %s", err.Error())
//return
}
}
// Run the binary file.
@@ -171,3 +179,22 @@ func (app *cRunApp) Run(ctx context.Context) {
mlog.Printf("build running pid: %d", pid)
}
}
func matchWatchPaths(watchPaths []string, eventPath string) bool {
for _, path := range watchPaths {
absPath, err := filepath.Abs(path)
if err != nil {
mlog.Printf("match watchPath '%s' error: %s", path, err.Error())
continue
}
matched, err := filepath.Match(absPath, eventPath)
if err != nil {
mlog.Printf("match watchPath '%s' error: %s", path, err.Error())
continue
}
if matched {
return true
}
}
return false
}

View File

@@ -34,6 +34,7 @@ gf gen ctrl
CGenCtrlBriefSdkStdVersion = `use standard version prefix for generated sdk request path`
CGenCtrlBriefSdkNoV1 = `do not add version suffix for interface module name if version is v1`
CGenCtrlBriefClear = `auto delete generated and unimplemented controller go files if api definitions are missing`
CGenCtrlControllerMerge = `generate all controller files into one go file by name of api definition source go file`
)
const (
@@ -58,6 +59,7 @@ func init() {
`CGenCtrlBriefSdkStdVersion`: CGenCtrlBriefSdkStdVersion,
`CGenCtrlBriefSdkNoV1`: CGenCtrlBriefSdkNoV1,
`CGenCtrlBriefClear`: CGenCtrlBriefClear,
`CGenCtrlControllerMerge`: CGenCtrlControllerMerge,
})
}
@@ -72,6 +74,7 @@ type (
SdkStdVersion bool `short:"v" name:"sdkStdVersion" brief:"{CGenCtrlBriefSdkStdVersion}" orphan:"true"`
SdkNoV1 bool `short:"n" name:"sdkNoV1" brief:"{CGenCtrlBriefSdkNoV1}" orphan:"true"`
Clear bool `short:"c" name:"clear" brief:"{CGenCtrlBriefClear}" orphan:"true"`
Merge bool `short:"m" name:"merge" brief:"{CGenCtrlControllerMerge}" orphan:"true"`
}
CGenCtrlOutput struct{}
)
@@ -79,7 +82,7 @@ type (
func (c CGenCtrl) Ctrl(ctx context.Context, in CGenCtrlInput) (out *CGenCtrlOutput, err error) {
if in.WatchFile != "" {
err = c.generateByWatchFile(
in.WatchFile, in.SdkPath, in.SdkStdVersion, in.SdkNoV1, in.Clear,
in.WatchFile, in.SdkPath, in.SdkStdVersion, in.SdkNoV1, in.Clear, in.Merge,
)
mlog.Print(`done!`)
return
@@ -104,7 +107,7 @@ func (c CGenCtrl) Ctrl(ctx context.Context, in CGenCtrlInput) (out *CGenCtrlOutp
)
err = c.generateByModule(
apiModuleFolderPath, dstModuleFolderPath, in.SdkPath,
in.SdkStdVersion, in.SdkNoV1, in.Clear,
in.SdkStdVersion, in.SdkNoV1, in.Clear, in.Merge,
)
if err != nil {
return nil, err
@@ -115,7 +118,7 @@ func (c CGenCtrl) Ctrl(ctx context.Context, in CGenCtrlInput) (out *CGenCtrlOutp
return
}
func (c CGenCtrl) generateByWatchFile(watchFile, sdkPath string, sdkStdVersion, sdkNoV1, clear bool) (err error) {
func (c CGenCtrl) generateByWatchFile(watchFile, sdkPath string, sdkStdVersion, sdkNoV1, clear, merge bool) (err error) {
// File lock to avoid multiple processes.
var (
flockFilePath = gfile.Temp("gf.cli.gen.service.lock")
@@ -154,14 +157,14 @@ func (c CGenCtrl) generateByWatchFile(watchFile, sdkPath string, sdkStdVersion,
dstModuleFolderPath = gfile.Join(projectRootPath, "internal", "controller", module)
)
return c.generateByModule(
apiModuleFolderPath, dstModuleFolderPath, sdkPath, sdkStdVersion, sdkNoV1, clear,
apiModuleFolderPath, dstModuleFolderPath, sdkPath, sdkStdVersion, sdkNoV1, clear, merge,
)
}
// parseApiModule parses certain api and generate associated go files by certain module, not all api modules.
func (c CGenCtrl) generateByModule(
apiModuleFolderPath, dstModuleFolderPath, sdkPath string,
sdkStdVersion, sdkNoV1, clear bool,
sdkStdVersion, sdkNoV1, clear, merge bool,
) (err error) {
// parse src and dst folder go files.
apiItemsInSrc, err := c.getApiItemsInSrc(apiModuleFolderPath)
@@ -194,7 +197,7 @@ func (c CGenCtrl) generateByModule(
toBeImplementedApiItems = append(toBeImplementedApiItems, item)
}
if len(toBeImplementedApiItems) > 0 {
err = newControllerGenerator().Generate(dstModuleFolderPath, toBeImplementedApiItems)
err = newControllerGenerator().Generate(dstModuleFolderPath, toBeImplementedApiItems, merge)
if err != nil {
return
}

View File

@@ -10,6 +10,7 @@ import "github.com/gogf/gf/v2/text/gstr"
type apiItem struct {
Import string `eg:"demo.com/api/user/v1"`
FileName string `eg:"user"`
Module string `eg:"user"`
Version string `eg:"v1"`
MethodName string `eg:"GetList"`

View File

@@ -53,6 +53,7 @@ func (c CGenCtrl) getApiItemsInSrc(apiModuleFolderPath string) (items []apiItem,
}
item := apiItem{
Import: gstr.Trim(importPath, `"`),
FileName: gfile.Name(apiFileFolderPath),
Module: gfile.Basename(apiModuleFolderPath),
Version: gfile.Basename(apiVersionFolderPath),
MethodName: methodName,

View File

@@ -23,7 +23,7 @@ func newControllerGenerator() *controllerGenerator {
return &controllerGenerator{}
}
func (c *controllerGenerator) Generate(dstModuleFolderPath string, apiModuleApiItems []apiItem) (err error) {
func (c *controllerGenerator) Generate(dstModuleFolderPath string, apiModuleApiItems []apiItem, merge bool) (err error) {
var (
doneApiItemSet = gset.NewStrSet()
)
@@ -42,7 +42,7 @@ func (c *controllerGenerator) Generate(dstModuleFolderPath string, apiModuleApiI
return
}
for _, subItem := range subItems {
if err = c.doGenerateCtrlItem(dstModuleFolderPath, subItem); err != nil {
if err = c.doGenerateCtrlItem(dstModuleFolderPath, subItem, merge); err != nil {
return
}
doneApiItemSet.Add(subItem.String())
@@ -115,7 +115,7 @@ func (c *controllerGenerator) doGenerateCtrlNewByModuleAndVersion(
return
}
func (c *controllerGenerator) doGenerateCtrlItem(dstModuleFolderPath string, item apiItem) (err error) {
func (c *controllerGenerator) doGenerateCtrlItem(dstModuleFolderPath string, item apiItem, merge bool) (err error) {
var (
methodNameSnake = gstr.CaseSnake(item.MethodName)
ctrlName = fmt.Sprintf(`Controller%s`, gstr.UcFirst(item.Version))
@@ -123,15 +123,40 @@ func (c *controllerGenerator) doGenerateCtrlItem(dstModuleFolderPath string, ite
`%s_%s_%s.go`, item.Module, item.Version, methodNameSnake,
))
)
content := gstr.ReplaceByMap(consts.TemplateGenCtrlControllerMethodFunc, g.MapStrStr{
"{Module}": item.Module,
"{ImportPath}": item.Import,
"{CtrlName}": ctrlName,
"{Version}": item.Version,
"{MethodName}": item.MethodName,
})
if err = gfile.PutContents(methodFilePath, gstr.TrimLeft(content)); err != nil {
return err
var content string
if merge {
methodFilePath = gfile.Join(dstModuleFolderPath, fmt.Sprintf(
`%s_%s_%s.go`, item.Module, item.Version, item.FileName,
))
}
if gfile.Exists(methodFilePath) {
content = gstr.ReplaceByMap(consts.TemplateGenCtrlControllerMethodFuncMerge, g.MapStrStr{
"{Module}": item.Module,
"{CtrlName}": ctrlName,
"{Version}": item.Version,
"{MethodName}": item.MethodName,
})
if gstr.Contains(gfile.GetContents(methodFilePath), fmt.Sprintf(`func (c *%v) %v`, ctrlName, item.MethodName)) {
return
}
if err = gfile.PutContentsAppend(methodFilePath, gstr.TrimLeft(content)); err != nil {
return err
}
} else {
content = gstr.ReplaceByMap(consts.TemplateGenCtrlControllerMethodFunc, g.MapStrStr{
"{Module}": item.Module,
"{ImportPath}": item.Import,
"{CtrlName}": ctrlName,
"{Version}": item.Version,
"{MethodName}": item.MethodName,
})
if err = gfile.PutContents(methodFilePath, gstr.TrimLeft(content)); err != nil {
return err
}
}
mlog.Printf(`generated: %s`, methodFilePath)
return

View File

@@ -25,8 +25,8 @@ require (
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@@ -54,6 +54,13 @@ func (c *{CtrlName}) {MethodName}(ctx context.Context, req *{Version}.{MethodNam
}
`
const TemplateGenCtrlControllerMethodFuncMerge = `
func (c *{CtrlName}) {MethodName}(ctx context.Context, req *{Version}.{MethodName}Req) (res *{Version}.{MethodName}Res, err error) {
return nil, gerror.NewCode(gcode.CodeNotImplemented)
}
`
const TemplateGenCtrlApiInterface = `
// =================================================================================
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.

View File

@@ -119,6 +119,8 @@ var (
"dwf": "model/vnd.dwf",
"ics": "text/calendar",
"vcard": "text/vcard",
"apk": "application/vnd.android.package-archive",
"ipa": "application/octet-stream",
}
)

View File

@@ -3,7 +3,7 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.8.9
// @AutoGenerate Version 2.9.3
package sys
import (

View File

@@ -3,7 +3,7 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.8.9
// @AutoGenerate Version 2.9.3
package sysin
import (

View File

@@ -3,7 +3,7 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.8.9
// @AutoGenerate Version 2.9.3
package genrouter
import "hotgo/internal/controller/admin/sys"

View File

@@ -18,6 +18,54 @@ import (
)
type (
ISysDictType interface {
// Tree 树
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
// Delete 删除
Delete(ctx context.Context, in *sysin.DictTypeDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.DictTypeEditInp) (err error)
// TreeSelect 获取类型关系树选项
TreeSelect(ctx context.Context, in *sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
}
ISysProvinces interface {
// Tree 关系树选项列表
Tree(ctx context.Context) (list []*sysin.ProvincesTree, err error)
// Delete 删除省市区数据
Delete(ctx context.Context, in *sysin.ProvincesDeleteInp) (err error)
// Edit 修改/新增省市区数据
Edit(ctx context.Context, in *sysin.ProvincesEditInp) (err error)
// Status 更新省市区状态
Status(ctx context.Context, in *sysin.ProvincesStatusInp) (err error)
// MaxSort 最大排序
MaxSort(ctx context.Context, in *sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
// View 获取省市区信息
View(ctx context.Context, in *sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
// ChildrenList 获取省市区下级列表
ChildrenList(ctx context.Context, in *sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
// UniqueId 获取省市区下级列表
UniqueId(ctx context.Context, in *sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
// Select 省市区选项
Select(ctx context.Context, in *sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
}
ISysDictData interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.DictDataDeleteInp) error
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.DictDataEditInp) (err error)
// List 获取列表
List(ctx context.Context, in *sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
// GetId 获取指定类型的ID
GetId(ctx context.Context, t string) (id int64, err error)
// GetType 获取指定ID的类型标识
GetType(ctx context.Context, id int64) (types string, err error)
// GetTypes 获取指定ID的所有类型标识包含下级
GetTypes(ctx context.Context, id int64) (types []string, err error)
// Select 获取列表
Select(ctx context.Context, in *sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
}
ISysEmsLog interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.EmsLogDeleteInp) (err error)
@@ -40,6 +88,24 @@ type (
// VerifyCode 效验验证码
VerifyCode(ctx context.Context, in *sysin.VerifyEmsCodeInp) (err error)
}
ISysServeLicense interface {
// Model 服务许可证ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取服务许可证列表
List(ctx context.Context, in *sysin.ServeLicenseListInp) (list []*sysin.ServeLicenseListModel, totalCount int, err error)
// Export 导出服务许可证
Export(ctx context.Context, in *sysin.ServeLicenseListInp) (err error)
// Edit 修改/新增服务许可证
Edit(ctx context.Context, in *sysin.ServeLicenseEditInp) (err error)
// Delete 删除服务许可证
Delete(ctx context.Context, in *sysin.ServeLicenseDeleteInp) (err error)
// View 获取服务许可证指定信息
View(ctx context.Context, in *sysin.ServeLicenseViewInp) (res *sysin.ServeLicenseViewModel, err error)
// Status 更新服务许可证状态
Status(ctx context.Context, in *sysin.ServeLicenseStatusInp) (err error)
// AssignRouter 分配服务许可证路由
AssignRouter(ctx context.Context, in *sysin.ServeLicenseAssignRouterInp) (err error)
}
ISysAddons interface {
// List 获取列表
List(ctx context.Context, in *sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
@@ -54,47 +120,41 @@ type (
// UnInstall 卸载模块
UnInstall(ctx context.Context, in *sysin.AddonsUnInstallInp) (err error)
}
ISysAttachment interface {
// Model ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// Delete 删除附件
Delete(ctx context.Context, in *sysin.AttachmentDeleteInp) (err error)
// View 获取附件信息
View(ctx context.Context, in *sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
// List 获取附件列表
List(ctx context.Context, in *sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
// ClearKind 清空上传类型
ClearKind(ctx context.Context, in *sysin.AttachmentClearKindInp) (err error)
}
ISysDictData interface {
ISysBlacklist interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.DictDataDeleteInp) error
Delete(ctx context.Context, in *sysin.BlacklistDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.DictDataEditInp) (err error)
Edit(ctx context.Context, in *sysin.BlacklistEditInp) (err error)
// Status 更新部门状态
Status(ctx context.Context, in *sysin.BlacklistStatusInp) (err error)
// View 获取指定字典类型信息
View(ctx context.Context, in *sysin.BlacklistViewInp) (res *sysin.BlacklistViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
// GetId 获取指定类型的ID
GetId(ctx context.Context, t string) (id int64, err error)
// GetType 获取指定ID的类型标识
GetType(ctx context.Context, id int64) (types string, err error)
// GetTypes 获取指定ID的所有类型标识包含下级
GetTypes(ctx context.Context, id int64) (types []string, err error)
// Select 获取列表
Select(ctx context.Context, in *sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
List(ctx context.Context, in *sysin.BlacklistListInp) (list []*sysin.BlacklistListModel, totalCount int, err error)
// VariableLoad 变化加载
VariableLoad(ctx context.Context, err error)
// Load 加载黑名单
Load(ctx context.Context)
// VerifyRequest 验证请求的访问IP是否在黑名单如果存在则返回错误
VerifyRequest(r *ghttp.Request) (err error)
// ClusterSync 集群同步
ClusterSync(ctx context.Context, message *gredis.Message)
}
ISysServeLog interface {
// Model 服务日志Orm模型
Model(ctx context.Context) *gdb.Model
// List 获取服务日志列表
List(ctx context.Context, in *sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
// Export 导出服务日志
Export(ctx context.Context, in *sysin.ServeLogListInp) (err error)
// Delete 删除服务日志
Delete(ctx context.Context, in *sysin.ServeLogDeleteInp) (err error)
// View 获取服务日志指定信息
View(ctx context.Context, in *sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
// RealWrite 真实写入
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
ISysCronGroup interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.CronGroupDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.CronGroupEditInp) (err error)
// Status 更新状态
Status(ctx context.Context, in *sysin.CronGroupStatusInp) (err error)
// MaxSort 最大排序
MaxSort(ctx context.Context, in *sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
// View 获取指定信息
View(ctx context.Context, in *sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
// Select 选项
Select(ctx context.Context, in *sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
}
ISysCurdDemo interface {
// Model 生成演示ORM模型
@@ -116,16 +176,6 @@ type (
// Switch 更新生成演示开关
Switch(ctx context.Context, in *sysin.CurdDemoSwitchInp) (err error)
}
ISysDictType interface {
// Tree 树
Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
// Delete 删除
Delete(ctx context.Context, in *sysin.DictTypeDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.DictTypeEditInp) (err error)
// TreeSelect 获取类型关系树选项
TreeSelect(ctx context.Context, in *sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
}
ISysGenCodes interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.GenCodesDeleteInp) (err error)
@@ -168,6 +218,22 @@ type (
// List 列表
List(ctx context.Context, in *sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
}
ISysLoginLog interface {
// Model 登录日志Orm模型
Model(ctx context.Context) *gdb.Model
// List 获取登录日志列表
List(ctx context.Context, in *sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
// Export 导出登录日志
Export(ctx context.Context, in *sysin.LoginLogListInp) (err error)
// Delete 删除登录日志
Delete(ctx context.Context, in *sysin.LoginLogDeleteInp) (err error)
// View 获取登录日志指定信息
View(ctx context.Context, in *sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
// Push 推送登录日志
Push(ctx context.Context, in *sysin.LoginLogPushInp)
// RealWrite 真实写入
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
}
ISysAddonsConfig interface {
// GetConfigByGroup 获取指定分组的配置
GetConfigByGroup(ctx context.Context, in *sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
@@ -176,25 +242,17 @@ type (
// UpdateConfigByGroup 更新指定分组的配置
UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateAddonsConfigInp) (err error)
}
ISysBlacklist interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.BlacklistDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.BlacklistEditInp) (err error)
// Status 更新部门状态
Status(ctx context.Context, in *sysin.BlacklistStatusInp) (err error)
// View 获取指定字典类型信息
View(ctx context.Context, in *sysin.BlacklistViewInp) (res *sysin.BlacklistViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.BlacklistListInp) (list []*sysin.BlacklistListModel, totalCount int, err error)
// VariableLoad 变化加载
VariableLoad(ctx context.Context, err error)
// Load 加载黑名单
Load(ctx context.Context)
// VerifyRequest 验证请求的访问IP是否在黑名单如果存在则返回错误
VerifyRequest(r *ghttp.Request) (err error)
// ClusterSync 集群同步
ClusterSync(ctx context.Context, message *gredis.Message)
ISysAttachment interface {
// Model ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// Delete 删除附件
Delete(ctx context.Context, in *sysin.AttachmentDeleteInp) (err error)
// View 获取附件信息
View(ctx context.Context, in *sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
// List 获取附件列表
List(ctx context.Context, in *sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
// ClearKind 清空上传类型
ClearKind(ctx context.Context, in *sysin.AttachmentClearKindInp) (err error)
}
ISysConfig interface {
// InitConfig 初始化系统配置
@@ -257,6 +315,20 @@ type (
// OnlineExec 在线执行
OnlineExec(ctx context.Context, in *sysin.OnlineExecInp) (err error)
}
ISysServeLog interface {
// Model 服务日志Orm模型
Model(ctx context.Context) *gdb.Model
// List 获取服务日志列表
List(ctx context.Context, in *sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
// Export 导出服务日志
Export(ctx context.Context, in *sysin.ServeLogListInp) (err error)
// Delete 删除服务日志
Delete(ctx context.Context, in *sysin.ServeLogDeleteInp) (err error)
// View 获取服务日志指定信息
View(ctx context.Context, in *sysin.ServeLogViewInp) (res *sysin.ServeLogViewModel, err error)
// RealWrite 真实写入
RealWrite(ctx context.Context, models entity.SysServeLog) (err error)
}
ISysSmsLog interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.SmsLogDeleteInp) (err error)
@@ -279,156 +351,29 @@ type (
// VerifyCode 效验验证码
VerifyCode(ctx context.Context, in *sysin.VerifyCodeInp) (err error)
}
ISysCronGroup interface {
// Delete 删除
Delete(ctx context.Context, in *sysin.CronGroupDeleteInp) (err error)
// Edit 修改/新增
Edit(ctx context.Context, in *sysin.CronGroupEditInp) (err error)
// Status 更新状态
Status(ctx context.Context, in *sysin.CronGroupStatusInp) (err error)
// MaxSort 最大排序
MaxSort(ctx context.Context, in *sysin.CronGroupMaxSortInp) (res *sysin.CronGroupMaxSortModel, err error)
// View 获取指定信息
View(ctx context.Context, in *sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
// Select 选项
Select(ctx context.Context, in *sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
}
ISysLoginLog interface {
// Model 登录日志Orm模型
Model(ctx context.Context) *gdb.Model
// List 获取登录日志列表
List(ctx context.Context, in *sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
// Export 导出登录日志
Export(ctx context.Context, in *sysin.LoginLogListInp) (err error)
// Delete 删除登录日志
Delete(ctx context.Context, in *sysin.LoginLogDeleteInp) (err error)
// View 获取登录日志指定信息
View(ctx context.Context, in *sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
// Push 推送登录日志
Push(ctx context.Context, in *sysin.LoginLogPushInp)
// RealWrite 真实写入
RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
}
ISysProvinces interface {
// Tree 关系树选项列表
Tree(ctx context.Context) (list []*sysin.ProvincesTree, err error)
// Delete 删除省市区数据
Delete(ctx context.Context, in *sysin.ProvincesDeleteInp) (err error)
// Edit 修改/新增省市区数据
Edit(ctx context.Context, in *sysin.ProvincesEditInp) (err error)
// Status 更新省市区状态
Status(ctx context.Context, in *sysin.ProvincesStatusInp) (err error)
// MaxSort 最大排序
MaxSort(ctx context.Context, in *sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
// View 获取省市区信息
View(ctx context.Context, in *sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
// List 获取列表
List(ctx context.Context, in *sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
// ChildrenList 获取省市区下级列表
ChildrenList(ctx context.Context, in *sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
// UniqueId 获取省市区下级列表
UniqueId(ctx context.Context, in *sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
// Select 省市区选项
Select(ctx context.Context, in *sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
}
ISysServeLicense interface {
// Model 服务许可证ORM模型
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
// List 获取服务许可证列表
List(ctx context.Context, in *sysin.ServeLicenseListInp) (list []*sysin.ServeLicenseListModel, totalCount int, err error)
// Export 导出服务许可证
Export(ctx context.Context, in *sysin.ServeLicenseListInp) (err error)
// Edit 修改/新增服务许可证
Edit(ctx context.Context, in *sysin.ServeLicenseEditInp) (err error)
// Delete 删除服务许可证
Delete(ctx context.Context, in *sysin.ServeLicenseDeleteInp) (err error)
// View 获取服务许可证指定信息
View(ctx context.Context, in *sysin.ServeLicenseViewInp) (res *sysin.ServeLicenseViewModel, err error)
// Status 更新服务许可证状态
Status(ctx context.Context, in *sysin.ServeLicenseStatusInp) (err error)
// AssignRouter 分配服务许可证路由
AssignRouter(ctx context.Context, in *sysin.ServeLicenseAssignRouterInp) (err error)
}
)
var (
localSysCronGroup ISysCronGroup
localSysLoginLog ISysLoginLog
localSysProvinces ISysProvinces
localSysServeLicense ISysServeLicense
localSysEmsLog ISysEmsLog
localSysAddons ISysAddons
localSysAttachment ISysAttachment
localSysDictData ISysDictData
localSysServeLog ISysServeLog
localSysSmsLog ISysSmsLog
localSysAddonsConfig ISysAddonsConfig
localSysBlacklist ISysBlacklist
localSysAttachment ISysAttachment
localSysConfig ISysConfig
localSysCron ISysCron
localSysCurdDemo ISysCurdDemo
localSysDictType ISysDictType
localSysProvinces ISysProvinces
localSysDictData ISysDictData
localSysEmsLog ISysEmsLog
localSysGenCodes ISysGenCodes
localSysLog ISysLog
localSysSmsLog ISysSmsLog
localSysLoginLog ISysLoginLog
localSysServeLicense ISysServeLicense
localSysAddons ISysAddons
localSysBlacklist ISysBlacklist
localSysCronGroup ISysCronGroup
localSysCurdDemo ISysCurdDemo
)
func SysLoginLog() ISysLoginLog {
if localSysLoginLog == nil {
panic("implement not found for interface ISysLoginLog, forgot register?")
}
return localSysLoginLog
}
func RegisterSysLoginLog(i ISysLoginLog) {
localSysLoginLog = i
}
func SysProvinces() ISysProvinces {
if localSysProvinces == nil {
panic("implement not found for interface ISysProvinces, forgot register?")
}
return localSysProvinces
}
func RegisterSysProvinces(i ISysProvinces) {
localSysProvinces = i
}
func SysServeLicense() ISysServeLicense {
if localSysServeLicense == nil {
panic("implement not found for interface ISysServeLicense, forgot register?")
}
return localSysServeLicense
}
func RegisterSysServeLicense(i ISysServeLicense) {
localSysServeLicense = i
}
func SysCronGroup() ISysCronGroup {
if localSysCronGroup == nil {
panic("implement not found for interface ISysCronGroup, forgot register?")
}
return localSysCronGroup
}
func RegisterSysCronGroup(i ISysCronGroup) {
localSysCronGroup = i
}
func SysEmsLog() ISysEmsLog {
if localSysEmsLog == nil {
panic("implement not found for interface ISysEmsLog, forgot register?")
}
return localSysEmsLog
}
func RegisterSysEmsLog(i ISysEmsLog) {
localSysEmsLog = i
}
func SysAttachment() ISysAttachment {
if localSysAttachment == nil {
panic("implement not found for interface ISysAttachment, forgot register?")
@@ -440,50 +385,6 @@ func RegisterSysAttachment(i ISysAttachment) {
localSysAttachment = i
}
func SysDictData() ISysDictData {
if localSysDictData == nil {
panic("implement not found for interface ISysDictData, forgot register?")
}
return localSysDictData
}
func RegisterSysDictData(i ISysDictData) {
localSysDictData = i
}
func SysServeLog() ISysServeLog {
if localSysServeLog == nil {
panic("implement not found for interface ISysServeLog, forgot register?")
}
return localSysServeLog
}
func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
}
func SysAddons() ISysAddons {
if localSysAddons == nil {
panic("implement not found for interface ISysAddons, forgot register?")
}
return localSysAddons
}
func RegisterSysAddons(i ISysAddons) {
localSysAddons = i
}
func SysBlacklist() ISysBlacklist {
if localSysBlacklist == nil {
panic("implement not found for interface ISysBlacklist, forgot register?")
}
return localSysBlacklist
}
func RegisterSysBlacklist(i ISysBlacklist) {
localSysBlacklist = i
}
func SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
@@ -506,15 +407,48 @@ func RegisterSysCron(i ISysCron) {
localSysCron = i
}
func SysCurdDemo() ISysCurdDemo {
if localSysCurdDemo == nil {
panic("implement not found for interface ISysCurdDemo, forgot register?")
func SysServeLog() ISysServeLog {
if localSysServeLog == nil {
panic("implement not found for interface ISysServeLog, forgot register?")
}
return localSysCurdDemo
return localSysServeLog
}
func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = i
func RegisterSysServeLog(i ISysServeLog) {
localSysServeLog = i
}
func SysSmsLog() ISysSmsLog {
if localSysSmsLog == nil {
panic("implement not found for interface ISysSmsLog, forgot register?")
}
return localSysSmsLog
}
func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
}
func SysAddonsConfig() ISysAddonsConfig {
if localSysAddonsConfig == nil {
panic("implement not found for interface ISysAddonsConfig, forgot register?")
}
return localSysAddonsConfig
}
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = i
}
func SysProvinces() ISysProvinces {
if localSysProvinces == nil {
panic("implement not found for interface ISysProvinces, forgot register?")
}
return localSysProvinces
}
func RegisterSysProvinces(i ISysProvinces) {
localSysProvinces = i
}
func SysDictType() ISysDictType {
@@ -528,6 +462,61 @@ func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
}
func SysEmsLog() ISysEmsLog {
if localSysEmsLog == nil {
panic("implement not found for interface ISysEmsLog, forgot register?")
}
return localSysEmsLog
}
func RegisterSysEmsLog(i ISysEmsLog) {
localSysEmsLog = i
}
func SysDictData() ISysDictData {
if localSysDictData == nil {
panic("implement not found for interface ISysDictData, forgot register?")
}
return localSysDictData
}
func RegisterSysDictData(i ISysDictData) {
localSysDictData = i
}
func SysBlacklist() ISysBlacklist {
if localSysBlacklist == nil {
panic("implement not found for interface ISysBlacklist, forgot register?")
}
return localSysBlacklist
}
func RegisterSysBlacklist(i ISysBlacklist) {
localSysBlacklist = i
}
func SysCronGroup() ISysCronGroup {
if localSysCronGroup == nil {
panic("implement not found for interface ISysCronGroup, forgot register?")
}
return localSysCronGroup
}
func RegisterSysCronGroup(i ISysCronGroup) {
localSysCronGroup = i
}
func SysCurdDemo() ISysCurdDemo {
if localSysCurdDemo == nil {
panic("implement not found for interface ISysCurdDemo, forgot register?")
}
return localSysCurdDemo
}
func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = i
}
func SysGenCodes() ISysGenCodes {
if localSysGenCodes == nil {
panic("implement not found for interface ISysGenCodes, forgot register?")
@@ -550,24 +539,35 @@ func RegisterSysLog(i ISysLog) {
localSysLog = i
}
func SysAddonsConfig() ISysAddonsConfig {
if localSysAddonsConfig == nil {
panic("implement not found for interface ISysAddonsConfig, forgot register?")
func SysLoginLog() ISysLoginLog {
if localSysLoginLog == nil {
panic("implement not found for interface ISysLoginLog, forgot register?")
}
return localSysAddonsConfig
return localSysLoginLog
}
func RegisterSysAddonsConfig(i ISysAddonsConfig) {
localSysAddonsConfig = i
func RegisterSysLoginLog(i ISysLoginLog) {
localSysLoginLog = i
}
func SysSmsLog() ISysSmsLog {
if localSysSmsLog == nil {
panic("implement not found for interface ISysSmsLog, forgot register?")
func SysServeLicense() ISysServeLicense {
if localSysServeLicense == nil {
panic("implement not found for interface ISysServeLicense, forgot register?")
}
return localSysSmsLog
return localSysServeLicense
}
func RegisterSysSmsLog(i ISysSmsLog) {
localSysSmsLog = i
func RegisterSysServeLicense(i ISysServeLicense) {
localSysServeLicense = i
}
func SysAddons() ISysAddons {
if localSysAddons == nil {
panic("implement not found for interface ISysAddons, forgot register?")
}
return localSysAddons
}
func RegisterSysAddons(i ISysAddons) {
localSysAddons = i
}