Commit eefbd83d authored by yinxiaoling's avatar yinxiaoling

下载失败数据接口

parent 60b738df
...@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Validator; ...@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Validator;
use App\Http\Controllers\Tool; use App\Http\Controllers\Tool;
use App\Service\StrategyService; use App\Service\StrategyService;
use App\Models\StrategySet; use App\Models\StrategySet;
use Illuminate\Support\Facades\Log;
//use App\Http\Requests\StrategySetCreateRequest; //use App\Http\Requests\StrategySetCreateRequest;
class StrategySetController extends Controller class StrategySetController extends Controller
...@@ -99,7 +100,7 @@ class StrategySetController extends Controller ...@@ -99,7 +100,7 @@ class StrategySetController extends Controller
} }
$url = storage_path()."\\import\\".$excelFile.'.xlsx'; $url = storage_path()."\\import\\".$excelFile.'.xlsx';
try{ try{
if (!file_exists($url)){ if (file_exists($url) == false){
return $this->errorWithInfo('文件不存在,下载失败', 401); return $this->errorWithInfo('文件不存在,下载失败', 401);
} }
$cont=fopen($url,'r'); $cont=fopen($url,'r');
...@@ -113,6 +114,7 @@ class StrategySetController extends Controller ...@@ -113,6 +114,7 @@ class StrategySetController extends Controller
header('Content-transfer-encoding: binary'); header('Content-transfer-encoding: binary');
return $fcontent; return $fcontent;
}catch(\Exception $e){ }catch(\Exception $e){
Log::channel('api')->error($e->getFile().'-'.$e->getLine().'-'.$e->getMessage());
return $this->errorWithInfo('下载异常', 401); return $this->errorWithInfo('下载异常', 401);
} }
......
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