This commit is contained in:
fit2-zhao 2020-12-17 16:47:36 +08:00
commit e05657fe11
2 changed files with 12 additions and 8 deletions

View File

@ -25,6 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.time.Instant;
@ -131,7 +132,7 @@ public class APIReportService {
String startTime = jsonRequestResults.getJSONObject(j).getString("startTime");
String name = jsonRequestResults.getJSONObject(j).getString("name");
String url = jsonRequestResults.getJSONObject(j).getString("url");
if (StringUtils.isBlank(url)){
if (StringUtils.isBlank(url)) {
//如果非http请求不入库
continue;
}
@ -139,7 +140,7 @@ public class APIReportService {
apiDataView.setId(UUID.randomUUID().toString());
apiDataView.setReportId(reportId);
apiDataView.setApiName(name);
apiDataView.setUrl(StringUtils.substringBefore(url,"?"));
apiDataView.setUrl(StringUtils.substringBefore(url, "?"));
apiDataView.setResponseTime(responseTime);
apiDataView.setStartTime(sdf.format(new Date(Long.parseLong(startTime))));
apiDataView.setResponseCode(responseCode);
@ -149,8 +150,9 @@ public class APIReportService {
} catch (Exception e) {
LogUtil.error(e);
}
apiDataViewMapper.insertListApiData(listApiDataView);
if (listApiDataView.size() > 0) {
apiDataViewMapper.insertListApiData(listApiDataView);
}
}
public String create(ApiTest test, String triggerMode) {

View File

@ -21,7 +21,7 @@
<el-main v-loading="batchLoading" style="overflow: auto">
<div v-for="(item,index) in apiCaseList" :key="index">
<api-case-item v-loading="singleLoading && singleRunId === item.id"
@refresh="getApiTest"
@refresh="refresh"
@singleRun="singleRun"
@copyCase="copyCase"
@showExecResult="showExecResult"
@ -150,6 +150,11 @@
this.$emit('refresh');
},
refresh(data) {
this.getApiTest();
this.$emit('refresh');
},
getApiTest() {
if (this.api) {
this.condition.projectId = this.projectId;
@ -238,9 +243,6 @@
} else {
this.$warning("没有可执行的用例!");
}
},
refresh() {
this.getApiTest();
}
}
}