|
@@ -108,14 +108,15 @@ class Extension3915ModuleController extends BaseController |
|
@@ -108,14 +108,15 @@ class Extension3915ModuleController extends BaseController |
|
108
|
$this->fail('当前项目不能调用当前方法');
|
108
|
$this->fail('当前项目不能调用当前方法');
|
|
109
|
}
|
109
|
}
|
|
110
|
$moduleFieldModel = new ExtensionModuleField();
|
110
|
$moduleFieldModel = new ExtensionModuleField();
|
|
111
|
- $filedList = $moduleFieldModel->where(['module_id' => $this->param['module_id']])->pluck('field_name', 'id')->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('请先设置字段,再添加数据',Code::SUCCESS);
|
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
|
} |