示例#1
0
文件: cdrs.go 项目: eloycoto/cgrates
// Retrieves the callCost out of CGR logDb
func (apier *ApierV1) GetCallCostLog(attrs utils.AttrGetCallCost, reply *engine.SMCost) error {
	if attrs.CgrId == "" {
		return utils.NewErrMandatoryIeMissing("CgrId")
	}
	if attrs.RunId == "" {
		attrs.RunId = utils.META_DEFAULT
	}
	if smcs, err := apier.CdrDb.GetSMCosts(attrs.CgrId, attrs.RunId, "", ""); err != nil {
		return utils.NewErrServerError(err)
	} else if len(smcs) == 0 {
		return utils.ErrNotFound
	} else {
		*reply = *smcs[0]
	}
	return nil
}
示例#2
0
文件: cdrs.go 项目: bhepp/cgrates
// Retrieves the callCost out of CGR logDb
func (apier *ApierV1) GetCallCostLog(attrs utils.AttrGetCallCost, reply *engine.CallCost) error {
	if attrs.CgrId == "" {
		return utils.NewErrMandatoryIeMissing("CgrId")
	}
	if attrs.RunId == "" {
		attrs.RunId = utils.META_DEFAULT
	}
	if cc, err := apier.CdrDb.GetCallCostLog(attrs.CgrId, attrs.RunId); err != nil {
		return utils.NewErrServerError(err)
	} else if cc == nil {
		return utils.ErrNotFound
	} else {
		*reply = *cc
	}
	return nil
}