Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into master-server
正在显示
6 个修改的文件
包含
95 行增加
和
25 行删除
| @@ -46,8 +46,12 @@ class SyncInquiryRelay extends Command | @@ -46,8 +46,12 @@ class SyncInquiryRelay extends Command | ||
| 46 | { | 46 | { |
| 47 | $this->output('开始同步表单系统询盘'); | 47 | $this->output('开始同步表单系统询盘'); |
| 48 | $this->getInquiryForm(); | 48 | $this->getInquiryForm(); |
| 49 | - $this->output('开始同步asp采集询盘'); | 49 | + |
| 50 | + $this->output('开始同步SC平台询盘'); | ||
| 50 | $this->getInquirySzcm(); | 51 | $this->getInquirySzcm(); |
| 52 | + | ||
| 53 | + $this->output('开始同步FS平台询盘'); | ||
| 54 | + $this->getInquiryFs(); | ||
| 51 | } | 55 | } |
| 52 | 56 | ||
| 53 | /** | 57 | /** |
| @@ -65,9 +69,6 @@ class SyncInquiryRelay extends Command | @@ -65,9 +69,6 @@ class SyncInquiryRelay extends Command | ||
| 65 | //+86区号过滤 | 69 | //+86区号过滤 |
| 66 | continue; | 70 | continue; |
| 67 | } | 71 | } |
| 68 | - if (strpos($item['refer'], 'findsupply.com') !== false) { | ||
| 69 | - $item['source_type'] = InquiryInfo::TYPE_FIND_SUPPLY; | ||
| 70 | - } | ||
| 71 | $this->saveDate($item, $item['source_type']); | 72 | $this->saveDate($item, $item['source_type']); |
| 72 | } | 73 | } |
| 73 | } | 74 | } |
| @@ -112,6 +113,37 @@ class SyncInquiryRelay extends Command | @@ -112,6 +113,37 @@ class SyncInquiryRelay extends Command | ||
| 112 | } | 113 | } |
| 113 | 114 | ||
| 114 | /** | 115 | /** |
| 116 | + * @return bool | ||
| 117 | + * @throws \Exception | ||
| 118 | + * @author Akun | ||
| 119 | + * @date 2025/03/04 11:48 | ||
| 120 | + */ | ||
| 121 | + public function getInquiryFs() | ||
| 122 | + { | ||
| 123 | + $service = new InquiryRelayService(); | ||
| 124 | + $next_page_url = 'https://www.findsupply.com/api/external?page=1&pagesize=50'; | ||
| 125 | + $model = new InquiryInfo(); | ||
| 126 | + while ($next_page_url) { | ||
| 127 | + $result = $service->getInquiryFs($next_page_url); | ||
| 128 | + $data = $result['data']; | ||
| 129 | + $next_page_url = $result['next_page_url']; | ||
| 130 | + | ||
| 131 | + if ($data) { | ||
| 132 | + foreach ($data as $item) { | ||
| 133 | + $message_sign = md5($item['name'] . $item['email'] . $item['phone'] . $item['ip'] . $item['time']); | ||
| 134 | + $inquiry_info = $model->where('message_sign', $message_sign)->first(); | ||
| 135 | + if ($inquiry_info) { | ||
| 136 | + $next_page_url = null; | ||
| 137 | + break; | ||
| 138 | + } | ||
| 139 | + $this->saveDate($item, InquiryInfo::TYPE_FIND_SUPPLY); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + return true; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + /** | ||
| 115 | * 询盘数据入库 | 147 | * 询盘数据入库 |
| 116 | * @param $data | 148 | * @param $data |
| 117 | * @param $type | 149 | * @param $type |
| @@ -148,6 +180,7 @@ class SyncInquiryRelay extends Command | @@ -148,6 +180,7 @@ class SyncInquiryRelay extends Command | ||
| 148 | $html = curl_c($data['refer'], false); | 180 | $html = curl_c($data['refer'], false); |
| 149 | 181 | ||
| 150 | if (empty($data['title'])) { | 182 | if (empty($data['title'])) { |
| 183 | + $data['title'] = ''; | ||
| 151 | preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches); | 184 | preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches); |
| 152 | if (!empty($matches[1])) { | 185 | if (!empty($matches[1])) { |
| 153 | $data['title'] = substr($matches[1][0], 0, 255); | 186 | $data['title'] = substr($matches[1][0], 0, 255); |
| @@ -92,7 +92,6 @@ class InquiryForwardController extends BaseController | @@ -92,7 +92,6 @@ class InquiryForwardController extends BaseController | ||
| 92 | 'id' => 'required',//ID | 92 | 'id' => 'required',//ID |
| 93 | 'name' => 'required',//名称 | 93 | 'name' => 'required',//名称 |
| 94 | 'email' => 'required',//邮箱 | 94 | 'email' => 'required',//邮箱 |
| 95 | - 'phone' => 'required',//电话号码 | ||
| 96 | 'ip' => 'required',//ip | 95 | 'ip' => 'required',//ip |
| 97 | 'forward_url' => 'required',//转发网址 | 96 | 'forward_url' => 'required',//转发网址 |
| 98 | 'message' => 'required',//发送内容 | 97 | 'message' => 'required',//发送内容 |
| @@ -100,7 +99,6 @@ class InquiryForwardController extends BaseController | @@ -100,7 +99,6 @@ class InquiryForwardController extends BaseController | ||
| 100 | 'id.required' => 'ID不能为空', | 99 | 'id.required' => 'ID不能为空', |
| 101 | 'name.required' => '名称不能为空', | 100 | 'name.required' => '名称不能为空', |
| 102 | 'email.required' => '邮箱不能为空', | 101 | 'email.required' => '邮箱不能为空', |
| 103 | - 'phone.required' => '电话号码不能为空', | ||
| 104 | 'ip.required' => 'ip不能为空', | 102 | 'ip.required' => 'ip不能为空', |
| 105 | 'forward_url.required' => '转发网址不能为空', | 103 | 'forward_url.required' => '转发网址不能为空', |
| 106 | 'message.required' => '内容不能为空', | 104 | 'message.required' => '内容不能为空', |
| @@ -176,7 +176,7 @@ class InquiryForwardLogic extends BaseLogic | @@ -176,7 +176,7 @@ class InquiryForwardLogic extends BaseLogic | ||
| 176 | $start_at = $now; | 176 | $start_at = $now; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | - InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'], $this->param['message'], $is_v6, json_encode([$url]), $start_at); | 179 | + InquiryRelayDetail::createInquiry($info['id'], $website, $info['country'], $this->param['ip'], $this->param['name'], $this->param['email'], $this->param['phone'] ?? '', $this->param['message'], $is_v6, json_encode([$url]), $start_at); |
| 180 | 180 | ||
| 181 | $num += 1; | 181 | $num += 1; |
| 182 | } | 182 | } |
| @@ -488,7 +488,7 @@ class RankDataLogic extends BaseLogic | @@ -488,7 +488,7 @@ class RankDataLogic extends BaseLogic | ||
| 488 | $without_project_ids = []; //不用处理排名的项目 | 488 | $without_project_ids = []; //不用处理排名的项目 |
| 489 | $without_extension_project_ids = [658]; //是否达标只统计主词的 | 489 | $without_extension_project_ids = [658]; //是否达标只统计主词的 |
| 490 | $extension_project_ids = [354]; //扩展词也到达标的 | 490 | $extension_project_ids = [354]; //扩展词也到达标的 |
| 491 | - $compliance_project_ids = [2163]; //直接达标处理的 | 491 | + $compliance_project_ids = [2163,257]; //直接达标处理的 |
| 492 | $ceaseProjectId = [ | 492 | $ceaseProjectId = [ |
| 493 | 47, | 493 | 47, |
| 494 | 354, | 494 | 354, |
| @@ -36,8 +36,9 @@ class InquiryInfo extends Base | @@ -36,8 +36,9 @@ class InquiryInfo extends Base | ||
| 36 | const TYPE_SITE_GROUP = 1; | 36 | const TYPE_SITE_GROUP = 1; |
| 37 | const TYPE_ADS = 2; | 37 | const TYPE_ADS = 2; |
| 38 | const TYPE_AI_SITE_GROUP = 3; | 38 | const TYPE_AI_SITE_GROUP = 3; |
| 39 | - const TYPE_SPIDER = 4; | ||
| 40 | - const TYPE_FIND_SUPPLY = 5; | 39 | + const TYPE_PROMOTION = 4; |
| 40 | + const TYPE_SPIDER = 5; | ||
| 41 | + const TYPE_FIND_SUPPLY = 6; | ||
| 41 | 42 | ||
| 42 | /** | 43 | /** |
| 43 | * 状态映射 | 44 | * 状态映射 |
| @@ -60,9 +61,10 @@ class InquiryInfo extends Base | @@ -60,9 +61,10 @@ class InquiryInfo extends Base | ||
| 60 | public function typeMap() | 61 | public function typeMap() |
| 61 | { | 62 | { |
| 62 | return [ | 63 | return [ |
| 63 | - self::TYPE_SITE_GROUP => '站群询盘', | 64 | + self::TYPE_SITE_GROUP => '自建AI站', |
| 64 | self::TYPE_ADS => 'ADS采集站', | 65 | self::TYPE_ADS => 'ADS采集站', |
| 65 | - self::TYPE_AI_SITE_GROUP => '自建AI站群', | 66 | + self::TYPE_AI_SITE_GROUP => '客户AI站', |
| 67 | + self::TYPE_PROMOTION => '客户推广到期站', | ||
| 66 | self::TYPE_SPIDER => 'SC平台', | 68 | self::TYPE_SPIDER => 'SC平台', |
| 67 | self::TYPE_FIND_SUPPLY => 'FS平台', | 69 | self::TYPE_FIND_SUPPLY => 'FS平台', |
| 68 | ]; | 70 | ]; |
| @@ -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 | +} |
-
请 注册 或 登录 后发表评论