package management import ( "context" "gd_management/apis" "gd_management/errors" "github.com/astaxie/beego/orm" ) func ManagementGetProviderApiLimitCount(ctx context.Context, req *apis.ManagementGetProviderApiLimitCountReq, reply *apis.ManagementGetProviderApiLimitCountReply) (err error) { o := orm.NewOrm() if req.ProviderApiId == 0 { err = o.Raw("select id,count from t_gd_provider_api where provider_api_code = ?", "103-001").QueryRow(&reply.ProviderApiId, &reply.Count) } else { reply.ProviderApiId = req.ProviderApiId err = o.Raw("select count from t_gd_provider_api where id = ?", req.ProviderApiId).QueryRow(&reply.Count) } if err != nil && err != orm.ErrNoRows { return errors.DataBaseError } return err }