本文整理汇总了Golang中github.com/cgrates/cgrates/utils.TPAccountActions.SetAccountActionsId方法的典型用法代码示例。如果您正苦于以下问题:Golang TPAccountActions.SetAccountActionsId方法的具体用法?Golang TPAccountActions.SetAccountActionsId怎么用?Golang TPAccountActions.SetAccountActionsId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cgrates/cgrates/utils.TPAccountActions
的用法示例。
在下文中一共展示了TPAccountActions.SetAccountActionsId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GetTPAccountActions
// Queries specific DerivedCharge on tariff plan
func (self *ApierV1) GetTPAccountActions(attrs AttrGetTPAccountActions, reply *utils.TPAccountActions) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "AccountActionsId"}); len(missing) != 0 { //Params missing
return utils.NewErrMandatoryIeMissing(missing...)
}
tmpAa := &utils.TPAccountActions{TPid: attrs.TPid}
if err := tmpAa.SetAccountActionsId(attrs.AccountActionsId); err != nil {
return err
}
tmpAaa := engine.APItoModelAccountAction(tmpAa)
if aas, err := self.StorDb.GetTpAccountActions(tmpAaa); err != nil {
return utils.NewErrServerError(err)
} else if len(aas) == 0 {
return utils.ErrNotFound
} else {
tpAaa, err := engine.TpAccountActions(aas).GetAccountActions()
if err != nil {
return err
}
aa := tpAaa[tmpAa.KeyId()]
tpdc := utils.TPAccountActions{
TPid: attrs.TPid,
ActionPlanId: aa.ActionPlanId,
ActionTriggersId: aa.ActionTriggersId,
}
if err := tpdc.SetAccountActionsId(attrs.AccountActionsId); err != nil {
return err
}
*reply = tpdc
}
return nil
}
示例2: GetTPAccountActions
// Queries specific DerivedCharge on tariff plan
func (self *ApierV1) GetTPAccountActions(attrs AttrGetTPAccountActions, reply *utils.TPAccountActions) error {
if missing := utils.MissingStructFields(&attrs, []string{"TPid", "AccountActionsId"}); len(missing) != 0 { //Params missing
return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing)
}
tmpAa := &utils.TPAccountActions{TPid: attrs.TPid}
if err := tmpAa.SetAccountActionsId(attrs.AccountActionsId); err != nil {
return err
}
if aas, err := self.StorDb.GetTpAccountActions(tmpAa); err != nil {
return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error())
} else if len(aas) == 0 {
return errors.New(utils.ERR_NOT_FOUND)
} else {
aa := aas[tmpAa.KeyId()]
tpdc := utils.TPAccountActions{
TPid: attrs.TPid,
ActionPlanId: aa.ActionPlanId,
ActionTriggersId: aa.ActionTriggersId,
}
if err := tpdc.SetAccountActionsId(attrs.AccountActionsId); err != nil {
return err
}
*reply = tpdc
}
return nil
}