作者 赵彬吉
@@ -47,6 +47,27 @@ class PostInquiryForward extends Command @@ -47,6 +47,27 @@ class PostInquiryForward extends Command
47 parent::__construct(); 47 parent::__construct();
48 } 48 }
49 49
  50 + /**
  51 + * 芯片网站
  52 + * @var array
  53 + */
  54 + protected $xp_websites = [
  55 + 'www.shinecomponents.com',
  56 + 'www.hk-allchips.com',
  57 + 'www.xinjiada-ic.com',
  58 + 'www.sic-components.com',
  59 + 'www.chip1-vip.com',
  60 + 'www.flash-turtle.com',
  61 + 'www.xinteerchip.com',
  62 + 'www.conevoelec.com'
  63 + ];
  64 +
  65 + /**
  66 + * 5.0询盘转发到自己站点的网站
  67 + * @var array
  68 + */
  69 + protected $self_websites = [205570, 64532, 150535, 292114, 124579, 237114, 194809, 278184, 166223, 366238, 277923, 297045, 309218, 75191, 57616];
  70 +
50 71
51 public function handle() 72 public function handle()
52 { 73 {
@@ -129,21 +150,23 @@ class PostInquiryForward extends Command @@ -129,21 +150,23 @@ class PostInquiryForward extends Command
129 'referrer_url' => $detail['referrer'], 150 'referrer_url' => $detail['referrer'],
130 'user_agent' => $detail['user_agent'], 151 'user_agent' => $detail['user_agent'],
131 ]; 152 ];
132 - $res = Http::withoutVerifying()->timeout(30)->post($website . 'api/traffic_visit/', $data)->json(); 153 + $url = $website . 'api/traffic_visit/';
  154 + $res = Http::withoutVerifying()->timeout(30)->post($url, $data)->json();
133 if (empty($res['status']) || $res['status'] != 200) { 155 if (empty($res['status']) || $res['status'] != 200) {
134 $log->status = InquiryRelayDetailLog::STATUS_FAIL; 156 $log->status = InquiryRelayDetailLog::STATUS_FAIL;
135 $log->remark = mb_substr($res['message'] ?? '', 0, 200); 157 $log->remark = mb_substr($res['message'] ?? '', 0, 200);
136 $log->save(); 158 $log->save();
137 159
138 - Log::channel('inquiry_forward')->error('post_inquiry_forward visit error', [$res, $website . 'api/traffic_visit/', $data]); 160 + Log::channel('inquiry_forward')->error('post_inquiry_forward visit error', [$res, $url, $data]);
139 return false; 161 return false;
140 } 162 }
  163 + Log::channel('inquiry_forward')->error('post_inquiry_forward visit success', [$res, $url, $data]);
141 } else { 164 } else {
142 //v4 v5分离项目 往测试链接推 165 //v4 v5分离项目 往测试链接推
143 $project_info = InquiryProject::select(['is_split', 'test_domain'])->where('domain', 'like', '%' . $detail['website'] . '%')->first(); 166 $project_info = InquiryProject::select(['is_split', 'test_domain'])->where('domain', 'like', '%' . $detail['website'] . '%')->first();
144 if (!$project_info) { 167 if (!$project_info) {
145 $log->status = InquiryRelayDetailLog::STATUS_FAIL; 168 $log->status = InquiryRelayDetailLog::STATUS_FAIL;
146 - $log->remark = '获取域名对应项目失败'; 169 + $log->remark = '获取分离项目测试域名失败';
147 $log->save(); 170 $log->save();
148 171
149 return false; 172 return false;
@@ -161,16 +184,19 @@ class PostInquiryForward extends Command @@ -161,16 +184,19 @@ class PostInquiryForward extends Command
161 'user_agent' => $detail['user_agent'], 184 'user_agent' => $detail['user_agent'],
162 "ip" => $detail['ip'], 185 "ip" => $detail['ip'],
163 ]; 186 ];
164 - $res = Http::get($website . 'wp-admin/admin-ajax.php', $data); 187 + $url = $website . 'wp-admin/admin-ajax.php';
  188 + $res = Http::withoutVerifying()->timeout(30)->get($url, $data);
165 $status = $res->status(); 189 $status = $res->status();
166 if ($status != 200) { 190 if ($status != 200) {
167 $log->status = InquiryRelayDetailLog::STATUS_FAIL; 191 $log->status = InquiryRelayDetailLog::STATUS_FAIL;
168 $log->remark = mb_substr($res->body() ?? '', 0, 200); 192 $log->remark = mb_substr($res->body() ?? '', 0, 200);
169 $log->save(); 193 $log->save();
170 194
171 - Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 visit error', [$res->body(), $website . 'wp-admin/admin-ajax.php', $data]); 195 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 visit error', [$res->body(), $url, $data]);
172 return false; 196 return false;
173 } 197 }
  198 +
  199 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 visit success', [$res->body(), $url, $data]);
174 } 200 }
175 $log->status = InquiryRelayDetailLog::STATUS_SUCCESS; 201 $log->status = InquiryRelayDetailLog::STATUS_SUCCESS;
176 $log->save(); 202 $log->save();
@@ -179,11 +205,17 @@ class PostInquiryForward extends Command @@ -179,11 +205,17 @@ class PostInquiryForward extends Command
179 205
180 public function inquiry(InquiryRelayDetail $detail, InquiryRelayDetailLog $log) 206 public function inquiry(InquiryRelayDetail $detail, InquiryRelayDetailLog $log)
181 { 207 {
182 - // v6  
183 - if ($detail['is_v6']) {  
184 - $res = $this->v6Inquiry($detail, $log); 208 + if (in_array($detail['website'], $this->xp_websites)) {
  209 + // 芯片网站
  210 + $res = $this->xpInquiry($detail, $log);
185 } else { 211 } else {
186 - $res = $this->v5Inquiry($detail, $log); 212 + if ($detail['is_v6']) {
  213 + // v6
  214 + $res = $this->v6Inquiry($detail, $log);
  215 + } else {
  216 + // v5
  217 + $res = $this->v5Inquiry($detail, $log);
  218 + }
187 } 219 }
188 220
189 if (!$res) { 221 if (!$res) {
@@ -196,6 +228,47 @@ class PostInquiryForward extends Command @@ -196,6 +228,47 @@ class PostInquiryForward extends Command
196 return true; 228 return true;
197 } 229 }
198 230
  231 + public function xpInquiry($detail, $log)
  232 + {
  233 + $data = [
  234 + 'refer' => $log['url'],
  235 + 'contact_name' => $detail['name'],
  236 + 'email' => $detail['email'],
  237 + 'tel' => $detail['phone'],
  238 + 'ip' => $detail['ip'],
  239 + 'remark' => $detail['message'],
  240 + 'submit_time' => date('Y-m-d H:i:s', time() + 20),
  241 + ];
  242 + $url = 'https://' . $detail['website'] . '/api/store/webmail?flag=opencart';
  243 + $post_data = json_encode($data);
  244 + $curl = curl_init($url);
  245 + curl_setopt($curl, CURLOPT_POST, 1);
  246 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  247 + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
  248 + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  249 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
  250 + curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36');
  251 + curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
  252 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 1);
  253 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  254 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
  255 + curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8', 'Content-Length: ' . strlen($post_data)));
  256 + $curl_response = curl_exec($curl);
  257 + curl_close($curl);
  258 +
  259 + $res = json_decode($curl_response, true);
  260 + if (empty($res['code']) || $res['code'] != 200) {
  261 + $log->status = InquiryRelayDetailLog::STATUS_FAIL;
  262 + $log->remark = mb_substr($res['msg'] ?? '', 0, 200);
  263 + $log->save();
  264 + Log::channel('inquiry_forward')->error('post_inquiry_forward xp inquiry error', [$res, $url, $data]);
  265 + return false;
  266 + }
  267 + Log::channel('inquiry_forward')->error('post_inquiry_forward xp inquiry success', [$res, $url, $data]);
  268 +
  269 + return false;
  270 + }
  271 +
199 public function v6Inquiry($detail, $log) 272 public function v6Inquiry($detail, $log)
200 { 273 {
201 $website = 'https://' . $detail['website'] . '/'; 274 $website = 'https://' . $detail['website'] . '/';
@@ -211,45 +284,70 @@ class PostInquiryForward extends Command @@ -211,45 +284,70 @@ class PostInquiryForward extends Command
211 } else { 284 } else {
212 $data['__amp_source_origin'] = trim($website, '/'); 285 $data['__amp_source_origin'] = trim($website, '/');
213 } 286 }
214 - $res = Http::withoutVerifying()->timeout(30)->withHeaders(['User-Agent' => $detail['user_agent']])->post($website . 'api/inquiryQd?source=5', $data)->json(); 287 + $url = $website . 'api/inquiryQd?source=5';
  288 + $res = Http::withoutVerifying()->timeout(30)->withHeaders(['User-Agent' => $detail['user_agent']])->post($url, $data)->json();
215 if (empty($res['code']) || $res['code'] != 200) { 289 if (empty($res['code']) || $res['code'] != 200) {
216 $log->status = InquiryRelayDetailLog::STATUS_FAIL; 290 $log->status = InquiryRelayDetailLog::STATUS_FAIL;
217 $log->remark = mb_substr($res['message'] ?? '', 0, 200); 291 $log->remark = mb_substr($res['message'] ?? '', 0, 200);
218 $log->save(); 292 $log->save();
219 - Log::channel('inquiry_forward')->error('post_inquiry_forward v6 inquiry error', [$res, $website . 'api/inquiryQd/', $data]); 293 + Log::channel('inquiry_forward')->error('post_inquiry_forward v6 inquiry error', [$res, $url, $data]);
220 return false; 294 return false;
221 } 295 }
  296 + Log::channel('inquiry_forward')->error('post_inquiry_forward v6 inquiry success', [$res, $url, $data]);
222 return true; 297 return true;
223 } 298 }
224 299
225 public function v5Inquiry($detail, $log) 300 public function v5Inquiry($detail, $log)
226 { 301 {
227 - $data = [  
228 - 'name' => $detail['name'],  
229 - 'phone' => $detail['phone'],  
230 - 'message' => $detail['message'],  
231 - 'email' => $detail['email'],  
232 - 'ip' => $detail['ip'],  
233 - 'token' => md5($log['url'] . $detail['name'] . $detail['ip'] . date("Y-m-d")),  
234 - 'refer' => $log['url'],  
235 - 'submit_time' => date('Y-m-d H:i:s'),  
236 - 'source' => 5,  
237 - ];  
238 - $result = Http::withoutVerifying()->timeout(30)->post('https://www.globalso.site/api/external-interface/add/fa043f9cbec6b38f', $data);  
239 - $res['data'][0]['status'] = 'success';  
240 - //兼容接口返回格式  
241 - if (!empty($res['data'][0]['status'])) {  
242 - $res['data'][0]['code'] = $res['data'][0]['status'] == 'success' ? 200 : 400;  
243 - !empty($res['data'][0]['msg']) && $res['message'] = $res['data'][0]['msg'];  
244 - }  
245 - if (empty($res['data'][0]['code']) || !in_array($res['data'][0]['code'], [200, 300])) {  
246 - $log->status = InquiryRelayDetailLog::STATUS_FAIL;  
247 - $log->remark = mb_substr($res['message'] ?? '', 0, 200);  
248 - $log->save(); 302 + $project_id = InquiryProject::where('version', '<', 6)->where('domain', 'like', '%' . $detail['website'] . '%')->value('primary_id') ?? 0;
  303 + if (in_array($project_id, $this->self_websites)) {
  304 + //发送到自己站点项目
  305 + $data = [
  306 + 'Name' => $detail['name'],
  307 + 'Phone' => $detail['phone'],
  308 + 'Message' => $detail['message'],
  309 + 'Email' => $detail['email'],
  310 + 'submit_ip' => $detail['ip'],
  311 + 'refer' => $log['url'],
  312 + 'submit_time' => date('Y-m-d H:i:s', time() + 60)
  313 + ];
  314 + $url = 'https://' . $detail['website'] . '/wp-admin/admin-ajax.php?action=live_remort_receive';
  315 + $res = Http::withoutVerifying()->timeout(30)->withHeaders(['User-Agent' => $detail['user_agent']])->post($url, $data);
  316 + $status = $res->status();
  317 + if ($status != 200) {
  318 + $log->status = InquiryRelayDetailLog::STATUS_FAIL;
  319 + $log->remark = mb_substr($res->body() ?? '', 0, 200);
  320 + $log->save();
249 321
250 - Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 inquiry error', [$result->body(), 'https://www.globalso.site/api/external-interface/add/fa043f9cbec6b38f', $data]);  
251 - return false; 322 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 inquiry error', [$res->body(), $url, $data]);
  323 + return false;
  324 + }
  325 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 inquiry success', [$res->body(), $url, $data]);
  326 + } else {
  327 + $data = [
  328 + 'name' => $detail['name'],
  329 + 'phone' => $detail['phone'],
  330 + 'message' => $detail['message'],
  331 + 'email' => $detail['email'],
  332 + 'ip' => $detail['ip'],
  333 + 'token' => md5($log['url'] . $detail['name'] . $detail['ip'] . date("Y-m-d")),
  334 + 'refer' => $log['url'],
  335 + 'submit_time' => date('Y-m-d H:i:s'),
  336 + 'source' => 5,
  337 + ];
  338 + $url = 'https://www.globalso.site/api/external-interface/add/fa043f9cbec6b38f';
  339 + $res = Http::withoutVerifying()->timeout(30)->withHeaders(['User-Agent' => $detail['user_agent']])->post($url, $data)->json();
  340 + if (empty($res['status']) || $res['status'] != 200) {
  341 + $log->status = InquiryRelayDetailLog::STATUS_FAIL;
  342 + $log->remark = mb_substr($res['message'] ?? '', 0, 200);
  343 + $log->save();
  344 +
  345 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 inquiry error', [$res, $url, $data]);
  346 + return false;
  347 + }
  348 + Log::channel('inquiry_forward')->error('post_inquiry_forward v4|v5 inquiry success', [$res, $url, $data]);
252 } 349 }
  350 +
253 return true; 351 return true;
254 } 352 }
255 353
@@ -153,6 +153,20 @@ class RelayInquiryForward extends Command @@ -153,6 +153,20 @@ class RelayInquiryForward extends Command
153 153
154 protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀 154 protected $otherzb = [700, 300]; //模拟访问来源占比 (非美国) google.com|google.其他后缀
155 155
  156 + /**
  157 + * 芯片网站
  158 + * @var array
  159 + */
  160 + protected $xp_websites = [
  161 + 'www.shinecomponents.com',
  162 + 'www.hk-allchips.com',
  163 + 'www.xinjiada-ic.com',
  164 + 'www.sic-components.com',
  165 + 'www.chip1-vip.com',
  166 + 'www.flash-turtle.com',
  167 + 'www.xinteerchip.com',
  168 + 'www.conevoelec.com'
  169 + ];
