作者 邓超

上传文件

@@ -367,13 +367,13 @@ class Home extends Base { @@ -367,13 +367,13 @@ class Home extends Base {
367 'cc|'.__('to_cc') => [$yzemail], 367 'cc|'.__('to_cc') => [$yzemail],
368 'bcc|'.__('to_bcc') => [$yzemail], 368 'bcc|'.__('to_bcc') => [$yzemail],
369 'priority|'.__('priority_email') => ['in'=>[1,3,5]], 369 'priority|'.__('priority_email') => ['in'=>[1,3,5]],
370 - 'attachment|'.__('files_email') => [  
371 - 'file'=>[  
372 - 'ext' => [],  
373 - 'size' => 1024*1024*50,  
374 - 'mine' => []  
375 - ]  
376 - ], 370 +// 'attachment|'.__('files_email') => [
  371 +// 'file'=>[
  372 +// 'ext' => [],
  373 +// 'size' => 1024*1024*50,
  374 +// 'mine' => []
  375 +// ]
  376 +// ],
377 'receipt|'.__('receipt_email') => [] 377 'receipt|'.__('receipt_email') => []
378 ],[ 378 ],[
379 379
@@ -414,6 +414,7 @@ class Home extends Base { @@ -414,6 +414,7 @@ class Home extends Base {
414 $sendData['reply_to'] = [];//回复到那个邮件 414 $sendData['reply_to'] = [];//回复到那个邮件
415 //Attachments 附件 上传的 415 //Attachments 附件 上传的
416 $sendData['attachment'] = []; 416 $sendData['attachment'] = [];
  417 + // 这个是直接上传文件
417 $attachment = app()->file('attachment'); 418 $attachment = app()->file('attachment');
418 if($attachment){ 419 if($attachment){
419 foreach ($attachment as $file){ 420 foreach ($attachment as $file){
@@ -429,6 +430,23 @@ class Home extends Base { @@ -429,6 +430,23 @@ class Home extends Base {
429 } 430 }
430 } 431 }
431 } 432 }
  433 + // 这个是通过了上传接口上传的文件
  434 + $attachment = app()->request('attachment');
  435 + if($attachment){
  436 + foreach ($attachment as $file){
  437 + $file = json_decode($file,true);
  438 + if(empty($file['data']['saveName'])|| !is_file(PUBLIC_PATH.$file['data']['saveName'])){
  439 + app()->e('附件('.$file['data']['name'].")异常");
  440 + }
  441 + $sendData['attachment'][] = [
  442 + 'name' => $file['data']['name'],
  443 + 'filename' => $file['data']['name'],
  444 + 'signName' => $file['data']['saveName'],
  445 + 'path' => PUBLIC_PATH.$file['data']['saveName']
  446 + ];
  447 + }
  448 + }
  449 +
432 // 远程路径,云文件 450 // 远程路径,云文件
433 $attachmentUrl = app()->request('attachmentUrl'); 451 $attachmentUrl = app()->request('attachmentUrl');
434 if(is_array($attachmentUrl)){ 452 if(is_array($attachmentUrl)){