+
+
+
+
+
+ {{ item.name }}
+ {{ item.desc }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+`
+)
diff --git a/server/internal/library/addons/module.go b/server/internal/library/addons/module.go
index cac34ad..e5f9f3d 100644
--- a/server/internal/library/addons/module.go
+++ b/server/internal/library/addons/module.go
@@ -66,11 +66,12 @@ func RegisterModulesRouter(ctx context.Context, group *ghttp.RouterGroup) {
func RegisterModule(m Module) Module {
mLock.Lock()
defer mLock.Unlock()
- _, ok := modules[m.GetSkeleton().Name]
+ name := m.GetSkeleton().Name
+ _, ok := modules[name]
if ok {
- panic("module repeat registration, name:" + m.GetSkeleton().Name)
+ panic("module repeat registration, name:" + name)
}
- modules[m.GetSkeleton().Name] = m
+ modules[name] = m
return m
}
diff --git a/server/internal/library/contexts/context.go b/server/internal/library/contexts/context.go
index 0b7e43d..b2f86f7 100644
--- a/server/internal/library/contexts/context.go
+++ b/server/internal/library/contexts/context.go
@@ -107,6 +107,15 @@ func GetRoleKey(ctx context.Context) string {
return user.RoleKey
}
+// GetModule 获取应用模块
+func GetModule(ctx context.Context) string {
+ c := Get(ctx)
+ if c == nil {
+ return ""
+ }
+ return c.Module
+}
+
// SetAddonName 设置插件信息
func SetAddonName(ctx context.Context, name string) {
c := Get(ctx)
diff --git a/server/internal/library/hggen/views/column_default.go b/server/internal/library/hggen/views/column_default.go
index 888a537..169e93e 100644
--- a/server/internal/library/hggen/views/column_default.go
+++ b/server/internal/library/hggen/views/column_default.go
@@ -256,11 +256,6 @@ func setDefaultQuery(field *sysin.GenCodesColumnListModel) {
return
}
- if field.Index == consts.GenCodesIndexPK {
- field.IsQuery = true
- return
- }
-
if gstr.HasSuffix(field.GoName, "Status") && IsNumberType(field.GoType) {
field.IsQuery = true
return
diff --git a/server/internal/library/hggen/views/curd_generate_web_edit.go b/server/internal/library/hggen/views/curd_generate_web_edit.go
index 378f345..3696f6f 100644
--- a/server/internal/library/hggen/views/curd_generate_web_edit.go
+++ b/server/internal/library/hggen/views/curd_generate_web_edit.go
@@ -126,7 +126,7 @@ func (l *gCurd) generateWebEditScript(ctx context.Context, in *CurdPreviewInput)
}
setupBuffer.WriteString(" function loadForm(value) {\n loading.value = true;\n\n // 新增\n if (value.id < 1) {\n params.value = newState(value);\n MaxSort()\n .then((res) => {\n params.value.sort = res.sort;\n })\n .finally(() => {\n loading.value = false;\n });\n return;\n }\n\n // 编辑\n View({ id: value.id })\n .then((res) => {\n params.value = res;\n })\n .finally(() => {\n loading.value = false;\n });\n }\n\n watch(\n () => props.formParams,\n (value) => {\n loadForm(value);\n }\n );")
} else {
- importBuffer.WriteString(" import { onMounted, ref, computed } from 'vue';\n")
+ importBuffer.WriteString(" import { onMounted, ref, computed, watch } from 'vue';\n")
if in.Config.Application.Crud.Templates[in.In.GenTemplate].IsAddon {
importBuffer.WriteString(" import { Edit, View } from '@/api/addons/" + in.In.AddonName + "/" + gstr.LcFirst(in.In.VarName) + "';\n")
} else {
diff --git a/server/internal/library/hgorm/handler/filter_auth.go b/server/internal/library/hgorm/handler/filter_auth.go
index 315eea8..ecee5a8 100644
--- a/server/internal/library/hgorm/handler/filter_auth.go
+++ b/server/internal/library/hgorm/handler/filter_auth.go
@@ -52,11 +52,11 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model {
err := g.Model("admin_role").Where("id", co.User.RoleId).Scan(&role)
if err != nil {
- g.Log().Fatalf(ctx, "failed to role information err:%+v", err)
+ g.Log().Panicf(ctx, "failed to role information err:%+v", err)
}
if role == nil {
- g.Log().Fatalf(ctx, "failed to role information roleModel == nil")
+ g.Log().Panicf(ctx, "failed to role information roleModel == nil")
}
sq := g.Model("admin_member").Fields("id")
@@ -77,7 +77,7 @@ func FilterAuthWithField(filterField string) func(m *gdb.Model) *gdb.Model {
case consts.RoleDataSelfAndAllSub: // 自己和全部下级
m = m.WhereIn(filterField, GetSelfAndAllSub(co.User.Id))
default:
- g.Log().Fatalf(ctx, "dataScope is not registered")
+ g.Log().Panicf(ctx, "dataScope is not registered")
}
return m
diff --git a/server/internal/library/queue/consumer.go b/server/internal/library/queue/consumer.go
new file mode 100644
index 0000000..e1fab96
--- /dev/null
+++ b/server/internal/library/queue/consumer.go
@@ -0,0 +1,73 @@
+package queue
+
+import (
+ "context"
+ "github.com/gogf/gf/v2/frame/g"
+ "sync"
+)
+
+// consumerStrategy 消费者策略,实现该接口即可加入到消费队列中
+type consumerStrategy interface {
+ GetTopic() string // 获取消费主题
+ Handle(ctx context.Context, mqMsg MqMsg) (err error) // 处理消息
+}
+
+// consumerManager 消费者管理
+type consumerManager struct {
+ sync.Mutex
+ list map[string]consumerStrategy // 维护的消费者列表
+}
+
+var consumers = &consumerManager{
+ list: make(map[string]consumerStrategy),
+}
+
+// RegisterConsumer 注册任务到消费者队列
+func RegisterConsumer(cs consumerStrategy) {
+ consumers.Lock()
+ defer consumers.Unlock()
+ topic := cs.GetTopic()
+ if _, ok := consumers.list[topic]; ok {
+ g.Log().Debugf(ctx, "queue.RegisterConsumer topic:%v duplicate registration.", topic)
+ return
+ }
+ consumers.list[topic] = cs
+}
+
+// StartConsumersListener 启动所有已注册的消费者监听
+func StartConsumersListener(ctx context.Context) {
+ for _, consumer := range consumers.list {
+ go func(consumer consumerStrategy) {
+ consumerListen(ctx, consumer)
+ }(consumer)
+ }
+}
+
+// consumerListen 消费者监听
+func consumerListen(ctx context.Context, job consumerStrategy) {
+ var (
+ topic = job.GetTopic()
+ consumer, err = InstanceConsumer()
+ )
+
+ if err != nil {
+ g.Log().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
+ return
+ }
+
+ if listenErr := consumer.ListenReceiveMsgDo(topic, func(mqMsg MqMsg) {
+ err = job.Handle(ctx, mqMsg)
+
+ if err != nil {
+ // 遇到错误,重新加入到队列
+ //queue.Push(topic, mqMsg.Body)
+ }
+
+ // 记录消费队列日志
+ ConsumerLog(ctx, topic, mqMsg, err)
+
+ }); listenErr != nil {
+ g.Log().Fatalf(ctx, "消费队列:%s 监听失败, err:%+v", topic, listenErr)
+ }
+
+}
diff --git a/server/internal/library/queue/disk.go b/server/internal/library/queue/disk.go
index dfafdc3..1a9473c 100644
--- a/server/internal/library/queue/disk.go
+++ b/server/internal/library/queue/disk.go
@@ -11,6 +11,8 @@ import (
"time"
)
+// Disk 磁盘队列
+
type DiskProducerMq struct {
config *disk.Config
producers map[string]*disk.Queue
diff --git a/server/internal/library/queue/push.go b/server/internal/library/queue/producer.go
similarity index 100%
rename from server/internal/library/queue/push.go
rename to server/internal/library/queue/producer.go
diff --git a/server/internal/library/sms/aliyun/handle.go b/server/internal/library/sms/aliyun/handle.go
index 1b498d2..7c150fa 100644
--- a/server/internal/library/sms/aliyun/handle.go
+++ b/server/internal/library/sms/aliyun/handle.go
@@ -66,7 +66,7 @@ func CreateClient(accessKeyId *string, accessKeySecret *string) (_result *dysmsa
return _result, _err
}
-func Send(accessKeyId string, accessKeySecret string) (_err error) {
+func TestSend(accessKeyId string, accessKeySecret string) (_err error) {
// 工程代码泄露可能会导致AccessKey泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议使用更安全的 STS 方式,更多鉴权访问方式请参见:https://help.aliyun.com/document_detail/378661.html
client, _err := CreateClient(tea.String(accessKeyId), tea.String(accessKeySecret))
if _err != nil {
diff --git a/server/internal/logic/admin/dept.go b/server/internal/logic/admin/dept.go
index f52ab8b..94d79d4 100644
--- a/server/internal/logic/admin/dept.go
+++ b/server/internal/logic/admin/dept.go
@@ -10,7 +10,6 @@ import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
- "github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/library/hgorm"
@@ -18,7 +17,6 @@ import (
"hotgo/internal/model/input/adminin"
"hotgo/internal/service"
"hotgo/utility/convert"
- "hotgo/utility/tree"
"hotgo/utility/validate"
)
@@ -33,27 +31,21 @@ func init() {
}
// NameUnique 菜单名称是否唯一
-func (s *sAdminDept) NameUnique(ctx context.Context, in adminin.DeptNameUniqueInp) (*adminin.DeptNameUniqueModel, error) {
-
- var res adminin.DeptNameUniqueModel
+func (s *sAdminDept) NameUnique(ctx context.Context, in adminin.DeptNameUniqueInp) (res *adminin.DeptNameUniqueModel, err error) {
isUnique, err := dao.AdminDept.IsUniqueName(ctx, in.Id, in.Name)
if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return nil, err
+ return
}
+ res = new(adminin.DeptNameUniqueModel)
res.IsUnique = isUnique
- return &res, nil
+ return
}
// Delete 删除
func (s *sAdminDept) Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error) {
-
- var (
- models *entity.AdminDept
- )
- err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Scan(&models)
- if err != nil {
+ var models *entity.AdminDept
+ if err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Scan(&models); err != nil {
return err
}
@@ -71,115 +63,86 @@ func (s *sAdminDept) Delete(ctx context.Context, in adminin.DeptDeleteInp) (err
}
_, err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Delete()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
-
- return nil
+ return
}
// Edit 修改/新增
func (s *sAdminDept) Edit(ctx context.Context, in adminin.DeptEditInp) (err error) {
-
if in.Name == "" {
err = gerror.New("名称不能为空")
- return err
+ return
}
uniqueName, err := dao.AdminDept.IsUniqueName(ctx, in.Id, in.Name)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return err
+ return
}
if !uniqueName {
err = gerror.New("名称已存在")
- return err
+ return
}
- in.Pid, in.Level, in.Tree, err = hgorm.GenSubTree(ctx, dao.AdminDept, in.Pid)
- if err != nil {
- return err
+ if in.Pid, in.Level, in.Tree, err = hgorm.GenSubTree(ctx, dao.AdminDept, in.Pid); err != nil {
+ return
}
// 修改
if in.Id > 0 {
_, err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Data(in).Update()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
-
- return nil
+ return
}
// 新增
_, err = dao.AdminDept.Ctx(ctx).Data(in).Insert()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
- return nil
+ return
}
// Status 更新部门状态
func (s *sAdminDept) Status(ctx context.Context, in adminin.DeptStatusInp) (err error) {
-
if in.Id <= 0 {
err = gerror.New("ID不能为空")
- return err
+ return
}
if in.Status <= 0 {
err = gerror.New("状态不能为空")
- return err
+ return
}
if !validate.InSliceInt(consts.StatusMap, in.Status) {
err = gerror.New("状态不正确")
- return err
+ return
}
// 修改
in.UpdatedAt = gtime.Now()
_, err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Data("status", in.Status).Update()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
-
- return nil
+ return
}
// MaxSort 最大排序
-func (s *sAdminDept) MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (*adminin.DeptMaxSortModel, error) {
- var res adminin.DeptMaxSortModel
-
+func (s *sAdminDept) MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error) {
+ res = new(adminin.DeptMaxSortModel)
if in.Id > 0 {
- if err := dao.AdminDept.Ctx(ctx).Where("id", in.Id).Order("sort desc").Scan(&res); err != nil {
+ if err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Order("sort desc").Scan(&res); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return nil, err
+ return
}
}
res.Sort = res.Sort + 10
-
- return &res, nil
+ return
}
// View 获取指定字典类型信息
func (s *sAdminDept) View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error) {
-
- if err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Scan(&res); err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return nil, err
- }
-
- return res, nil
+ err = dao.AdminDept.Ctx(ctx).Where("id", in.Id).Scan(&res)
+ return
}
// List 获取列表
-func (s *sAdminDept) List(ctx context.Context, in adminin.DeptListInp) (list adminin.DeptListModel, err error) {
+func (s *sAdminDept) List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error) {
var (
mod = dao.AdminDept.Ctx(ctx)
models []*entity.AdminDept
@@ -228,114 +191,12 @@ func (s *sAdminDept) List(ctx context.Context, in adminin.DeptListInp) (list adm
if err = mod.Order("pid asc,sort asc").Scan(&models); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return list, err
+ return
}
- list = gconv.SliceMap(models)
- for k, v := range list {
- list[k]["index"] = v["id"]
- list[k]["key"] = v["id"]
- list[k]["label"] = v["name"]
- }
-
- return tree.GenTree(list), nil
-}
-
-type DeptTree struct {
- entity.AdminDept
- Children []*DeptTree `json:"children"`
-}
-
-// getDeptChildIds 将列表转为父子关系列表
-func (s *sAdminDept) getDeptChildIds(ctx context.Context, lists []*DeptTree, pid int64) []*DeptTree {
-
- var (
- count = len(lists)
- newLists []*DeptTree
- )
-
- if count == 0 {
- return nil
- }
-
- for i := 0; i < len(lists); i++ {
- if lists[i].Id > 0 && lists[i].Pid == pid {
- var row *DeptTree
- if err := gconv.Structs(lists[i], &row); err != nil {
- panic(err)
- }
- row.Children = s.getDeptChildIds(ctx, lists, row.Id)
- newLists = append(newLists, row)
- }
- }
-
- return newLists
-}
-
-type DeptListTree struct {
- Id int64 `json:"id" `
- Key int64 `json:"key" `
- Pid int64 `json:"pid" `
- Label string `json:"label"`
- Title string `json:"title"`
- Name string `json:"name"`
- Type string `json:"type"`
- Children []*DeptListTree `json:"children"`
-}
-
-// ListTree 获取列表树
-func (s *sAdminDept) ListTree(ctx context.Context, in adminin.DeptListTreeInp) (list []*adminin.DeptListTreeModel, err error) {
- var (
- mod = dao.AdminDept.Ctx(ctx)
- dataList []*entity.AdminDept
- models []*DeptListTree
- )
-
- err = mod.Order("id desc").Scan(&dataList)
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return list, err
- }
-
- _ = gconv.Structs(dataList, &models)
-
- // 重写树入参
- for i := 0; i < len(models); i++ {
- models[i].Key = models[i].Id
- models[i].Title = models[i].Name
- models[i].Label = models[i].Name
- }
-
- childIds := s.getDeptTreeChildIds(ctx, models, 0)
-
- _ = gconv.Structs(childIds, &list)
-
- return list, nil
-}
-
-// getDeptTreeChildIds 将列表转为父子关系列表
-func (s *sAdminDept) getDeptTreeChildIds(ctx context.Context, lists []*DeptListTree, pid int64) []*DeptListTree {
- var (
- count = len(lists)
- newLists []*DeptListTree
- )
-
- if count == 0 {
- return nil
- }
-
- for i := 0; i < len(lists); i++ {
- if lists[i].Id > 0 && lists[i].Pid == pid {
- var row *DeptListTree
- if err := gconv.Structs(lists[i], &row); err != nil {
- panic(err)
- }
- row.Children = s.getDeptTreeChildIds(ctx, lists, row.Id)
- newLists = append(newLists, row)
- }
- }
-
- return newLists
+ res = new(adminin.DeptListModel)
+ res.List = s.treeList(0, models)
+ return
}
// GetName 获取部门名称
@@ -352,3 +213,23 @@ func (s *sAdminDept) GetName(ctx context.Context, id int64) (name string, err er
return data.Name, nil
}
+
+// treeList 树状列表
+func (s *sAdminDept) treeList(pid int64, nodes []*entity.AdminDept) (list []*adminin.DeptTree) {
+ list = make([]*adminin.DeptTree, 0)
+ for _, v := range nodes {
+ if v.Pid == pid {
+ item := new(adminin.DeptTree)
+ item.AdminDept = *v
+ item.Label = v.Name
+ item.Value = v.Id
+
+ child := s.treeList(v.Id, nodes)
+ if len(child) > 0 {
+ item.Children = child
+ }
+ list = append(list, item)
+ }
+ }
+ return
+}
diff --git a/server/internal/logic/admin/member.go b/server/internal/logic/admin/member.go
index ebe7047..01f9c9f 100644
--- a/server/internal/logic/admin/member.go
+++ b/server/internal/logic/admin/member.go
@@ -256,6 +256,7 @@ func (s *sAdminMember) ResetPwd(ctx context.Context, in adminin.MemberResetPwdIn
memberInfo *entity.AdminMember
memberId = contexts.GetUserId(ctx)
)
+
if err = s.FilterAuthModel(ctx, memberId).Where("id", in.Id).Scan(&memberInfo); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return err
@@ -400,10 +401,18 @@ func (s *sAdminMember) Edit(ctx context.Context, in adminin.MemberEditInp) (err
return gerror.New("超管账号禁止编辑!")
}
- // 权限验证
- var mm = s.FilterAuthModel(ctx, opMemberId).Where("id", in.Id)
- _, err = mm.Data(in).Update()
- if err != nil {
+ mod := s.FilterAuthModel(ctx, opMemberId)
+ if in.Password != "" {
+ salt, err := s.FilterAuthModel(ctx, contexts.GetUserId(ctx)).Fields(dao.AdminMember.Columns().Salt).Where("id", in.Id).Value()
+ if err != nil {
+ return err
+ }
+ in.PasswordHash = gmd5.MustEncryptString(in.Password + salt.String())
+ } else {
+ mod = mod.FieldsEx(dao.AdminMember.Columns().PasswordHash)
+ }
+
+ if _, err = mod.Where("id", in.Id).Data(in).Update(); err != nil {
return gerror.Wrap(err, consts.ErrorORM)
}
diff --git a/server/internal/logic/admin/member_post.go b/server/internal/logic/admin/member_post.go
index e6c6be0..4f28d63 100644
--- a/server/internal/logic/admin/member_post.go
+++ b/server/internal/logic/admin/member_post.go
@@ -25,18 +25,18 @@ func init() {
service.RegisterAdminMemberPost(NewAdminMemberPost())
}
-func (s *sAdminMemberPost) UpdatePostIds(ctx context.Context, member_id int64, post_ids []int64) (err error) {
- _, err = dao.AdminMemberPost.Ctx(ctx).Where("member_id", member_id).Delete()
+func (s *sAdminMemberPost) UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error) {
+ _, err = dao.AdminMemberPost.Ctx(ctx).Where("member_id", memberId).Delete()
if err != nil {
err = gerror.Wrap(err, "删除失败")
return err
}
- for i := 0; i < len(post_ids); i++ {
+ for i := 0; i < len(postIds); i++ {
_, err = dao.AdminMemberPost.Ctx(ctx).
Insert(entity.AdminMemberPost{
- MemberId: member_id,
- PostId: post_ids[i],
+ MemberId: memberId,
+ PostId: postIds[i],
})
if err != nil {
err = gerror.Wrap(err, "插入用户岗位失败")
@@ -48,20 +48,20 @@ func (s *sAdminMemberPost) UpdatePostIds(ctx context.Context, member_id int64, p
}
// GetMemberByIds 获取指定用户的岗位ids
-func (s *sAdminMemberPost) GetMemberByIds(ctx context.Context, member_id int64) (post_ids []int64, err error) {
+func (s *sAdminMemberPost) GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error) {
var list []*entity.AdminMemberPost
err = dao.AdminMemberPost.Ctx(ctx).
Fields("post_id").
- Where("member_id", member_id).
+ Where("member_id", memberId).
Scan(&list)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return post_ids, err
+ return postIds, err
}
for i := 0; i < len(list); i++ {
- post_ids = append(post_ids, list[i].PostId)
+ postIds = append(postIds, list[i].PostId)
}
- return post_ids, nil
+ return postIds, nil
}
diff --git a/server/internal/logic/admin/monitor.go b/server/internal/logic/admin/monitor.go
index 63dc4c9..7053fb1 100644
--- a/server/internal/logic/admin/monitor.go
+++ b/server/internal/logic/admin/monitor.go
@@ -34,7 +34,7 @@ func init() {
// StartMonitor 启动服务监控
func (s *sAdminMonitor) StartMonitor(ctx context.Context) {
simple.SafeGo(ctx, func(ctx context.Context) {
- s.data.STartTime = gtime.Now()
+ s.data.STartTime = gtime.Now().Timestamp()
intranetIP, err := location.GetLocalIP()
if err != nil {
g.Log().Infof(ctx, "parse intranetIP err:%+v", err)
diff --git a/server/internal/logic/admin/role.go b/server/internal/logic/admin/role.go
index 3958211..f51db31 100644
--- a/server/internal/logic/admin/role.go
+++ b/server/internal/logic/admin/role.go
@@ -12,7 +12,6 @@ import (
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
- "github.com/gogf/gf/v2/util/gconv"
"hotgo/api/admin/role"
"hotgo/internal/consts"
"hotgo/internal/dao"
@@ -25,9 +24,7 @@ import (
"hotgo/internal/service"
"hotgo/utility/auth"
"hotgo/utility/convert"
- "hotgo/utility/tree"
"sort"
- "strconv"
)
type sAdminRole struct{}
@@ -69,31 +66,26 @@ func (s *sAdminRole) Verify(ctx context.Context, path, method string) bool {
}
// List 获取列表
-func (s *sAdminRole) List(ctx context.Context, in adminin.RoleListInp) (list []g.Map, totalCount int, err error) {
+func (s *sAdminRole) List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error) {
var (
mod = dao.AdminRole.Ctx(ctx)
- models []*adminin.RoleListModel
+ models []*entity.AdminRole
)
totalCount, err = mod.Count()
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return list, totalCount, err
+ return
}
- err = mod.Page(in.Page, in.PerPage).Order("id asc").Scan(&models)
- if err != nil {
+ if err = mod.Page(in.Page, in.PerPage).Order("sort asc,id asc").Scan(&models); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return list, totalCount, err
+ return
}
- for _, v := range models {
- v.Label = v.Name
- v.Value = v.Id
- v.Key = strconv.FormatInt(v.Id, 10)
- }
-
- return tree.GenTree(gconv.SliceMap(models)), totalCount, err
+ res = new(adminin.RoleListModel)
+ res.List = s.treeList(0, models)
+ return
}
// GetName 获取指定角色的名称
@@ -134,6 +126,7 @@ func (s *sAdminRole) GetPermissions(ctx context.Context, reqInfo *role.GetPermis
if err != nil {
return nil, err
}
+
if len(values) == 0 {
return
}
@@ -156,6 +149,10 @@ func (s *sAdminRole) UpdatePermissions(ctx context.Context, reqInfo *role.Update
if len(reqInfo.MenuIds) == 0 {
return nil
}
+
+ // 去重
+ reqInfo.MenuIds = convert.UniqueSliceInt64(reqInfo.MenuIds)
+
addMap := make(g.List, 0, len(reqInfo.MenuIds))
for _, v := range reqInfo.MenuIds {
addMap = append(addMap, g.Map{
@@ -163,8 +160,8 @@ func (s *sAdminRole) UpdatePermissions(ctx context.Context, reqInfo *role.Update
"menu_id": v,
})
}
- _, err = dao.AdminRoleMenu.Ctx(ctx).Data(addMap).Insert()
- if err != nil {
+
+ if _, err = dao.AdminRoleMenu.Ctx(ctx).Data(addMap).Insert(); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return err
}
@@ -176,56 +173,47 @@ func (s *sAdminRole) UpdatePermissions(ctx context.Context, reqInfo *role.Update
func (s *sAdminRole) Edit(ctx context.Context, in *role.EditReq) (err error) {
if in.Name == "" {
err = gerror.New("名称不能为空")
- return err
+ return
}
+
if in.Key == "" {
err = gerror.New("编码不能为空")
- return err
+ return
}
uniqueName, err := dao.AdminRole.IsUniqueName(ctx, in.Id, in.Name)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return err
+ return
}
if !uniqueName {
err = gerror.New("名称已存在")
- return err
+ return
}
uniqueCode, err := dao.AdminRole.IsUniqueCode(ctx, in.Id, in.Key)
if err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return err
+ return
}
if !uniqueCode {
err = gerror.New("编码已存在")
- return err
+ return
}
- in.Pid, in.Level, in.Tree, err = hgorm.GenSubTree(ctx, dao.AdminRole, in.Pid)
- if err != nil {
- return err
+ if in.Pid, in.Level, in.Tree, err = hgorm.GenSubTree(ctx, dao.AdminRole, in.Pid); err != nil {
+ return
}
// 修改
if in.Id > 0 {
_, err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Data(in).Update()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
-
- return nil
+ return
}
// 新增
_, err = dao.AdminRole.Ctx(ctx).Data(in).Insert()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
- return nil
+ return
}
func (s *sAdminRole) Delete(ctx context.Context, in *role.DeleteReq) (err error) {
@@ -233,12 +221,9 @@ func (s *sAdminRole) Delete(ctx context.Context, in *role.DeleteReq) (err error)
return gerror.New("ID不正确!")
}
- var (
- models *entity.AdminRole
- )
- err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models)
- if err != nil {
- return err
+ var models *entity.AdminRole
+ if err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models); err != nil {
+ return
}
if models == nil {
@@ -255,12 +240,7 @@ func (s *sAdminRole) Delete(ctx context.Context, in *role.DeleteReq) (err error)
}
_, err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Delete()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
-
- return nil
+ return
}
func (s *sAdminRole) DataScopeSelect(ctx context.Context) (res form.Selects) {
@@ -285,8 +265,7 @@ func (s *sAdminRole) DataScopeEdit(ctx context.Context, in *adminin.DataScopeEdi
superRoleKey = g.Cfg().MustGet(ctx, "hotgo.admin.superRoleKey")
)
- err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models)
- if err != nil {
+ if err = dao.AdminRole.Ctx(ctx).Where("id", in.Id).Scan(&models); err != nil {
return
}
@@ -310,10 +289,26 @@ func (s *sAdminRole) DataScopeEdit(ctx context.Context, in *adminin.DataScopeEdi
Where("id", in.Id).
Data(models).
Update()
- if err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return err
- }
- return nil
+ return
+}
+
+// treeList 树状列表
+func (s *sAdminRole) treeList(pid int64, nodes []*entity.AdminRole) (list []*adminin.RoleTree) {
+ list = make([]*adminin.RoleTree, 0)
+ for _, v := range nodes {
+ if v.Pid == pid {
+ item := new(adminin.RoleTree)
+ item.AdminRole = *v
+ item.Label = v.Name
+ item.Value = v.Id
+
+ child := s.treeList(v.Id, nodes)
+ if len(child) > 0 {
+ item.Children = child
+ }
+ list = append(list, item)
+ }
+ }
+ return
}
diff --git a/server/internal/logic/middleware/admin_auth.go b/server/internal/logic/middleware/admin_auth.go
index 6b4abb3..4c5663a 100644
--- a/server/internal/logic/middleware/admin_auth.go
+++ b/server/internal/logic/middleware/admin_auth.go
@@ -20,11 +20,7 @@ import (
// AdminAuth 后台鉴权中间件
func (s *sMiddleware) AdminAuth(r *ghttp.Request) {
-
- var (
- ctx = r.Context()
- )
-
+ var ctx = r.Context()
// 替换掉模块前缀
routerPrefix := g.Cfg().MustGet(ctx, "router.admin.prefix", "/admin")
path := gstr.Replace(r.URL.Path, routerPrefix.String(), "", 1)
diff --git a/server/internal/logic/sys/cron_group.go b/server/internal/logic/sys/cron_group.go
index 1245b88..d3ce733 100644
--- a/server/internal/logic/sys/cron_group.go
+++ b/server/internal/logic/sys/cron_group.go
@@ -9,14 +9,12 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
- "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
- "hotgo/utility/tree"
"hotgo/utility/validate"
)
@@ -157,31 +155,39 @@ func (s *sSysCronGroup) List(ctx context.Context, in sysin.CronGroupListInp) (li
}
// Select 选项
-func (s *sSysCronGroup) Select(ctx context.Context, in sysin.CronGroupSelectInp) (list sysin.CronGroupSelectModel, err error) {
+func (s *sSysCronGroup) Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error) {
var (
- mod = dao.SysCronGroup.Ctx(ctx)
- models []*entity.SysCronGroup
- typeList []g.Map
+ mod = dao.SysCronGroup.Ctx(ctx)
+ models []*entity.SysCronGroup
)
if err = mod.Order("pid asc,sort asc").Scan(&models); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
- return list, err
+ return
}
- for i := 0; i < len(models); i++ {
- typeList = append(typeList, g.Map{
- "index": models[i].Id,
- "key": models[i].Id,
- "label": models[i].Name,
- "id": models[i].Id,
- "pid": models[i].Pid,
- "name": models[i].Name,
- "sort": models[i].Sort,
- "created_at": models[i].CreatedAt,
- "status": models[i].Status,
- })
+ res = new(sysin.CronGroupSelectModel)
+ res.List = s.treeList(0, models)
+ return
+}
+
+// treeList 树状列表
+func (s *sSysCronGroup) treeList(pid int64, nodes []*entity.SysCronGroup) (list []*sysin.CronGroupTree) {
+ list = make([]*sysin.CronGroupTree, 0)
+ for _, v := range nodes {
+ if v.Pid == pid {
+ item := new(sysin.CronGroupTree)
+ item.SysCronGroup = *v
+ item.Label = v.Name
+ item.Value = v.Id
+ item.Key = v.Id
+
+ child := s.treeList(v.Id, nodes)
+ if len(child) > 0 {
+ item.Children = child
+ }
+ list = append(list, item)
+ }
}
-
- return tree.GenTree(typeList), nil
+ return
}
diff --git a/server/internal/logic/sys/dict_type.go b/server/internal/logic/sys/dict_type.go
index b36f249..af9753b 100644
--- a/server/internal/logic/sys/dict_type.go
+++ b/server/internal/logic/sys/dict_type.go
@@ -9,14 +9,12 @@ package sys
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
- "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/dao"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/sysin"
"hotgo/internal/service"
- "hotgo/utility/tree"
)
type sSysDictType struct{}
@@ -30,35 +28,19 @@ func init() {
}
// Tree 树
-func (s *sSysDictType) Tree(ctx context.Context) (list []g.Map, err error) {
+func (s *sSysDictType) Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error) {
var (
mod = dao.SysDictType.Ctx(ctx)
models []*entity.SysDictType
)
- if err = mod.Order("pid asc,sort asc").Scan(&models); err != nil {
+ if err = mod.Order("sort asc,id asc").Scan(&models); err != nil {
err = gerror.Wrap(err, consts.ErrorORM)
return list, err
}
- for i := 0; i < len(models); i++ {
- list = append(list, g.Map{
- "index": models[i].Id,
- "key": models[i].Id,
- "label": models[i].Name,
- "id": models[i].Id,
- "pid": models[i].Pid,
- "name": models[i].Name,
- "type": models[i].Type,
- "sort": models[i].Sort,
- "remark": models[i].Remark,
- "status": models[i].Status,
- "updated_at": models[i].UpdatedAt,
- "created_at": models[i].CreatedAt,
- })
- }
-
- return tree.GenTree(list), nil
+ list = s.treeList(0, models)
+ return
}
// Delete 删除
@@ -141,42 +123,11 @@ func (s *sSysDictType) Edit(ctx context.Context, in sysin.DictTypeEditInp) (err
return nil
}
-// Select 选项
-func (s *sSysDictType) Select(ctx context.Context, in sysin.DictTypeSelectInp) (list sysin.DictTypeSelectModel, err error) {
- var (
- mod = dao.SysDictType.Ctx(ctx)
- models []*entity.SysDictType
- typeList []g.Map
- )
-
- if err = mod.Order("pid asc,sort asc").Scan(&models); err != nil {
- err = gerror.Wrap(err, consts.ErrorORM)
- return list, err
- }
-
- for i := 0; i < len(models); i++ {
- typeList = append(typeList, g.Map{
- "index": models[i].Id,
- "key": models[i].Id,
- "label": models[i].Name,
- "id": models[i].Id,
- "pid": models[i].Pid,
- "name": models[i].Name,
- "sort": models[i].Sort,
- "created_at": models[i].CreatedAt,
- "status": models[i].Status,
- })
- }
-
- return tree.GenTree(typeList), nil
-}
-
// TreeSelect 获取类型关系树选项
-func (s *sSysDictType) TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list sysin.DictTreeSelectModel, err error) {
+func (s *sSysDictType) TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error) {
var (
- mod = dao.SysDictType.Ctx(ctx)
- models []*entity.SysDictType
- typeList []g.Map
+ mod = dao.SysDictType.Ctx(ctx)
+ models []*entity.SysDictType
)
if err = mod.Order("pid asc,sort asc").Scan(&models); err != nil {
@@ -184,26 +135,39 @@ func (s *sSysDictType) TreeSelect(ctx context.Context, in sysin.DictTreeSelectIn
return list, err
}
- for i := 0; i < len(models); i++ {
- typeList = append(typeList, g.Map{
- "index": models[i].Id,
- "key": models[i].Id,
- "label": models[i].Name,
- "id": models[i].Id,
- "pid": models[i].Pid,
- "name": models[i].Name,
- "sort": models[i].Sort,
- "created_at": models[i].CreatedAt,
- "status": models[i].Status,
- })
- }
+ list = s.treeList(0, models)
- maps := tree.GenTree(typeList)
- for _, v := range maps {
+ for _, v := range list {
// 父类一律禁止选中
- if _, ok := v["children"]; ok {
- v["disabled"] = true
+ if len(v.Children) > 0 {
+ v.Disabled = true
+ for _, v2 := range v.Children {
+ if len(v2.Children) > 0 {
+ v2.Disabled = true
+ }
+ }
}
}
- return tree.GenTree(typeList), nil
+ return
+}
+
+// treeList 树状列表
+func (s *sSysDictType) treeList(pid int64, nodes []*entity.SysDictType) (list []*sysin.DictTypeTree) {
+ list = make([]*sysin.DictTypeTree, 0)
+ for _, v := range nodes {
+ if v.Pid == pid {
+ item := new(sysin.DictTypeTree)
+ item.SysDictType = *v
+ item.Label = v.Name
+ item.Value = v.Id
+ item.Key = v.Id
+
+ child := s.treeList(v.Id, nodes)
+ if len(child) > 0 {
+ item.Children = child
+ }
+ list = append(list, item)
+ }
+ }
+ return
}
diff --git a/server/internal/model/config.go b/server/internal/model/config.go
index c1d11d6..afb7b69 100644
--- a/server/internal/model/config.go
+++ b/server/internal/model/config.go
@@ -166,6 +166,8 @@ type GenerateConfig struct {
type BuildAddonConfig struct {
SrcPath string `json:"srcPath"`
TemplatePath string `json:"templatePath"`
+ WebApiPath string `json:"webApiPath"`
+ WebViewsPath string `json:"webViewsPath"`
}
// CacheConfig 缓存配置
diff --git a/server/internal/model/input/adminin/dept.go b/server/internal/model/input/adminin/dept.go
index b15fe13..b6913e2 100644
--- a/server/internal/model/input/adminin/dept.go
+++ b/server/internal/model/input/adminin/dept.go
@@ -7,7 +7,6 @@
package adminin
import (
- "github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
)
@@ -57,34 +56,18 @@ type DeptListInp struct {
Code string
}
-// DeptTreeDept 树
-type DeptTreeDept struct {
+// DeptTree 树
+type DeptTree struct {
entity.AdminDept
- Children []*DeptTreeDept `json:"children"`
+ Label string `json:"label" dc:"标签"`
+ Value int64 `json:"value" dc:"键值"`
+ Children []*DeptTree `json:"children"`
}
-type DeptListModel []g.Map
-
-// DeptListTreeInp 获取列表树
-type DeptListTreeInp struct {
- Name string
- Code string
+type DeptListModel struct {
+ List []*DeptTree `json:"list"`
}
-// DeptListTreeDept 树
-type DeptListTreeDept struct {
- Id int64 `json:"id" `
- Key int64 `json:"key" `
- Pid int64 `json:"pid" `
- Label string `json:"label"`
- Title string `json:"title"`
- Name string `json:"name"`
- Type string `json:"type"`
- Children []*DeptListTreeDept `json:"children"`
-}
-
-type DeptListTreeModel DeptListTreeDept
-
// DeptStatusInp 更新部门状态
type DeptStatusInp struct {
entity.AdminDept
diff --git a/server/internal/model/input/adminin/member.go b/server/internal/model/input/adminin/member.go
index 80bbf59..6094ae0 100644
--- a/server/internal/model/input/adminin/member.go
+++ b/server/internal/model/input/adminin/member.go
@@ -7,6 +7,8 @@
package adminin
import (
+ "context"
+ "github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
@@ -44,13 +46,13 @@ type MemberProfileInp struct {
Id int64
}
type MemberProfileModel struct {
- PostGroup string `json:"postGroup" description:"岗位名称"`
- RoleGroup string `json:"roleGroup" description:"角色名称"`
- User *MemberViewModel `json:"member" description:"用户基本信息"`
- SysDept *DeptViewModel `json:"sysDept" description:"部门信息"`
- SysRoles []*RoleListModel `json:"sysRoles" description:"角色列表"`
- PostIds int64 `json:"postIds" description:"当前岗位"`
- RoleIds int64 `json:"roleIds" description:"当前角色"`
+ PostGroup string `json:"postGroup" dc:"岗位名称"`
+ RoleGroup string `json:"roleGroup" dc:"角色名称"`
+ User *MemberViewModel `json:"member" dc:"用户基本信息"`
+ SysDept *DeptViewModel `json:"sysDept" dc:"部门信息"`
+ SysRoles []*RoleListModel `json:"sysRoles" dc:"角色列表"`
+ PostIds int64 `json:"postIds" dc:"当前岗位"`
+ RoleIds int64 `json:"roleIds" dc:"当前角色"`
}
// MemberUpdateProfileInp 更新用户资料
@@ -118,36 +120,48 @@ type MemberMaxSortModel struct {
// MemberEditInp 修改/新增管理员
type MemberEditInp struct {
- Id int64 `json:"id" description:""`
- RoleId int `json:"roleId" v:"required#角色不能为空" description:"角色ID"`
- PostIds []int64 `json:"postIds" v:"required#岗位不能为空" description:"岗位ID"`
- DeptId int64 `json:"deptId" v:"required#部门不能为空" description:"部门ID"`
- Username string `json:"username" v:"required#账号不能为空" description:"帐号"`
- Password string `json:"password" description:"密码"`
- RealName string `json:"realName" description:"真实姓名"`
- Avatar string `json:"avatar" description:"头像"`
- Sex string `json:"sex" description:"性别"`
- Qq string `json:"qq" description:"qq"`
- Email string `json:"email" description:"邮箱"`
- Birthday *gtime.Time `json:"birthday" description:"生日"`
- ProvinceId int `json:"provinceId" description:"省"`
- CityId int `json:"cityId" description:"城市"`
- AreaId int `json:"areaId" description:"地区"`
- Address string `json:"address" description:"默认地址"`
- Mobile string `json:"mobile" description:"手机号码"`
- Remark string `json:"remark" description:"备注"`
- Status string `json:"status" description:"状态"`
- CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
- UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
+ Id int64 `json:"id" dc:""`
+ RoleId int `json:"roleId" v:"required#角色不能为空" dc:"角色ID"`
+ PostIds []int64 `json:"postIds" v:"required#岗位不能为空" dc:"岗位ID"`
+ DeptId int64 `json:"deptId" v:"required#部门不能为空" dc:"部门ID"`
+ Username string `json:"username" v:"required#账号不能为空" dc:"帐号"`
+ PasswordHash string `json:"passwordHash" dc:"密码hash"`
+ Password string `json:"password" dc:"密码"`
+ RealName string `json:"realName" dc:"真实姓名"`
+ Avatar string `json:"avatar" dc:"头像"`
+ Sex string `json:"sex" dc:"性别"`
+ Qq string `json:"qq" dc:"qq"`
+ Email string `json:"email" dc:"邮箱"`
+ Birthday *gtime.Time `json:"birthday" dc:"生日"`
+ ProvinceId int `json:"provinceId" dc:"省"`
+ CityId int `json:"cityId" dc:"城市"`
+ AreaId int `json:"areaId" dc:"地区"`
+ Address string `json:"address" dc:"默认地址"`
+ Mobile string `json:"mobile" dc:"手机号码"`
+ Remark string `json:"remark" dc:"备注"`
+ Status string `json:"status" dc:"状态"`
+ CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
+ UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
type MemberAddInp struct {
MemberEditInp
- PasswordHash string `json:"passwordHash" description:"密码hash"`
- Salt string `json:"salt" description:"密码盐"`
- Pid int64 `json:"pid" description:"上级ID"`
- Level int `json:"level" description:"等级"`
- Tree string `json:"tree" description:"关系树"`
+ Salt string `json:"salt" dc:"密码盐"`
+ Pid int64 `json:"pid" dc:"上级ID"`
+ Level int `json:"level" dc:"等级"`
+ Tree string `json:"tree" dc:"关系树"`
+}
+
+func (in *MemberEditInp) Filter(ctx context.Context) (err error) {
+ if in.Password != "" {
+ if err := g.Validator().
+ Rules("length:6,16").
+ Messages("#新密码不能为空#新密码需在6~16之间").
+ Data(in.Password).Run(ctx); err != nil {
+ return err.Current()
+ }
+ }
+ return
}
type MemberEditModel struct{}
@@ -165,8 +179,8 @@ type MemberViewInp struct {
type MemberViewModel struct {
entity.AdminMember
- DeptName string `json:"deptName" description:"所属部门"`
- RoleName string `json:"roleName" description:"所属角色"`
+ DeptName string `json:"deptName" dc:"所属部门"`
+ RoleName string `json:"roleName" dc:"所属角色"`
}
// MemberListInp 获取列表
@@ -174,21 +188,21 @@ type MemberListInp struct {
form.PageReq
form.RangeDateReq
form.StatusReq
- DeptId int `json:"deptId" dc:"部门ID"`
- Mobile int `json:"mobile" dc:"手机号"`
+ DeptId int `json:"deptId" dc:"部门ID"`
+ Mobile int `json:"mobile" dc:"手机号"`
Username string `json:"username" dc:"用户名"`
RealName string `json:"realName" dc:"真实姓名"`
- Name string `json:"name" dc:"岗位名称"`
- Code string `json:"code" dc:"岗位编码"`
- CreatedAt []int64 `json:"createdAt" dc:"创建时间"`
+ Name string `json:"name" dc:"岗位名称"`
+ Code string `json:"code" dc:"岗位编码"`
+ CreatedAt []int64 `json:"createdAt" dc:"创建时间"`
}
type MemberListModel struct {
entity.AdminMember
- DeptName string `json:"deptName" description:"所属部门"`
- RoleName string `json:"roleName" description:"所属角色"`
- PostIds []int64 `json:"postIds" description:"岗位"`
- DeptId int64 `json:"deptId" description:"部门ID"`
+ DeptName string `json:"deptName" dc:"所属部门"`
+ RoleName string `json:"roleName" dc:"所属角色"`
+ PostIds []int64 `json:"postIds" dc:"岗位"`
+ DeptId int64 `json:"deptId" dc:"部门ID"`
}
// MemberLoginInp 登录
@@ -197,31 +211,31 @@ type MemberLoginInp struct {
Password string
}
type MemberLoginModel struct {
- Id int64 `json:"id" description:"用户ID"`
- Token string `json:"token" description:"登录token"`
- Expires int64 `json:"expires" description:"登录有效期"`
+ Id int64 `json:"id" dc:"用户ID"`
+ Token string `json:"token" dc:"登录token"`
+ Expires int64 `json:"expires" dc:"登录有效期"`
}
type LoginMemberInfoModel struct {
- Id int64 `json:"id" description:"用户ID"`
- DeptName string `json:"deptName" description:"所属部门"`
- RoleName string `json:"roleName" description:"所属角色"`
- Permissions []string `json:"permissions" description:"角色信息"`
- DeptId int64 `json:"-" description:"部门ID"`
- RoleId int64 `json:"-" description:"角色ID"`
- Username string `json:"username" description:"用户名"`
- RealName string `json:"realName" description:"姓名"`
- Avatar string `json:"avatar" description:"头像"`
- Balance float64 `json:"balance" description:"余额"`
- Sex int `json:"sex" description:"性别"`
- Qq string `json:"qq" description:"qq"`
- Email string `json:"email" description:"邮箱"`
- Mobile string `json:"mobile" description:"手机号码"`
- Birthday *gtime.Time `json:"birthday" description:"生日"`
- CityId int64 `json:"cityId" description:"城市编码"`
- Address string `json:"address" description:"联系地址"`
- Cash *MemberCash `json:"cash" description:"收款信息"`
- CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
+ Id int64 `json:"id" dc:"用户ID"`
+ DeptName string `json:"deptName" dc:"所属部门"`
+ RoleName string `json:"roleName" dc:"所属角色"`
+ Permissions []string `json:"permissions" dc:"角色信息"`
+ DeptId int64 `json:"-" dc:"部门ID"`
+ RoleId int64 `json:"-" dc:"角色ID"`
+ Username string `json:"username" dc:"用户名"`
+ RealName string `json:"realName" dc:"姓名"`
+ Avatar string `json:"avatar" dc:"头像"`
+ Balance float64 `json:"balance" dc:"余额"`
+ Sex int `json:"sex" dc:"性别"`
+ Qq string `json:"qq" dc:"qq"`
+ Email string `json:"email" dc:"邮箱"`
+ Mobile string `json:"mobile" dc:"手机号码"`
+ Birthday *gtime.Time `json:"birthday" dc:"生日"`
+ CityId int64 `json:"cityId" dc:"城市编码"`
+ Address string `json:"address" dc:"联系地址"`
+ Cash *MemberCash `json:"cash" dc:"收款信息"`
+ CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
*MemberLoginStatModel
}
@@ -246,10 +260,10 @@ type MemberSelectInp struct {
}
type MemberSelectModel struct {
- Value int64 `json:"value" dc:"用户ID"`
- Label string `json:"label" dc:"真实姓名"`
+ Value int64 `json:"value" dc:"用户ID"`
+ Label string `json:"label" dc:"真实姓名"`
Username string `json:"username" dc:"用户名"`
- Avatar string `json:"avatar" dc:"头像"`
+ Avatar string `json:"avatar" dc:"头像"`
}
// MemberLoginStatInp 用户登录统计
diff --git a/server/internal/model/input/adminin/menu.go b/server/internal/model/input/adminin/menu.go
index 11cb8a7..b21639a 100644
--- a/server/internal/model/input/adminin/menu.go
+++ b/server/internal/model/input/adminin/menu.go
@@ -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 adminin
import (
@@ -123,9 +122,7 @@ type MenuRouteMeta struct {
FrameSrc string `json:"frameSrc,omitempty" ` // 内联外部地址
Permissions string `json:"permissions,omitempty"` // 菜单包含权限集合,满足其中一个就会显示
Affix bool `json:"affix,omitempty"` // 是否固定 设置为 true 之后 多页签不可删除
-
- // 自定义
- Type int `json:"type"` // 菜单类型
+ Type int `json:"type"` // 菜单类型
}
type MenuRoute struct {
diff --git a/server/internal/model/input/adminin/role.go b/server/internal/model/input/adminin/role.go
index e72c0dd..969a16b 100644
--- a/server/internal/model/input/adminin/role.go
+++ b/server/internal/model/input/adminin/role.go
@@ -10,6 +10,7 @@ import (
"hotgo/internal/model"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
+ "sort"
)
// RoleListInp 获取列表
@@ -17,10 +18,27 @@ type RoleListInp struct {
form.PageReq
}
-type RoleListModel struct {
+type RoleTree struct {
entity.AdminRole
- Label string `json:"label" dc:"标签"`
- Value int64 `json:"value" dc:"键值"`
+ Label string `json:"label" dc:"标签"`
+ Value int64 `json:"value" dc:"键值"`
+ Children []*RoleTree `json:"children" dc:"子级"`
+}
+
+type RoleListModel struct {
+ List []*RoleTree `json:"list"`
+}
+
+func Sort(v []*RoleTree) {
+ sort.SliceStable(v, func(i, j int) bool {
+ if v[i].Sort < v[j].Sort {
+ return true
+ }
+ if v[i].Sort > v[j].Sort {
+ return false
+ }
+ return v[i].Id < v[j].Id
+ })
}
// RoleMemberListInp 查询列表
@@ -28,15 +46,15 @@ type RoleMemberListInp struct {
form.PageReq
form.RangeDateReq
form.StatusReq
- Role int `json:"role" description:"角色ID"`
- DeptId int `json:"deptId" description:"部门ID"`
- Mobile int `json:"mobile" description:"手机号"`
- Username string `json:"username" description:"用户名"`
- Realname string `json:"realname" description:"真实姓名"`
- StartTime string `json:"start_time" description:"开始时间"`
- EndTime string `json:"end_time" description:"结束时间"`
- Name string `json:"name" description:"岗位名称"`
- Code string `json:"code" description:"岗位编码"`
+ Role int `json:"role" dc:"角色ID"`
+ DeptId int `json:"deptId" dc:"部门ID"`
+ Mobile int `json:"mobile" dc:"手机号"`
+ Username string `json:"username" dc:"用户名"`
+ RealName string `json:"realName" dc:"真实姓名"`
+ StartTime string `json:"start_time" dc:"开始时间"`
+ EndTime string `json:"end_time" dc:"结束时间"`
+ Name string `json:"name" dc:"岗位名称"`
+ Code string `json:"code" dc:"岗位编码"`
}
type RoleMemberListModel []*MemberListModel
@@ -46,12 +64,12 @@ type MenuRoleListInp struct {
RoleId int64
}
type MenuRoleListModel struct {
- Menus []*model.LabelTreeMenu `json:"menus" description:"菜单列表"`
- CheckedKeys []int64 `json:"checkedKeys" description:"选择的菜单ID"`
+ Menus []*model.LabelTreeMenu `json:"menus" dc:"菜单列表"`
+ CheckedKeys []int64 `json:"checkedKeys" dc:"选择的菜单ID"`
}
type DataScopeEditInp struct {
- Id int64 `json:"id" v:"required" dc:"角色ID"`
+ Id int64 `json:"id" v:"required" dc:"角色ID"`
DataScope int `json:"dataScope" v:"required" dc:"数据范围"`
- CustomDept []int64 `json:"customDept" dc:"自定义部门权限"`
+ CustomDept []int64 `json:"customDept" dc:"自定义部门权限"`
}
diff --git a/server/internal/model/input/sysin/cron_group.go b/server/internal/model/input/sysin/cron_group.go
index 53c586f..be7ff73 100644
--- a/server/internal/model/input/sysin/cron_group.go
+++ b/server/internal/model/input/sysin/cron_group.go
@@ -7,7 +7,6 @@
package sysin
import (
- "github.com/gogf/gf/v2/frame/g"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
@@ -64,4 +63,15 @@ type CronGroupStatusModel struct{}
type CronGroupSelectInp struct {
}
-type CronGroupSelectModel []g.Map
+type CronGroupSelectModel struct {
+ List []*CronGroupTree `json:"list"`
+}
+
+type CronGroupTree struct {
+ entity.SysCronGroup
+ Disabled bool `json:"disabled" dc:"是否禁用"`
+ Label string `json:"label" dc:"标签"`
+ Value int64 `json:"value" dc:"键值"`
+ Key int64 `json:"key" dc:"键名"`
+ Children []*CronGroupTree `json:"children" dc:"子级"`
+}
diff --git a/server/internal/model/input/sysin/dict_type.go b/server/internal/model/input/sysin/dict_type.go
index 58d46cf..74d7e71 100644
--- a/server/internal/model/input/sysin/dict_type.go
+++ b/server/internal/model/input/sysin/dict_type.go
@@ -23,14 +23,17 @@ type DictTypeDeleteInp struct {
}
type DictTypeDeleteModel struct{}
-// DictTypeSelectInp 获取类型选项
-type DictTypeSelectInp struct {
-}
-
-type DictTypeSelectModel []g.Map
-
// DictTreeSelectInp 获取类型关系树选项
type DictTreeSelectInp struct {
}
type DictTreeSelectModel []g.Map
+
+type DictTypeTree struct {
+ entity.SysDictType
+ Disabled bool `json:"disabled" dc:"是否禁用"`
+ Label string `json:"label" dc:"标签"`
+ Value int64 `json:"value" dc:"键值"`
+ Key int64 `json:"key" dc:"键名"`
+ Children []*DictTypeTree `json:"children" dc:"子级"`
+}
diff --git a/server/internal/model/input/sysin/gen_codes.go b/server/internal/model/input/sysin/gen_codes.go
index 78ae618..297f512 100644
--- a/server/internal/model/input/sysin/gen_codes.go
+++ b/server/internal/model/input/sysin/gen_codes.go
@@ -83,11 +83,11 @@ type GenCodesSelectsModel struct {
LinkMode form.Selects `json:"linkMode" dc:"关联表方式"`
BuildMeth form.Selects `json:"buildMeth" dc:"生成方式"`
// 字段表格选项
- FormMode form.Selects `json:"formMode" dc:"表单组件"`
- FormRole form.Selects `json:"formRole" dc:"表单验证"`
- DictMode DictTreeSelectModel `json:"dictMode" dc:"字典类型"`
- WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
- Addons form.Selects `json:"addons" dc:"插件选项"`
+ FormMode form.Selects `json:"formMode" dc:"表单组件"`
+ FormRole form.Selects `json:"formRole" dc:"表单验证"`
+ DictMode []*DictTypeTree `json:"dictMode" dc:"字典类型"`
+ WhereMode form.Selects `json:"whereMode" dc:"查询条件"`
+ Addons form.Selects `json:"addons" dc:"插件选项"`
}
type GenTypeSelects []*GenTypeSelect
diff --git a/server/internal/model/monitor.go b/server/internal/model/monitor.go
index 4eb0e03..b9cb02d 100644
--- a/server/internal/model/monitor.go
+++ b/server/internal/model/monitor.go
@@ -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 model
import (
@@ -12,7 +11,7 @@ import (
type MonitorData struct {
// STartTime 启动时间
- STartTime *gtime.Time
+ STartTime int64
// 内网IP
IntranetIP string
// 公网IP
diff --git a/server/internal/queues/init.go b/server/internal/queues/init.go
deleted file mode 100644
index e18c452..0000000
--- a/server/internal/queues/init.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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
-
-import (
- "context"
- "github.com/gogf/gf/v2/frame/g"
- "hotgo/internal/library/queue"
-)
-
-type jobStrategy interface {
- getTopic() string
- handle(ctx context.Context, mqMsg queue.MqMsg) (err error)
-}
-
-var jobList []jobStrategy
-
-func Run(ctx context.Context) {
- for _, job := range uniqueJob(jobList) {
- go func(job jobStrategy) {
- listen(ctx, job)
- }(job)
- }
-}
-
-func listen(ctx context.Context, job jobStrategy) {
- var (
- topic = job.getTopic()
- consumer, err = queue.InstanceConsumer()
- )
-
- if err != nil {
- g.Log().Fatalf(ctx, "InstanceConsumer %s err:%+v", topic, err)
- return
- }
-
- // 访问日志
- if listenErr := consumer.ListenReceiveMsgDo(topic, func(mqMsg queue.MqMsg) {
- err = job.handle(ctx, mqMsg)
-
- if err != nil {
- // 遇到错误,重新加入到队列
- //queue.Push(topic, mqMsg.Body)
- }
-
- // 记录队列日志
- queue.ConsumerLog(ctx, topic, mqMsg, err)
-
- }); listenErr != nil {
- g.Log().Fatalf(ctx, "队列:%s 监听失败, err:%+v", topic, listenErr)
- }
-
-}
-
-// uniqueJob 去重
-func uniqueJob(languages []jobStrategy) []jobStrategy {
- result := make([]jobStrategy, 0, len(languages))
- temp := map[jobStrategy]struct{}{}
- for _, item := range languages {
- if _, ok := temp[item]; !ok {
- temp[item] = struct{}{}
- result = append(result, item)
- }
- }
- return result
-}
diff --git a/server/internal/queues/login_log.go b/server/internal/queues/login_log.go
index 7012d44..c0ca742 100644
--- a/server/internal/queues/login_log.go
+++ b/server/internal/queues/login_log.go
@@ -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 queues
import (
@@ -16,7 +15,7 @@ import (
)
func init() {
- jobList = append(jobList, LoginLog)
+ queue.RegisterConsumer(LoginLog)
}
// LoginLog 登录日志
@@ -24,13 +23,13 @@ var LoginLog = &qLoginLog{}
type qLoginLog struct{}
-// getTopic 主题
-func (q *qLoginLog) getTopic() string {
+// GetTopic 主题
+func (q *qLoginLog) GetTopic() string {
return consts.QueueLoginLogTopic
}
-// handle 处理消息
-func (q *qLoginLog) handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
+// Handle 处理消息
+func (q *qLoginLog) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
var data entity.SysLoginLog
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
return err
diff --git a/server/internal/queues/serve_log.go b/server/internal/queues/serve_log.go
index b0cfe30..f3a9d38 100644
--- a/server/internal/queues/serve_log.go
+++ b/server/internal/queues/serve_log.go
@@ -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 queues
import (
@@ -16,7 +15,7 @@ import (
)
func init() {
- jobList = append(jobList, ServeLog)
+ queue.RegisterConsumer(ServeLog)
}
// ServeLog 登录日志
@@ -24,13 +23,13 @@ var ServeLog = &qServeLog{}
type qServeLog struct{}
-// getTopic 主题
-func (q *qServeLog) getTopic() string {
+// GetTopic 主题
+func (q *qServeLog) GetTopic() string {
return consts.QueueServeLogTopic
}
-// handle 处理消息
-func (q *qServeLog) handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
+// Handle 处理消息
+func (q *qServeLog) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
var data entity.SysServeLog
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
return err
diff --git a/server/internal/queues/sys_log.go b/server/internal/queues/sys_log.go
index 1128b48..1db0736 100644
--- a/server/internal/queues/sys_log.go
+++ b/server/internal/queues/sys_log.go
@@ -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 queues
import (
@@ -16,7 +15,7 @@ import (
)
func init() {
- jobList = append(jobList, SysLog)
+ queue.RegisterConsumer(SysLog)
}
// SysLog 系统日志
@@ -24,13 +23,13 @@ var SysLog = &qSysLog{}
type qSysLog struct{}
-// getTopic 主题
-func (q *qSysLog) getTopic() string {
+// GetTopic 主题
+func (q *qSysLog) GetTopic() string {
return consts.QueueLogTopic
}
-// handle 处理消息
-func (q *qSysLog) handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
+// Handle 处理消息
+func (q *qSysLog) Handle(ctx context.Context, mqMsg queue.MqMsg) (err error) {
var data entity.SysLog
if err = json.Unmarshal(mqMsg.Body, &data); err != nil {
return err
diff --git a/server/internal/router/websocket.go b/server/internal/router/websocket.go
index f851cd2..db29f3b 100644
--- a/server/internal/router/websocket.go
+++ b/server/internal/router/websocket.go
@@ -38,11 +38,11 @@ func WebSocket(ctx context.Context, group *ghttp.RouterGroup) {
// 注册消息路由
websocket.RegisterMsg(websocket.EventHandlers{
- "ping": common.Site.Ping, // 心跳
- "join": common.Site.Join, // 加入组
- "quit": common.Site.Quit, // 退出组
- "adminMonitorTrends": admin.Monitor.Trends, // 后台监控,动态数据
- "adminMonitorRunInfo": admin.Monitor.RunInfo, // 后台监控,运行信息
+ "ping": common.Site.Ping, // 心跳
+ "join": common.Site.Join, // 加入组
+ "quit": common.Site.Quit, // 退出组
+ "admin/monitor/trends": admin.Monitor.Trends, // 后台监控,动态数据
+ "admin/monitor/runInfo": admin.Monitor.RunInfo, // 后台监控,运行信息
})
}
diff --git a/server/internal/service/admin.go b/server/internal/service/admin.go
index 5b0464d..5f63c18 100644
--- a/server/internal/service/admin.go
+++ b/server/internal/service/admin.go
@@ -15,14 +15,9 @@ import (
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/database/gdb"
- "github.com/gogf/gf/v2/frame/g"
)
type (
- IAdminMonitor interface {
- StartMonitor(ctx context.Context)
- GetMeta(ctx context.Context) *model.MonitorData
- }
IAdminNotice interface {
Model(ctx context.Context, option ...*handler.Option) *gdb.Model
Delete(ctx context.Context, in adminin.NoticeDeleteInp) error
@@ -50,7 +45,7 @@ type (
}
IAdminRole interface {
Verify(ctx context.Context, path, method string) bool
- List(ctx context.Context, in adminin.RoleListInp) (list []g.Map, totalCount int, err error)
+ List(ctx context.Context, in adminin.RoleListInp) (res *adminin.RoleListModel, totalCount int, err error)
GetName(ctx context.Context, RoleId int64) (name string, err error)
GetMemberList(ctx context.Context, RoleId int64) (list []*adminin.RoleListModel, err error)
GetPermissions(ctx context.Context, reqInfo *role.GetPermissionsReq) (MenuIds []int64, err error)
@@ -61,14 +56,13 @@ type (
DataScopeEdit(ctx context.Context, in *adminin.DataScopeEditInp) (err error)
}
IAdminDept interface {
- NameUnique(ctx context.Context, in adminin.DeptNameUniqueInp) (*adminin.DeptNameUniqueModel, error)
+ NameUnique(ctx context.Context, in adminin.DeptNameUniqueInp) (res *adminin.DeptNameUniqueModel, err error)
Delete(ctx context.Context, in adminin.DeptDeleteInp) (err error)
Edit(ctx context.Context, in adminin.DeptEditInp) (err error)
Status(ctx context.Context, in adminin.DeptStatusInp) (err error)
- MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (*adminin.DeptMaxSortModel, error)
+ MaxSort(ctx context.Context, in adminin.DeptMaxSortInp) (res *adminin.DeptMaxSortModel, err error)
View(ctx context.Context, in adminin.DeptViewInp) (res *adminin.DeptViewModel, err error)
- List(ctx context.Context, in adminin.DeptListInp) (list adminin.DeptListModel, err error)
- ListTree(ctx context.Context, in adminin.DeptListTreeInp) (list []*adminin.DeptListTreeModel, err error)
+ List(ctx context.Context, in adminin.DeptListInp) (res *adminin.DeptListModel, err error)
GetName(ctx context.Context, id int64) (name string, err error)
}
IAdminMember interface {
@@ -97,8 +91,8 @@ type (
MemberLoginStat(ctx context.Context, in adminin.MemberLoginStatInp) (res *adminin.MemberLoginStatModel, err error)
}
IAdminMemberPost interface {
- UpdatePostIds(ctx context.Context, member_id int64, post_ids []int64) (err error)
- GetMemberByIds(ctx context.Context, member_id int64) (post_ids []int64, err error)
+ UpdatePostIds(ctx context.Context, memberId int64, postIds []int64) (err error)
+ GetMemberByIds(ctx context.Context, memberId int64) (postIds []int64, err error)
}
IAdminMenu interface {
RoleList(ctx context.Context, in adminin.MenuRoleListInp) (*adminin.MenuRoleListModel, error)
@@ -113,9 +107,14 @@ type (
GetMenuList(ctx context.Context, memberId int64) (lists role.DynamicRes, err error)
LoginPermissions(ctx context.Context, memberId int64) (lists adminin.MemberLoginPermissions, err error)
}
+ IAdminMonitor interface {
+ StartMonitor(ctx context.Context)
+ GetMeta(ctx context.Context) *model.MonitorData
+ }
)
var (
+ localAdminPost IAdminPost
localAdminRole IAdminRole
localAdminDept IAdminDept
localAdminMember IAdminMember
@@ -123,7 +122,6 @@ var (
localAdminMenu IAdminMenu
localAdminMonitor IAdminMonitor
localAdminNotice IAdminNotice
- localAdminPost IAdminPost
)
func AdminDept() IAdminDept {
diff --git a/server/internal/service/sys.go b/server/internal/service/sys.go
index 507ef68..637ddac 100644
--- a/server/internal/service/sys.go
+++ b/server/internal/service/sys.go
@@ -17,6 +17,20 @@ import (
)
type (
+ ISysAddonsConfig interface {
+ GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
+ ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
+ UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) error
+ }
+ ISysAttachment interface {
+ Delete(ctx context.Context, in sysin.AttachmentDeleteInp) error
+ Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error)
+ Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error)
+ MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (*sysin.AttachmentMaxSortModel, error)
+ View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
+ List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
+ Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (data *entity.SysAttachment, err error)
+ }
ISysBlacklist interface {
Delete(ctx context.Context, in sysin.BlacklistDeleteInp) (err error)
Edit(ctx context.Context, in sysin.BlacklistEditInp) (err error)
@@ -27,12 +41,6 @@ type (
VariableLoad(ctx context.Context, err error)
Load(ctx context.Context)
}
- ISysDictData interface {
- Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
- Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
- List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
- Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
- }
ISysEmsLog interface {
Delete(ctx context.Context, in sysin.EmsLogDeleteInp) error
Edit(ctx context.Context, in sysin.EmsLogEditInp) (err error)
@@ -44,60 +52,6 @@ type (
AllowSend(ctx context.Context, models *entity.SysEmsLog, config *model.EmailConfig) (err error)
VerifyCode(ctx context.Context, in sysin.VerifyEmsCodeInp) (err error)
}
- ISysLog interface {
- Export(ctx context.Context, in sysin.LogListInp) (err error)
- RealWrite(ctx context.Context, commonLog entity.SysLog) (err error)
- AutoLog(ctx context.Context) error
- AnalysisLog(ctx context.Context) entity.SysLog
- View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
- Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
- List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
- }
- ISysConfig interface {
- GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error)
- GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error)
- GetSms(ctx context.Context) (conf *model.SmsConfig, err error)
- GetGeo(ctx context.Context) (conf *model.GeoConfig, err error)
- GetUpload(ctx context.Context) (conf *model.UploadConfig, err error)
- GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error)
- GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
- GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error)
- GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error)
- GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error)
- GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (*sysin.GetConfigModel, error)
- ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error)
- UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error
- }
- ISysCron interface {
- StartCron(ctx context.Context)
- Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
- Edit(ctx context.Context, in sysin.CronEditInp) (err error)
- Status(ctx context.Context, in sysin.CronStatusInp) (err error)
- MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
- View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error)
- List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
- OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
- }
- ISysCronGroup interface {
- Delete(ctx context.Context, in sysin.CronGroupDeleteInp) error
- Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
- Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
- MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (*sysin.CronGroupMaxSortModel, error)
- View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
- List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
- Select(ctx context.Context, in sysin.CronGroupSelectInp) (list sysin.CronGroupSelectModel, err error)
- }
- ISysCurdDemo interface {
- Model(ctx context.Context, option ...*handler.Option) *gdb.Model
- List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
- Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
- Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
- Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
- MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
- View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
- Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
- Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error)
- }
ISysGenCodes interface {
Delete(ctx context.Context, in sysin.GenCodesDeleteInp) error
Edit(ctx context.Context, in sysin.GenCodesEditInp) (res *sysin.GenCodesEditModel, err error)
@@ -112,56 +66,6 @@ type (
Preview(ctx context.Context, in sysin.GenCodesPreviewInp) (res *sysin.GenCodesPreviewModel, err error)
Build(ctx context.Context, in sysin.GenCodesBuildInp) (err error)
}
- ISysAddons interface {
- List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
- Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
- Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
- Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
- Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
- UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
- }
- ISysAddonsConfig interface {
- GetConfigByGroup(ctx context.Context, in sysin.GetAddonsConfigInp) (res *sysin.GetAddonsConfigModel, err error)
- ConversionType(ctx context.Context, models *entity.SysAddonsConfig) (value interface{}, err error)
- UpdateConfigByGroup(ctx context.Context, in sysin.UpdateAddonsConfigInp) error
- }
- ISysDictType interface {
- Tree(ctx context.Context) (list []g.Map, err error)
- Delete(ctx context.Context, in sysin.DictTypeDeleteInp) error
- Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
- Select(ctx context.Context, in sysin.DictTypeSelectInp) (list sysin.DictTypeSelectModel, err error)
- TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list sysin.DictTreeSelectModel, err error)
- }
- ISysLoginLog interface {
- Model(ctx context.Context) *gdb.Model
- List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
- Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
- Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
- View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
- Push(ctx context.Context, in sysin.LoginLogPushInp)
- RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
- }
- ISysAttachment interface {
- Delete(ctx context.Context, in sysin.AttachmentDeleteInp) error
- Edit(ctx context.Context, in sysin.AttachmentEditInp) (err error)
- Status(ctx context.Context, in sysin.AttachmentStatusInp) (err error)
- MaxSort(ctx context.Context, in sysin.AttachmentMaxSortInp) (*sysin.AttachmentMaxSortModel, error)
- View(ctx context.Context, in sysin.AttachmentViewInp) (res *sysin.AttachmentViewModel, err error)
- List(ctx context.Context, in sysin.AttachmentListInp) (list []*sysin.AttachmentListModel, totalCount int, err error)
- Add(ctx context.Context, meta *sysin.UploadFileMeta, fullPath, drive string) (data *entity.SysAttachment, err error)
- }
- ISysProvinces interface {
- Tree(ctx context.Context) (list []g.Map, err error)
- Delete(ctx context.Context, in sysin.ProvincesDeleteInp) error
- Edit(ctx context.Context, in sysin.ProvincesEditInp) (err error)
- Status(ctx context.Context, in sysin.ProvincesStatusInp) (err error)
- MaxSort(ctx context.Context, in sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
- View(ctx context.Context, in sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
- List(ctx context.Context, in sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
- ChildrenList(ctx context.Context, in sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
- UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
- Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
- }
ISysServeLog interface {
Model(ctx context.Context) *gdb.Model
List(ctx context.Context, in sysin.ServeLogListInp) (list []*sysin.ServeLogListModel, totalCount int, err error)
@@ -182,28 +86,178 @@ type (
AllowSend(ctx context.Context, models *entity.SysSmsLog, config *model.SmsConfig) (err error)
VerifyCode(ctx context.Context, in sysin.VerifyCodeInp) (err error)
}
+ ISysAddons interface {
+ List(ctx context.Context, in sysin.AddonsListInp) (list []*sysin.AddonsListModel, totalCount int, err error)
+ Selects(ctx context.Context, in sysin.AddonsSelectsInp) (res *sysin.AddonsSelectsModel, err error)
+ Build(ctx context.Context, in sysin.AddonsBuildInp) (err error)
+ Install(ctx context.Context, in sysin.AddonsInstallInp) (err error)
+ Upgrade(ctx context.Context, in sysin.AddonsUpgradeInp) (err error)
+ UnInstall(ctx context.Context, in sysin.AddonsUnInstallInp) (err error)
+ }
+ ISysConfig interface {
+ GetLoadCache(ctx context.Context) (conf *model.CacheConfig, err error)
+ GetLoadGenerate(ctx context.Context) (conf *model.GenerateConfig, err error)
+ GetSms(ctx context.Context) (conf *model.SmsConfig, err error)
+ GetGeo(ctx context.Context) (conf *model.GeoConfig, err error)
+ GetUpload(ctx context.Context) (conf *model.UploadConfig, err error)
+ GetSmtp(ctx context.Context) (conf *model.EmailConfig, err error)
+ GetBasic(ctx context.Context) (conf *model.BasicConfig, err error)
+ GetLoadSSL(ctx context.Context) (conf *model.SSLConfig, err error)
+ GetLoadLog(ctx context.Context) (conf *model.LogConfig, err error)
+ GetLoadServeLog(ctx context.Context) (conf *model.ServeLogConfig, err error)
+ GetConfigByGroup(ctx context.Context, in sysin.GetConfigInp) (*sysin.GetConfigModel, error)
+ ConversionType(ctx context.Context, models *entity.SysConfig) (value interface{}, err error)
+ UpdateConfigByGroup(ctx context.Context, in sysin.UpdateConfigInp) error
+ }
+ ISysLog interface {
+ Export(ctx context.Context, in sysin.LogListInp) (err error)
+ RealWrite(ctx context.Context, commonLog entity.SysLog) (err error)
+ AutoLog(ctx context.Context) error
+ AnalysisLog(ctx context.Context) entity.SysLog
+ View(ctx context.Context, in sysin.LogViewInp) (res *sysin.LogViewModel, err error)
+ Delete(ctx context.Context, in sysin.LogDeleteInp) (err error)
+ List(ctx context.Context, in sysin.LogListInp) (list []*sysin.LogListModel, totalCount int, err error)
+ }
+ ISysLoginLog interface {
+ Model(ctx context.Context) *gdb.Model
+ List(ctx context.Context, in sysin.LoginLogListInp) (list []*sysin.LoginLogListModel, totalCount int, err error)
+ Export(ctx context.Context, in sysin.LoginLogListInp) (err error)
+ Delete(ctx context.Context, in sysin.LoginLogDeleteInp) (err error)
+ View(ctx context.Context, in sysin.LoginLogViewInp) (res *sysin.LoginLogViewModel, err error)
+ Push(ctx context.Context, in sysin.LoginLogPushInp)
+ RealWrite(ctx context.Context, models entity.SysLoginLog) (err error)
+ }
+ ISysCronGroup interface {
+ Delete(ctx context.Context, in sysin.CronGroupDeleteInp) error
+ Edit(ctx context.Context, in sysin.CronGroupEditInp) (err error)
+ Status(ctx context.Context, in sysin.CronGroupStatusInp) (err error)
+ MaxSort(ctx context.Context, in sysin.CronGroupMaxSortInp) (*sysin.CronGroupMaxSortModel, error)
+ View(ctx context.Context, in sysin.CronGroupViewInp) (res *sysin.CronGroupViewModel, err error)
+ List(ctx context.Context, in sysin.CronGroupListInp) (list []*sysin.CronGroupListModel, totalCount int, err error)
+ Select(ctx context.Context, in sysin.CronGroupSelectInp) (res *sysin.CronGroupSelectModel, err error)
+ }
+ ISysCurdDemo interface {
+ Model(ctx context.Context, option ...*handler.Option) *gdb.Model
+ List(ctx context.Context, in sysin.CurdDemoListInp) (list []*sysin.CurdDemoListModel, totalCount int, err error)
+ Export(ctx context.Context, in sysin.CurdDemoListInp) (err error)
+ Edit(ctx context.Context, in sysin.CurdDemoEditInp) (err error)
+ Delete(ctx context.Context, in sysin.CurdDemoDeleteInp) (err error)
+ MaxSort(ctx context.Context, in sysin.CurdDemoMaxSortInp) (res *sysin.CurdDemoMaxSortModel, err error)
+ View(ctx context.Context, in sysin.CurdDemoViewInp) (res *sysin.CurdDemoViewModel, err error)
+ Status(ctx context.Context, in sysin.CurdDemoStatusInp) (err error)
+ Switch(ctx context.Context, in sysin.CurdDemoSwitchInp) (err error)
+ }
+ ISysDictData interface {
+ Delete(ctx context.Context, in sysin.DictDataDeleteInp) error
+ Edit(ctx context.Context, in sysin.DictDataEditInp) (err error)
+ List(ctx context.Context, in sysin.DictDataListInp) (list []*sysin.DictDataListModel, totalCount int, err error)
+ Select(ctx context.Context, in sysin.DataSelectInp) (list sysin.DataSelectModel, err error)
+ }
+ ISysDictType interface {
+ Tree(ctx context.Context) (list []*sysin.DictTypeTree, err error)
+ Delete(ctx context.Context, in sysin.DictTypeDeleteInp) error
+ Edit(ctx context.Context, in sysin.DictTypeEditInp) (err error)
+ TreeSelect(ctx context.Context, in sysin.DictTreeSelectInp) (list []*sysin.DictTypeTree, err error)
+ }
+ ISysProvinces interface {
+ Tree(ctx context.Context) (list []g.Map, err error)
+ Delete(ctx context.Context, in sysin.ProvincesDeleteInp) error
+ Edit(ctx context.Context, in sysin.ProvincesEditInp) (err error)
+ Status(ctx context.Context, in sysin.ProvincesStatusInp) (err error)
+ MaxSort(ctx context.Context, in sysin.ProvincesMaxSortInp) (res *sysin.ProvincesMaxSortModel, err error)
+ View(ctx context.Context, in sysin.ProvincesViewInp) (res *sysin.ProvincesViewModel, err error)
+ List(ctx context.Context, in sysin.ProvincesListInp) (list []*sysin.ProvincesListModel, totalCount int, err error)
+ ChildrenList(ctx context.Context, in sysin.ProvincesChildrenListInp) (list []*sysin.ProvincesChildrenListModel, totalCount int, err error)
+ UniqueId(ctx context.Context, in sysin.ProvincesUniqueIdInp) (res *sysin.ProvincesUniqueIdModel, err error)
+ Select(ctx context.Context, in sysin.ProvincesSelectInp) (res *sysin.ProvincesSelectModel, err error)
+ }
+ ISysCron interface {
+ StartCron(ctx context.Context)
+ Delete(ctx context.Context, in sysin.CronDeleteInp) (err error)
+ Edit(ctx context.Context, in sysin.CronEditInp) (err error)
+ Status(ctx context.Context, in sysin.CronStatusInp) (err error)
+ MaxSort(ctx context.Context, in sysin.CronMaxSortInp) (res *sysin.CronMaxSortModel, err error)
+ View(ctx context.Context, in sysin.CronViewInp) (res *sysin.CronViewModel, err error)
+ List(ctx context.Context, in sysin.CronListInp) (list []*sysin.CronListModel, totalCount int, err error)
+ OnlineExec(ctx context.Context, in sysin.OnlineExecInp) (err error)
+ }
)
var (
localSysCron ISysCron
- localSysCronGroup ISysCronGroup
- localSysCurdDemo ISysCurdDemo
+ localSysAttachment ISysAttachment
+ localSysBlacklist ISysBlacklist
+ localSysEmsLog ISysEmsLog
localSysGenCodes ISysGenCodes
- localSysLog ISysLog
- localSysConfig ISysConfig
- localSysAddonsConfig ISysAddonsConfig
- localSysDictType ISysDictType
- localSysLoginLog ISysLoginLog
- localSysAddons ISysAddons
- localSysProvinces ISysProvinces
localSysServeLog ISysServeLog
localSysSmsLog ISysSmsLog
- localSysAttachment ISysAttachment
+ localSysAddonsConfig ISysAddonsConfig
+ localSysConfig ISysConfig
+ localSysLog ISysLog
+ localSysLoginLog ISysLoginLog
+ localSysAddons ISysAddons
+ localSysCurdDemo ISysCurdDemo
localSysDictData ISysDictData
- localSysEmsLog ISysEmsLog
- localSysBlacklist ISysBlacklist
+ localSysDictType ISysDictType
+ localSysProvinces ISysProvinces
+ localSysCronGroup ISysCronGroup
)
+func SysGenCodes() ISysGenCodes {
+ if localSysGenCodes == nil {
+ panic("implement not found for interface ISysGenCodes, forgot register?")
+ }
+ return localSysGenCodes
+}
+
+func RegisterSysGenCodes(i ISysGenCodes) {
+ localSysGenCodes = 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 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 SysAttachment() ISysAttachment {
+ if localSysAttachment == nil {
+ panic("implement not found for interface ISysAttachment, forgot register?")
+ }
+ return localSysAttachment
+}
+
+func RegisterSysAttachment(i ISysAttachment) {
+ localSysAttachment = i
+}
+
func SysBlacklist() ISysBlacklist {
if localSysBlacklist == nil {
panic("implement not found for interface ISysBlacklist, forgot register?")
@@ -215,17 +269,6 @@ func RegisterSysBlacklist(i ISysBlacklist) {
localSysBlacklist = 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 SysEmsLog() ISysEmsLog {
if localSysEmsLog == nil {
panic("implement not found for interface ISysEmsLog, forgot register?")
@@ -237,6 +280,17 @@ func RegisterSysEmsLog(i ISysEmsLog) {
localSysEmsLog = 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 SysConfig() ISysConfig {
if localSysConfig == nil {
panic("implement not found for interface ISysConfig, forgot register?")
@@ -248,15 +302,37 @@ func RegisterSysConfig(i ISysConfig) {
localSysConfig = i
}
-func SysCron() ISysCron {
- if localSysCron == nil {
- panic("implement not found for interface ISysCron, forgot register?")
+func SysLog() ISysLog {
+ if localSysLog == nil {
+ panic("implement not found for interface ISysLog, forgot register?")
}
- return localSysCron
+ return localSysLog
}
-func RegisterSysCron(i ISysCron) {
- localSysCron = i
+func RegisterSysLog(i ISysLog) {
+ localSysLog = i
+}
+
+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 SysCronGroup() ISysCronGroup {
@@ -281,48 +357,15 @@ func RegisterSysCurdDemo(i ISysCurdDemo) {
localSysCurdDemo = i
}
-func SysGenCodes() ISysGenCodes {
- if localSysGenCodes == nil {
- panic("implement not found for interface ISysGenCodes, forgot register?")
+func SysDictData() ISysDictData {
+ if localSysDictData == nil {
+ panic("implement not found for interface ISysDictData, forgot register?")
}
- return localSysGenCodes
+ return localSysDictData
}
-func RegisterSysGenCodes(i ISysGenCodes) {
- localSysGenCodes = i
-}
-
-func SysLog() ISysLog {
- if localSysLog == nil {
- panic("implement not found for interface ISysLog, forgot register?")
- }
- return localSysLog
-}
-
-func RegisterSysLog(i ISysLog) {
- localSysLog = 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 SysAddonsConfig() ISysAddonsConfig {
- if localSysAddonsConfig == nil {
- panic("implement not found for interface ISysAddonsConfig, forgot register?")
- }
- return localSysAddonsConfig
-}
-
-func RegisterSysAddonsConfig(i ISysAddonsConfig) {
- localSysAddonsConfig = i
+func RegisterSysDictData(i ISysDictData) {
+ localSysDictData = i
}
func SysDictType() ISysDictType {
@@ -336,57 +379,13 @@ func RegisterSysDictType(i ISysDictType) {
localSysDictType = i
}
-func SysLoginLog() ISysLoginLog {
- if localSysLoginLog == nil {
- panic("implement not found for interface ISysLoginLog, forgot register?")
+func SysCron() ISysCron {
+ if localSysCron == nil {
+ panic("implement not found for interface ISysCron, forgot register?")
}
- return localSysLoginLog
+ return localSysCron
}
-func RegisterSysLoginLog(i ISysLoginLog) {
- localSysLoginLog = i
-}
-
-func SysAttachment() ISysAttachment {
- if localSysAttachment == nil {
- panic("implement not found for interface ISysAttachment, forgot register?")
- }
- return localSysAttachment
-}
-
-func RegisterSysAttachment(i ISysAttachment) {
- localSysAttachment = 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 SysServeLog() ISysServeLog {
- if localSysServeLog == nil {
- panic("implement not found for interface ISysServeLog, forgot register?")
- }
- return localSysServeLog
-}
-
-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 RegisterSysCron(i ISysCron) {
+ localSysCron = i
}
diff --git a/server/internal/websocket/init.go b/server/internal/websocket/init.go
index 2d6871c..05085fa 100644
--- a/server/internal/websocket/init.go
+++ b/server/internal/websocket/init.go
@@ -31,9 +31,9 @@ var (
// Start 启动
func Start(c context.Context) {
ctxManager = c
- g.Log().Debug(ctxManager, "start websocket..")
go clientManager.start()
go clientManager.ping()
+ g.Log().Debug(ctxManager, "start websocket..")
}
// Stop 关闭
diff --git a/server/internal/websocket/router.go b/server/internal/websocket/router.go
index 8371e34..21c78b4 100644
--- a/server/internal/websocket/router.go
+++ b/server/internal/websocket/router.go
@@ -19,9 +19,9 @@ func handlerMsg(client *Client, message []byte) {
g.Log().Warningf(ctxManager, "handlerMsg recover, err:%+v, stack:%+v", r, string(debug.Stack()))
}
}()
- request := &WRequest{}
- err := gconv.Struct(message, request)
- if err != nil {
+
+ var request *WRequest
+ if err := gconv.Struct(message, &request); err != nil {
g.Log().Warningf(ctxManager, "handlerMsg 数据解析失败,err:%+v, message:%+v", err, string(message))
return
}
@@ -31,8 +31,6 @@ func handlerMsg(client *Client, message []byte) {
return
}
- //g.Log().Infof(ctxManager, "websocket handlerMsg:%+v", request)
-
fun, ok := routers[request.Event]
if !ok {
g.Log().Warningf(ctxManager, "handlerMsg function id %v: not registered", request.Event)
diff --git a/server/main.go b/server/main.go
index 9a3653e..be2d396 100644
--- a/server/main.go
+++ b/server/main.go
@@ -15,6 +15,7 @@ import (
"hotgo/internal/cmd"
"hotgo/internal/global"
_ "hotgo/internal/logic"
+ _ "hotgo/internal/queues"
)
func main() {
diff --git a/server/manifest/config/config.example.yaml b/server/manifest/config/config.example.yaml
index 55c8590..d76efc7 100644
--- a/server/manifest/config/config.example.yaml
+++ b/server/manifest/config/config.example.yaml
@@ -245,4 +245,6 @@ hggen:
# 生成插件模块,通过后台创建新插件时使用的模板,允许自定义,可以参考default模板进行改造
addon:
srcPath: "./resource/generate/default/addon" # 生成模板路径
- templatePath: "./resource/template/addons/{$name}" # 页面模板路径
\ No newline at end of file
+ templatePath: "./resource/template/addons/{$name}" # 页面模板路径
+ webApiPath: "../web/src/api/addons/{$name}" # webApi生成路径
+ webViewsPath: "../web/src/views/addons/{$name}" # web页面生成路径
\ No newline at end of file
diff --git a/server/storage/data/generate/addons/.gitkeep b/server/storage/data/generate/addons/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/server/storage/data/hotgo.sql b/server/storage/data/hotgo.sql
index 7db3639..26117e5 100644
--- a/server/storage/data/hotgo.sql
+++ b/server/storage/data/hotgo.sql
@@ -1,14 +1,13 @@
-- phpMyAdmin SQL Dump
--- version 4.9.0.1
+-- version 5.2.1
-- https://www.phpmyadmin.net/
--
--- 主机: localhost:3306
--- 生成日期: 2023-02-23 15:03:54
--- 服务器版本: 5.7.38-log
--- PHP 版本: 5.6.40
+-- 主机: localhost
+-- 生成日期: 2023-02-26 06:04:12
+-- 服务器版本: 5.7.41
+-- PHP 版本: 7.3.33
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
-SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
@@ -73,8 +72,8 @@ CREATE TABLE `hg_addon_hgexample_table` (
--
INSERT INTO `hg_addon_hgexample_table` (`id`, `category_id`, `flag`, `title`, `description`, `content`, `image`, `images`, `attachfile`, `attachfiles`, `map`, `star`, `price`, `views`, `activity_at`, `start_at`, `end_at`, `switch`, `sort`, `avatar`, `sex`, `qq`, `email`, `mobile`, `hobby`, `channel`, `city_id`, `pid`, `level`, `tree`, `remark`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`, `deleted_at`) VALUES
-(1, 1, '[1, 2]', '测试标题', '描述', '这是内容............
', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqamvhlq4w3ki6bl.webp', '[\"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqap5l9brk2lkavu.jpg\", \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaqua7fw8ukbbp5.jpg\"]', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaup19k9oznyixz.doc', '[\"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqawg96ba4cuezvv.xlsx\", \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaup19k9oznyixz.doc\"]', '[{\"key\": \"qwe\", \"value\": \"123\"}, {\"key\": \"asd\", \"value\": \"456\"}]', '3.0', '88.00', 10, '2022-12-23', '2022-12-01 00:00:00', '2022-12-31 23:59:59', 1, 20, '', 15, '133814250', '133814250@qq.com', '15303830571', '[3, 2, 1]', 1, 140406, 0, 1, '', '备注!', 1, 1, 1, '2022-12-15 19:30:14', '2023-02-23 13:59:00', NULL),
-(2, 0, '[1]', '测试2', '描述', '这是内容............
', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqamvhlq4w3ki6bl.webp', '[\"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqap5l9brk2lkavu.jpg\", \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaqua7fw8ukbbp5.jpg\"]', 'http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaup19k9oznyixz.doc', '[\"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqawg96ba4cuezvv.xlsx\", \"http://bufanyun.cn-bj.ufileos.com/hotgo/attachment/2023-02-09/cqdqaup19k9oznyixz.doc\"]', '[{\"key\": \"qwe\", \"value\": \"123\"}, {\"key\": \"asd\", \"value\": \"456\"}]', 3.0, 88.00, 10, '2022-12-23', '2022-12-01 00:00:00', '2022-12-31 23:59:59', 1, 20, '', 15, '133814250', '133814250@qq.com', '15303830571', '[3, 2, 1]', 1, 140406, 0, 1, '', '备注!', 1, 1, 1, '2022-12-15 19:30:14', '2023-02-23 13:59:00', NULL),
+(2, 0, '[1]', '测试2', '描述', '