156 170
157 public function handle() 171 public function handle()
158 { 172 {
@@ -207,9 +221,14 @@ class RelayInquiryForward extends Command @@ -207,9 +221,14 @@ class RelayInquiryForward extends Command
207 public function completeDetail($inquiry_detail) 221 public function completeDetail($inquiry_detail)
208 { 222 {
209 //visit urls 223 //visit urls
210 - $visit_urls = $this->getUrls($inquiry_detail['is_v6'], $inquiry_detail['website'], $inquiry_detail['email']);  
211 $inquiry_url = json_decode($inquiry_detail['urls'], true); 224 $inquiry_url = json_decode($inquiry_detail['urls'], true);
212 - $urls = array_merge($visit_urls, $inquiry_url); 225 + if (in_array($inquiry_detail['website'], $this->xp_websites)) {
  226 + //芯片网站无需模拟访问,直接发送询盘
  227 + $urls = $inquiry_url;
  228 + } else {
  229 + $visit_urls = $this->getUrls($inquiry_detail['is_v6'], $inquiry_detail['website'], $inquiry_detail['email']);
  230 + $urls = array_merge($visit_urls, $inquiry_url);
  231 + }
213 232
214 //lang 233 //lang
215 if (is_numeric($inquiry_detail['message'])) { //数字会被识别为中文 234 if (is_numeric($inquiry_detail['message'])) { //数字会被识别为中文
@@ -303,8 +322,8 @@ class RelayInquiryForward extends Command @@ -303,8 +322,8 @@ class RelayInquiryForward extends Command
303 $all_urls = array_merge($urls, $product_url, $product_cate_url, $keywords_url, $page_url); 322 $all_urls = array_merge($urls, $product_url, $product_cate_url, $keywords_url, $page_url);
304 323
305 if (count($all_urls) > 1) { 324 if (count($all_urls) > 1) {
306 - // 随机访问1-6个页面  
307 - $deep = rand(1, 6); 325 + // 随机访问1-5个页面
  326 + $deep = rand(1, 5);
308 $visit_urls = Arr::random($all_urls, $deep > count($all_urls) ? count($all_urls) : $deep); 327 $visit_urls = Arr::random($all_urls, $deep > count($all_urls) ? count($all_urls) : $deep);
309 $urls = array_merge($urls, $visit_urls); 328 $urls = array_merge($urls, $visit_urls);
310 } 329 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 namespace App\Console\Commands\Inquiry; 9 namespace App\Console\Commands\Inquiry;
10 10
11 use App\Helper\Translate; 11 use App\Helper\Translate;
  12 +use App\Helper\Validate;
12 use App\Models\Inquiry\InquiryInfo; 13 use App\Models\Inquiry\InquiryInfo;
13 use App\Services\InquiryRelayService; 14 use App\Services\InquiryRelayService;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
@@ -43,7 +44,9 @@ class SyncInquiryRelay extends Command @@ -43,7 +44,9 @@ class SyncInquiryRelay extends Command
43 44
44 public function handle() 45 public function handle()
45 { 46 {
  47 + $this->output('开始同步表单系统询盘');
46 $this->getInquiryForm(); 48 $this->getInquiryForm();
  49 + $this->output('开始同步asp采集询盘');
47 $this->getInquirySzcm(); 50 $this->getInquirySzcm();
48 } 51 }
49 52
@@ -62,6 +65,9 @@ class SyncInquiryRelay extends Command @@ -62,6 +65,9 @@ class SyncInquiryRelay extends Command
62 //+86区号过滤 65 //+86区号过滤
63 continue; 66 continue;
64 } 67 }
  68 + if (strpos($item['refer'], 'findsupply.com') !== false) {
  69 + $item['source_type'] = InquiryInfo::TYPE_FIND_SUPPLY;
  70 + }
65 $this->saveDate($item, $item['source_type']); 71 $this->saveDate($item, $item['source_type']);
66 } 72 }
67 } 73 }
@@ -162,7 +168,20 @@ class SyncInquiryRelay extends Command @@ -162,7 +168,20 @@ class SyncInquiryRelay extends Command
162 $data['image'] = ''; 168 $data['image'] = '';
163 } 169 }
164 170
165 - $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image']); 171 + //判断手机和邮箱是否有效
  172 + $email_status = 0;
  173 + if ($data['email']) {
  174 + $check_email = Validate::email($data['email']);
  175 + $email_status = $check_email ? 1 : 0;
  176 + }
  177 + $phone_status = 0;
  178 + if ($data['phone']) {
  179 + $num_phone = preg_replace('/\D/', '', $data['phone']) ?? ''; // \D 匹配所有非数字字符
  180 + $check_phone = Validate::phone($num_phone);
  181 + $phone_status = $check_phone ? 1 : 0;
  182 + }
  183 +
  184 + $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image'], $email_status, $phone_status);
166 return true; 185 return true;
167 } 186 }
168 187
@@ -184,4 +203,9 @@ class SyncInquiryRelay extends Command @@ -184,4 +203,9 @@ class SyncInquiryRelay extends Command
184 } 203 }
185 return $ip; 204 return $ip;
186 } 205 }
  206 +
  207 + public function output($message)
  208 + {
  209 + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL;
  210 + }
187 } 211 }
@@ -209,6 +209,7 @@ class DownloadProject extends Command @@ -209,6 +209,7 @@ class DownloadProject extends Command
209 // } 209 // }
210 210
211 public function workChatMessage($data,$project_id){ 211 public function workChatMessage($data,$project_id){
  212 + $data['main_lang_id'] = 8;
212 $arr = []; 213 $arr = [];
213 $content = ''; 214 $content = '';
214 $content1 = ''; 215 $content1 = '';
@@ -223,10 +224,12 @@ class DownloadProject extends Command @@ -223,10 +224,12 @@ class DownloadProject extends Command
223 $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true); 224 $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
224 $country = ''; 225 $country = '';
225 foreach ($data['inquiry_country'] as $k => $v){ 226 foreach ($data['inquiry_country'] as $k => $v){
226 - $country .= $k.''; 227 + $country .= $k.',';
227 }; 228 };
228 - $country = trim($country,'、');  
229 - $content1 .= '询盘主要来源于'.$country.'等国家地区'; 229 + $country = trim($country,',');
  230 + if(!empty($country)){
  231 + $content1 .= '询盘主要来源于'.$country.'等国家地区';
  232 + }
230 } 233 }
231 $content1 .= '如有高质量客户,请您密切关注与跟进;'; 234 $content1 .= '如有高质量客户,请您密切关注与跟进;';
232 } 235 }
@@ -236,14 +239,27 @@ class DownloadProject extends Command @@ -236,14 +239,27 @@ class DownloadProject extends Command
236 $content2 = ''; 239 $content2 = '';
237 if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){ 240 if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
238 $content2 .= '项目截止目前'; 241 $content2 .= '项目截止目前';
  242 + if($data['main_lang_id'] == 8){
  243 + $title = 'Yandex';
  244 + }else{
  245 + $title = '谷歌';
  246 + }
239 if(!empty($data['google_indexed_num'])){ 247 if(!empty($data['google_indexed_num'])){
240 - $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,'; 248 + $content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
241 } 249 }
242 if(!empty($data['google_links_num'])){ 250 if(!empty($data['google_links_num'])){
243 - $content2 .= '外链量:'.$data['google_links_num'].'条,'; 251 + //获取上一次的外链数
  252 + $latestRecord = V6WeeklyReport::where(['project_id'=>$project_id])->orderBy('id', 'desc')->first();
  253 + if(!empty($latestRecord)){
  254 + if($latestRecord['google_links_num'] != $data['google_links_num']){
  255 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  256 + }
  257 + }else{
  258 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  259 + }
244 } 260 }
245 if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){ 261 if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
246 - $content2 .= '谷歌搜索排名'; 262 + $content2 .= $title.'搜索排名';
247 if(!empty($data['keyword_home_num'])){ 263 if(!empty($data['keyword_home_num'])){
248 $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,'; 264 $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
249 } 265 }
@@ -285,10 +301,12 @@ class DownloadProject extends Command @@ -285,10 +301,12 @@ class DownloadProject extends Command
285 $content3 .= '新闻:'.$data['week_news_num'].'条。'; 301 $content3 .= '新闻:'.$data['week_news_num'].'条。';
286 } 302 }
287 } 303 }
  304 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
