【添加】规则消息通知

This commit is contained in:
PandaGoAdmin
2022-09-02 17:16:45 +08:00
parent 6312617f49
commit 31fe267d0a
13 changed files with 353 additions and 101 deletions

View File

@@ -0,0 +1,65 @@
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)
}