@@ -102,12 +102,14 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
102
102
}
103
103
104
104
result := mapstr .New ()
105
+ hasError := false
105
106
for objID , inputData := range inputData {
106
107
subResult := mapstr .New ()
107
108
if err := o .IsValidObject (params , objID ); nil != err {
108
109
blog .Errorf ("not found the objid: %s" , objID )
109
110
subResult ["errors" ] = fmt .Sprintf ("the object(%s) is invalid" , objID )
110
111
result [objID ] = subResult
112
+ hasError = true
111
113
continue
112
114
}
113
115
@@ -122,6 +124,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
122
124
blog .Errorf ("not found the objid: %s" , objID )
123
125
subResult ["errors" ] = err .Error ()
124
126
result [objID ] = subResult
127
+ hasError = true
125
128
continue
126
129
}
127
130
@@ -143,6 +146,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
143
146
errStr := params .Lang .Languagef ("import_row_int_error_str" , idx , err )
144
147
subResult ["errors" ] = errStr
145
148
result [objID ] = subResult
149
+ hasError = true
146
150
continue
147
151
}
148
152
@@ -170,6 +174,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
170
174
}
171
175
}
172
176
result [objID ] = subResult
177
+ hasError = true
173
178
continue
174
179
}
175
180
@@ -190,6 +195,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
190
195
}
191
196
}
192
197
result [objID ] = subResult
198
+ hasError = true
193
199
continue
194
200
}
195
201
attrCond := condition .CreateCondition ()
@@ -209,6 +215,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
209
215
}
210
216
}
211
217
result [objID ] = subResult
218
+ hasError = true
212
219
continue
213
220
}
214
221
@@ -227,6 +234,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
227
234
}
228
235
}
229
236
result [objID ] = subResult
237
+ hasError = true
230
238
continue
231
239
}
232
240
@@ -245,6 +253,7 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
245
253
}
246
254
}
247
255
result [objID ] = subResult
256
+ hasError = true
248
257
continue
249
258
}
250
259
@@ -264,7 +273,11 @@ func (o *object) CreateObjectBatch(params types.ContextParams, data mapstr.MapSt
264
273
265
274
}
266
275
276
+ if hasError {
277
+ return result , params .Err .Error (common .CCErrCommNotAllSuccess )
278
+ }
267
279
return result , nil
280
+
268
281
}
269
282
func (o * object ) FindObjectBatch (params types.ContextParams , data mapstr.MapStr ) (mapstr.MapStr , error ) {
270
283
@@ -333,7 +346,7 @@ func (o *object) CreateObject(params types.ContextParams, isMainline bool, data
333
346
334
347
if exists {
335
348
blog .Errorf ("[operation-obj] the object(%#v) is repeated" , data )
336
- return nil , params .Err .Error (common .CCErrCommDuplicateItem )
349
+ return nil , params .Err .Errorf (common .CCErrCommDuplicateItem , "" )
337
350
}
338
351
339
352
err = obj .Create ()
@@ -694,7 +707,7 @@ func (o *object) UpdateObject(params types.ContextParams, data mapstr.MapStr, id
694
707
695
708
if exists {
696
709
blog .Errorf ("[operation-obj] the object(%#v) is repeated" , data )
697
- return params .Err .Error (common .CCErrCommDuplicateItem )
710
+ return params .Err .Errorf (common .CCErrCommDuplicateItem , "" )
698
711
}
699
712
if err = obj .Update (data ); nil != err {
700
713
blog .Errorf ("[operation-obj] failed to update the object(%d), the new data(%#v), err: %s" , id , data , err .Error ())
0 commit comments