288 } 305 }
289 - $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';  
290 - $arr[] = $content3;  
291 - $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'; 306 + if(!empty($content3)){
  307 + $arr[] = $content3;
  308 + }
  309 + $content4 = '';
292 if(!empty($data['main_update_num'])){ 310 if(!empty($data['main_update_num'])){
293 $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。'; 311 $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
294 } 312 }
@@ -304,17 +322,29 @@ class DownloadProject extends Command @@ -304,17 +322,29 @@ class DownloadProject extends Command
304 if(!empty($data['aggregation_minor_update_num'])){ 322 if(!empty($data['aggregation_minor_update_num'])){
305 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。'; 323 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
306 } 324 }
307 - $arr[] = $content4; 325 + if(!empty($content4)){
  326 + $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;
  327 + }
  328 + if(!empty($content4)){
  329 + $arr[] = $content4;
  330 + }
  331 + if(empty($arr)){
  332 + return true;
  333 + }
308 foreach ($arr as $key => $val){ 334 foreach ($arr as $key => $val){
309 - $content .= ($key+1).','.$val."\n"; 335 + $content .= ($key+1).','.$val.PHP_EOL;
310 } 336 }
311 $timestamp = strtotime('tomorrow 9:00 AM'); 337 $timestamp = strtotime('tomorrow 9:00 AM');
312 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp); 338 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
  339 + if(empty($content)){
  340 + return true;
  341 + }
  342 + $tips = 'Tips:'.PHP_EOL.'1、全球搜V6.0系统提供网页TDK、H标签、Img标签等用户自定义编辑接口且辅以AI创作工具,用户可进一步对相关优化设置进行精细化优化与调整;'.PHP_EOL.'2、全球搜V6.0系统提供小语种页面精准校对翻译功能,用户可进一步对已翻译小语种页面进行人工翻译校对;'.PHP_EOL.'3、全球搜V6.0系统支持绑定Facebook、LinkedIn、X(原Twitter)等社媒账号,可一键同步转发网站上发布的产品和新闻至社媒账号动态,建议用户用起来哦;'.PHP_EOL.'4、如用户有较丰富的企业、产品、服务相关视频素材,全球搜建议用户及时创建YouTube主页,并在YouTube和网站相关网页上同步发布视频;';
313 $param = [ 343 $param = [
314 'project_id'=>$project_id, 344 'project_id'=>$project_id,
315 'friend_id'=>17667, 345 'friend_id'=>17667,
316 'type'=>MessagePush::TYPE_WEEK, 346 'type'=>MessagePush::TYPE_WEEK,
317 - 'content'=>"【全球搜V6.0周报】--项目id:$project_id"."\n".$content, 347 + 'content'=>"【全球搜V6.0周报】--项目id:$project_id".PHP_EOL.$content.PHP_EOL.$tips,
318 'ref_ids'=>'', 348 'ref_ids'=>'',
319 'send_time'=>$tomorrowNineAM, 349 'send_time'=>$tomorrowNineAM,
320 'status'=>0, 350 'status'=>0,
@@ -323,5 +353,6 @@ class DownloadProject extends Command @@ -323,5 +353,6 @@ class DownloadProject extends Command
323 $messagePushModel = new MessagePush(); 353 $messagePushModel = new MessagePush();
324 $messagePushModel->add($param); 354 $messagePushModel->add($param);
325 echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL; 355 echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL;
  356 + return true;
326 } 357 }
327 } 358 }
@@ -13,6 +13,8 @@ use App\Models\CustomModule\CustomModuleCategory; @@ -13,6 +13,8 @@ use App\Models\CustomModule\CustomModuleCategory;
13 use App\Models\CustomModule\CustomModuleContent; 13 use App\Models\CustomModule\CustomModuleContent;
14 use App\Models\CustomModule\CustomModuleExtentContent; 14 use App\Models\CustomModule\CustomModuleExtentContent;
15 use App\Models\News\News; 15 use App\Models\News\News;
  16 +use App\Models\Product\Category;
  17 +use App\Models\Product\Product;
16 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
17 use App\Models\Template\BTemplate; 19 use App\Models\Template\BTemplate;
18 use App\Models\Template\Template; 20 use App\Models\Template\Template;
@@ -36,7 +38,7 @@ class LyhImportTest extends Command @@ -36,7 +38,7 @@ class LyhImportTest extends Command
36 */ 38 */
37 protected $description = '导入数据'; 39 protected $description = '导入数据';
38 40
39 - public $data = ''; 41 +
40 42
41 /** 43 /**
42 * @remark :统一更新路由 44 * @remark :统一更新路由
@@ -46,15 +48,87 @@ class LyhImportTest extends Command @@ -46,15 +48,87 @@ class LyhImportTest extends Command
46 * @time :2023/11/20 15:13 48 * @time :2023/11/20 15:13
47 */ 49 */
48 public function handle(){ 50 public function handle(){
49 - ProjectServer::useProject(2385); 51 + ProjectServer::useProject(3283);
50 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 52 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
51 -// $this->importCustomModule($this->data);  
52 - $this->newsImportCustom(); 53 + $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283);
53 DB::disconnect('custom_mysql'); 54 DB::disconnect('custom_mysql');
54 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 55 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
55 } 56 }
56 57
57 /** 58 /**
  59 + * @remark :导入分类
  60 + * @name :importProductCategory
  61 + * @author :lyh
  62 + * @method :post
  63 + * @time :2025/3/3 15:59
  64 + */
  65 + public function importProduct($url,$project_id){
  66 + $line_of_text = [];
  67 + $opts = [
  68 + 'http' => [
  69 + 'method' => 'GET',
  70 + 'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
  71 + ],
  72 + 'ssl' => [
  73 + 'verify_peer' => false,
  74 + 'verify_peer_name' => false
  75 + ]
  76 + ];
  77 + $file_handle = fopen($url, 'r', null, stream_context_create($opts));
  78 + while (!feof($file_handle)) {
  79 + $line_of_text[] = fgetcsv($file_handle, 0, ',');
  80 + }
  81 + fclose($file_handle);
  82 + $cateModel = new Category();
  83 + $productModel = new Product();
  84 + foreach ($line_of_text as $k => $val){
  85 + if($k < 2){
  86 + continue;
  87 + }
  88 + $saveData = [];
  89 + if($val[1] ?? ''){
  90 + $saveData['title'] = $val[1];
  91 + }else{
  92 + continue;
  93 + }
  94 + if($val[0] ?? ''){
  95 + $cateInfo = $cateModel->read(['seo_title'=>trim($val[0])]);
  96 + if($cateInfo !== false){
  97 + $saveData['category_id'] = $cateInfo['id'];
  98 + }
  99 + }
  100 + $saveData['intro'] = $val[2];
  101 + $saveData['content'] = $val[3];
  102 + $seo = ['seo_title'=>$val[5]];
  103 + $saveData['seo_mate'] = json_encode($seo,true);
  104 + $thumb = ['alt'=>'主图','url'=>str_replace('/public','',$val[6])];
  105 + $gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]];
  106 + $saveData['thumb'] = json_encode($thumb,true);
  107 + $saveData['gallery'] = json_encode($gallery,true);
  108 + }
  109 + }
  110 +
  111 + public function handleCatePid(){
  112 + $cateModel = new Category();
  113 + $list = $cateModel->list([],'id',['*'],'asc');
  114 + foreach ($list as $k => $v){
  115 + if($v['seo_des'] == 0){
  116 + $pid = 0;
  117 + }else{
  118 + $info = $cateModel->read(['seo_title'=>$v['seo_des']],['id']);
  119 + if($info !== false){
  120 + $pid = $info['id'];
  121 + }else{
  122 + $pid = 0;
  123 + }
  124 + }
  125 + //更新pid
  126 + $cateModel->edit(['pid'=>$pid],['id'=>$v['id']]);
  127 + }
  128 + return true;
  129 + }
  130 +
  131 + /**
58 * @remark :导入扩展模块数据 132 * @remark :导入扩展模块数据
59 * @name :importCustomModule 133 * @name :importCustomModule
60 * @author :lyh 134 * @author :lyh
@@ -206,7 +206,6 @@ class CopyProject extends Command @@ -206,7 +206,6 @@ class CopyProject extends Command
206 } 206 }
207 return true; 207 return true;
208 } 208 }
209 -  
210 //复制数据库 209 //复制数据库
211 public function copyMysql($project_id,$new_project_id){ 210 public function copyMysql($project_id,$new_project_id){
212 //切换数据库配置 211 //切换数据库配置
@@ -267,7 +266,6 @@ class CopyProject extends Command @@ -267,7 +266,6 @@ class CopyProject extends Command
267 } 266 }
268 return true; 267 return true;
269 } 268 }
270 -  
271 /** 269 /**
272 * @param $message 270 * @param $message
273 * @return bool 271 * @return bool
@@ -9,9 +9,11 @@ @@ -9,9 +9,11 @@
9 9
10 namespace App\Console\Commands\ProjectWeeklyReport; 10 namespace App\Console\Commands\ProjectWeeklyReport;
11 11
  12 +use App\Helper\FormGlobalsoApi;
12 use App\Models\Blog\Blog; 13 use App\Models\Blog\Blog;
13 use App\Models\Com\Notify; 14 use App\Models\Com\Notify;
14 use App\Models\Com\V6WeeklyReport; 15 use App\Models\Com\V6WeeklyReport;
  16 +use App\Models\Domain\DomainInfo;
15 use App\Models\HomeCount\Count; 17 use App\Models\HomeCount\Count;
16 use App\Models\News\News; 18 use App\Models\News\News;
17 use App\Models\Product\Product; 19 use App\Models\Product\Product;
@@ -52,9 +54,16 @@ class WeekProject extends Command @@ -52,9 +54,16 @@ class WeekProject extends Command
52 */ 54 */
53 public function handle(){ 55 public function handle(){
54 $projectModel = new Project(); 56 $projectModel = new Project();
55 - $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']); 57 + $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title','is_weekly_report','main_lang_id']);
  58 + $domainModel = new DomainInfo();
