正在显示
1 个修改的文件
包含
5 行增加
和
1 行删除
| @@ -110,12 +110,13 @@ class Extension3915ModuleController extends BaseController | @@ -110,12 +110,13 @@ class Extension3915ModuleController extends BaseController | ||
| 110 | $moduleFieldModel = new ExtensionModuleField(); | 110 | $moduleFieldModel = new ExtensionModuleField(); |
| 111 | $filedList = $moduleFieldModel->where(['module_id' => $this->param['module_id']])->pluck( 'id','field_name')->toArray(); | 111 | $filedList = $moduleFieldModel->where(['module_id' => $this->param['module_id']])->pluck( 'id','field_name')->toArray(); |
| 112 | if(empty($filedList)){ | 112 | if(empty($filedList)){ |
| 113 | - $this->response('请先设置字段,再添加数据'); | 113 | + $this->fail('请先设置字段,再添加数据'); |
| 114 | } | 114 | } |
| 115 | $data = $this->param['data']; | 115 | $data = $this->param['data']; |
| 116 | $moduleValueModel = new ExtensionModuleValue(); | 116 | $moduleValueModel = new ExtensionModuleValue(); |
| 117 | $key_filedId = []; | 117 | $key_filedId = []; |
| 118 | $resultData = []; | 118 | $resultData = []; |
| 119 | + try { | ||
| 119 | foreach ($data as $k => $v){ | 120 | foreach ($data as $k => $v){ |
| 120 | foreach ($v as $k1 => $v1){ | 121 | foreach ($v as $k1 => $v1){ |
| 121 | if($k == 0){ | 122 | if($k == 0){ |
| @@ -137,6 +138,9 @@ class Extension3915ModuleController extends BaseController | @@ -137,6 +138,9 @@ class Extension3915ModuleController extends BaseController | ||
| 137 | $moduleValueModel->truncate(); | 138 | $moduleValueModel->truncate(); |
| 138 | $moduleValueModel->insertAll($resultData); | 139 | $moduleValueModel->insertAll($resultData); |
| 139 | } | 140 | } |
| 141 | + }catch (\Exception $e){ | ||
| 142 | + $this->fail('当前文件不能导入,请修改后再导入'); | ||
| 143 | + } | ||
| 140 | $this->response('success',Code::SUCCESS,$resultData); | 144 | $this->response('success',Code::SUCCESS,$resultData); |
| 141 | } | 145 | } |
| 142 | } | 146 | } |
-
请 注册 或 登录 后发表评论