|
...
|
...
|
@@ -5,6 +5,7 @@ |
|
|
|
* Date: 2025/2/13
|
|
|
|
* Time: 11:01
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
...
|
...
|
@@ -37,30 +38,30 @@ class InquiryRelayService |
|
|
|
{
|
|
|
|
try {
|
|
|
|
// 获取数据
|
|
|
|
$url = "https://api.szcmapi.com/get_inquiry.aspx?id=".$id;
|
|
|
|
$url = "https://api.szcmapi.com/get_inquiry.aspx?id=" . $id;
|
|
|
|
$json = $this->szcmCurl($url);
|
|
|
|
// 兼容过去到的数据, 比较乱
|
|
|
|
$json = trim(str_replace("\r\n", '\n', (string) $json));
|
|
|
|
$json = str_replace('3/4"','3/4',$json);
|
|
|
|
$json = str_replace('"Steklopribor"','Steklopribor',$json);
|
|
|
|
$json = str_replace('"Net30 days"','Net30 days',$json);
|
|
|
|
$json = trim(str_replace("\r\n", '\n', (string)$json));
|
|
|
|
$json = str_replace('3/4"', '3/4', $json);
|
|
|
|
$json = str_replace('"Steklopribor"', 'Steklopribor', $json);
|
|
|
|
$json = str_replace('"Net30 days"', 'Net30 days', $json);
|
|
|
|
$json = trim($json);
|
|
|
|
$json = str_replace("\n",'',$json);
|
|
|
|
$array = json_decode($json,true);
|
|
|
|
$json = str_replace("\n", '', $json);
|
|
|
|
$array = json_decode($json, true);
|
|
|
|
|
|
|
|
if (empty($array))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// 整合最终数据
|
|
|
|
$title = base64_decode($array['title']);
|
|
|
|
$title = str_replace("'",'',$title);
|
|
|
|
$title = str_replace("'", '', $title);
|
|
|
|
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
|
|
|
$title = str_replace("'",'',$title);
|
|
|
|
$title = str_replace("'", '', $title);
|
|
|
|
$message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8');
|
|
|
|
$message = str_replace("'",'',$message);
|
|
|
|
$message = str_replace("'", '', $message);
|
|
|
|
$email = trim($array['Email']);
|
|
|
|
$name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8');
|
|
|
|
$name = str_replace("'",'',$name);
|
|
|
|
$name = str_replace("'", '', $name);
|
|
|
|
|
|
|
|
$result = [
|
|
|
|
'image' => $array['image'] ?: '',
|
|
...
|
...
|
@@ -106,6 +107,42 @@ class InquiryRelayService |
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取findsupply询盘
|
|
|
|
* @param $url
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
* @author Akun
|
|
|
|
* @date 2025/03/04 10:48
|
|
|
|
*/
|
|
|
|
public function getInquiryFs($url)
|
|
|
|
{
|
|
|
|
$re = curl_get($url);
|
|
|
|
$result = [];
|
|
|
|
$next_page_url = '';
|
|
|
|
if (isset($re['status']) && $re['status'] == 200) {
|
|
|
|
$next_page_url = $re['data']['next_page_url'];
|
|
|
|
foreach ($re['data']['data'] as $v) {
|
|
|
|
$dateTime = new \DateTime($v['created_at']);
|
|
|
|
$time = $dateTime->format('Y-m-d H:i:s');
|
|
|
|
$result[] = [
|
|
|
|
'time' => $time,
|
|
|
|
'name' => $v['NAME'] ?: '',
|
|
|
|
'email' => $v['email'] ?: '',
|
|
|
|
'phone' => $v['phone_number'] ?: '',
|
|
|
|
'refer' => $v['page_url'] ?: '',
|
|
|
|
'message' => $v['content'] ?: '',
|
|
|
|
'ip' => $v['ip'] ?: '',
|
|
|
|
'source_address' => 'www.findsupply.com',
|
|
|
|
'title' => $v['products_title'] ?: '',
|
|
|
|
'submit_country' => $v['country'] ?: ''
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ['next_page_url' => $next_page_url, 'data' => $result];
|
|
|
|
}
|
|
|
|
|
|
|
|
########################################################################################################################
|
|
|
|
# 询盘结束, 同步项目及路由 #
|
|
|
|
########################################################################################################################
|
...
|
...
|
|