56 foreach ($list as $k => $v){ 59 foreach ($list as $k => $v){
57 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  61 + $domainInfo = $domainModel->read(['project_id'=>$v['id']]);
  62 + if($domainInfo === false){
  63 + echo date('Y-m-d H:i:s') . '域名不存在,跳过:'.$v['title'] . PHP_EOL;
  64 + continue;
  65 + }
  66 + $v['domain'] = $domainInfo['domain'];
58 ProjectServer::useProject($v['id']); 67 ProjectServer::useProject($v['id']);
59 $this->weekData($v); 68 $this->weekData($v);
60 DB::disconnect('custom_mysql'); 69 DB::disconnect('custom_mysql');
@@ -74,6 +83,7 @@ class WeekProject extends Command @@ -74,6 +83,7 @@ class WeekProject extends Command
74 $data = [ 83 $data = [
75 'project_id'=>$value['id'], 84 'project_id'=>$value['id'],
76 'title'=>$value['title'], 85 'title'=>$value['title'],
  86 + 'main_lang_id'=>$value['main_lang_id'],
77 ]; 87 ];
78 // 上一周的开始时间(周一 00:00:00) 88 // 上一周的开始时间(周一 00:00:00)
79 $startOfLastWeek = strtotime("last week monday"); 89 $startOfLastWeek = strtotime("last week monday");
@@ -84,11 +94,18 @@ class WeekProject extends Command @@ -84,11 +94,18 @@ class WeekProject extends Command
84 $data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek); 94 $data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek);
85 $countModel = new Count(); 95 $countModel = new Count();
86 $startOfThisWeek = date('Y-m-d', strtotime("monday this week")); 96 $startOfThisWeek = date('Y-m-d', strtotime("monday this week"));
87 - $startOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']);  
88 $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfThisWeek,'project_id'=>$value['id']],['inquiry_num','country']); 97 $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfThisWeek,'project_id'=>$value['id']],['inquiry_num','country']);
89 - $data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量  
90 - $data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]);  
91 - $data['week_inquiry_total'] = ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0); 98 + $data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘总数量
  99 + $data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]);//询盘国家
  100 + //获取上一周询盘数量
  101 + $result = (new FormGlobalsoApi())->getDateInquiry($value['domain'],$data['start_date'],$data['end_date']);
  102 + if(isset($result['status'])){
  103 + $data['week_inquiry_total'] = $result['data'];
  104 + echo date('Y-m-d H:i:s') . '项目id:'.$value['id'].',域名:'.$value['domain'].',上周询盘数量data:'.$result['data'] . PHP_EOL;
  105 + }else{
  106 + $data['week_inquiry_total'] = 0;
  107 + echo date('Y-m-d H:i:s') . '项目id:'.$value['id'].',域名:'.$value['domain'].',请求询盘错误。' . PHP_EOL;
  108 + }
92 $rankDataModel = new RankData(); 109 $rankDataModel = new RankData();
93 $rankInfo = $rankDataModel->read(['project_id'=>$value['id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']); 110 $rankInfo = $rankDataModel->read(['project_id'=>$value['id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']);
94 $data['google_indexed_num'] = $rankInfo['indexed_pages_num'] ?? 0; 111 $data['google_indexed_num'] = $rankInfo['indexed_pages_num'] ?? 0;
@@ -115,13 +132,15 @@ class WeekProject extends Command @@ -115,13 +132,15 @@ class WeekProject extends Command
115 //日均访问量 132 //日均访问量
116 $data['daily_average_num'] = 0; 133 $data['daily_average_num'] = 0;
117 $pv_num_count = $countModel->where('project_id',$value['id'])->whereBetween('date', [$startOfLastWeekFormatted,$endOfLastWeekFormatted])->sum('pv_num'); 134 $pv_num_count = $countModel->where('project_id',$value['id'])->whereBetween('date', [$startOfLastWeekFormatted,$endOfLastWeekFormatted])->sum('pv_num');
118 - echo date('Y-m-d H:i:s') . 'pv总量:'.$pv_num_count . PHP_EOL;  
119 if($pv_num_count != 0){ 135 if($pv_num_count != 0){
120 $data['daily_average_num'] = round($pv_num_count / 7,2); 136 $data['daily_average_num'] = round($pv_num_count / 7,2);
121 } 137 }
  138 +
  139 + if(isset($value['is_weekly_report']) && $value['is_weekly_report'] != 0){
  140 + $this->workChatMessage($data,$value['id']);
  141 + }
122 $v6WeeklyReportModel = new V6WeeklyReport(); 142 $v6WeeklyReportModel = new V6WeeklyReport();
123 $v6WeeklyReportModel->add($data); 143 $v6WeeklyReportModel->add($data);
124 - $this->workChatMessage($data,$value['id']);  
125 return true; 144 return true;
126 } 145 }
127 146
@@ -143,6 +162,7 @@ class WeekProject extends Command @@ -143,6 +162,7 @@ class WeekProject extends Command
143 echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL; 162 echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
144 return false; 163 return false;
145 } 164 }
  165 + $content = '';
146 $content1 = ''; 166 $content1 = '';
147 if(!empty($data['inquiry_total'])){ 167 if(!empty($data['inquiry_total'])){
148 $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,'; 168 $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
@@ -150,15 +170,17 @@ class WeekProject extends Command @@ -150,15 +170,17 @@ class WeekProject extends Command
150 $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。'; 170 $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
151 } 171 }
152 if(!empty($data['inquiry_country'])){ 172 if(!empty($data['inquiry_country'])){
153 - $data['inquiry_country'] = json_decode($data['inquiry_country']);  
154 - arsort($data);  
155 - $data['inquiry_country'] = array_slice($data, 0, 4, true); 173 + $data['inquiry_country'] = json_decode($data['inquiry_country'],true);
  174 + arsort($data['inquiry_country']);
  175 + $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
156 $country = ''; 176 $country = '';
157 foreach ($data['inquiry_country'] as $k => $v){ 177 foreach ($data['inquiry_country'] as $k => $v){
158 - $country .= $k.''; 178 + $country .= $k.',';
159 }; 179 };
160 - $country = trim($country,'、');  
161 - $content1 .= '询盘主要来源于'.$country.'等国家地区'; 180 + $country = trim($country,',');
  181 + if(!empty($country)){
  182 + $content1 .= '询盘主要来源于'.$country.'等国家地区。';
  183 + }
162 } 184 }
163 $content1 .= '如有高质量客户,请您密切关注与跟进;'; 185 $content1 .= '如有高质量客户,请您密切关注与跟进;';
164 } 186 }
@@ -168,14 +190,27 @@ class WeekProject extends Command @@ -168,14 +190,27 @@ class WeekProject extends Command
168 $content2 = ''; 190 $content2 = '';
169 if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){ 191 if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
170 $content2 .= '项目截止目前'; 192 $content2 .= '项目截止目前';
  193 + if($data['main_lang_id'] == 8){
  194 + $title = 'Yandex';
  195 + }else{
  196 + $title = '谷歌';
  197 + }
171 if(!empty($data['google_indexed_num'])){ 198 if(!empty($data['google_indexed_num'])){
172 - $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,'; 199 + $content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';
173 } 200 }
174 if(!empty($data['google_links_num'])){ 201 if(!empty($data['google_links_num'])){
175 - $content2 .= '外链量:'.$data['google_links_num'].'条,'; 202 + //获取上一次的外链数
  203 + $latestRecord = V6WeeklyReport::where(['project_id'=>$project_id])->orderBy('id', 'desc')->first();
  204 + if(!empty($latestRecord)){
  205 + if($latestRecord['google_links_num'] != $data['google_links_num']){
  206 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  207 + }
  208 + }else{
  209 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  210 + }
176 } 211 }
177 if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){ 212 if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
178 - $content2 .= '谷歌搜索排名'; 213 + $content2 .= $title.'搜索排名';
179 if(!empty($data['keyword_home_num'])){ 214 if(!empty($data['keyword_home_num'])){
180 $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,'; 215 $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
181 } 216 }
@@ -217,10 +252,12 @@ class WeekProject extends Command @@ -217,10 +252,12 @@ class WeekProject extends Command
217 $content3 .= '新闻:'.$data['week_news_num'].'条。'; 252 $content3 .= '新闻:'.$data['week_news_num'].'条。';
218 } 253 }
219 } 254 }
  255 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
220 } 256 }
221 - $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';  
222 - $arr[] = $content3;  
223 - $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'; 257 + if(!empty($content3)){
  258 + $arr[] = $content3;
  259 + }
  260 + $content4 = '';
224 if(!empty($data['main_update_num'])){ 261 if(!empty($data['main_update_num'])){
225 $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。'; 262 $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
226 } 263 }
@@ -236,23 +273,36 @@ class WeekProject extends Command @@ -236,23 +273,36 @@ class WeekProject extends Command
236 if(!empty($data['aggregation_minor_update_num'])){ 273 if(!empty($data['aggregation_minor_update_num'])){
237 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。'; 274 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
238 } 275 }
239 - $arr[] = $content4; 276 + if(!empty($content4)){
  277 + $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;
  278 + }
  279 + if(!empty($content4)){
  280 + $arr[] = $content4;
  281 + }
  282 + if(empty($arr)){
  283 + return true;
  284 + }
240 foreach ($arr as $key => $val){ 285 foreach ($arr as $key => $val){
241 - $content .= ($key + 1) .','.$val.PHP_EOL; 286 + $content .= ($key+1).','.$val.PHP_EOL;
242 } 287 }
243 $timestamp = strtotime('tomorrow 9:00 AM'); 288 $timestamp = strtotime('tomorrow 9:00 AM');
244 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp); 289 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
  290 + if(empty($content)){
  291 + return true;
  292 + }
  293 + $tips = 'Tips:'.PHP_EOL.'1、全球搜V6.0系统提供网页TDK、H标签、Img标签等用户自定义编辑接口且辅以AI创作工具,用户可进一步对相关优化设置进行精细化优化与调整;'.PHP_EOL.'2、全球搜V6.0系统提供小语种页面精准校对翻译功能,用户可进一步对已翻译小语种页面进行人工翻译校对;'.PHP_EOL.'3、全球搜V6.0系统支持绑定Facebook、LinkedIn、X(原Twitter)等社媒账号,可一键同步转发网站上发布的产品和新闻至社媒账号动态,建议用户用起来哦;'.PHP_EOL.'4、如用户有较丰富的企业、产品、服务相关视频素材,全球搜建议用户及时创建YouTube主页,并在YouTube和网站相关网页上同步发布视频;';
