[优化]优化目录

This commit is contained in:
PandaX
2023-11-07 16:45:23 +08:00
parent 3a4cea5b26
commit 6bdc4b1dd6
37 changed files with 97 additions and 98 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/PandaXGO/PandaKit/restfulx"
"pandax/apps/rule/entity"
"pandax/apps/rule/services"
"pandax/pkg/global_model"
model2 "pandax/pkg/global/model"
"pandax/pkg/rule_engine"
"strings"
)
@@ -77,7 +77,7 @@ func (p *RuleChainApi) GetRuleChain(rc *restfulx.ReqCtx) {
func (p *RuleChainApi) InsertRuleChain(rc *restfulx.ReqCtx) {
var data entity.RuleChain
restfulx.BindJsonAndValid(rc, &data)
data.Id = global_model.GenerateID()
data.Id = model2.GenerateID()
data.Owner = rc.LoginAccount.UserName
data.OrgId = rc.LoginAccount.OrganizationId
p.RuleChainApp.Insert(data)
@@ -104,7 +104,7 @@ func (p *RuleChainApi) CloneRuleChain(rc *restfulx.ReqCtx) {
id := restfulx.PathParam(rc, "id")
one := p.RuleChainApp.FindOne(id)
one.RuleName = one.RuleName + "-克隆"
one.Id = global_model.GenerateID()
one.Id = model2.GenerateID()
one.Root = "0"
p.RuleChainApp.Insert(*one)
}

View File

@@ -1,7 +1,7 @@
package entity
import (
"pandax/pkg/global_model"
"pandax/pkg/global/model"
"time"
)
@@ -12,7 +12,7 @@ type RuleChainBaseLabel struct {
}
type RuleChainBase struct {
global_model.BaseAuthModel
model.BaseAuthModel
Root string `json:"root" gorm:"comment:是否根节点,1 根链 0 普通链"`
RuleName string `gorm:"ruleName;type:varchar(50);comment:名称" json:"ruleName"`
RuleBase64 string `gorm:"ruleBase64;type:longtext;comment:Base64缩略图" json:"ruleBase64"` //缩略图 base64

View File

@@ -11,7 +11,7 @@ import (
"pandax/apps/rule/entity"
"pandax/pkg/events"
"pandax/pkg/global"
"pandax/pkg/global_model"
"pandax/pkg/global/model"
)
type (
@@ -77,7 +77,7 @@ func (m *ruleChainModelImpl) FindListPage(page, pageSize int, data entity.RuleCh
db = db.Where("rule_remark like ?", "%"+data.RuleRemark+"%")
}
// 组织数据访问权限
global_model.OrgAuthSet(db, data.RoleId, data.Owner)
model.OrgAuthSet(db, data.RoleId, data.Owner)
err := db.Count(&total).Error
err = db.Order("create_time").Limit(pageSize).Offset(offset).Find(&list).Error
biz.ErrIsNil(err, "查询规则链分页列表失败")
@@ -95,7 +95,7 @@ func (m *ruleChainModelImpl) FindList(data entity.RuleChain) *[]entity.RuleChain
db = db.Where("rule_remark like ?", "%"+data.RuleRemark+"%")
}
// 组织数据访问权限
global_model.OrgAuthSet(db, data.RoleId, data.Owner)
model.OrgAuthSet(db, data.RoleId, data.Owner)
biz.ErrIsNil(db.Order("create_time").Find(&list).Error, "查询规则链列表失败")
return &list
}
@@ -108,7 +108,7 @@ func (m *ruleChainModelImpl) FindListBaseLabel(data entity.RuleChain) *[]entity.
db = db.Where("rule_name like ?", "%"+data.RuleName+"%")
}
// 组织数据访问权限
global_model.OrgAuthSet(db, data.RoleId, data.Owner)
model.OrgAuthSet(db, data.RoleId, data.Owner)
biz.ErrIsNil(db.Find(&list).Error, "查询规则链列表失败")
return &list
}

View File

@@ -10,7 +10,7 @@ import (
"github.com/PandaXGO/PandaKit/biz"
"pandax/apps/rule/entity"
"pandax/pkg/global"
"pandax/pkg/global_model"
"pandax/pkg/global/model"
)
type (
@@ -51,7 +51,7 @@ func (m *ruleChainLogModelImpl) FindListPage(page, pageSize int, data entity.Rul
db = db.Where("msg_type = ?", data.MsgType)
}
// 组织数据访问权限
global_model.OrgAuthSet(db, data.RoleId, data.Owner)
model.OrgAuthSet(db, data.RoleId, data.Owner)
err := db.Count(&total).Error
err = db.Order("create_at").Limit(pageSize).Offset(offset).Find(&list).Error
biz.ErrIsNil(err, "查询规则链分页列表失败")