Commit 0d697aa7 authored by hj's avatar hj

更新提交

parent 96c7596d
......@@ -13,10 +13,10 @@ class ChemicalsMsdsService
public function getMsds($cas, $type = null, $comInfo = null)
{
$fileService = app(FileService::class);
$msdPdf = $fileService->getFileListByModelData($comInfo['cus_type'].'_'.$cas.'_msds', $comInfo['cus_number']);
/*$msdPdf = $fileService->getFileListByModelData($comInfo['cus_type'].'_'.$cas.'_msds', $comInfo['cus_number']);
if($msdPdf){
return $fileService->getDownloadUrl(current($msdPdf)['uniqueid']);
}
}*/
/*$findResult = shell_exec('find '.env('MSDS_FILE_DIR').' -iname \''.$cas.'\' -print');
if(is_null($findResult)){
......@@ -67,7 +67,7 @@ class ChemicalsMsdsService
$dlHtml = '';
if($dlContent['title'][$key]){
//$dlHtml = '<h2 style="font-size: 20px; text-align: center;" align="center">'.$dlContent['title'][$key].'</h2>';
preg_match_all('/<dt>(?<cTitle>[\s\S]*?)<\/dt>[\s]*?<dd>(?<cContent>[\s\S]*?)<\/dd>/i', $dl, $ddContent);
preg_match_all('/<dt>(?<cTitle>[\s\S]*?)<\/dt>[\s]*?<dd[\s\S]*?>(?<cContent>[\s\S]*?)<\/dd>/i', $dl, $ddContent);
if($ddContent){
foreach($ddContent['cTitle'] as $k => $c){
$dlHtml .= '<div><span style="margin: 0;">'.$c.'</span>';
......@@ -77,6 +77,16 @@ class ChemicalsMsdsService
}
$msds_html = str_replace($dl, $dlHtml, $msds_html);
}
if($key == 1){
preg_match_all('/<dt>(?<cTitle>[\s\S]*?)<\/dt>[\s]*?<dd[\s\S]*?>(?<cContent>[\s\S]*?)<\/dd>/i', $dl, $ddContent);
if($ddContent){
foreach($ddContent['cTitle'] as $k => $c){
$dlHtml .= '<div><span style="margin: 0;">'.$c.'</span>';
$dlHtml .= '<span style="font-weight: normal">'.$ddContent['cContent'][$k].'</span></div>';
}
}
$msds_html = str_replace($dl, $dlHtml, $msds_html);
}
}
}
preg_match('/(?<title>第[\s]*?3[\s\S]+?)<table[\s]*?class=[\\\'|\"]table-text-center avoid-page-break-inside[\\\'|\"]>[\s\S]*?<\/table>/i', $content['content'], $tableContent);
......@@ -93,7 +103,7 @@ class ChemicalsMsdsService
//file_put_contents('./test.html', $msds_html);
file_put_contents('./test.html', $msds_html);
//$msds_html = file_get_contents('./test.html');
$this->getPdfApp()->loadHTML($msds_html, 'utf-8');
......
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