245 $param = [ 294 $param = [
246 'project_id'=>$project_id, 295 'project_id'=>$project_id,
247 'friend_id'=>$friend_id, 296 'friend_id'=>$friend_id,
248 'type'=>MessagePush::TYPE_WEEK, 297 'type'=>MessagePush::TYPE_WEEK,
249 - 'content'=>'【全球搜V6.0周报】'.PHP_EOL.$content, 298 + 'content'=>"【全球搜V6.0周报】".PHP_EOL.$content.PHP_EOL.$tips,
250 'ref_ids'=>'', 299 'ref_ids'=>'',
251 - 'send_time'=>$tomorrowNineAM 300 + 'send_time'=>$tomorrowNineAM,
  301 + 'status'=>0,
252 ]; 302 ];
253 //写入一条推送消息 自动消费 303 //写入一条推送消息 自动消费
254 $messagePushModel = new MessagePush(); 304 $messagePushModel = new MessagePush();
255 - echo date('Y-m-d H:i:s') . '生成推送消息:'.$project_id . PHP_EOL;  
256 - return $messagePushModel->add($param); 305 + $messagePushModel->add($param);
  306 + return true;
257 } 307 }
258 } 308 }
@@ -9,10 +9,8 @@ use App\Models\Devops\ServersIp; @@ -9,10 +9,8 @@ use App\Models\Devops\ServersIp;
9 use App\Models\Domain\DomainCreateTask; 9 use App\Models\Domain\DomainCreateTask;
10 use App\Models\Domain\DomainInfo; 10 use App\Models\Domain\DomainInfo;
11 use App\Models\Product\Keyword; 11 use App\Models\Product\Keyword;
12 -use App\Models\Product\KeywordRelated;  
13 -use App\Models\Product\Product; 12 +use App\Models\Project\DeployBuild;
14 use App\Models\Project\Project; 13 use App\Models\Project\Project;
15 -use App\Models\Project\ProjectUpdateTdk;  
16 use App\Models\WebSetting\WebLanguage; 14 use App\Models\WebSetting\WebLanguage;
17 use App\Services\BatchExportService; 15 use App\Services\BatchExportService;
18 use App\Services\ProjectServer; 16 use App\Services\ProjectServer;
@@ -37,9 +35,76 @@ class Temp extends Command @@ -37,9 +35,76 @@ class Temp extends Command
37 35
38 public function handle() 36 public function handle()
39 { 37 {
  38 + $this->domain_rewrite_https();
  39 + }
  40 +
  41 + /**
  42 + * 小语种为二级目录的项目强制跳转https
  43 + * @author Akun
  44 + * @date 2025/03/01 10:48
  45 + */
  46 + public function domain_rewrite_https()
  47 + {
  48 + $domainModel = new DomainInfo();
  49 + $projectModel = new Project();
  50 + $buildModel = new DeployBuild();
  51 + $serverIpModel = new ServersIp();
  52 + $domainCreateTaskModel = new DomainCreateTask();
  53 + $list = $domainModel->select(['id', 'domain', 'project_id'])->where('status', '=', 1)->where('project_id', '>', 0)->get();
  54 + foreach ($list as $v) {
  55 + $project_info = $projectModel->read(['id' => $v['project_id']], ['serve_id']);
  56 + if (!$project_info) {
  57 + continue;
  58 + }
  59 +
  60 + $build_info = $buildModel->read(['project_id' => $v['project_id']], ['linking_format']);
  61 + if (!$build_info) {
  62 + continue;
  63 + }
  64 + if ($build_info['linking_format'] != 1) {
  65 + continue;
  66 + }
  67 +
  68 + $servers_ip_info = $serverIpModel->read(['id' => $project_info['serve_id']], ['servers_id', 'ip', 'domain']);
  69 + if (!$servers_ip_info) {
  70 + continue;
  71 + }
  72 +
  73 + //过滤测试项目域名
  74 + if ($servers_ip_info['servers_id'] == ServerConfig::SELF_TEST_ID) {
  75 + continue;
  76 + }
  77 +
  78 + //过滤自建站项目域名
  79 + if ($servers_ip_info['servers_id'] == ServerConfig::SELF_SITE_ID) {
  80 + continue;
  81 + }
  82 +
  83 + //过滤已解析到别的ip的域名
  84 + if (!check_domain_record($v['domain'], $servers_ip_info)) {
  85 + continue;
  86 + }
  87 +
  88 + //强制跳转https
  89 + $v->is_https = 1;
  90 + $v->save();
  91 +
  92 + //创建更新站点证书任务
  93 + $task_info = $domainCreateTaskModel->read(['type' => DomainCreateTask::TYPE_MAIN, 'domain_id' => $v['id'], 'status' => ['<', DomainCreateTask::STATUS_SUC]]);
  94 + if (!$task_info) {
  95 + $domainCreateTaskModel->add([
  96 + 'server_id' => $servers_ip_info['servers_id'],
  97 + 'project_id' => $v['project_id'],
  98 + 'domain_id' => $v['id'],
  99 + 'type' => DomainCreateTask::TYPE_MAIN
  100 + ]);
  101 + }
40 102
  103 + $this->output($v['id'] . ' , success');
  104 + }
41 } 105 }
42 106
  107 +
