作者 lyh

gx

@@ -53,7 +53,7 @@ if (!function_exists('http_post')) { @@ -53,7 +53,7 @@ if (!function_exists('http_post')) {
53 * @param type $url 53 * @param type $url
54 * @param type $post_data 54 * @param type $post_data
55 */ 55 */
56 - function http_post($url, $post_data, $header = []) 56 + function http_post($url, $post_data, $header = [],$is_json = true)
57 { 57 {
58 if (empty($header)) { 58 if (empty($header)) {
59 $header = array( 59 $header = array(
@@ -78,7 +78,10 @@ if (!function_exists('http_post')) { @@ -78,7 +78,10 @@ if (!function_exists('http_post')) {
78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); 78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
79 } 79 }
80 curl_close($ch); 80 curl_close($ch);
81 - return json_decode($res, true); 81 + if($is_json){
  82 + return json_decode($res, true);
  83 + }
  84 + return $res;
82 } 85 }
83 } 86 }
84 87
@@ -314,9 +314,15 @@ class LoginController extends BaseController @@ -314,9 +314,15 @@ class LoginController extends BaseController
314 public function ceshi(){ 314 public function ceshi(){
315 //同步到大文件 315 //同步到大文件
316 $path = '/upload/m/video/2023-08'; 316 $path = '/upload/m/video/2023-08';
317 - $fileName = '64e81b9b80b13315901.mp4'; 317 + $fileName = '64e81b9b80b1331590.mp4';
318 $file_path = config('filesystems.disks.cos')['cdn1'].$path.'/'.$fileName; 318 $file_path = config('filesystems.disks.cos')['cdn1'].$path.'/'.$fileName;
319 - $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';  
320 - return shell_exec($cmd); 319 + $param = [
  320 + 'file_path'=>$file_path,
  321 + 'save_path'=>'/www/wwwroot/cos'.$path
  322 + ];
  323 + $url = 'https://v6-file.globalso.com/upload.php';
  324 + http_post($url,$param,['charset=utf-8'],false);
  325 +// $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';
  326 +// return shell_exec($cmd);
321 } 327 }
322 } 328 }