mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-11 19:53:55 +08:00
发布v2.2.10版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
108
server/internal/controller/admin/sys/addons.go
Normal file
108
server/internal/controller/admin/sys/addons.go
Normal file
@@ -0,0 +1,108 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/addons"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
Addons = cAddons{}
|
||||
)
|
||||
|
||||
type cAddons struct{}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cAddons) List(ctx context.Context, req *addons.ListReq) (res *addons.ListRes, err error) {
|
||||
var in sysin.AddonsListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysAddons().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(addons.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 获取指定信息
|
||||
func (c *cAddons) Selects(ctx context.Context, req *addons.SelectsReq) (res *addons.SelectsRes, err error) {
|
||||
data, err := service.SysAddons().Selects(ctx, sysin.AddonsSelectsInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(addons.SelectsRes)
|
||||
res.AddonsSelectsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cAddons) Build(ctx context.Context, req *addons.BuildReq) (res *addons.BuildRes, err error) {
|
||||
var in sysin.AddonsBuildInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysAddons().Build(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Install 安装模块
|
||||
func (c *cAddons) Install(ctx context.Context, req *addons.InstallReq) (res *addons.InstallRes, err error) {
|
||||
var in sysin.AddonsInstallInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = service.SysAddons().Install(ctx, in); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// Upgrade 更新模块
|
||||
func (c *cAddons) Upgrade(ctx context.Context, req *addons.UpgradeReq) (res *addons.UpgradeRes, err error) {
|
||||
var in sysin.AddonsUpgradeInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = service.SysAddons().Upgrade(ctx, in); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// UnInstall 卸载模块
|
||||
func (c *cAddons) UnInstall(ctx context.Context, req *addons.UnInstallReq) (res *addons.UnInstallRes, err error) {
|
||||
var in sysin.AddonsUnInstallInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = service.SysAddons().UnInstall(ctx, in); err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
99
server/internal/controller/admin/sys/attachment.go
Normal file
99
server/internal/controller/admin/sys/attachment.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/attachment"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Attachment = cAttachment{}
|
||||
)
|
||||
|
||||
type cAttachment struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cAttachment) Delete(ctx context.Context, req *attachment.DeleteReq) (res *attachment.DeleteRes, err error) {
|
||||
var in sysin.AttachmentDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysAttachment().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cAttachment) Edit(ctx context.Context, req *attachment.EditReq) (res *attachment.EditRes, err error) {
|
||||
var in sysin.AttachmentEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysAttachment().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cAttachment) MaxSort(ctx context.Context, req *attachment.MaxSortReq) (res *attachment.MaxSortRes, err error) {
|
||||
data, err := service.SysAttachment().MaxSort(ctx, sysin.AttachmentMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cAttachment) View(ctx context.Context, req *attachment.ViewReq) (res *attachment.ViewRes, err error) {
|
||||
data, err := service.SysAttachment().View(ctx, sysin.AttachmentViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ViewRes)
|
||||
res.AttachmentViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cAttachment) List(ctx context.Context, req *attachment.ListReq) (res *attachment.ListRes, err error) {
|
||||
var in sysin.AttachmentListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysAttachment().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(attachment.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cAttachment) Status(ctx context.Context, req *attachment.StatusReq) (res *attachment.StatusRes, err error) {
|
||||
var in sysin.AttachmentStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysAttachment().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
99
server/internal/controller/admin/sys/blacklist.go
Normal file
99
server/internal/controller/admin/sys/blacklist.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/blacklist"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Blacklist = cBlacklist{}
|
||||
)
|
||||
|
||||
type cBlacklist struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cBlacklist) Delete(ctx context.Context, req *blacklist.DeleteReq) (res *blacklist.DeleteRes, err error) {
|
||||
var in sysin.BlacklistDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysBlacklist().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cBlacklist) Edit(ctx context.Context, req *blacklist.EditReq) (res *blacklist.EditRes, err error) {
|
||||
var in sysin.BlacklistEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysBlacklist().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cBlacklist) MaxSort(ctx context.Context, req *blacklist.MaxSortReq) (res *blacklist.MaxSortRes, err error) {
|
||||
data, err := service.SysBlacklist().MaxSort(ctx, sysin.BlacklistMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cBlacklist) View(ctx context.Context, req *blacklist.ViewReq) (res *blacklist.ViewRes, err error) {
|
||||
data, err := service.SysBlacklist().View(ctx, sysin.BlacklistViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ViewRes)
|
||||
res.BlacklistViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cBlacklist) List(ctx context.Context, req *blacklist.ListReq) (res *blacklist.ListRes, err error) {
|
||||
var in sysin.BlacklistListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysBlacklist().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(blacklist.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cBlacklist) Status(ctx context.Context, req *blacklist.StatusReq) (res *blacklist.StatusRes, err error) {
|
||||
var in sysin.BlacklistStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysBlacklist().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
58
server/internal/controller/admin/sys/config.go
Normal file
58
server/internal/controller/admin/sys/config.go
Normal file
@@ -0,0 +1,58 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/config"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Config = cConfig{}
|
||||
)
|
||||
|
||||
type cConfig struct{}
|
||||
|
||||
// GetConfig 获取指定分组的配置
|
||||
func (c *cConfig) GetConfig(ctx context.Context, req *config.GetReq) (res *config.GetRes, err error) {
|
||||
var in sysin.GetConfigInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel, err = service.SysConfig().GetConfigByGroup(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateConfig 更新指定分组的配置
|
||||
func (c *cConfig) UpdateConfig(ctx context.Context, req *config.UpdateReq) (res *config.UpdateRes, err error) {
|
||||
var in sysin.UpdateConfigInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysConfig().UpdateConfigByGroup(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// TypeSelect 数据类型选项
|
||||
func (c *cConfig) TypeSelect(ctx context.Context, req *config.TypeSelectReq) (res config.TypeSelectRes, err error) {
|
||||
for _, v := range consts.ConfigTypes {
|
||||
res = append(res, form.Select{
|
||||
Value: v,
|
||||
Name: v,
|
||||
Label: v,
|
||||
})
|
||||
}
|
||||
return
|
||||
}
|
||||
114
server/internal/controller/admin/sys/cron.go
Normal file
114
server/internal/controller/admin/sys/cron.go
Normal file
@@ -0,0 +1,114 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Cron = cCron{}
|
||||
)
|
||||
|
||||
type cCron struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCron) Delete(ctx context.Context, req *cron.DeleteReq) (res *cron.DeleteRes, err error) {
|
||||
var in sysin.CronDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCron().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCron) Edit(ctx context.Context, req *cron.EditReq) (res *cron.EditRes, err error) {
|
||||
var in sysin.CronEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCron().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCron) MaxSort(ctx context.Context, req *cron.MaxSortReq) (res *cron.MaxSortRes, err error) {
|
||||
data, err := service.SysCron().MaxSort(ctx, sysin.CronMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCron) View(ctx context.Context, req *cron.ViewReq) (res *cron.ViewRes, err error) {
|
||||
data, err := service.SysCron().View(ctx, sysin.CronViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ViewRes)
|
||||
res.CronViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCron) List(ctx context.Context, req *cron.ListReq) (res *cron.ListRes, err error) {
|
||||
var in sysin.CronListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysCron().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cCron) Status(ctx context.Context, req *cron.StatusReq) (res *cron.StatusRes, err error) {
|
||||
var in sysin.CronStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCron().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// OnlineExec 在线执行
|
||||
func (c *cCron) OnlineExec(ctx context.Context, req *cron.OnlineExecReq) (res *cron.OnlineExecRes, err error) {
|
||||
if req.Id <= 0 {
|
||||
return nil, gerror.New("定时任务ID不能为空")
|
||||
}
|
||||
|
||||
var in sysin.OnlineExecInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return res, service.SysCron().OnlineExec(ctx, in)
|
||||
}
|
||||
110
server/internal/controller/admin/sys/cron_group.go
Normal file
110
server/internal/controller/admin/sys/cron_group.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/cron"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
CronGroup = cCronGroup{}
|
||||
)
|
||||
|
||||
type cCronGroup struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cCronGroup) Delete(ctx context.Context, req *cron.GroupDeleteReq) (res *cron.GroupDeleteRes, err error) {
|
||||
var in sysin.CronGroupDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCronGroup().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cCronGroup) Edit(ctx context.Context, req *cron.GroupEditReq) (res *cron.GroupEditRes, err error) {
|
||||
var in sysin.CronGroupEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCronGroup().Edit(ctx, in)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cCronGroup) MaxSort(ctx context.Context, req *cron.GroupMaxSortReq) (res *cron.GroupMaxSortRes, err error) {
|
||||
data, err := service.SysCronGroup().MaxSort(ctx, sysin.CronGroupMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupMaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cCronGroup) View(ctx context.Context, req *cron.GroupViewReq) (res *cron.GroupViewRes, err error) {
|
||||
data, err := service.SysCronGroup().View(ctx, sysin.CronGroupViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupViewRes)
|
||||
res.CronGroupViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cCronGroup) List(ctx context.Context, req *cron.GroupListReq) (res *cron.GroupListRes, err error) {
|
||||
var in sysin.CronGroupListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysCronGroup().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(cron.GroupListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新状态
|
||||
func (c *cCronGroup) Status(ctx context.Context, req *cron.GroupStatusReq) (res *cron.GroupStatusRes, err error) {
|
||||
var in sysin.CronGroupStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCronGroup().Status(ctx, in)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cCronGroup) Select(ctx context.Context, req *cron.GroupSelectReq) (res *cron.GroupSelectRes, err error) {
|
||||
list, err := service.SysCronGroup().Select(ctx, sysin.CronGroupSelectInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*cron.GroupSelectRes)(&list)
|
||||
return
|
||||
}
|
||||
158
server/internal/controller/admin/sys/curd_demo.go
Normal file
158
server/internal/controller/admin/sys/curd_demo.go
Normal file
@@ -0,0 +1,158 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.1.4
|
||||
// @AutoGenerate Date 2023-02-20 16:41:58
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"hotgo/api/admin/curddemo"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
)
|
||||
|
||||
var (
|
||||
CurdDemo = cCurdDemo{}
|
||||
)
|
||||
|
||||
type cCurdDemo struct{}
|
||||
|
||||
// List 查看生成演示列表
|
||||
func (c *cCurdDemo) List(ctx context.Context, req *curddemo.ListReq) (res *curddemo.ListRes, err error) {
|
||||
var in sysin.CurdDemoListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysCurdDemo().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出生成演示列表
|
||||
func (c *cCurdDemo) Export(ctx context.Context, req *curddemo.ExportReq) (res *curddemo.ExportRes, err error) {
|
||||
var in sysin.CurdDemoListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCurdDemo().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新生成演示
|
||||
func (c *cCurdDemo) Edit(ctx context.Context, req *curddemo.EditReq) (res *curddemo.EditRes, err error) {
|
||||
var in sysin.CurdDemoEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCurdDemo().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 获取生成演示最大排序
|
||||
func (c *cCurdDemo) MaxSort(ctx context.Context, req *curddemo.MaxSortReq) (res *curddemo.MaxSortRes, err error) {
|
||||
data, err := service.SysCurdDemo().MaxSort(ctx, sysin.CurdDemoMaxSortInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.MaxSortRes)
|
||||
res.CurdDemoMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定生成演示信息
|
||||
func (c *cCurdDemo) View(ctx context.Context, req *curddemo.ViewReq) (res *curddemo.ViewRes, err error) {
|
||||
var in sysin.CurdDemoViewInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysCurdDemo().View(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(curddemo.ViewRes)
|
||||
res.CurdDemoViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除生成演示
|
||||
func (c *cCurdDemo) Delete(ctx context.Context, req *curddemo.DeleteReq) (res *curddemo.DeleteRes, err error) {
|
||||
var in sysin.CurdDemoDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCurdDemo().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新生成演示状态
|
||||
func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *curddemo.StatusRes, err error) {
|
||||
var in sysin.CurdDemoStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCurdDemo().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Switch 更新生成演示开关状态
|
||||
func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) {
|
||||
var in sysin.CurdDemoSwitchInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysCurdDemo().Switch(ctx, in)
|
||||
return
|
||||
}
|
||||
94
server/internal/controller/admin/sys/dict_data.go
Normal file
94
server/internal/controller/admin/sys/dict_data.go
Normal file
@@ -0,0 +1,94 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictData = cDictData{}
|
||||
)
|
||||
|
||||
type cDictData struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictData) Delete(ctx context.Context, req *dict.DataDeleteReq) (res *dict.DataDeleteRes, err error) {
|
||||
var in sysin.DictDataDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysDictData().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictData) Edit(ctx context.Context, req *dict.DataEditReq) (res *dict.DataEditRes, err error) {
|
||||
var in sysin.DictDataEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysDictData().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cDictData) List(ctx context.Context, req *dict.DataListReq) (res *dict.DataListRes, err error) {
|
||||
var in sysin.DictDataListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysDictData().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(dict.DataListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Select 指定选项
|
||||
func (c *cDictData) Select(ctx context.Context, req *dict.DataSelectReq) (res dict.DataSelectRes, err error) {
|
||||
var in sysin.DataSelectInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, err := service.SysDictData().Select(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = dict.DataSelectRes(list)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 多个选项
|
||||
func (c *cDictData) Selects(ctx context.Context, req *dict.DataSelectsReq) (res dict.DataSelectsRes, err error) {
|
||||
res = make(dict.DataSelectsRes)
|
||||
for _, v := range req.Types {
|
||||
option, err := service.SysDictData().Select(ctx, sysin.DataSelectInp{Type: v})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res[v] = option
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
61
server/internal/controller/admin/sys/dict_type.go
Normal file
61
server/internal/controller/admin/sys/dict_type.go
Normal file
@@ -0,0 +1,61 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/dict"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
DictType = cDictType{}
|
||||
)
|
||||
|
||||
type cDictType struct{}
|
||||
|
||||
// Tree 树
|
||||
func (c *cDictType) Tree(ctx context.Context, req *dict.TypeTreeReq) (res *dict.TypeTreeRes, err error) {
|
||||
res = new(dict.TypeTreeRes)
|
||||
res.List, err = service.SysDictType().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cDictType) Delete(ctx context.Context, req *dict.TypeDeleteReq) (res *dict.TypeDeleteRes, err error) {
|
||||
var in sysin.DictTypeDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysDictType().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cDictType) Edit(ctx context.Context, req *dict.TypeEditReq) (res *dict.TypeEditRes, err error) {
|
||||
var in sysin.DictTypeEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysDictType().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Select 选项
|
||||
func (c *cDictType) Select(ctx context.Context, req *dict.TypeSelectReq) (res *dict.TypeSelectRes, err error) {
|
||||
list, err := service.SysDictType().Select(ctx, sysin.DictTypeSelectInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*dict.TypeSelectRes)(&list)
|
||||
return
|
||||
}
|
||||
87
server/internal/controller/admin/sys/ems_log.go
Normal file
87
server/internal/controller/admin/sys/ems_log.go
Normal file
@@ -0,0 +1,87 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/emslog"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
EmsLog = cEmsLog{}
|
||||
)
|
||||
|
||||
type cEmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cEmsLog) Delete(ctx context.Context, req *emslog.DeleteReq) (res *emslog.DeleteRes, err error) {
|
||||
var in sysin.EmsLogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysEmsLog().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cEmsLog) Edit(ctx context.Context, req *emslog.EditReq) (res *emslog.EditRes, err error) {
|
||||
var in sysin.EmsLogEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysEmsLog().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cEmsLog) View(ctx context.Context, req *emslog.ViewReq) (res *emslog.ViewRes, err error) {
|
||||
data, err := service.SysEmsLog().View(ctx, sysin.EmsLogViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ViewRes)
|
||||
res.EmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cEmsLog) List(ctx context.Context, req *emslog.ListReq) (res *emslog.ListRes, err error) {
|
||||
var in sysin.EmsLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysEmsLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(emslog.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cEmsLog) Status(ctx context.Context, req *emslog.StatusReq) (res *emslog.StatusRes, err error) {
|
||||
var in sysin.EmsLogStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysEmsLog().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
196
server/internal/controller/admin/sys/gen_codes.go
Normal file
196
server/internal/controller/admin/sys/gen_codes.go
Normal file
@@ -0,0 +1,196 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/gencodes"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
GenCodes = cGenCodes{}
|
||||
)
|
||||
|
||||
type cGenCodes struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cGenCodes) Delete(ctx context.Context, req *gencodes.DeleteReq) (res *gencodes.DeleteRes, err error) {
|
||||
var in sysin.GenCodesDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysGenCodes().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cGenCodes) Edit(ctx context.Context, req *gencodes.EditReq) (res *gencodes.EditRes, err error) {
|
||||
var in sysin.GenCodesEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysGenCodes().Edit(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.EditRes)
|
||||
res.GenCodesEditModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cGenCodes) MaxSort(ctx context.Context, req *gencodes.MaxSortReq) (res *gencodes.MaxSortRes, err error) {
|
||||
data, err := service.SysGenCodes().MaxSort(ctx, sysin.GenCodesMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cGenCodes) View(ctx context.Context, req *gencodes.ViewReq) (res *gencodes.ViewRes, err error) {
|
||||
data, err := service.SysGenCodes().View(ctx, sysin.GenCodesViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ViewRes)
|
||||
res.GenCodesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cGenCodes) List(ctx context.Context, req *gencodes.ListReq) (res *gencodes.ListRes, err error) {
|
||||
var in sysin.GenCodesListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysGenCodes().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cGenCodes) Status(ctx context.Context, req *gencodes.StatusReq) (res *gencodes.StatusRes, err error) {
|
||||
var in sysin.GenCodesStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysGenCodes().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Selects 获取指定信息
|
||||
func (c *cGenCodes) Selects(ctx context.Context, req *gencodes.SelectsReq) (res *gencodes.SelectsRes, err error) {
|
||||
data, err := service.SysGenCodes().Selects(ctx, sysin.GenCodesSelectsInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.SelectsRes)
|
||||
res.GenCodesSelectsModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// TableSelect 数据库表选项
|
||||
func (c *cGenCodes) TableSelect(ctx context.Context, req *gencodes.TableSelectReq) (res *gencodes.TableSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().TableSelect(ctx, sysin.GenCodesTableSelectInp{Name: req.Name})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.TableSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnSelect 表字段选项
|
||||
func (c *cGenCodes) ColumnSelect(ctx context.Context, req *gencodes.ColumnSelectReq) (res *gencodes.ColumnSelectRes, err error) {
|
||||
data, err := service.SysGenCodes().ColumnSelect(ctx, sysin.GenCodesColumnSelectInp{Name: req.Name, Table: req.Table})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnSelectRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// ColumnList 表字段列表
|
||||
func (c *cGenCodes) ColumnList(ctx context.Context, req *gencodes.ColumnListReq) (res *gencodes.ColumnListRes, err error) {
|
||||
var in sysin.GenCodesColumnListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysGenCodes().ColumnList(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*gencodes.ColumnListRes)(&data)
|
||||
return
|
||||
}
|
||||
|
||||
// Preview 生成预览
|
||||
func (c *cGenCodes) Preview(ctx context.Context, req *gencodes.PreviewReq) (res *gencodes.PreviewRes, err error) {
|
||||
var in sysin.GenCodesPreviewInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysGenCodes().Preview(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(gencodes.PreviewRes)
|
||||
res.GenCodesPreviewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Build 生成预览
|
||||
func (c *cGenCodes) Build(ctx context.Context, req *gencodes.BuildReq) (res *gencodes.BuildRes, err error) {
|
||||
var in sysin.GenCodesBuildInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysGenCodes().Build(ctx, in)
|
||||
return
|
||||
}
|
||||
82
server/internal/controller/admin/sys/log.go
Normal file
82
server/internal/controller/admin/sys/log.go
Normal file
@@ -0,0 +1,82 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/log"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
// Log 日志
|
||||
var Log = sLog{}
|
||||
|
||||
type sLog struct{}
|
||||
|
||||
// Clear 清空日志
|
||||
func (c *sLog) Clear(ctx context.Context, req *log.ClearReq) (res *log.ClearRes, err error) {
|
||||
err = gerror.New("暂时考虑到安全问题,请到数据库清空")
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出
|
||||
func (c *sLog) Export(ctx context.Context, req *log.ExportReq) (res *log.ExportRes, err error) {
|
||||
var in sysin.LogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysLog().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// List 获取访问日志列表
|
||||
func (c *sLog) List(ctx context.Context, req *log.ListReq) (res *log.ListRes, err error) {
|
||||
var in sysin.LogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(log.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *sLog) View(ctx context.Context, req *log.ViewReq) (res *log.ViewRes, err error) {
|
||||
data, err := service.SysLog().View(ctx, sysin.LogViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(log.ViewRes)
|
||||
res.LogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *sLog) Delete(ctx context.Context, req *log.DeleteReq) (res *log.DeleteRes, err error) {
|
||||
var in sysin.LogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysLog().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
100
server/internal/controller/admin/sys/login_log.go
Normal file
100
server/internal/controller/admin/sys/login_log.go
Normal file
@@ -0,0 +1,100 @@
|
||||
// Package sys
|
||||
// @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
|
||||
// @AutoGenerate Version 2.1.1
|
||||
// @AutoGenerate Date 2023-01-19 16:57:33
|
||||
//
|
||||
package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/loginlog"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
LoginLog = cLoginLog{}
|
||||
)
|
||||
|
||||
type cLoginLog struct{}
|
||||
|
||||
// List 查看登录日志列表
|
||||
func (c *cLoginLog) List(ctx context.Context, req *loginlog.ListReq) (res *loginlog.ListRes, err error) {
|
||||
var in sysin.LoginLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysLoginLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(loginlog.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出登录日志列表
|
||||
func (c *cLoginLog) Export(ctx context.Context, req *loginlog.ExportReq) (res *loginlog.ExportRes, err error) {
|
||||
var in sysin.LoginLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysLoginLog().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定登录日志信息
|
||||
func (c *cLoginLog) View(ctx context.Context, req *loginlog.ViewReq) (res *loginlog.ViewRes, err error) {
|
||||
var in sysin.LoginLogViewInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysLoginLog().View(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(loginlog.ViewRes)
|
||||
res.LoginLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除登录日志
|
||||
func (c *cLoginLog) Delete(ctx context.Context, req *loginlog.DeleteReq) (res *loginlog.DeleteRes, err error) {
|
||||
var in sysin.LoginLogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysLoginLog().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
172
server/internal/controller/admin/sys/provinces.go
Normal file
172
server/internal/controller/admin/sys/provinces.go
Normal file
@@ -0,0 +1,172 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/provinces"
|
||||
"hotgo/internal/library/location"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Provinces = cProvinces{}
|
||||
)
|
||||
|
||||
type cProvinces struct{}
|
||||
|
||||
// Tree 关系树选项列表
|
||||
func (c *cProvinces) Tree(ctx context.Context, req *provinces.TreeReq) (res *provinces.TreeRes, err error) {
|
||||
res = new(provinces.TreeRes)
|
||||
res.List, err = service.SysProvinces().Tree(ctx)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cProvinces) Delete(ctx context.Context, req *provinces.DeleteReq) (res *provinces.DeleteRes, err error) {
|
||||
var in sysin.ProvincesDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysProvinces().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cProvinces) Edit(ctx context.Context, req *provinces.EditReq) (res *provinces.EditRes, err error) {
|
||||
var in sysin.ProvincesEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysProvinces().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cProvinces) MaxSort(ctx context.Context, req *provinces.MaxSortReq) (res *provinces.MaxSortRes, err error) {
|
||||
data, err := service.SysProvinces().MaxSort(ctx, sysin.ProvincesMaxSortInp{})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.MaxSortRes)
|
||||
res.ProvincesMaxSortModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cProvinces) View(ctx context.Context, req *provinces.ViewReq) (res *provinces.ViewRes, err error) {
|
||||
data, err := service.SysProvinces().View(ctx, sysin.ProvincesViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ViewRes)
|
||||
res.ProvincesViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cProvinces) List(ctx context.Context, req *provinces.ListReq) (res *provinces.ListRes, err error) {
|
||||
var in sysin.ProvincesListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysProvinces().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cProvinces) Status(ctx context.Context, req *provinces.StatusReq) (res *provinces.StatusRes, err error) {
|
||||
var in sysin.ProvincesStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysProvinces().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// ChildrenList 获取省市区下级列表
|
||||
func (c *cProvinces) ChildrenList(ctx context.Context, req *provinces.ChildrenListReq) (res *provinces.ChildrenListRes, err error) {
|
||||
var in sysin.ProvincesChildrenListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysProvinces().ChildrenList(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.ChildrenListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// UniqueId 地区ID是否唯一
|
||||
func (c *cProvinces) UniqueId(ctx context.Context, req *provinces.UniqueIdReq) (res *provinces.UniqueIdRes, err error) {
|
||||
var in sysin.ProvincesUniqueIdInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysProvinces().UniqueId(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.UniqueIdRes)
|
||||
res.ProvincesUniqueIdModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Select 省市区选项
|
||||
func (c *cProvinces) Select(ctx context.Context, req *provinces.SelectReq) (res *provinces.SelectRes, err error) {
|
||||
var in sysin.ProvincesSelectInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysProvinces().Select(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(provinces.SelectRes)
|
||||
res.ProvincesSelectModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// CityLabel 省市区选项
|
||||
func (c *cProvinces) CityLabel(ctx context.Context, req *provinces.CityLabelReq) (res *provinces.CityLabelRes, err error) {
|
||||
cityLabel, err := location.ParseSimpleRegion(ctx, req.Id, req.Spilt)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = (*provinces.CityLabelRes)(&cityLabel)
|
||||
return
|
||||
}
|
||||
98
server/internal/controller/admin/sys/serve_log.go
Normal file
98
server/internal/controller/admin/sys/serve_log.go
Normal file
@@ -0,0 +1,98 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/servelog"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
ServeLog = cServeLog{}
|
||||
)
|
||||
|
||||
type cServeLog struct{}
|
||||
|
||||
// List 查看服务日志列表
|
||||
func (c *cServeLog) List(ctx context.Context, req *servelog.ListReq) (res *servelog.ListRes, err error) {
|
||||
var in sysin.ServeLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysServeLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Export 导出服务日志列表
|
||||
func (c *cServeLog) Export(ctx context.Context, req *servelog.ExportReq) (res *servelog.ExportRes, err error) {
|
||||
var in sysin.ServeLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysServeLog().Export(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定服务日志信息
|
||||
func (c *cServeLog) View(ctx context.Context, req *servelog.ViewReq) (res *servelog.ViewRes, err error) {
|
||||
var in sysin.ServeLogViewInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
data, err := service.SysServeLog().View(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(servelog.ViewRes)
|
||||
res.ServeLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除服务日志
|
||||
func (c *cServeLog) Delete(ctx context.Context, req *servelog.DeleteReq) (res *servelog.DeleteRes, err error) {
|
||||
var in sysin.ServeLogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysServeLog().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
99
server/internal/controller/admin/sys/sms_log.go
Normal file
99
server/internal/controller/admin/sys/sms_log.go
Normal file
@@ -0,0 +1,99 @@
|
||||
// Package sys
|
||||
// @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 sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/api/admin/smslog"
|
||||
"hotgo/internal/model/input/form"
|
||||
"hotgo/internal/model/input/sysin"
|
||||
"hotgo/internal/service"
|
||||
)
|
||||
|
||||
var (
|
||||
SmsLog = cSmsLog{}
|
||||
)
|
||||
|
||||
type cSmsLog struct{}
|
||||
|
||||
// Delete 删除
|
||||
func (c *cSmsLog) Delete(ctx context.Context, req *smslog.DeleteReq) (res *smslog.DeleteRes, err error) {
|
||||
var in sysin.SmsLogDeleteInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().Delete(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 更新
|
||||
func (c *cSmsLog) Edit(ctx context.Context, req *smslog.EditReq) (res *smslog.EditRes, err error) {
|
||||
var in sysin.SmsLogEditInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().Edit(ctx, in)
|
||||
return
|
||||
}
|
||||
|
||||
// MaxSort 最大排序
|
||||
func (c *cSmsLog) MaxSort(ctx context.Context, req *smslog.MaxSortReq) (res *smslog.MaxSortRes, err error) {
|
||||
data, err := service.SysSmsLog().MaxSort(ctx, sysin.SmsLogMaxSortInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.MaxSortRes)
|
||||
res.Sort = data.Sort
|
||||
return
|
||||
}
|
||||
|
||||
// View 获取指定信息
|
||||
func (c *cSmsLog) View(ctx context.Context, req *smslog.ViewReq) (res *smslog.ViewRes, err error) {
|
||||
data, err := service.SysSmsLog().View(ctx, sysin.SmsLogViewInp{Id: req.Id})
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ViewRes)
|
||||
res.SmsLogViewModel = data
|
||||
return
|
||||
}
|
||||
|
||||
// List 查看列表
|
||||
func (c *cSmsLog) List(ctx context.Context, req *smslog.ListReq) (res *smslog.ListRes, err error) {
|
||||
var in sysin.SmsLogListInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
list, totalCount, err := service.SysSmsLog().List(ctx, in)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = new(smslog.ListRes)
|
||||
res.List = list
|
||||
res.PageCount = form.CalPageCount(totalCount, req.PerPage)
|
||||
res.Page = req.Page
|
||||
res.PerPage = req.PerPage
|
||||
return
|
||||
}
|
||||
|
||||
// Status 更新部门状态
|
||||
func (c *cSmsLog) Status(ctx context.Context, req *smslog.StatusReq) (res *smslog.StatusRes, err error) {
|
||||
var in sysin.SmsLogStatusInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = service.SysSmsLog().Status(ctx, in)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user