43 /** 108 /**
44 * 240服务器上解析cname的项目迁移 109 * 240服务器上解析cname的项目迁移
45 * @author Akun 110 * @author Akun
@@ -128,42 +193,6 @@ class Temp extends Command @@ -128,42 +193,6 @@ class Temp extends Command
128 } 193 }
129 194
130 /** 195 /**
131 - * 2025-02-05 日以来的项目,重写tdk(keyword_title)  
132 - * @author Akun  
133 - * @date 2025/02/15 10:58  
134 - */  
135 - public function product_keyword_rewrite()  
136 - {  
137 - $products = ProjectUpdateTdk::where('created_at', '>=', '2025-02-05 00:00:00')->pluck('project_id')->toArray();  
138 - $products_ids = array_unique($products);  
139 -  
140 - $success_json = file_get_contents(storage_path('logs/lk/success.log'));  
141 - $success = json_decode($success_json, true) ?: [];  
142 -  
143 - foreach ($products_ids as $project_id) {  
144 - if (in_array($project_id, $success)) {  
145 - $this->output($project_id . ' | 已执行,跳过');  
146 - continue;  
147 - }  
148 -  
149 - ProjectServer::useProject($project_id);  
150 - DB::connection('custom_mysql')->table('gl_product_keyword')->update(['keyword_title' => '']);  
151 -  
152 - try {  
153 - ProjectUpdateTdk::add_task($project_id);  
154 - } catch (\Exception $e) {  
155 - $this->output($project_id . ' | ' . $e->getMessage());  
156 - }  
157 -  
158 - DB::disconnect('custom_mysql');  
159 - array_push($success, $project_id);  
160 - file_put_contents(storage_path('logs/lk/success.log'), json_encode($success));  
161 - }  
162 -  
163 - $this->output('success');  
164 - }  
165 -  
166 - /**  
167 * 创建所有站点建站任务 196 * 创建所有站点建站任务
168 * @author Akun 197 * @author Akun
169 * @date 2025/01/27 9:48 198 * @date 2025/01/27 9:48
@@ -386,33 +415,6 @@ class Temp extends Command @@ -386,33 +415,6 @@ class Temp extends Command
386 } 415 }
387 } 416 }
388 417
389 -  
390 - /**  
391 - * 关联所有项目关键词  
392 - * @author Akun  
393 - * @date 2024/11/18 15:07  
394 - */  
395 - public function relation_all_keywords()  
396 - {  
397 - $projects = Project::select(['id'])->orderBy('id', 'asc')->get();  
398 - foreach ($projects as $project) {  
399 - ProjectServer::useProject($project->id);  
400 -  
401 - try {  
402 - Product::select(['id', 'keyword_id'])->chunk(1000, function ($query) {  
403 - foreach ($query as $item) {  
404 - KeywordRelated::saveRelated($item->id, $item->keyword_id);  
405 - }  
406 - });  
407 - } catch (\Exception $e) {  
408 - $this->output($e->getMessage());  
409 - continue;  
410 - }  
411 -  
412 - $this->output('ID:' . $project->id . ',success');  
413 - }  
414 - }  
415 -  
416 /** 418 /**
417 * 获取指定服务器所有项目 419 * 获取指定服务器所有项目
418 * @author Akun 420 * @author Akun
@@ -692,66 +694,6 @@ class Temp extends Command @@ -692,66 +694,6 @@ class Temp extends Command
692 } 694 }
693 } 695 }
694 696
695 - /**  
696 - * 创建指定项目聚合页生成任务  
697 - * @author Akun  
698 - * @date 2025/02/11 13:50  
699 - */  
700 - public function create_update_keyword_page()  
701 - {  
702 - $ids_arr = ["46", "83", "91", "150", "190", "206", "219", "221", "232", "233", "238", "287", "290", "299", "319", "321", "353", "356", "388", "389", "456", "457", "475", "491", "518", "535", "554", "600", "624", "650", "728", "732", "783", "807", "835", "881", "896", "913", "947", "1001", "1320", "1336", "1373", "1424", "1442", "1455", "1466", "1505", "1584", "1597", "1617", "1682", "1770", "1816", "1824", "1835", "1860", "1870", "1896", "1913", "1989", "1991", "1992", "2022", "2037", "2059", "2060", "2062", "2104", "2115", "2129", "2131", "2135", "2191", "2204", "2217", "2245", "2257", "2287", "2309", "2313", "2330", "2336", "2337", "2338", "2351", "2391", "2418", "2423", "2435", "2462", "2496", "2504", "2505", "2660", "2768", "2811", "2874", "3157"];  
703 - $project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get();  
704 -  
705 - $domain_model = new DomainInfo();  
706 - $notify_model = new Notify();  
707 - $server_ip_model = new ServersIp();  
708 -  
709 - foreach ($project_list as $value) {  
710 - $project_id = $value->id;  
711 -  
712 - $domain_info = $domain_model->read(['project_id' => $project_id, 'status' => 1], ['id', 'domain']);  
713 - if (!$domain_info) {  
714 - //过滤未绑定正式域名的项目  
715 - continue;  
716 - }  
717 - $domain = $domain_info['domain'];  
718 -  
719 - //获取项目所在服务器  
720 - $serve_ip_info = $server_ip_model->read(['id' => $value->serve_id], ['domain', 'ip', 'servers_id']);  
721 - if (!$serve_ip_info) {  
722 - $this->output('项目id:' . $project_id . ' | 未查询到服务器数据');  
723 - continue;  
724 - }  
725 -  
726 - if ($serve_ip_info['servers_id'] != ServerConfig::SELF_SITE_ID) {  
727 - if (!check_domain_record($domain, $serve_ip_info)) {  
728 - $this->output('项目id:' . $project_id . ', domain:' . $domain . ' | 未解析到目标服务器');  
729 - continue;  
730 - }  
731 - }  
732 -  
733 -  
734 - $data = [  
735 - 'project_id' => $project_id,  
736 - 'type' => 1,  
737 - 'route' => 4,  
738 - 'server_id' => $serve_ip_info['servers_id'],  
739 - 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP]  
740 - ];  
741 - $notify = $notify_model->read($data, ['id']);  
742 -  
743 - if (!$notify) {  
744 - $data['data'] = Arr::a2s(['domain' => $domain, 'url' => null, 'language' => []]);  
745 - $data['status'] = Notify::STATUS_INIT;  
746 - if ($serve_ip_info['servers_id'] == 2) {  
747 - $data['is_pull_html_zip'] = Notify::IS_PULL_HTML_ZIP_TRUE;  
748 - }  
749 - $notify_model->add($data);  
750 -  
751 - $this->output('项目id:' . $project_id . ', domain:' . $domain . ' | success');  
752 - }  
753 - }  
754 - }  
755 697
756 public function output($msg) 698 public function output($msg)
757 { 699 {
@@ -209,7 +209,29 @@ class FormGlobalsoApi @@ -209,7 +209,29 @@ class FormGlobalsoApi
209 $queryString = http_build_query($data); 209 $queryString = http_build_query($data);
210 $url = 'https://www.globalso.site/api/external-interface/country_con/15243d63ed5a5738?'.$queryString; 210 $url = 'https://www.globalso.site/api/external-interface/country_con/15243d63ed5a5738?'.$queryString;
211 $res = http_get($url,['charset=utf-8']); 211 $res = http_get($url,['charset=utf-8']);
212 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL; 212 + return $res;
  213 + }
  214 +
  215 + /**
  216 + * @remark :按时间区间
  217 + * @name :getMonthInquiry
  218 + * @author :lyh
  219 + * @method :post
  220 + * @time :2025/3/1 9:49
  221 + * https://form.globalso.com/api/external-interface/date_count?sta_date=2025-02-26&end_date=2025-02-28&domain=www.ultrasounddawei.com
  222 + */
  223 + public function getDateInquiry($url,$start,$end,$is_upgrade = 0){
  224 + $token = md5($url.date("Y-m-d"));
  225 + $data = [
  226 + 'domain' => $url,
  227 + 'token' => $token,
  228 + 'source'=> $is_upgrade ? '1,2,3,4,5' : '1,3,5',
  229 + 'end_date' => $end,
  230 + 'sta_date'=>$start,
  231 + ];
  232 + $queryString = http_build_query($data);
  233 + $url = 'https://www.globalso.site/api/external-interface/date_count?'.$queryString;
  234 + $res = http_get($url,['charset=utf-8']);
213 return $res; 235 return $res;
214 } 236 }
215 } 237 }
@@ -78,7 +78,7 @@ class ServersController extends BaseController @@ -78,7 +78,7 @@ class ServersController extends BaseController
78 unset($this->map['domain']); 78 unset($this->map['domain']);
79 } 79 }
80 $serversModel = new ServersModel(); 80 $serversModel = new ServersModel();
81 - $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order); 81 + $data = $serversModel->lists($this->map,$this->page,$this->row,$this->order = 'sort');
82 $this->response('success',Code::SUCCESS,$data); 82 $this->response('success',Code::SUCCESS,$data);
83 } 83 }
84 84
@@ -5,12 +5,11 @@ namespace App\Http\Controllers\Aside\Optimize; @@ -5,12 +5,11 @@ namespace App\Http\Controllers\Aside\Optimize;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
7 use App\Http\Logic\Aside\Optimize\InquiryForwardLogic; 7 use App\Http\Logic\Aside\Optimize\InquiryForwardLogic;
8 -use App\Models\Inquiry\AreaTimezone;  
9 8
10 class InquiryForwardController extends BaseController 9 class InquiryForwardController extends BaseController
11 { 10 {
12 /** 11 /**
13 - * 获取询信息发列表 12 + * 获取询列表
14 * @param InquiryForwardLogic $inquiryForwardLogic 13 * @param InquiryForwardLogic $inquiryForwardLogic
15 * @author Akun 14 * @author Akun
16 * @date 2025/02/21 10:55 15 * @date 2025/02/21 10:55
@@ -29,11 +28,33 @@ class InquiryForwardController extends BaseController @@ -29,11 +28,33 @@ class InquiryForwardController extends BaseController
29 if (isset($this->param['url_keyword'])) { 28 if (isset($this->param['url_keyword'])) {
30 $this->map['url_keyword'] = ['like', '%' . $this->map['url_keyword'] . '%']; 29 $this->map['url_keyword'] = ['like', '%' . $this->map['url_keyword'] . '%'];
31 } 30 }
  31 + if (isset($this->param['message'])) {
  32 + $this->map['message'] = ['like', '%' . $this->map['message'] . '%'];
  33 + }
32 $lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order); 34 $lists = $inquiryForwardLogic->getInquiryLists($this->map, $this->page, $this->row, $this->order);
33 $this->response('success', Code::SUCCESS, $lists); 35 $this->response('success', Code::SUCCESS, $lists);
34 } 36 }
35 37
36 /** 38 /**
  39 + * 获取询盘详情
  40 + * @param InquiryForwardLogic $inquiryForwardLogic
  41 + * @throws \App\Exceptions\AsideGlobalException
  42 + * @throws \App\Exceptions\BsideGlobalException
  43 + * @author Akun
  44 + * @date 2025/03/01 11:21
  45 + */
  46 + public function getInquiryInfo(InquiryForwardLogic $inquiryForwardLogic)
  47 + {
  48 + $this->request->validate([
  49 + 'id' => 'required',
  50 + ], [
  51 + 'id.required' => 'ID不能为空',
  52 + ]);
  53 + $info = $inquiryForwardLogic->infoInquiry();
  54 + $this->response('success', Code::SUCCESS, $info);
  55 + }
  56 +
  57 + /**
37 * 获取询盘类型 58 * 获取询盘类型
38 * @param InquiryForwardLogic $inquiryForwardLogic 59 * @param InquiryForwardLogic $inquiryForwardLogic
39 * @author Akun 60 * @author Akun
@@ -166,4 +187,22 @@ class InquiryForwardController extends BaseController @@ -166,4 +187,22 @@ class InquiryForwardController extends BaseController
166 187
167 $this->response('success'); 188 $this->response('success');
168 } 189 }
  190 +
  191 + /**
  192 + * 获取询盘详情列表
  193 + * @param InquiryForwardLogic $inquiryForwardLogic
  194 + * @author Akun
  195 + * @date 2025/03/01 9:22
  196 + */
  197 + public function getInquiryDetailList(InquiryForwardLogic $inquiryForwardLogic)
  198 + {
  199 + if (isset($this->param['country'])) {
  200 + $this->map['country'] = ['like', '%' . $this->map['country'] . '%'];
  201 + }
  202 + if (isset($this->param['website'])) {
  203 + $this->map['website'] = ['like', '%' . $this->map['website'] . '%'];
  204 + }
  205 + $lists = $inquiryForwardLogic->getInquiryDetailLists($this->map, $this->page, $this->row, $this->order);
  206 + $this->response('success', Code::SUCCESS, $lists);
  207 + }
169 } 208 }
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Controllers\Bside; 10 namespace App\Http\Controllers\Bside;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
  13 +use App\Helper\FormGlobalsoApi;
13 use App\Helper\PayStripeApi; 14 use App\Helper\PayStripeApi;
14 use App\Http\Logic\Bside\News\NewsLogic; 15 use App\Http\Logic\Bside\News\NewsLogic;
15 use App\Models\Ai\AiBlog; 16 use App\Models\Ai\AiBlog;
@@ -19,6 +20,7 @@ use App\Models\CustomModule\CustomModuleContent; @@ -19,6 +20,7 @@ use App\Models\CustomModule\CustomModuleContent;
19 use App\Models\CustomModule\CustomModuleExtentContent; 20 use App\Models\CustomModule\CustomModuleExtentContent;
20 use App\Models\Domain\DomainInfo; 21 use App\Models\Domain\DomainInfo;
21 use App\Models\ExtentModule\ExtensionModuleValue; 22 use App\Models\ExtentModule\ExtensionModuleValue;
  23 +use App\Models\HomeCount\Count;
