diff --git a/backend/modules/file/logic/file/FileManager.php b/backend/modules/file/logic/file/FileManager.php index 80d2f26..ba555a7 100755 --- a/backend/modules/file/logic/file/FileManager.php +++ b/backend/modules/file/logic/file/FileManager.php @@ -15,7 +15,7 @@ class FileManager const TYPE_WORD = 4;//word文本 const TYPE_TXT = 5;//txt文本 - public static $extension = [ + private $extension = [ self::TYPE_IMAGE => ['jpg', 'png', 'jpeg'], self::TYPE_VIDEO => ['mp4'], self::TYPE_EXCEL => [], @@ -29,16 +29,14 @@ class FileManager * @return array * 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false */ - public function searchType($array, $keyword) + public function searchType($keyword) { - foreach($array as $key => $value){ - foreach ($value as $k => $v) { - if($v == $keyword){ - return ['status' => true, 'info' => '操作成功', 'type' => $key]; - } + foreach($this->extension as $key => $type){ + if (in_array($keyword, $type)) { + return $key; } } - return ['status' => false, 'info' => '操作失败']; + return 0; } /** diff --git a/backend/modules/goods/views/goods/express.php b/backend/modules/goods/views/goods/express.php new file mode 100755 index 0000000..022f640 --- /dev/null +++ b/backend/modules/goods/views/goods/express.php @@ -0,0 +1,35 @@ + +field($model, 'coverImageId')->hiddenInput()->label('') ?> +field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 1, + 'fillInAttribute' => 'coverImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId, 'ruleverify' => $model->ruleVerify]), + ], +])->label('商品封面图') ?> + +field($model, 'detailImageId')->hiddenInput()->label('') ?> +field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [ + 'url' => 'upload', + 'deleteUrl' => 'img-id-del', + 'dragdropWidth'=> 800, + 'afterSave' => 'save-file', + 'maxCount' => 5, + 'fillInAttribute' => 'detailImageId', + 'model' => $model, + 'previewConfig' => [ + 'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId, 'ruleverify' => $model->ruleVerify]), + ], +])->label('商品详情图') ?>