You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
3.2 KiB
71 lines
3.2 KiB
package modelskpi
|
|
|
|
import (
|
|
"appPlatform/overall"
|
|
"strings"
|
|
)
|
|
|
|
// 企业微信模版信息发送回调
|
|
type UpdateWechatTempmsg struct {
|
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"`
|
|
Type int `json:"type" gorm:"column:type;type:int(1) ;default:1;comment:类型(1:文本通知型;2:图文展示型;3:按钮交互型;4:投票选择型;5:多项选择型)"`
|
|
Sendmsgcont string `json:"sendmsgcont" gorm:"column:sendmsgcont;type:longtext ;comment:发送文件信息"`
|
|
Msgid string `json:"msgid" gorm:"column:msgid;type:mediumtext;comment:消息id,用于撤回应用消息"`
|
|
ResponseCode string `json:"response_code" gorm:"column:response_code;type:mediumtext ;comment:仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,72小时内有效,且只能使用一次"`
|
|
Orderkey int64 `json:"orderkey" gorm:"column:orderkey;type:bigint(20) unsigned;not null;default:0;comment:流程id"`
|
|
Enforcer string `json:"enforcer" gorm:"column:enforcer;type:mediumtext;comment:执行人"`
|
|
State int `json:"sate" gorm:"column:sate;type:int(1) unsigned;default:2;not null;comment:状态(1:已执行更新;2:未执行更新)"`
|
|
TaskId string `json:"task_id" gorm:"column:task_id;type:mediumtext;comment:任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成,最长128字节,填了action_menu字段的话本字段必填"`
|
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"`
|
|
}
|
|
|
|
func (UpdateWechatTempmsg *UpdateWechatTempmsg) TableName() string {
|
|
return "update_wechat_tempmsg"
|
|
}
|
|
|
|
// 添加
|
|
func (cont *UpdateWechatTempmsg) AddCont() (err error) {
|
|
err = overall.CONSTANT_DB_KPI.Create(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *UpdateWechatTempmsg) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *UpdateWechatTempmsg) GetCont(whereMap interface{}, field ...string) (err error) {
|
|
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
gormDb = gormDb.Where(whereMap)
|
|
err = gormDb.First(&cont).Error
|
|
return
|
|
}
|
|
|
|
// 根据条件获取总数
|
|
func (cont *UpdateWechatTempmsg) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *UpdateWechatTempmsg) ContMap(whereMap interface{}, field ...string) (countAry []UpdateWechatTempmsg, err error) {
|
|
gormDb := overall.CONSTANT_DB_KPI.Model(&cont)
|
|
if len(field) > 0 {
|
|
fieldStr := strings.Join(field, ",")
|
|
gormDb = gormDb.Select(fieldStr)
|
|
}
|
|
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error
|
|
return
|
|
}
|
|
|
|
// 删除内容
|
|
func (cont *UpdateWechatTempmsg) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|