|
|
@ -81,7 +81,9 @@ class GoodsController extends Controller |
|
|
|
{ |
|
|
|
$model = new Goods(); |
|
|
|
|
|
|
|
if ($model->load(Yii::$app->request->post()) && $model->save()) { |
|
|
|
if ($model->load(Yii::$app->request->post())) { |
|
|
|
$img_id_arr = explode(',', $model->image); |
|
|
|
$model->save(); |
|
|
|
return $this->redirect('index'); |
|
|
|
} |
|
|
|
|
|
|
@ -164,15 +166,15 @@ class GoodsController extends Controller |
|
|
|
/** |
|
|
|
* 处理文件上传成功后回调保存到临时文件表中 |
|
|
|
*/ |
|
|
|
public function actionSavefile() |
|
|
|
public function actionSaveFile() |
|
|
|
{ |
|
|
|
$data = Yii::$app->request->get('data'); |
|
|
|
$fileName = Yii::$app->request->get('fileName')[0]; |
|
|
|
$file_name = Yii::$app->request->get('fileName')[0]; |
|
|
|
|
|
|
|
if ($data['status'] == true) { |
|
|
|
$model = new TemFile(); |
|
|
|
$model->user_id = Yii::$app->user->identity->id; |
|
|
|
$model->name = $fileName; |
|
|
|
$model->name = $file_name; |
|
|
|
$type = Yii::$app->file->searchType(FileManager::$extension, pathinfo($data['path'])['extension']); |
|
|
|
if ($type != -1) { |
|
|
|
$model->type = $type; |
|
|
@ -191,13 +193,13 @@ class GoodsController extends Controller |
|
|
|
public function actionImgIdDel() |
|
|
|
{ |
|
|
|
$alias = Yii::$app->request->get('data')['alias']; |
|
|
|
$imgid = Yii::$app->request->get('imgid'); |
|
|
|
$imgidarr = explode(',', $imgid); |
|
|
|
$temfile = TemFile::findOne(['alias' => $alias]); |
|
|
|
if ($temfile) { |
|
|
|
$imgidarr = array_diff($imgidarr, [$temfile->id]); |
|
|
|
} |
|
|
|
$imgidstr = implode(',', $imgidarr); |
|
|
|
return $imgidstr; |
|
|
|
$img_id = Yii::$app->request->get('imgid'); |
|
|
|
$img_id_arr = explode(',', $img_id); |
|
|
|
$tem_file = TemFile::findOne(['alias' => $alias]); |
|
|
|
if ($tem_file) { |
|
|
|
$img_id_arr = array_diff($img_id_arr, [$tem_file->id]); |
|
|
|
} |
|
|
|
$img_id_str = implode(',', $img_id_arr); |
|
|
|
return $img_id_str; |
|
|
|
} |
|
|
|
} |