图集模块为上传图集无法新增问题修复

This commit is contained in:
hdm 2022-09-19 13:01:00 +08:00
parent fa8a05ce5d
commit 2a7f0a3fb6
2 changed files with 18 additions and 16 deletions

View File

@ -64,7 +64,7 @@ class Gallery extends BaseController
// 验证失败 输出错误信息
return to_assign(1, $e->getError());
}
$param['admin_id'] = $tis->uid;
$param['admin_id'] = $this->uid;
$this->model->addGallery($param);
}else{
return view();

View File

@ -80,6 +80,7 @@ class Gallery extends Model
$fileData = isset($param['img_file']) ? $param['img_file'] : 0;
//插入图集数据
$insertData = [];
if(is_array($filepathData)){
foreach ($filepathData as $key => $value) {
if (!$value) {
continue;
@ -97,6 +98,7 @@ class Gallery extends Model
$insertData[] = $file;
}
Db::name('GalleryFile')->strict(false)->field(true)->insertAll($insertData);
}
add_log('add', $insertId, $param);
} catch(\Exception $e) {
return to_assign(1, '操作失败,原因:'.$e->getMessage());