/**
     * 上传媒体文件
     * 
     * @param think\Request $request 
     * @return json
     */
    public function uploadsMediaFile(Request $request) {
        if ($request->isAjax()) {
            $config    = Config::pull('alioss');
            $ossClient = new OssClient($config['asscessKeyId'], $config['accessKeySecret'], $config['endpoint']);
            $cnameConfig = $ossClient->getBucketCname($config['bucket']);
            // $ossClient->addBucketCname($config['bucket'], $config['domian']);
            $thumb = input('post.baseurl');
            if (strstr($thumb,',')) {
                $thumb = explode(',',$thumb);
                $thumb = $thumb[1];
            }
            $control = input('post.control');
            $PUBLIC  = Env::get('root_path') . 'public';
            $waterPath = $PUBLIC . $this->waterSrc;
            $rand      = mt_rand(1000,9999);
            $name      = $control.'_'.date("H-i-s",time()).'_'.$rand.'.png';
            $path      = './uploads/'.$control.'/'.date('Ymd',time());
            $thumbName = $path . '/thumb_'.$name;
            $img = new Img;
            if ( is_base64($thumb) ) {
                if (!file_exists($path)) {
                    @mkdir($path,0777,true);
                }
                $src = $path.'/'.$name;                
                $res = file_put_contents($src,base64_decode($thumb));
                if (!$res) return json(['code' => 500,'info' => 'Internal Server Error','message' => 'FAILED'], 500);
                $imgHandle = Image::open($src);
                if ($this->isWater == '开启') {
                    $imgHandle->water($waterPath,$this->waterPosition,$this->waterAlpha)->save($src);
                    $imgData[] = $src;
                }
                if ($this->thumb == '是') {
                    $config    = Config::pull('alioss');                    
                    try {
                        $imgHandle->thumb($this->config['thumb_width'],$this->config['thumb_height'],$this->thumbCrop)->save($thumbName);
                        $results = $ossClient->uploadFile($config['bucket'],ltrim($thumbName,'./'),$PUBLIC.$thumbName);
                        $imgData[] = 'https://cdn.meiismy.com/'.ltrim($thumbName,'./');
                        if ($lastId = $img->addImg($imgData)) return json(['code' => 200,'info' => 'OK','message' => 'Successfully','img_id' => $lastId],200);
                    } catch (OssException $e) {                        
                        return json(['code' => 500, 'info' => 'oss_error', 'message' => $e->getMessage()],500);
                    }
                }
            } else {
                $files  = request()->file('upload');
                if (is_array($files)) {
                    foreach($files as $file) {
                        $info = $file->validate(['size'=> 2097152,'ext'=>'jpeg,jpg,png,gif'])->move($path);
                        if ($info) {
                            $src[] = $path.'/'.$info->getSaveName();
                        }else{
                            return json(['code' => 500, 'info' => 'Internal Server Error','message' => $file->getError()]);
                        }
                    }
                }
                for ($i=0;$i<count($src);$i++) {
                    $imgHandle = Image::open($src[$i]);
                    if ($this->isWater == '开启') {
                        $imgHandle->water($waterPath,$this->waterPosition,$this->waterAlpha)->save($src[$i]);
                    }
                    if ($this->thumb == '是') {                        
                        $imgHandle->thumb($this->config['thumb_width'],$this->config['thumb_height'],$this->thumbCrop)->save($thumbName);
                    }
                    $imgData[$i] = [$src[$i],$thumbName];
                }
                return json($src);
            }
        } else {
            return json(['status' => false,'message' => '不支持的请求方式。'],414);
        }
    }