diff --git a/README.md b/README.md index 5b0c6c4467265f5c79fbbca13964ec41b32fcffc..648faecf8882f9722bf2af29341d73f99e5b27a9 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ ## 🏭在线体验 -演示地址:http://47.104.252.2:8080/ 帐号:admin 密码:123456 - +演示地址:http://101.35.247.125:7789/ 帐号:admin 密码:123456 +组态大屏:http://101.35.247.125:7790/ --- 系统在线文档 --- diff --git a/apps/rule/api/rule_notice.go b/apps/rule/api/rule_notice.go deleted file mode 100644 index 837a6cda3574865aa4ea889232a20dd4d72bc9f0..0000000000000000000000000000000000000000 --- a/apps/rule/api/rule_notice.go +++ /dev/null @@ -1,65 +0,0 @@ -package api - -// ========================================================================== -// 生成日期:2022-09-02 15:49:39 +0800 CST -// 生成路径: apps/rule/api/rule_notice.go -// 生成人:panda -// ========================================================================== -import ( - "github.com/XM-GO/PandaKit/model" - "github.com/XM-GO/PandaKit/restfulx" - - "github.com/XM-GO/PandaKit/utils" - "pandax/apps/rule/entity" - "pandax/apps/rule/services" -) - -type RuleNoticeApi struct { - RuleNoticeApp services.RuleNoticeModel -} - -// GetRuleNoticeList Notice列表数据 -func (p *RuleNoticeApi) GetRuleNoticeList(rc *restfulx.ReqCtx) { - data := entity.RuleNotice{} - pageNum := restfulx.QueryInt(rc, "pageNum", 1) - pageSize := restfulx.QueryInt(rc, "pageSize", 10) - data.Name = restfulx.QueryParam(rc, "name") - - list, total := p.RuleNoticeApp.FindListPage(pageNum, pageSize, data) - - rc.ResData = model.ResultPage{ - Total: total, - PageNum: int64(pageNum), - PageSize: int64(pageNum), - Data: list, - } -} - -// GetRuleNotice 获取Notice -func (p *RuleNoticeApi) GetRuleNotice(rc *restfulx.ReqCtx) { - id := restfulx.PathParamInt(rc, "id") - rc.ResData = p.RuleNoticeApp.FindOne(int64(id)) -} - -// InsertRuleNotice 添加Notice -func (p *RuleNoticeApi) InsertRuleNotice(rc *restfulx.ReqCtx) { - var data entity.RuleNotice - restfulx.BindQuery(rc, &data) - - p.RuleNoticeApp.Insert(data) -} - -// UpdateRuleNotice 修改Notice -func (p *RuleNoticeApi) UpdateRuleNotice(rc *restfulx.ReqCtx) { - var data entity.RuleNotice - restfulx.BindQuery(rc, &data) - - p.RuleNoticeApp.Update(data) -} - -// DeleteRuleNotice 删除Notice -func (p *RuleNoticeApi) DeleteRuleNotice(rc *restfulx.ReqCtx) { - id := restfulx.PathParam(rc, "id") - ids := utils.IdsStrToIdsIntGroup(id) - p.RuleNoticeApp.Delete(ids) -} diff --git a/apps/rule/entity/notice.go b/apps/rule/entity/notice.go deleted file mode 100644 index f14ffe44201501edef9254d4b4738421da93948d..0000000000000000000000000000000000000000 --- a/apps/rule/entity/notice.go +++ /dev/null @@ -1,62 +0,0 @@ -package entity - -import ( - "encoding/json" - "github.com/XM-GO/PandaKit/model" -) - -type RuleNotice struct { - model.BaseAutoModel - UserId string `json:"user_id"` - Name string `json:"name"` - Category string `json:"category"` // http,mail - Description string `json:"description"` - Model string `json:"model"` // 配置或模板 setting or template - ExParam json.RawMessage `json:"ex_param" gorm:"type:jsonb;comment: 拓展参数"` -} - -func (RuleNotice) TableName() string { - return "rule_notice" -} - -type RestSetting struct { - Method string `json:"method"` - Url string `json:"url"` - Headers map[string]string `json:"headers"` - BodyType string `json:"bodyType"` - Timeout int64 `json:"timeout"` - CertificationPath string `json:"certificationPath"` - PrivateKeyPath string `json:"privateKeyPath"` - RootCaPath string `json:"rootCaPath"` - InsecureSkipVerify bool `json:"insecureSkipVerify"` -} - -type MqttSetting struct { - Server string `json:"server"` - Topic string `json:"topic"` - Qos byte `json:"qos"` - Username string `json:"username"` - Password string `json:"password"` - Retained bool `json:"retained"` - CertificationPath string `json:"certificationPath"` - PrivateKeyPath string `json:"privateKeyPath"` - RootCaPath string `json:"rootCaPath"` - InsecureSkipVerify bool `json:"insecureSkipVerify"` -} - -type MailSetting struct { - Host string `json:"host"` // 服务器地址 - Port int `json:"port"` // 服务器端口 - From string `json:"from"` // 邮箱账号 - Nickname string `json:"nickname"` // 发件人 - Secret string `json:"secret"` // 邮箱密码 - IsSSL bool `json:"isSsl"` // 是否开启ssl -} - -type ScriptSetting struct { - Category string `json:"category"` // 0 python,1 javascript 2 shell -} - -type DataTemplate struct { - DataTemplate string `json:"dataTemplate"` -} diff --git a/apps/rule/router/rule_notice.go b/apps/rule/router/rule_notice.go deleted file mode 100644 index 0a4230ffe40e898dea7b0aed739b1585376b8499..0000000000000000000000000000000000000000 --- a/apps/rule/router/rule_notice.go +++ /dev/null @@ -1,70 +0,0 @@ -// ========================================================================== -// 生成日期:2022-09-02 15:49:39 +0800 CST -// 生成路径: apps/rule/router/rule_notice.go -// 生成人:panda -// ========================================================================== -package router - -import ( - "github.com/XM-GO/PandaKit/model" - "github.com/XM-GO/PandaKit/restfulx" - "pandax/apps/rule/api" - "pandax/apps/rule/entity" - "pandax/apps/rule/services" - - restfulspec "github.com/emicklei/go-restful-openapi/v2" - "github.com/emicklei/go-restful/v3" -) - -func InitRuleNoticeRouter(container *restful.Container) { - s := &api.RuleNoticeApi{ - RuleNoticeApp: services.RuleNoticeModelDao, - } - - ws := new(restful.WebService) - ws.Path("/rule/notice").Produces(restful.MIME_JSON) - tags := []string{"notice"} - - ws.Route(ws.GET("/list").To(func(request *restful.Request, response *restful.Response) { - restfulx.NewReqCtx(request, response).WithLog("获取Notice分页列表").Handle(s.GetRuleNoticeList) - }). - Doc("获取Notice分页列表"). - Param(ws.QueryParameter("pageNum", "页数").Required(true).DataType("int")). - Param(ws.QueryParameter("pageSize", "每页条数").Required(true).DataType("int")). - Metadata(restfulspec.KeyOpenAPITags, tags). - Writes(model.ResultPage{}). - Returns(200, "OK", model.ResultPage{})) - - ws.Route(ws.GET("/{id}").To(func(request *restful.Request, response *restful.Response) { - restfulx.NewReqCtx(request, response).WithLog("获取Notice信息").Handle(s.GetRuleNotice) - }). - Doc("获取Notice信息"). - Param(ws.PathParameter("id", "Id").DataType("int")). - Metadata(restfulspec.KeyOpenAPITags, tags). - Writes(entity.RuleNotice{}). // on the response - Returns(200, "OK", entity.RuleNotice{}). - Returns(404, "Not Found", nil)) - - ws.Route(ws.POST("").To(func(request *restful.Request, response *restful.Response) { - restfulx.NewReqCtx(request, response).WithLog("添加Notice信息").Handle(s.InsertRuleNotice) - }). - Doc("添加Notice信息"). - Metadata(restfulspec.KeyOpenAPITags, tags). - Reads(entity.RuleNotice{})) - - ws.Route(ws.PUT("").To(func(request *restful.Request, response *restful.Response) { - restfulx.NewReqCtx(request, response).WithLog("修改Notice信息").Handle(s.UpdateRuleNotice) - }). - Doc("修改Notice信息"). - Metadata(restfulspec.KeyOpenAPITags, tags). - Reads(entity.RuleNotice{})) - - ws.Route(ws.DELETE("/{id}").To(func(request *restful.Request, response *restful.Response) { - restfulx.NewReqCtx(request, response).WithLog("删除Notice信息").Handle(s.DeleteRuleNotice) - }). - Doc("删除Notice信息"). - Metadata(restfulspec.KeyOpenAPITags, tags). - Param(ws.PathParameter("id", "多id 1,2,3").DataType("string"))) - - container.Add(ws) -} diff --git a/apps/rule/services/rule_notice.go b/apps/rule/services/rule_notice.go deleted file mode 100644 index f8cb59fda049da9283ab64fb019212d63404c672..0000000000000000000000000000000000000000 --- a/apps/rule/services/rule_notice.go +++ /dev/null @@ -1,101 +0,0 @@ -// ========================================================================== -// 生成日期:2022-09-02 15:49:39 +0800 CST -// 生成路径: apps/rule/services/rule_notice.go -// 生成人:panda -// ========================================================================== - -package services - -import ( - "github.com/XM-GO/PandaKit/biz" - "pandax/apps/rule/entity" - "pandax/pkg/global" -) - -type ( - RuleNoticeModel interface { - Insert(data entity.RuleNotice) *entity.RuleNotice - FindOne(id int64) *entity.RuleNotice - FindListPage(page, pageSize int, data entity.RuleNotice) (*[]entity.RuleNotice, int64) - FindList(data entity.RuleNotice) *[]entity.RuleNotice - Update(data entity.RuleNotice) *entity.RuleNotice - Delete(ids []int64) - } - - noticeModelImpl struct { - table string - } -) - -var RuleNoticeModelDao RuleNoticeModel = ¬iceModelImpl{ - table: `rule_notice`, -} - -func (m *noticeModelImpl) Insert(data entity.RuleNotice) *entity.RuleNotice { - err := global.Db.Table(m.table).Create(&data).Error - biz.ErrIsNil(err, "添加规则通知配置失败") - return &data -} - -func (m *noticeModelImpl) FindOne(id int64) *entity.RuleNotice { - resData := new(entity.RuleNotice) - db := global.Db.Table(m.table).Where("id = ?", id) - err := db.First(resData).Error - biz.ErrIsNil(err, "查询规则通知配置失败") - return resData -} - -func (m *noticeModelImpl) FindListPage(page, pageSize int, data entity.RuleNotice) (*[]entity.RuleNotice, int64) { - list := make([]entity.RuleNotice, 0) - var total int64 = 0 - offset := pageSize * (page - 1) - db := global.Db.Table(m.table) - // 此处填写 where参数判断 - if data.Description != "" { - db = db.Where("description = ?", data.Description) - } - if data.Name != "" { - db = db.Where("name like ?", "%"+data.Name+"%") - } - if data.Category != "" { - db = db.Where("category = ?", data.Category) - } - if data.Model != "" { - db = db.Where("model = ?", data.Model) - } - db.Where("delete_time IS NULL") - err := db.Count(&total).Error - err = db.Order("create_time").Limit(pageSize).Offset(offset).Find(&list).Error - biz.ErrIsNil(err, "查询规则通知配置分页列表失败") - return &list, total -} - -func (m *noticeModelImpl) FindList(data entity.RuleNotice) *[]entity.RuleNotice { - list := make([]entity.RuleNotice, 0) - db := global.Db.Table(m.table) - // 此处填写 where参数判断 - if data.Description != "" { - db = db.Where("description = ?", data.Description) - } - if data.Name != "" { - db = db.Where("name like ?", "%"+data.Name+"%") - } - if data.Category != "" { - db = db.Where("category = ?", data.Category) - } - if data.Model != "" { - db = db.Where("model = ?", data.Model) - } - db.Where("delete_time IS NULL") - biz.ErrIsNil(db.Order("create_time").Find(&list).Error, "查询规则通知配置列表失败") - return &list -} - -func (m *noticeModelImpl) Update(data entity.RuleNotice) *entity.RuleNotice { - biz.ErrIsNil(global.Db.Table(m.table).Updates(&data).Error, "修改规则通知配置失败") - return &data -} - -func (m *noticeModelImpl) Delete(ids []int64) { - biz.ErrIsNil(global.Db.Table(m.table).Delete(&entity.RuleNotice{}, "id in (?)", ids).Error, "删除规则通知配置失败") -} diff --git a/deploy/README.md b/deploy/README.md index 559636c29d4de3c480ad080aec0b9865bec9a6c3..d360d2a5887422027bc4de9504f953ec9d7062dd 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -10,8 +10,8 @@ sudo /usr/local/bin/k3s-uninstall.sh ## k3s部署流程 1. 设置打包环境 - set GOOS=linux - set GOARCH=amd64 + go env -w GOOS=linux + go env -w GOARCH=amd64 2. 构建Linux执行命令 go build -o pandax . 4. 构建docker镜像 (修改版本号 xmadmin/pandax:v1.0) diff --git a/pandax b/pandax index c6a4d9f1a75c202586082ed1a9173fc0fcaee491..6d5ec8e492c9aa0be5edf338a0a584bac85954fa 100644 Binary files a/pandax and b/pandax differ diff --git a/pkg/initialize/router.go b/pkg/initialize/router.go index 3dba0f2de536259b25127960136d4d6d0824eff8..8f4f98471b708334dbc57bf22ee5d6ee0d443a79 100644 --- a/pkg/initialize/router.go +++ b/pkg/initialize/router.go @@ -10,8 +10,6 @@ import ( resRouter "pandax/apps/resource/router" sysRouter "pandax/apps/system/router" - ruleRouter "pandax/apps/rule/router" - "pandax/pkg/middleware" ) @@ -65,10 +63,6 @@ func InitRouter() *transport.HttpServer { resRouter.InitResOssRouter(container) resRouter.InitResEmailsRouter(container) } - // 规则 - { - ruleRouter.InitRuleNoticeRouter(container) - } // api接口 middleware.SwaggerConfig(container) diff --git a/pkg/initialize/table.go b/pkg/initialize/table.go index de936eb1a30b5e25389df35ae7aa3dca8d8c396b..7f434bbfd8993902a92d9f1acb1d1c41a1d2d425 100644 --- a/pkg/initialize/table.go +++ b/pkg/initialize/table.go @@ -7,7 +7,6 @@ import ( jobEntity "pandax/apps/job/entity" logEntity "pandax/apps/log/entity" resSourceEntity "pandax/apps/resource/entity" - ruleEntity "pandax/apps/rule/entity" "pandax/apps/system/entity" "pandax/pkg/global" ) @@ -49,8 +48,6 @@ func InitTable() { flowEntity.FlowWorkStage{}, flowEntity.FlowWorkTask{}, flowEntity.FlowWorkTaskHistory{}, - - ruleEntity.RuleNotice{}, ), "初始化表失败") }