|
|
@@ -38,16 +38,16 @@ class ContractController extends AdminController
|
|
|
function saveContract(){
|
|
|
|
|
|
$id=request()->input('id','');//id
|
|
|
- $name=request()->input('name','');//合同名称
|
|
|
+ $name=request()->input('file_name');//合同名称
|
|
|
$sign_party=request()->input('sign_party',[]);//签署区域关键词
|
|
|
$texts=request()->input('texts',[]);//乙方方签署区域关键词
|
|
|
- if (empty($name)) return $this->apiResponseError('请填写合同名称');
|
|
|
+ if (empty($name)) return $this->apiResponseError('请填写合同名称11111');
|
|
|
if (mb_strlen($name) > 100) return $this->apiResponseError('合同名称最大100');
|
|
|
if (empty($sign_party)) return $this->apiResponseError('请填写签署区信息');
|
|
|
|
|
|
- $file =request()->file('file','');//文件
|
|
|
- if (empty($file)){
|
|
|
- return $this->apiResponseError('请选择文件');
|
|
|
+ $file_url =request()->file('file_url','');//文件
|
|
|
+ if (empty($file_url)){
|
|
|
+ return $this->apiResponseError('请上传文件');
|
|
|
}
|
|
|
if (empty($texts)){
|
|
|
return $this->apiResponseError('请填写变量');
|
|
|
@@ -59,10 +59,16 @@ class ContractController extends AdminController
|
|
|
return $this->apiResponseError('合同名称已存在');
|
|
|
}
|
|
|
|
|
|
- $extension = request()->file->extension();//获取文件扩展名
|
|
|
+ $pathInfo = pathinfo($file_url);
|
|
|
+ $extension = $pathInfo['extension'];//获取文件扩展名
|
|
|
$file_name = $name.'.'.$extension;
|
|
|
- $contracts_file = request()->file->storeAs('public/contract', $file_name);
|
|
|
|
|
|
+ $file_path = 'public/contract/'.date('Ymd').'/';
|
|
|
+ $path=public_path($file_path);
|
|
|
+ if(!is_dir($path))mkdir($path,0777,true);
|
|
|
+ file_put_contents($path . $file_name,$file_url);
|
|
|
+
|
|
|
+ $contracts_file = $file_path.$file_name;
|
|
|
|
|
|
|
|
|
$data = compact('name','contracts_file','sign_party','texts');
|