provider_api_get_limit_count.go 738 B

1234567891011121314151617181920212223
  1. package management
  2. import (
  3. "context"
  4. "gd_management/apis"
  5. "gd_management/errors"
  6. "github.com/astaxie/beego/orm"
  7. )
  8. func ManagementGetProviderApiLimitCount(ctx context.Context, req *apis.ManagementGetProviderApiLimitCountReq, reply *apis.ManagementGetProviderApiLimitCountReply) (err error) {
  9. o := orm.NewOrm()
  10. if req.ProviderApiId == 0 {
  11. err = o.Raw("select id,count from t_gd_provider_api where provider_api_code = ?", "103-001").QueryRow(&reply.ProviderApiId, &reply.Count)
  12. } else {
  13. reply.ProviderApiId = req.ProviderApiId
  14. err = o.Raw("select count from t_gd_provider_api where id = ?", req.ProviderApiId).QueryRow(&reply.Count)
  15. }
  16. if err != nil && err != orm.ErrNoRows {
  17. return errors.DataBaseError
  18. }
  19. return err
  20. }