Commit 73c27a76 authored by 张晓林's avatar 张晓林

证照图片上传

parent e111d745
...@@ -161,6 +161,7 @@ return [ ...@@ -161,6 +161,7 @@ return [
'GET,OPTIONS licence-list'=>'licence-list', 'GET,OPTIONS licence-list'=>'licence-list',
'GET,OPTIONS licence-detail'=>'licence-detail', 'GET,OPTIONS licence-detail'=>'licence-detail',
'POST,OPTIONS licence-insert'=>'licence-insert', 'POST,OPTIONS licence-insert'=>'licence-insert',
'POST,OPTIONS licence-img-upload'=>'licence-img-upload',
], ],
], ],
//省市区 //省市区
......
...@@ -6,6 +6,9 @@ use yii\data\ArrayDataProvider; ...@@ -6,6 +6,9 @@ use yii\data\ArrayDataProvider;
use backend\models\v1\branch\BranchLicence; use backend\models\v1\branch\BranchLicence;
use backend\controllers\v1\BaseController; use backend\controllers\v1\BaseController;
use backend\helpers\Func; use backend\helpers\Func;
use backend\helpers\UploadFiles;
use yii\web\UploadedFile;
use yii\web\HttpException;
class BranchLicenceController extends BaseController{ class BranchLicenceController extends BaseController{
...@@ -29,6 +32,7 @@ class BranchLicenceController extends BaseController{ ...@@ -29,6 +32,7 @@ class BranchLicenceController extends BaseController{
* @OA\Property(property="IS_FROM",description="来源",type="string"), * @OA\Property(property="IS_FROM",description="来源",type="string"),
* @OA\Property(property="LICENCE_EXPIRY_DATE",description="到期时间",type="string"), * @OA\Property(property="LICENCE_EXPIRY_DATE",description="到期时间",type="string"),
* @OA\Property(property="IS_SHOW",description="是否显示在前台",type="string"), * @OA\Property(property="IS_SHOW",description="是否显示在前台",type="string"),
* @OA\Property(property="LICENCE_IMG_URL",description="证照图片",type="string"),
* @OA\Property(property="LICENCE_CONTENT",description="证照说明",type="string"), * @OA\Property(property="LICENCE_CONTENT",description="证照说明",type="string"),
* ) * )
* ) * )
...@@ -55,6 +59,50 @@ class BranchLicenceController extends BaseController{ ...@@ -55,6 +59,50 @@ class BranchLicenceController extends BaseController{
} }
} }
/**
* @OA\Post(
* path="/backend/web/v1/branch/branch-licences/licence-img-upload",
* tags={"门店&DC"},
* summary="证照图片上传(张晓林)",
* operationId="uploadFile",
* @OA\Response(
* response=200,
* description="上传成功",
* ),
* security={{"Authorization":{}}},
* @OA\RequestBody(
* description="上传文件事例",
* @OA\MediaType(
* mediaType="multipart/form-data",
* @OA\Schema(
* type="object",
* @OA\Property(
* property="uploadFile",
* type="string",
* format="binary"
* ),
* )
* )
* )
* )
*/
public function actionLicenceImgUpload(){
//多文件时依赖注入参数参考UploadFiles类
$model = new UploadFiles(['png','jpg','jpeg']);
if (Yii::$app->request->isPost) {
//多文件用getInstances
$model->uploadFiles = UploadedFile::getInstance($model,'uploadFile');
$fileInfo = $model->upload();
if ($fileInfo['CODE']==200) {
// 文件上传成功
throw new HttpException(200);
}else{
throw new HttpException(422);
}
}
}
/** /**
* @OA\GET( * @OA\GET(
* path="/backend/web/v1/branch/branch-licences/licence-list", * path="/backend/web/v1/branch/branch-licences/licence-list",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment