Commit 889256b8 authored by hj's avatar hj

更新提交

parent 29de768e
......@@ -30,10 +30,10 @@ class ChemSrcService
try{
$responseHtml = $this->apiService->getCasWebInfo($cas);
if($responseHtml){
$wuhuaList = [];
$wuhuaDivRegx = '/id=[\\\'|\"]wuHuaDiv[\\\'|\"]>(?<wuhuaHtml>[\s\S]+?)<div\s{0,}class=[\\\'|\"]cata-div row[\\\'|\"]/i';
preg_match($wuhuaDivRegx, $responseHtml,$wuhuaHtml);
if(!empty($wuhuaHtml)) {
$wuhuaList = [];
$wuhuaDetailRegx = '/<th[\s\S]*?>(?<title>[\s\S]*?)<\/th>[\s\S]*?<td[\s\S]*?>(?<content>[\s\S]*?)<\/td>/i';
preg_match_all($wuhuaDetailRegx, $wuhuaHtml['wuhuaHtml'],$wuhuaDetailList);
if(!empty($wuhuaDetailList)){
......@@ -41,16 +41,16 @@ class ChemSrcService
$wuhuaList[$title] = str_replace( " ", "", str_replace( "\r\n", "", $wuhuaDetailList['content'][$key]));
}
}
}
if(!empty($wuhuaList)){
$baikeMysql = DB::connection('baike_mysql');
$baikeMysql->table('tp_mol_wuhua')
->updateOrInsert([
'cas' => $cas
], [
'mol_id' => $molId,
'content' => json_encode([$wuhuaList], JSON_UNESCAPED_UNICODE)
]);
if(!empty($wuhuaList)){
$baikeMysql = DB::connection('baike_mysql');
$baikeMysql->table('tp_mol_wuhua')
->updateOrInsert([
'cas' => $cas
], [
'mol_id' => $molId,
'content' => json_encode([$wuhuaList], JSON_UNESCAPED_UNICODE)
]);
}
}
return true;
}
......
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