Commit 179047ed by hcy001

1

parent 91cd9f93
Showing with 3 additions and 8 deletions
......@@ -391,7 +391,7 @@ class InquiryItemsModel extends Model
$con->beginTransaction();
$assignInsert = []; #指定领取人
$c = 0; #重复
$copy = ""; #重复型号
foreach ($goodsData[1] as $k=>&$b){
$insertArr= [
......@@ -413,16 +413,11 @@ class InquiryItemsModel extends Model
#判断是否已经存在此品牌+型号
$check = $this->where(["inquiry_id"=>$inquiry_id,"goods_name"=>$b["goods_name"],"brand_name"=>$b["brand_name"]])->count();
if ($check >0){
$c ++;
$copy = $copy.$b["goods_name"].",";
continue;
#throw new Exception("型号:".$b["goods_name"]." 品牌:".$b["brand_name"]."不得重复上传");
}
if (count($goodsData[1]) == $c){
throw new Exception("所有数据都存在重复!");
}
#插入明细
$inquiryItemsId = $this->insertGetId($insertArr);
......@@ -461,7 +456,7 @@ class InquiryItemsModel extends Model
$con->commit();
return [0, '批量导入询价成功'];
return [0, '批量导入询价成功'.($copy == "" ? "" : ",存在重复型号:".$copy)];
}catch (\Exception $e) {
$con->rollBack();
return [1001,"添加失败:".$e->getMessage()];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment