|
|
@@ -151,7 +151,7 @@ class Words extends Base
|
|
|
return $operate;
|
|
|
}
|
|
|
|
|
|
- //导入导入快捷回复
|
|
|
+ //导入快捷回复
|
|
|
function inserExcel()
|
|
|
{
|
|
|
Loader::import('PHPExcel.PHPExcel');
|
|
|
@@ -178,6 +178,15 @@ class Words extends Base
|
|
|
$info[$k]['user_id'] = 0;
|
|
|
$info[$k]['admin_id'] = session('user_id');
|
|
|
}
|
|
|
+ //检查表中数据是否有重复
|
|
|
+ for($a=0;$a<count($info);$a++){
|
|
|
+ for($b=$a+1;$b<count($info);$b++){
|
|
|
+ if($info[$a]['title'] == $info[$b]['title']){
|
|
|
+ return json(['code' => -1, 'data' => url('words/index'), 'msg' => 'excel表第'.($a+1).'行与第'.($b+1).'行快捷词重复']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //检查表格中数据是否已存在与数据库
|
|
|
$words = db('words')->where('user_id',0)->select();
|
|
|
for($i=0;$i<count($info);$i++){
|
|
|
for($j=0;$j<count($words);$j++){
|