site_id; $upload_model = new UploadModel($site_id, $this->app_module); $thumb_type = isset($this->params[ 'thumb' ]) ? $this->params[ 'thumb' ] : ''; $name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; $watermark = isset($this->params[ 'watermark' ]) ? $this->params[ 'watermark' ] : 0;// 是否需生成水印 $cloud = isset($this->params[ 'cloud' ]) ? $this->params[ 'cloud' ] : 1;// 是否需上传到云存储 $width = isset($this->params[ 'width' ]) ? $this->params[ 'width' ] : 0;// 限制宽度 $height = isset($this->params[ 'height' ]) ? $this->params[ 'height' ] : 0;// 限制高度 $from = isset($this->params[ 'from' ]) ? $this->params[ 'from' ] : '';// 位置 $param = array ( "thumb_type" => "", "name" => "file", "watermark" => $watermark, "cloud" => $cloud, 'width' => $width, 'height' => $height, 'from' => $from ); $result = $upload_model->setPath("common/images/" . date("Ymd") . '/')->image($param); return $this->response($result); } /** * 上传 存入相册 * @return \multitype */ public function album() { $upload_model = new UploadModel($this->site_id); $album_id = isset($this->params[ 'album_id' ]) ? $this->params[ 'album_id' ] : 0; $name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; $param = array ( "thumb_type" => [ "BIG", "MID", "SMALL" ], "name" => "file", "album_id" => $album_id ); $result = $upload_model->setPath("common/images/" . date("Ymd") . '/')->imageToAlbum($param); return $this->response($result); } /** * 视频上传 * @return \multitype */ public function video() { $upload_model = new UploadModel($this->site_id); $name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; $param = array ( "name" => "file" ); $result = $upload_model->setPath("common/video/" . date("Ymd") . '/')->video($param); return $this->response($this->success($result)); } /** * 上传(不存入相册) * @return \app\model\upload\Ambigous|\multitype */ public function upload() { $upload_model = new UploadModel(); $name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; $thumb_type = isset($this->params[ 'thumb' ]) ? $this->params[ 'thumb' ] : ''; $param = array ( "thumb_type" => "", "name" => "file" ); $result = $upload_model->setPath("common/images/" . date("Ymd") . '/')->image($param); return $this->response($this->success($result)); } /** * 校验文件 */ public function checkfile() { $upload_model = new UploadModel(); $result = $upload_model->domainCheckFile([ "name" => "file" ]); return $this->response($result); } /** * 上传文件 */ public function file() { $upload_model = new UploadModel($this->site_id); $param = array ( "name" => "file", 'extend_type' => [ 'xlsx', 'pdf' ] ); $result = $upload_model->setPath("common/file/" . date("Ymd") . '/')->file($param); return $this->response($this->success($result)); } /** * 删除文件 */ public function deleteFile() { if (request()->isAjax()) { $path = isset($this->params[ 'path' ]) ? $this->params[ 'path' ] : ''; $res = false; if (!empty($path)) { $res = delFile($path); } return $this->response($this->success($res)); } } /** * 上传微信支付证书 */ public function uploadWechatCert() { $upload_model = new UploadModel(); $site_id = $this->site_id; $name = isset($this->params[ 'name' ]) ? $this->params[ 'name' ] : ''; $extend_type = [ 'pem' ]; $param = array ( "name" => "file", "extend_type" => $extend_type ); $site_id = $site_id > 0 ? $site_id : 0; $result = $upload_model->setPath("common/wechat/cert/" . $site_id . "/")->file($param); return $this->response($this->success($result)); } /** * 退款退货凭证上传 */ public function refundMessageImg() { $upload_model = new UploadModel($this->site_id); $param = array ( "thumb_type" => "", "name" => "file", "watermark" => 0, "cloud" => 1 ); $result = $upload_model->setPath("refund/refund_message/" . date("Ymd") . '/')->image($param); return $this->response($result); } }