|
|
@@ -175,8 +175,10 @@ class RelationController extends Controller
|
|
|
$activeWorksheet = $spreadsheet->getActiveSheet();
|
|
|
$activeWorksheet->setCellValue('A1', 'id');
|
|
|
$activeWorksheet->setCellValue('B1', 'name');
|
|
|
- $activeWorksheet->setCellValue('C1', 'case');
|
|
|
+ $activeWorksheet->setCellValue('C1', 'from');
|
|
|
$activeWorksheet->setCellValue('D1', 'to');
|
|
|
+ $activeWorksheet->setCellValue('E1', 'match');
|
|
|
+ $activeWorksheet->setCellValue('F1', 'category');
|
|
|
|
|
|
$nissaya = Relation::cursor();
|
|
|
$currLine = 2;
|
|
|
@@ -184,8 +186,10 @@ class RelationController extends Controller
|
|
|
# code...
|
|
|
$activeWorksheet->setCellValue("A{$currLine}", $row->id);
|
|
|
$activeWorksheet->setCellValue("B{$currLine}", $row->name);
|
|
|
- $activeWorksheet->setCellValue("C{$currLine}", $row->case);
|
|
|
+ $activeWorksheet->setCellValue("C{$currLine}", $row->from);
|
|
|
$activeWorksheet->setCellValue("D{$currLine}", $row->to);
|
|
|
+ $activeWorksheet->setCellValue("E{$currLine}", $row->match);
|
|
|
+ $activeWorksheet->setCellValue("F{$currLine}", $row->category);
|
|
|
$currLine++;
|
|
|
}
|
|
|
$writer = new Xlsx($spreadsheet);
|
|
|
@@ -212,8 +216,10 @@ class RelationController extends Controller
|
|
|
# code...
|
|
|
$id = $activeWorksheet->getCell("A{$currLine}")->getValue();
|
|
|
$name = $activeWorksheet->getCell("B{$currLine}")->getValue();
|
|
|
- $case = $activeWorksheet->getCell("C{$currLine}")->getValue();
|
|
|
+ $from = $activeWorksheet->getCell("C{$currLine}")->getValue();
|
|
|
$to = $activeWorksheet->getCell("D{$currLine}")->getValue();
|
|
|
+ $match = $activeWorksheet->getCell("E{$currLine}")->getValue();
|
|
|
+ $category = $activeWorksheet->getCell("F{$currLine}")->getValue();
|
|
|
if(!empty($name)){
|
|
|
//查询是否有冲突数据
|
|
|
//查询此id是否有旧数据
|
|
|
@@ -221,7 +227,15 @@ class RelationController extends Controller
|
|
|
$oldRow = Relation::find($id);
|
|
|
}
|
|
|
//查询是否跟已有数据重复
|
|
|
- $row = Relation::where(['name'=>$name,'case'=>$case])->first();
|
|
|
+ /*
|
|
|
+ $row = Relation::where(['name'=>$name,
|
|
|
+ 'from'=>json_decode($from,true),
|
|
|
+ 'to'=>$to,
|
|
|
+ 'match'=>$match,
|
|
|
+ 'category'=>$category
|
|
|
+ ])->first();
|
|
|
+ */
|
|
|
+ $row = false;
|
|
|
if(!$row){
|
|
|
//不重复
|
|
|
if(isset($oldRow) && $oldRow){
|
|
|
@@ -241,8 +255,14 @@ class RelationController extends Controller
|
|
|
}
|
|
|
}
|
|
|
$row->name = $name;
|
|
|
- $row->case = $case;
|
|
|
+ if(empty($from)){
|
|
|
+ $row->from = null;
|
|
|
+ }else{
|
|
|
+ $row->from = $from;
|
|
|
+ }
|
|
|
$row->to = $to;
|
|
|
+ $row->match = $match;
|
|
|
+ $row->category = $category;
|
|
|
$row->editor_id = $user['user_uid'];
|
|
|
$row->save();
|
|
|
}else{
|