fixed: 异常上报代码调整

master
luziqi 3 years ago
parent 1ccd77e156
commit 7c5da611b7

@ -63,7 +63,7 @@ func (b *BugInfo) Create() (string, error) {
SetTimeout(10 * time.Second)
resp, err := client.R().
SetBodyJsonMarshal(b).
Post(API_tbapi + "/api/tb/v2/bug/create")
Post(API_tbapi + "/api/bug/v2/create")
if err != nil {
fmt.Println("Teambition提单失败", err)
return "", err
@ -72,8 +72,12 @@ func (b *BugInfo) Create() (string, error) {
fmt.Println("Teambition提单失败", resp.StatusCode, resp.String())
return "", err
}
if gjson.Get(resp.String(), "code").Int() != 200 {
return "", errors.New(gjson.Get(resp.String(), "msg").String())
}
bug_id := gjson.Get(resp.String(), "data").String()
if len(bug_id) == 0 {
fmt.Println(resp.String())
return "", errors.New("请求成功但返回bug_id为空")
}
fmt.Println("Teambition提单成功, id =", bug_id)

@ -138,13 +138,15 @@ func createTbBug(ano models.MonkeyAnomaly) {
bug_type = "EXCEPTION"
}
content := ""
content := "**异常ID**" + cast.ToString(ano.ID) + " "
content += "**关联Monkey报告** [点击查看](http://qa.flatincbr.work/#/monkey/result/" + cast.ToString(ano.TaskId) + ")" + "\n\n<br>\n\n"
content += "**上报时间:**" + ano.CreateTime.Format("2006-01-02 15:04:05") + "\n\n<br>\n\n"
content += "**应用版本:**" + task.Version + "\n\n<br>\n\n"
content += "**信息预览:**" + "\n\n"
title := "【Monkey测试】"
ano.JsonReady()
for i, v := range ano.Anomalies {
for ii, vv := range strings.Split(v, "\n") {
content += "> " + vv + "\n"
@ -176,7 +178,7 @@ func createTbBug(ano models.MonkeyAnomaly) {
content += "> " + "(...更多请查看Monkey报告)" + "\n"
content += "\n"
bug := common.NewBug("crushu") //task.Project
bug := common.NewBug(task.Project) //task.Project
bug.SetTitle(title).
SetPlatform(task.Platform).

Loading…
Cancel
Save