mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-27 19:35:49 +08:00
发布v2.8.4版本,更新内容请查看:https://github.com/bufanyun/hotgo/tree/v2.0/docs/guide-zh-CN/addon-version-upgrade.md
This commit is contained in:
@@ -7,11 +7,8 @@ package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/api/admin/config"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
"hotgo/api/admin/config"
|
||||
isysin "hotgo/internal/model/input/sysin"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -22,25 +19,15 @@ 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
|
||||
}
|
||||
|
||||
data, err := service.SysConfig().GetConfigByGroup(ctx, in)
|
||||
data, err := service.SysConfig().GetConfigByGroup(ctx, &req.GetConfigInp)
|
||||
|
||||
res = new(config.GetRes)
|
||||
res.GetConfigModel = (*isysin.GetConfigModel)(data)
|
||||
res.GetConfigModel = data
|
||||
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)
|
||||
err = service.SysConfig().UpdateConfigByGroup(ctx, &req.UpdateConfigInp)
|
||||
return
|
||||
}
|
||||
|
@@ -7,11 +7,8 @@ package sys
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/@{.name}/api/admin/index"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -22,16 +19,7 @@ type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
var in sysin.IndexTestInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := service.SysIndex().Test(ctx, in)
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@@ -7,11 +7,8 @@ package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/@{.name}/api/api/index"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -22,16 +19,7 @@ type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
var in sysin.IndexTestInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := service.SysIndex().Test(ctx, in)
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -40,3 +28,4 @@ func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestR
|
||||
res.IndexTestModel = data
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -8,13 +8,10 @@ package home
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/@{.name}/api/home/index"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
"hotgo/internal/model"
|
||||
isc "hotgo/internal/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
// Index 基础
|
||||
@@ -23,16 +20,7 @@ var Index = cIndex{}
|
||||
type cIndex struct{}
|
||||
|
||||
func (a *cIndex) Index(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
var in sysin.IndexTestInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := service.SysIndex().Test(ctx, in)
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@@ -7,11 +7,8 @@ package websocket
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"hotgo/addons/@{.name}/api/websocket/index"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
"hotgo/utility/validate"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -22,16 +19,7 @@ type cIndex struct{}
|
||||
|
||||
// Test 测试
|
||||
func (c *cIndex) Test(ctx context.Context, req *index.TestReq) (res *index.TestRes, err error) {
|
||||
var in sysin.IndexTestInp
|
||||
if err = gconv.Scan(req, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err = validate.PreFilter(ctx, &in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := service.SysIndex().Test(ctx, in)
|
||||
data, err := service.SysIndex().Test(ctx, &req.IndexTestInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@@ -1,3 +1,8 @@
|
||||
// Package crons
|
||||
// @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 crons
|
||||
|
||||
// 定时任务.
|
||||
|
@@ -12,7 +12,6 @@ import (
|
||||
"hotgo/addons/@{.name}/model"
|
||||
"hotgo/addons/@{.name}/model/input/sysin"
|
||||
"hotgo/addons/@{.name}/service"
|
||||
isysin "hotgo/internal/model/input/sysin"
|
||||
isc "hotgo/internal/service"
|
||||
)
|
||||
|
||||
@@ -28,22 +27,22 @@ func init() {
|
||||
|
||||
// GetBasic 获取基础配置
|
||||
func (s *sSysConfig) GetBasic(ctx context.Context) (conf *model.BasicConfig, err error) {
|
||||
var in = isysin.GetAddonsConfigInp{AddonName: global.GetSkeleton().Name, Group: "basic"}
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, in)
|
||||
var in sysin.GetConfigInp
|
||||
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
in.GetAddonsConfigInp.Group = "basic"
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err = gconv.Struct(models.List, &conf); err != nil {
|
||||
return
|
||||
}
|
||||
err = gconv.Struct(models.List, &conf)
|
||||
return
|
||||
}
|
||||
|
||||
// GetConfigByGroup 获取指定分组配置
|
||||
func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) {
|
||||
func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error) {
|
||||
in.GetAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, in.GetAddonsConfigInp)
|
||||
models, err := isc.SysAddonsConfig().GetConfigByGroup(ctx, &in.GetAddonsConfigInp)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -54,7 +53,7 @@ func (s *sSysConfig) GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp
|
||||
}
|
||||
|
||||
// UpdateConfigByGroup 更新指定分组的配置
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error {
|
||||
func (s *sSysConfig) UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error {
|
||||
in.UpdateAddonsConfigInp.AddonName = global.GetSkeleton().Name
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, in.UpdateAddonsConfigInp)
|
||||
return isc.SysAddonsConfig().UpdateConfigByGroup(ctx, &in.UpdateAddonsConfigInp)
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ func init() {
|
||||
}
|
||||
|
||||
// Test 测试
|
||||
func (s *sSysIndex) Test(ctx context.Context, in sysin.IndexTestInp) (res *sysin.IndexTestModel, err error) {
|
||||
func (s *sSysIndex) Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error) {
|
||||
res = new(sysin.IndexTestModel)
|
||||
res.Name = in.Name
|
||||
res.Module = fmt.Sprintf("当前插件模块是:%s,当前应用模块是:%s", global.GetSkeleton().Name, contexts.Get(ctx).Module)
|
||||
|
@@ -1,3 +1,8 @@
|
||||
// Package queues
|
||||
// @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 queues
|
||||
|
||||
// 消息队列.
|
||||
|
@@ -14,11 +14,11 @@ import (
|
||||
type (
|
||||
ISysConfig interface {
|
||||
GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
|
||||
GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
|
||||
UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error
|
||||
GetConfigByGroup(ctx context.Context, in *sysin.GetConfigInp) (res *sysin.GetConfigModel, err error)
|
||||
UpdateConfigByGroup(ctx context.Context, in *sysin.UpdateConfigInp) error
|
||||
}
|
||||
ISysIndex interface {
|
||||
Test(ctx context.Context, in sysin.IndexTestInp) (res *sysin.IndexTestModel, err error)
|
||||
Test(ctx context.Context, in *sysin.IndexTestInp) (res *sysin.IndexTestModel, err error)
|
||||
}
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user