|
@@ -5,6 +5,7 @@ |
|
@@ -5,6 +5,7 @@ |
|
5
|
* Date: 2025/2/13
|
5
|
* Date: 2025/2/13
|
|
6
|
* Time: 11:01
|
6
|
* Time: 11:01
|
|
7
|
*/
|
7
|
*/
|
|
|
|
8
|
+
|
|
8
|
namespace App\Services;
|
9
|
namespace App\Services;
|
|
9
|
|
10
|
|
|
10
|
use Illuminate\Support\Facades\Log;
|
11
|
use Illuminate\Support\Facades\Log;
|
|
@@ -37,30 +38,30 @@ class InquiryRelayService |
|
@@ -37,30 +38,30 @@ class InquiryRelayService |
|
37
|
{
|
38
|
{
|
|
38
|
try {
|
39
|
try {
|
|
39
|
// 获取数据
|
40
|
// 获取数据
|
|
40
|
- $url = "https://api.szcmapi.com/get_inquiry.aspx?id=".$id;
|
41
|
+ $url = "https://api.szcmapi.com/get_inquiry.aspx?id=" . $id;
|
|
41
|
$json = $this->szcmCurl($url);
|
42
|
$json = $this->szcmCurl($url);
|
|
42
|
// 兼容过去到的数据, 比较乱
|
43
|
// 兼容过去到的数据, 比较乱
|
|
43
|
- $json = trim(str_replace("\r\n", '\n', (string) $json));
|
|
|
|
44
|
- $json = str_replace('3/4"','3/4',$json);
|
|
|
|
45
|
- $json = str_replace('"Steklopribor"','Steklopribor',$json);
|
|
|
|
46
|
- $json = str_replace('"Net30 days"','Net30 days',$json);
|
44
|
+ $json = trim(str_replace("\r\n", '\n', (string)$json));
|
|
|
|
45
|
+ $json = str_replace('3/4"', '3/4', $json);
|
|
|
|
46
|
+ $json = str_replace('"Steklopribor"', 'Steklopribor', $json);
|
|
|
|
47
|
+ $json = str_replace('"Net30 days"', 'Net30 days', $json);
|
|
47
|
$json = trim($json);
|
48
|
$json = trim($json);
|
|
48
|
- $json = str_replace("\n",'',$json);
|
|
|
|
49
|
- $array = json_decode($json,true);
|
49
|
+ $json = str_replace("\n", '', $json);
|
|
|
|
50
|
+ $array = json_decode($json, true);
|
|
50
|
|
51
|
|
|
51
|
if (empty($array))
|
52
|
if (empty($array))
|
|
52
|
return false;
|
53
|
return false;
|
|
53
|
|
54
|
|
|
54
|
// 整合最终数据
|
55
|
// 整合最终数据
|
|
55
|
$title = base64_decode($array['title']);
|
56
|
$title = base64_decode($array['title']);
|
|
56
|
- $title = str_replace("'",'',$title);
|
57
|
+ $title = str_replace("'", '', $title);
|
|
57
|
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
58
|
$title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
|
|
58
|
- $title = str_replace("'",'',$title);
|
59
|
+ $title = str_replace("'", '', $title);
|
|
59
|
$message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8');
|
60
|
$message = html_entity_decode(addslashes(base64_decode($array['Message'])), ENT_QUOTES, 'UTF-8');
|
|
60
|
- $message = str_replace("'",'',$message);
|
61
|
+ $message = str_replace("'", '', $message);
|
|
61
|
$email = trim($array['Email']);
|
62
|
$email = trim($array['Email']);
|
|
62
|
- $name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8');
|
|
|
|
63
|
- $name = str_replace("'",'',$name);
|
63
|
+ $name = html_entity_decode($array['Name'], ENT_QUOTES, 'UTF-8');
|
|
|
|
64
|
+ $name = str_replace("'", '', $name);
|
|
64
|
|
65
|
|
|
65
|
$result = [
|
66
|
$result = [
|
|
66
|
'image' => $array['image'] ?: '',
|
67
|
'image' => $array['image'] ?: '',
|
|
@@ -106,7 +107,43 @@ class InquiryRelayService |
|
@@ -106,7 +107,43 @@ class InquiryRelayService |
|
106
|
return $result;
|
107
|
return $result;
|
|
107
|
}
|
108
|
}
|
|
108
|
|
109
|
|
|
|
|
110
|
+ /**
|
|
|
|
111
|
+ * 获取findsupply询盘
|
|
|
|
112
|
+ * @param $url
|
|
|
|
113
|
+ * @return array
|
|
|
|
114
|
+ * @throws \Exception
|
|
|
|
115
|
+ * @author Akun
|
|
|
|
116
|
+ * @date 2025/03/04 10:48
|
|
|
|
117
|
+ */
|
|
|
|
118
|
+ public function getInquiryFs($url)
|
|
|
|
119
|
+ {
|
|
|
|
120
|
+ $re = curl_get($url);
|
|
|
|
121
|
+ $result = [];
|
|
|
|
122
|
+ $next_page_url = '';
|
|
|
|
123
|
+ if (isset($re['status']) && $re['status'] == 200) {
|
|
|
|
124
|
+ $next_page_url = $re['data']['next_page_url'];
|
|
|
|
125
|
+ foreach ($re['data']['data'] as $v) {
|
|
|
|
126
|
+ $dateTime = new \DateTime($v['created_at']);
|
|
|
|
127
|
+ $time = $dateTime->format('Y-m-d H:i:s');
|
|
|
|
128
|
+ $result[] = [
|
|
|
|
129
|
+ 'time' => $time,
|
|
|
|
130
|
+ 'name' => $v['NAME'] ?: '',
|
|
|
|
131
|
+ 'email' => $v['email'] ?: '',
|
|
|
|
132
|
+ 'phone' => $v['phone_number'] ?: '',
|
|
|
|
133
|
+ 'refer' => $v['page_url'] ?: '',
|
|
|
|
134
|
+ 'message' => $v['content'] ?: '',
|
|
|
|
135
|
+ 'ip' => $v['ip'] ?: '',
|
|
|
|
136
|
+ 'source_address' => 'www.findsupply.com',
|
|
|
|
137
|
+ 'title' => $v['products_title'] ?: '',
|
|
|
|
138
|
+ 'submit_country' => $v['country'] ?: ''
|
|
|
|
139
|
+ ];
|
|
|
|
140
|
+ }
|
|
|
|
141
|
+ }
|
|
|
|
142
|
+
|
|
|
|
143
|
+ return ['next_page_url' => $next_page_url, 'data' => $result];
|
|
|
|
144
|
+ }
|
|
|
|
145
|
+
|
|
109
|
########################################################################################################################
|
146
|
########################################################################################################################
|
|
110
|
# 询盘结束, 同步项目及路由 #
|
147
|
# 询盘结束, 同步项目及路由 #
|
|
111
|
########################################################################################################################
|
148
|
########################################################################################################################
|
|
112
|
-} |
|
|
|
|
|
149
|
+} |