mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add opts field for thresholds cfg struct and use the CGREvent instead of the ArgsProcessEvent struct
This commit is contained in:
committed by
Dan Christian Bogos
parent
9782e164c6
commit
777580a06e
@@ -29,7 +29,7 @@ func init() {
|
||||
c := &CmdThresholdsForEvent{
|
||||
name: "thresholds_for_event",
|
||||
rpcMethod: utils.ThresholdSv1GetThresholdsForEvent,
|
||||
rpcParams: &engine.ThresholdsArgsProcessEvent{},
|
||||
rpcParams: &utils.CGREvent{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -38,7 +38,7 @@ func init() {
|
||||
type CmdThresholdsForEvent struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.ThresholdsArgsProcessEvent
|
||||
rpcParams *utils.CGREvent
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -52,9 +52,7 @@ func (self *CmdThresholdsForEvent) RpcMethod() string {
|
||||
|
||||
func (self *CmdThresholdsForEvent) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &engine.ThresholdsArgsProcessEvent{
|
||||
CGREvent: new(utils.CGREvent),
|
||||
}
|
||||
self.rpcParams = new(utils.CGREvent)
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package console
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
@@ -29,7 +28,7 @@ func init() {
|
||||
c := &CmdThresholdProcessEvent{
|
||||
name: "thresholds_process_event",
|
||||
rpcMethod: utils.ThresholdSv1ProcessEvent,
|
||||
rpcParams: &engine.ThresholdsArgsProcessEvent{},
|
||||
rpcParams: &utils.CGREvent{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -38,7 +37,7 @@ func init() {
|
||||
type CmdThresholdProcessEvent struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.ThresholdsArgsProcessEvent
|
||||
rpcParams *utils.CGREvent
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -52,17 +51,14 @@ func (self *CmdThresholdProcessEvent) RpcMethod() string {
|
||||
|
||||
func (self *CmdThresholdProcessEvent) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &engine.ThresholdsArgsProcessEvent{
|
||||
CGREvent: new(utils.CGREvent),
|
||||
}
|
||||
self.rpcParams = new(utils.CGREvent)
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdThresholdProcessEvent) PostprocessRpcParams() error {
|
||||
if self.rpcParams != nil && self.rpcParams.CGREvent != nil &&
|
||||
self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
if self.rpcParams != nil && self.rpcParams.Time == nil {
|
||||
self.rpcParams.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user