mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2026-03-06 22:35:37 +08:00
通知媒介可以设置发送频率
This commit is contained in:
@@ -79,7 +79,7 @@ func (this *MessageMediaInstanceDAO) FindEnabledMessageMediaInstance(tx *dbs.Tx,
|
||||
}
|
||||
|
||||
// CreateMediaInstance 创建媒介实例
|
||||
func (this *MessageMediaInstanceDAO) CreateMediaInstance(tx *dbs.Tx, name string, mediaType string, params maps.Map, description string) (int64, error) {
|
||||
func (this *MessageMediaInstanceDAO) CreateMediaInstance(tx *dbs.Tx, name string, mediaType string, params maps.Map, description string, rateJSON []byte) (int64, error) {
|
||||
op := NewMessageMediaInstanceOperator()
|
||||
op.Name = name
|
||||
op.MediaType = mediaType
|
||||
@@ -96,13 +96,17 @@ func (this *MessageMediaInstanceDAO) CreateMediaInstance(tx *dbs.Tx, name string
|
||||
|
||||
op.Description = description
|
||||
|
||||
if len(rateJSON) > 0 {
|
||||
op.Rate = rateJSON
|
||||
}
|
||||
|
||||
op.IsOn = true
|
||||
op.State = MessageMediaInstanceStateEnabled
|
||||
return this.SaveInt64(tx, op)
|
||||
}
|
||||
|
||||
// UpdateMediaInstance 修改媒介实例
|
||||
func (this *MessageMediaInstanceDAO) UpdateMediaInstance(tx *dbs.Tx, instanceId int64, name string, mediaType string, params maps.Map, description string, isOn bool) error {
|
||||
func (this *MessageMediaInstanceDAO) UpdateMediaInstance(tx *dbs.Tx, instanceId int64, name string, mediaType string, params maps.Map, description string, rateJSON []byte, isOn bool) error {
|
||||
if instanceId <= 0 {
|
||||
return errors.New("invalid instanceId")
|
||||
}
|
||||
@@ -122,6 +126,10 @@ func (this *MessageMediaInstanceDAO) UpdateMediaInstance(tx *dbs.Tx, instanceId
|
||||
}
|
||||
op.Params = paramsJSON
|
||||
|
||||
if len(rateJSON) > 0 {
|
||||
op.Rate = rateJSON
|
||||
}
|
||||
|
||||
op.Description = description
|
||||
op.IsOn = isOn
|
||||
return this.Save(tx, op)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package models
|
||||
|
||||
// 消息媒介接收人
|
||||
// MessageMediaInstance 消息媒介接收人
|
||||
type MessageMediaInstance struct {
|
||||
Id uint32 `field:"id"` // ID
|
||||
Name string `field:"name"` // 名称
|
||||
@@ -8,6 +8,7 @@ type MessageMediaInstance struct {
|
||||
MediaType string `field:"mediaType"` // 媒介类型
|
||||
Params string `field:"params"` // 媒介参数
|
||||
Description string `field:"description"` // 备注
|
||||
Rate string `field:"rate"` // 发送频率
|
||||
State uint8 `field:"state"` // 状态
|
||||
}
|
||||
|
||||
@@ -18,6 +19,7 @@ type MessageMediaInstanceOperator struct {
|
||||
MediaType interface{} // 媒介类型
|
||||
Params interface{} // 媒介参数
|
||||
Description interface{} // 备注
|
||||
Rate interface{} // 发送频率
|
||||
State interface{} // 状态
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user