22 use App\Models\Manage\ManageHr; 24 use App\Models\Manage\ManageHr;
23 use App\Models\Project\CountAllProject as AllProject; 25 use App\Models\Project\CountAllProject as AllProject;
24 use App\Models\Project\Project; 26 use App\Models\Project\Project;
@@ -38,22 +40,8 @@ class TestController extends BaseController @@ -38,22 +40,8 @@ class TestController extends BaseController
38 * @time :2025/2/13 16:34 40 * @time :2025/2/13 16:34
39 */ 41 */
40 public function ceshi(){ 42 public function ceshi(){
41 - $aiBlogService = new AiBlogService();  
42 - $aiBlogService->mch_id = '100008';  
43 - $aiBlogService->key = '8a9c925bdcca';  
44 - $result = $aiBlogService->createTask('apple');  
45 - if($result['status'] == 200){  
46 - $param = [  
47 - 'keywords'=>'apple',  
48 - 'status'=>$result['data']['status'],  
49 - 'task_id'=>$result['data']['task_id'],  
50 - 'project_id'=>1,  
51 - ];  
52 - ProjectServer::useProject(1);  
53 - $aiBlogModel = new AiBlog();  
54 - $aiBlogModel->add($param);  
55 - DB::disconnect('custom_mysql');  
56 - }  
57 - $this->response('success',Code::SUCCESS,$param); 43 + //获取上一周询盘数量
  44 + $result = (new FormGlobalsoApi())->getDateInquiry($this->param['domain'],$this->param['start'],$this->param['end']);
  45 + $this->response('success',Code::SUCCESS,$result);
58 } 46 }
59 } 47 }
@@ -14,7 +14,6 @@ use App\Models\Inquiry\InquiryProjectRoute; @@ -14,7 +14,6 @@ use App\Models\Inquiry\InquiryProjectRoute;
14 use App\Models\Inquiry\InquiryRelayDetail; 14 use App\Models\Inquiry\InquiryRelayDetail;
15 use Illuminate\Support\Arr; 15 use Illuminate\Support\Arr;
16 use Illuminate\Support\Facades\DB; 16 use Illuminate\Support\Facades\DB;
17 -use Illuminate\Support\Facades\Log;  
18 use Illuminate\Support\Str; 17 use Illuminate\Support\Str;
19 18
20 /** 19 /**
@@ -34,7 +33,7 @@ class InquiryForwardLogic extends BaseLogic @@ -34,7 +33,7 @@ class InquiryForwardLogic extends BaseLogic
34 } 33 }
35 34
36 /** 35 /**
37 - * 获取类型 36 + * 获取询盘类型
38 * @return array 37 * @return array
39 * @author Akun 38 * @author Akun
40 * @date 2025/02/21 11:19 39 * @date 2025/02/21 11:19
@@ -53,7 +52,7 @@ class InquiryForwardLogic extends BaseLogic @@ -53,7 +52,7 @@ class InquiryForwardLogic extends BaseLogic
53 } 52 }
54 53
55 /** 54 /**
56 - * 获取列表 55 + * 获取询盘列表
57 * @param $map 56 * @param $map
58 * @param $page 57 * @param $page
59 * @param $row 58 * @param $row
@@ -70,6 +69,23 @@ class InquiryForwardLogic extends BaseLogic @@ -70,6 +69,23 @@ class InquiryForwardLogic extends BaseLogic
70 } 69 }
71 70
72 /** 71 /**
  72 + * 获取询盘详情
  73 + * @return array
  74 + * @throws \App\Exceptions\AsideGlobalException
  75 + * @throws \App\Exceptions\BsideGlobalException
  76 + * @author Akun
  77 + * @date 2025/03/01 11:20
  78 + */
  79 + public function infoInquiry()
  80 + {
  81 + $info = $this->model->read(['id' => $this->param['id']], ['id', 'url', 'url_title', 'url_keyword', 'name', 'email', 'phone', 'ip', 'country', 'message']);
  82 + if ($info === false) {
  83 + $this->fail('获取询盘详情失败');
  84 + }
  85 + return $this->success($info);
  86 + }
  87 +
  88 + /**
73 * 转发询盘 89 * 转发询盘
74 * @return array 90 * @return array
75 * @throws \App\Exceptions\AsideGlobalException 91 * @throws \App\Exceptions\AsideGlobalException
@@ -91,7 +107,13 @@ class InquiryForwardLogic extends BaseLogic @@ -91,7 +107,13 @@ class InquiryForwardLogic extends BaseLogic
91 try { 107 try {
92 $num = 0; 108 $num = 0;
93 $now = date('Y-m-d H:i:s'); 109 $now = date('Y-m-d H:i:s');
94 - foreach ($this->param['forward_url'] as $url) { 110 + if (is_array($this->param['forward_url'])) {
  111 + $forward_url = $this->param['forward_url'];
  112 + } else {
  113 + $forward_url = explode(',', $this->param['forward_url']);
  114 + }
  115 + foreach ($forward_url as $url) {
  116 + $url = trim($url);
95 $domain_array = parse_url($url); 117 $domain_array = parse_url($url);
96 $website = $domain_array['host'] ?? ''; 118 $website = $domain_array['host'] ?? '';
97 if (!$website) { 119 if (!$website) {
@@ -166,7 +188,7 @@ class InquiryForwardLogic extends BaseLogic @@ -166,7 +188,7 @@ class InquiryForwardLogic extends BaseLogic
166 } catch (\Exception $e) { 188 } catch (\Exception $e) {
167 DB::rollback(); 189 DB::rollback();
168 190
169 - Log::error('inquiry_forward error:' . $e->getMessage()); 191 + @file_put_contents(storage_path('logs/lk_error.log'), $e->getMessage());
170 $this->fail('转发询盘失败'); 192 $this->fail('转发询盘失败');
171 } 193 }
172 194
@@ -267,12 +289,23 @@ class InquiryForwardLogic extends BaseLogic @@ -267,12 +289,23 @@ class InquiryForwardLogic extends BaseLogic
267 */ 289 */
268 public function aiRewrite() 290 public function aiRewrite()
269 { 291 {
270 - $ai_command = AiCommand::where('key', 'inquiry_text_rewrite')->value('ai');  
271 - if (!$ai_command) { 292 + $ai_info = AiCommand::select(['ai', 'not_use_probability'])->where('key', 'inquiry_text_rewrite')->first();
  293 + if (!$ai_info) {
272 $this->fail('AI重写指令未配置'); 294 $this->fail('AI重写指令未配置');
273 } 295 }
274 296
  297 + $ai_command = $ai_info['ai'];
  298 + $not_use_probability = $ai_info['not_use_probability'];
275 $in_content = $this->param['message']; 299 $in_content = $this->param['message'];
  300 +
  301 + // 当原始询盘内容长度大于15个字符, 60%几率直接发送原始内容。
  302 + if (strlen($in_content) >= 15) {
  303 + $randomNumber = rand(0, 100);
  304 + if ($randomNumber < $not_use_probability) {
  305 + return $this->success(['ai_message' => $in_content]);
  306 + }
  307 + }
  308 +
276 $translateSl = Translate::translateSl($in_content); 309 $translateSl = Translate::translateSl($in_content);
277 $lang = $translateSl['texts']['sl'] ?? 'en'; 310 $lang = $translateSl['texts']['sl'] ?? 'en';
278 if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) { 311 if ($lang == 'en' || $lang == 'ja' || $lang == 'ko' || Str::contains($lang, 'zh')) {
@@ -299,11 +332,36 @@ class InquiryForwardLogic extends BaseLogic @@ -299,11 +332,36 @@ class InquiryForwardLogic extends BaseLogic
299 */ 332 */
300 public function expiredInquiry() 333 public function expiredInquiry()
301 { 334 {
302 - $rs = $this->model->edit(['status' => InquiryInfo::STATUS_INVALID], ['id' => $this->param['id']]); 335 + if (isset($this->param['type']) && $this->param['type'] == 1) {
  336 + //启用
  337 + $status = InquiryInfo::STATUS_INIT;
  338 + } else {
  339 + //无效
  340 + $status = InquiryInfo::STATUS_INVALID;
  341 + }
  342 + $rs = $this->model->edit(['status' => $status], ['id' => $this->param['id']]);
303 343
304 if ($rs === false) { 344 if ($rs === false) {
305 - $this->fail('设置无效失败'); 345 + $this->fail('设置失败');
306 } 346 }
307 return $this->success(); 347 return $this->success();
308 } 348 }
  349 +
  350 + /**
  351 + * 获取询盘转发详情列表
  352 + * @param $map
  353 + * @param $page
  354 + * @param $row
  355 + * @param string $order
  356 + * @param string[] $filed
  357 + * @return array
  358 + * @author Akun
  359 + * @date 2025/03/01 9:22
  360 + */
  361 + public function getInquiryDetailLists($map, $page, $row, $order = 'id', $filed = ['*'])
  362 + {
  363 + $model = new InquiryRelayDetail();
  364 + $lists = $model->listsWith($map, $page, $row, $order, $filed, 'desc', ['detailLog']);
  365 + return $this->success($lists);
  366 + }
309 } 367 }
@@ -26,7 +26,7 @@ class UserLogic extends BaseLogic @@ -26,7 +26,7 @@ class UserLogic extends BaseLogic
26 */ 26 */
27 public function user_info() 27 public function user_info()
28 { 28 {
29 - $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'operator_id']); 29 + $info = $this->model->read($this->param, ['id', 'project_id', 'name', 'status', 'role_id' ,'mobile', 'is_password' ,'operator_id']);
30 if ($info === false) { 30 if ($info === false) {
31 $this->fail('当前数据不存在'); 31 $this->fail('当前数据不存在');
32 } 32 }
@@ -37,7 +37,7 @@ class UserLoginLogic @@ -37,7 +37,7 @@ class UserLoginLogic
37 */ 37 */
38 public function login(){ 38 public function login(){
39 //先验证手机号是否在项目中存在 39 //先验证手机号是否在项目中存在
40 - $info = $this->model->read(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id']); 40 + $info = $this->model->read(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','is_password','project_id']);
41 if($info === false){ 41 if($info === false){
42 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE); 42 $this->fail('当前用户不存在或者被禁用',Code::USER_REGISTER_ERROE);
43 } 43 }
@@ -46,12 +46,18 @@ class UserLoginLogic @@ -46,12 +46,18 @@ class UserLoginLogic
46 $list = $this->model->list(['mobile'=>$this->param['mobile'], 46 $list = $this->model->list(['mobile'=>$this->param['mobile'],
47 'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']); 47 'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);
48 }else{ 48 }else{
49 - $password = base64_encode(md5($this->param['password']));  
50 - $list = $this->model->list(['mobile'=>$this->param['mobile'],  
51 - 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);  
52 - if(empty($list)){ 49 + if(($info['is_password'] == $this->model::STATUS_ZERO) && ($info['project_id'] != 1)){//查看是否开启了密码登录:默认未开启
53 //验证code 50 //验证code
54 $list = $this->verifyCode($this->param['mobile'],$this->param['password']); 51 $list = $this->verifyCode($this->param['mobile'],$this->param['password']);
  52 + }else{
  53 + //先验证密码是否正确,在验证验证码
  54 + $password = base64_encode(md5($this->param['password']));
  55 + $list = $this->model->list(['mobile'=>$this->param['mobile'],
  56 + 'password'=>$password,'status'=>$this->model::STATUS_ZERO],'id',['id','project_id']);
  57 + if(empty($list)){
  58 + //默认只能使用验证码登录
  59 + $list = $this->verifyCode($this->param['mobile'],$this->param['password']);
  60 + }
55 } 61 }
56 } 62 }
57 //获取所有项目的项目id 63 //获取所有项目的项目id
@@ -143,10 +149,10 @@ class UserLoginLogic @@ -143,10 +149,10 @@ class UserLoginLogic
143 $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first(); 149 $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
144 if(!empty($smsInfo)){ 150 if(!empty($smsInfo)){
145 if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){ 151 if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
146 - $this->fail('账号密码错误/验证码错误'); 152 + $this->fail('验证码错误,如需账号密码登录,请联系管理员开启');
147 } 153 }
148 }else{ 154 }else{
149 - $this->fail('账号密码错误/验证码错误'); 155 + $this->fail('验证码错误,如需账号密码登录,请联系管理员开启');
150 } 156 }
151 $list = $this->model->list(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','project_id']); 157 $list = $this->model->list(['mobile'=>$this->param['mobile'],'status'=>$this->model::STATUS_ZERO],['id','project_id']);
152 return $this->success($list); 158 return $this->success($list);
@@ -14,6 +14,7 @@ class AutoPullNotify extends Base @@ -14,6 +14,7 @@ class AutoPullNotify extends Base
14 1 => '硅谷云服务器', 14 1 => '硅谷云服务器',
15 15 => '硅谷IDC服务器01(6.0美服1)', 15 15 => '硅谷IDC服务器01(6.0美服1)',
16 14 => '硅谷IDC服务器02(6.0美服2)', 16 14 => '硅谷IDC服务器02(6.0美服2)',
  17 + 21 => '硅谷IDC服务器03(6.0美服3)',
17 2 => '俄罗斯服务器', 18 2 => '俄罗斯服务器',
18 4 => '阿里云深圳服务器', 19 4 => '阿里云深圳服务器',
19 5 => '日本服务器', 20 5 => '日本服务器',
@@ -315,4 +315,29 @@ class Base extends Model @@ -315,4 +315,29 @@ class Base extends Model
315 return $this->formatQuery($data)->pluck($filed)->toArray(); 315 return $this->formatQuery($data)->pluck($filed)->toArray();
316 } 316 }
317 317
  318 + /**
  319 + * 带关联的列表数据
  320 + * @param $map
  321 + * @param $page
  322 + * @param $row
  323 + * @param string $order
  324 + * @param string[] $fields
  325 + * @param string $sort
  326 + * @param array $with
  327 + * @return array
  328 + * @author Akun
  329 + * @date 2025/03/01 9:19
  330 + */
  331 + public function listsWith($map, $page, $row, $order = 'id', $fields = ['*'], $sort = 'desc',$with=[]): array
  332 + {
  333 + $query = $this->formatQuery($map);
  334 + $with && $query->with($with);
  335 + $query = $this->sortOrder($query,$order,$sort);
  336 + $lists = $query->select($fields)->paginate($row, $fields, 'page', $page);
  337 + if (empty($lists)) {
  338 + return [];
  339 + }
  340 + $lists = $lists->toArray();
  341 + return $lists;
  342 + }
