|
|
|
@@ -69,7 +69,6 @@ func createSign(params map[string]interface{}, signKey string) string { |
|
|
|
func CreateSafetyTask(jobName string, body interface{}) (string, error) { |
|
|
|
checkSetting() |
|
|
|
client := getRestyClient() |
|
|
|
var jobResult string |
|
|
|
|
|
|
|
reqPara, _ := json.Marshal(body) |
|
|
|
log.Warn("job req:", string(reqPara[:])) |
|
|
|
@@ -82,43 +81,44 @@ func CreateSafetyTask(jobName string, body interface{}) (string, error) { |
|
|
|
SetHeader("sign", createSign(params, KEY)). |
|
|
|
//SetAuthToken(TOKEN). |
|
|
|
SetBody(body). |
|
|
|
SetResult(&jobResult). |
|
|
|
Post(HOST + "/v1/external/eval-standard/create") |
|
|
|
log.Info("url=" + HOST + "/v1/external/eval-standard/create") |
|
|
|
|
|
|
|
responseStr := string(res.Body()) |
|
|
|
log.Info("GetAlgorithmList responseStr=" + responseStr + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", fmt.Errorf("resty create job: %s", err) |
|
|
|
} else { |
|
|
|
log.Info("result string=" + jobResult + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
log.Info("result string=" + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
} |
|
|
|
|
|
|
|
responseStr := string(res.Body()) |
|
|
|
log.Info("responseStr=" + responseStr) |
|
|
|
|
|
|
|
return jobResult, nil |
|
|
|
return "", nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
func GetAlgorithmList() error { |
|
|
|
checkSetting() |
|
|
|
client := getRestyClient() |
|
|
|
var taskResult string |
|
|
|
params := make(map[string]interface{}) |
|
|
|
//params["appId"] = APPID |
|
|
|
|
|
|
|
jsonResult := make(map[string]interface{}) |
|
|
|
sign := createSign(params, KEY) |
|
|
|
|
|
|
|
res, err := client.R(). |
|
|
|
SetHeader("Content-Type", "application/json"). |
|
|
|
SetHeader("appId", APPID). |
|
|
|
SetHeader("sign", sign). |
|
|
|
SetResult(&taskResult). |
|
|
|
Get(HOST + "/v1/external/eval-standard/algorithmList") |
|
|
|
|
|
|
|
log.Info("url=" + HOST + "/v1/external/eval-standard/algorithmList" + " sign=" + sign + " appId=" + APPID) |
|
|
|
|
|
|
|
jsonerr := json.Unmarshal(res.Body(), &jsonResult) |
|
|
|
if jsonerr == nil { |
|
|
|
log.Info("jsonResult code=" + fmt.Sprint(jsonResult["msg"])) |
|
|
|
} |
|
|
|
responseStr := string(res.Body()) |
|
|
|
log.Info("GetAlgorithmList responseStr=" + responseStr + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
log.Info("taskResult=" + taskResult) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
log.Info("error =" + err.Error()) |
|
|
|
|