Browse Source

验证

master
wanghongjun 2 years ago
parent
commit
6e790fb3ce
  1. 4
      app/controller/AdminZoneGoods.php

4
app/controller/AdminZoneGoods.php

@ -84,10 +84,10 @@ class AdminZoneGoods extends BaseController
'image' => [ 'image' => [
'fileSize:10240000', // 文件大小不超过10M (10 * 1024 KB) 'fileSize:10240000', // 文件大小不超过10M (10 * 1024 KB)
'fileExt:jpeg,jpg,png,gif' 'fileExt:jpeg,jpg,png,gif'
], ]
'type' => 'require|in:1,2'
]; ];
validate($rule)->check($file); validate($rule)->check($file);
validate(['type' => 'require|in:1,2'])->check($param);
$image_path = $param['type'] == 1 ? 'topic' : 'background'; $image_path = $param['type'] == 1 ? 'topic' : 'background';
$path = Upload::uploadImage($file['image'],$image_path); $path = Upload::uploadImage($file['image'],$image_path);
return $this->renderSuccess('上传成功',['path' => $path,'url' => get_image_url($path)]); return $this->renderSuccess('上传成功',['path' => $path,'url' => get_image_url($path)]);

Loading…
Cancel
Save