318 } 343 }
@@ -37,6 +37,7 @@ class InquiryInfo extends Base @@ -37,6 +37,7 @@ class InquiryInfo extends Base
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; 39 const TYPE_SPIDER = 4;
  40 + const TYPE_FIND_SUPPLY = 5;
40 41
41 /** 42 /**
42 * 状态映射 43 * 状态映射
@@ -60,9 +61,10 @@ class InquiryInfo extends Base @@ -60,9 +61,10 @@ class InquiryInfo extends Base
60 { 61 {
61 return [ 62 return [
62 self::TYPE_SITE_GROUP => '站群询盘', 63 self::TYPE_SITE_GROUP => '站群询盘',
63 - self::TYPE_ADS => 'ads采集站询盘',  
64 - self::TYPE_AI_SITE_GROUP => 'AI站群询盘',  
65 - self::TYPE_SPIDER => '蜘蛛询盘', 64 + self::TYPE_ADS => 'ADS采集站',
  65 + self::TYPE_AI_SITE_GROUP => '自建AI站群',
  66 + self::TYPE_SPIDER => 'SC平台',
  67 + self::TYPE_FIND_SUPPLY => 'FS平台',
66 ]; 68 ];
67 } 69 }
68 70
@@ -83,15 +85,19 @@ class InquiryInfo extends Base @@ -83,15 +85,19 @@ class InquiryInfo extends Base
83 * @param $message_sign 85 * @param $message_sign
84 * @param $origin_key 86 * @param $origin_key
85 * @param string $image 87 * @param string $image
  88 + * @param int $email_status
  89 + * @param int $phone_status
86 * @return bool 90 * @return bool
87 */ 91 */
88 - public function createInquiry($name, $phone, $email, $ip, $country, $message, $message_cn, $type, $inquiry_date, $url, $url_title, $url_keyword, $message_sign, $origin_key, $image = '') 92 + public function createInquiry($name, $phone, $email, $ip, $country, $message, $message_cn, $type, $inquiry_date, $url, $url_title, $url_keyword, $message_sign, $origin_key, $image = '', $email_status = 0, $phone_status = 0)
89 { 93 {
90 try { 94 try {
91 $self = new self(); 95 $self = new self();
92 $self->name = $name; 96 $self->name = $name;
93 $self->phone = $phone; 97 $self->phone = $phone;
  98 + $self->phone_status = $phone_status;
94 $self->email = $email; 99 $self->email = $email;
  100 + $self->email_status = $email_status;
95 $self->ip = $ip; 101 $self->ip = $ip;
96 $self->country = $country; 102 $self->country = $country;
97 $self->message = $message; 103 $self->message = $message;
@@ -8,14 +8,14 @@ @@ -8,14 +8,14 @@
8 8
9 namespace App\Models\Inquiry; 9 namespace App\Models\Inquiry;
10 10
11 -use Illuminate\Database\Eloquent\Model; 11 +use App\Models\Base;
12 12
13 /** 13 /**
14 * 询盘转发详情 14 * 询盘转发详情
15 * Class ReInquiryDetail 15 * Class ReInquiryDetail
16 * @package App\Models\Inquiry 16 * @package App\Models\Inquiry
17 */ 17 */
18 -class InquiryRelayDetail extends Model 18 +class InquiryRelayDetail extends Base
19 { 19 {
20 /** 20 /**
21 * @var string 21 * @var string
@@ -8,14 +8,14 @@ @@ -8,14 +8,14 @@
8 8
9 namespace App\Models\Inquiry; 9 namespace App\Models\Inquiry;
10 10
11 -use Illuminate\Database\Eloquent\Model; 11 +use App\Models\Base;
12 12
13 /** 13 /**
14 * 转发详情日志 14 * 转发详情日志
15 * Class ReInquiryDetailLog 15 * Class ReInquiryDetailLog
16 * @package App\Models\Inquiry 16 * @package App\Models\Inquiry
17 */ 17 */
18 -class InquiryRelayDetailLog extends Model 18 +class InquiryRelayDetailLog extends Base
19 { 19 {
20 /** 20 /**
21 * @var string 21 * @var string
@@ -185,6 +185,12 @@ return [ @@ -185,6 +185,12 @@ return [
185 'level' => 'debug', 185 'level' => 'debug',
186 'days' => 14, 186 'days' => 14,
187 ], 187 ],
  188 + 'inquiry_forward' => [
  189 + 'driver' => 'daily',
  190 + 'path' => storage_path('logs/inquiry_forward/laravel.log'),
  191 + 'level' => 'debug',
  192 + 'days' => 14,
  193 + ],
188 ], 194 ],
189 //操作日志 195 //操作日志
190 'operator_log' =>[ 196 'operator_log' =>[
@@ -342,13 +342,15 @@ Route::middleware(['aloginauth'])->group(function () { @@ -342,13 +342,15 @@ Route::middleware(['aloginauth'])->group(function () {
342 342
343 //手动转发询盘 343 //手动转发询盘
344 Route::prefix('inquiry_forward')->group(function () { 344 Route::prefix('inquiry_forward')->group(function () {
345 - Route::any('/', [Aside\Optimize\InquiryForwardController::class, 'lists'])->name('admin.inquiry_lists'); 345 + Route::any('/', [Aside\Optimize\InquiryForwardController::class, 'lists'])->name('admin.inquiry_forward_lists');
  346 + Route::any('/getInquiryInfo', [Aside\Optimize\InquiryForwardController::class, 'getInquiryInfo'])->name('admin.inquiry_forward_getInquiryInfo');
346 Route::any('/getInquiryType', [Aside\Optimize\InquiryForwardController::class, 'getInquiryType'])->name('admin.inquiry_forward_getInquiryType'); 347 Route::any('/getInquiryType', [Aside\Optimize\InquiryForwardController::class, 'getInquiryType'])->name('admin.inquiry_forward_getInquiryType');
347 Route::any('/forwardInquiry', [Aside\Optimize\InquiryForwardController::class, 'forwardInquiry'])->name('admin.inquiry_forward_forwardInquiry'); 348 Route::any('/forwardInquiry', [Aside\Optimize\InquiryForwardController::class, 'forwardInquiry'])->name('admin.inquiry_forward_forwardInquiry');
348 Route::any('/getInquiryIp', [Aside\Optimize\InquiryForwardController::class, 'getInquiryIp'])->name('admin.inquiry_forward_getInquiryIp'); 349 Route::any('/getInquiryIp', [Aside\Optimize\InquiryForwardController::class, 'getInquiryIp'])->name('admin.inquiry_forward_getInquiryIp');
349 Route::any('/searchInquiryKeywords', [Aside\Optimize\InquiryForwardController::class, 'searchInquiryKeywords'])->name('admin.inquiry_forward_searchInquiryKeywords'); 350 Route::any('/searchInquiryKeywords', [Aside\Optimize\InquiryForwardController::class, 'searchInquiryKeywords'])->name('admin.inquiry_forward_searchInquiryKeywords');
350 Route::any('/aiRewriteInquiry', [Aside\Optimize\InquiryForwardController::class, 'aiRewriteInquiry'])->name('admin.inquiry_forward_aiRewriteInquiry'); 351 Route::any('/aiRewriteInquiry', [Aside\Optimize\InquiryForwardController::class, 'aiRewriteInquiry'])->name('admin.inquiry_forward_aiRewriteInquiry');
351 Route::any('/setInquiryExpired', [Aside\Optimize\InquiryForwardController::class, 'setInquiryExpired'])->name('admin.inquiry_forward_setInquiryExpired'); 352 Route::any('/setInquiryExpired', [Aside\Optimize\InquiryForwardController::class, 'setInquiryExpired'])->name('admin.inquiry_forward_setInquiryExpired');
  353 + Route::any('/getInquiryDetailList', [Aside\Optimize\InquiryForwardController::class, 'getInquiryDetailList'])->name('admin.inquiry_forward_getInquiryDetailList');
352 }); 354 });
353 355
354 Route::prefix('custom_module')->group(function () { 356 Route::prefix('custom_module')->group(function () {
@@ -533,7 +535,7 @@ Route::group([], function () { @@ -533,7 +535,7 @@ Route::group([], function () {
533 Route::any('/getProjectInService', [Aside\Project\ProjectController::class, 'getProjectInService'])->name('admin.getProjectInService');//获取项目服务状态 535 Route::any('/getProjectInService', [Aside\Project\ProjectController::class, 'getProjectInService'])->name('admin.getProjectInService');//获取项目服务状态
534 Route::any('/getProjectByChannel', [Aside\Project\ProjectController::class, 'getProjectByChannel'])->name('admin.getProjectByChannel');//获取渠道商的项目 536 Route::any('/getProjectByChannel', [Aside\Project\ProjectController::class, 'getProjectByChannel'])->name('admin.getProjectByChannel');//获取渠道商的项目
535 // 提供接口 同步人事信息到5.0后台 537 // 提供接口 同步人事信息到5.0后台
536 - Route::any('/get_hr_list', [Aside\Manage\HrController::class , 'getHrList'])->name('admin.get_hr_list'); 538 + Route::any('/get_hr_list', [Aside\Manage\HrController::class, 'getHrList'])->name('admin.get_hr_list');
537 // 提供模板 提单后台查看 539 // 提供模板 提单后台查看
538 Route::any('get_template_list', [Aside\Template\ATemplateController::class, 'getTemplateList'])->name('admin.get_template_list'); 540 Route::any('get_template_list', [Aside\Template\ATemplateController::class, 'getTemplateList'])->name('admin.get_template_list');
539 Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail'); 541 Route::any('get_template_detail', [Aside\Template\ATemplateController::class, 'getTemplateDetail'])->name('admin.get_template_detail');