package models

import (
	"github.com/beego/beego/v2/client/orm"
)

type CygxChartCeluePush struct {
	Id         int    `description:"新ID"`
	ChartId    int    `description:"图表ID"`
	IsHandle   int    `description:"文章ID"`
	Action     string `description:"日志类型：add，edit，move"`
	ModifyTime string `description:"修改时间"`
	CreateTime string `description:"创建时间"`
}

func GetChartCeluePushList() (item []*CygxChartCeluePush, err error) {
	o := orm.NewOrm()
	sql := ` SELECT *  FROM	cygx_chart_celue_push WHERE	is_handle = 0    GROUP BY chart_id   `
	_, err = o.Raw(sql).QueryRows(&item)
	return
}

// 更改推送内容是否处理状态
func UpdateCygxChartCeluePush(chartId int) (err error) {
	o := orm.NewOrm()
	sql := `UPDATE cygx_chart_celue_push SET is_handle=1 WHERE chart_id=? `
	_, err = o.Raw(sql, chartId).Exec()
	return
}
