1234567891011121314151617181920212223 |
- package management
- import (
- "context"
- "gd_management/apis"
- "gd_management/errors"
- "fmt"
- "github.com/astaxie/beego/orm"
- )
- func GetApiThreshold(ctx context.Context, req *apis.GetApiThresholdReq, reply *apis.GetApiThresholdReply) (err error) {
- tab := "t_gd_api"
- if req.Type == 1 {
- tab = "t_gd_provider_api"
- }
- sql := fmt.Sprintf("select threshold_timeout, threshold_fail_rate, threshold_norecord_rate, warning_enable from %s where id=?", tab)
- o := orm.NewOrm()
- err = o.Raw(sql, req.ApiId).QueryRow(&reply)
- if err != nil {
- return errors.DataBaseError
- }
- return nil
- }
|