diff --git a/pkg/api/controller/chargesVerify.go b/pkg/api/controller/chargesVerify.go index 894dcd94c..aaf69d8c3 100644 --- a/pkg/api/controller/chargesVerify.go +++ b/pkg/api/controller/chargesVerify.go @@ -52,7 +52,7 @@ import ( // default: // schema: // "$ref": "#/responses/commandResponse" -// description: 统一返回格式 +// description: 状态码非200,表示验证过程发生错误。状态码200,msg代表实际状态:success, illegal_quantity, missing_tenant, owned_fee, region_unauthorized, lack_of_memory func ChargesVerifyController(w http.ResponseWriter, r *http.Request) { if publicCloud := os.Getenv("PUBLIC_CLOUD"); publicCloud != "true" { @@ -69,10 +69,6 @@ func ChargesVerifyController(w http.ResponseWriter, r *http.Request) { tenant.EID = eid db.GetManager().TenantDao().UpdateModel(tenant) } - cloudAPI := os.Getenv("CLOUD_API") - if cloudAPI == "" { - cloudAPI = "http://api.goodrain.com" - } quantity := r.FormValue("quantity") if quantity == "" { httputil.ReturnError(r, w, 400, "quantity can not found") diff --git a/pkg/api/handler/publiccloud/chargesverify.go b/pkg/api/handler/publiccloud/chargesverify.go index 4f0567e47..221cfaa41 100644 --- a/pkg/api/handler/publiccloud/chargesverify.go +++ b/pkg/api/handler/publiccloud/chargesverify.go @@ -41,7 +41,7 @@ func ChargeSverify(tenant *model.Tenants, quantity int, reason string) *util.API if regionName == "" { return util.CreateAPIHandleError(500, fmt.Errorf("region name must define in api by env REGION_NAME")) } - api := fmt.Sprintf("%s/openapi/v1/enterprises/%s/memory-apply?quantity=%d&tid=%s&reason=%s®ion=%s", cloudAPI, tenant.EID, quantity, tenant.UUID, reason, regionName) + api := fmt.Sprintf("%s/openapi/console/v1/enterprises/%s/memory-apply?quantity=%d&tid=%s&reason=%s®ion=%s", cloudAPI, tenant.EID, quantity, tenant.UUID, reason, regionName) req, err := http.NewRequest("GET", api, nil) if err != nil { logrus.Error("create request cloud api error", err.Error()) @@ -52,9 +52,6 @@ func ChargeSverify(tenant *model.Tenants, quantity int, reason string) *util.API logrus.Error("create request cloud api error", err.Error()) return util.CreateAPIHandleError(400, fmt.Errorf("create request cloud api error")) } - if res.StatusCode == 200 { - return nil - } if res.Body != nil { defer res.Body.Close() rebody, _ := ioutil.ReadAll(res.Body)