@@ -42,12 +42,14 @@ func CommitCase(productId string, caseId int, title string, steps []commDomain.Z
4242 if ! strings .Contains (err .Error (), "404" ) {
4343 return
4444 }
45- if len (productId ) == 0 {
46- logUtils .Info ("not found productId, like: pid=1" )
47- return fmt .Errorf ("not found productId, like: pid=1" )
45+ logUtils .Info (i118Utils .Sprintf ("case_not_found" , caseId ))
46+ if len (productId ) > 0 {
47+ // 创建cases
48+ logUtils .Info (i118Utils .Sprintf ("auto_create_case" , productId , caseId ))
49+ _ , err = CreateCase (productId , title , steps , script , config )
50+ return err
4851 }
49- // 创建cases
50- _ , err = CreateCase (productId , title , steps , script , config )
52+
5153 return
5254 }
5355
@@ -138,8 +140,7 @@ func CreateCase(productId, title string, steps []commDomain.ZentaoCaseStep, scri
138140 err = ZentaoRequestErr (url , commConsts .ResponseParseErr .Message )
139141 return
140142 }
141- logUtils .Infof (i118Utils .Sprintf ("success_to_create_case" , title ) + "\n " )
142-
143+ logUtils .Infof (i118Utils .Sprintf ("success_to_create_case" , productId , title ) + "\n " )
143144 return
144145}
145146
0 commit comments