作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -67,10 +67,14 @@ class SendKeyword extends Command @@ -67,10 +67,14 @@ class SendKeyword extends Command
67 $send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000]; 67 $send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000];
68 $ban_domain = $this->banDomain(); 68 $ban_domain = $this->banDomain();
69 foreach ($projects as $item) { 69 foreach ($projects as $item) {
70 - if (empty($item->is_auto_keywords)) 70 + if (empty($item->is_auto_keywords)) {
  71 + $this->output('项目ID:' . $item->id . ', 未开启推送配置;');
71 continue; 72 continue;
72 - if (in_array($item->domain, $ban_domain)) 73 + }
  74 + if (in_array($item->domain, $ban_domain)) {
  75 + $this->output('项目ID:' . $item->id . ', 域名被禁用;');
73 continue; 76 continue;
  77 + }
74 if (empty($item->api_no)) { 78 if (empty($item->api_no)) {
75 $this->output('项目ID:' . $item->id . ', api_no为空;'); 79 $this->output('项目ID:' . $item->id . ', api_no为空;');
76 continue; 80 continue;
@@ -89,11 +93,15 @@ class SendKeyword extends Command @@ -89,11 +93,15 @@ class SendKeyword extends Command
89 93
90 // 项目是否达标 94 // 项目是否达标
91 $compliance = RankData::where(['project_id' => $item->id, 'api_no' => $item->api_no, 'lang' => ''])->value('is_compliance'); 95 $compliance = RankData::where(['project_id' => $item->id, 'api_no' => $item->api_no, 'lang' => ''])->value('is_compliance');
92 - if (FALSE == empty($compliance))  
93 - return false; 96 + if (FALSE == empty($compliance)) {
  97 + $this->output('项目ID:' . $item->id . ', 项目已达标,不需要推送;');
  98 + continue;
  99 + }
  100 +
94 101
95 $project = ProjectServer::useProject($item->id); 102 $project = ProjectServer::useProject($item->id);
96 if (empty($project)) { 103 if (empty($project)) {
  104 + $this->output('项目ID:' . $item->id . ', 项目链接失败;');
97 DB::disconnect('custom_mysql'); 105 DB::disconnect('custom_mysql');
98 continue; 106 continue;
99 } 107 }
@@ -109,6 +117,7 @@ class SendKeyword extends Command @@ -109,6 +117,7 @@ class SendKeyword extends Command
109 $item['apino'] = $item['api_no']; 117 $item['apino'] = $item['api_no'];
110 $this->sendNotice($item); 118 $this->sendNotice($item);
111 } 119 }
  120 + $this->output('项目ID:' . $item['id'] . ', ' . ($send ? '推送完成' : '无推送关键词;'));
112 } 121 }
113 return true; 122 return true;
114 } 123 }
@@ -74,7 +74,7 @@ class RecommendedSuppliers extends Command @@ -74,7 +74,7 @@ class RecommendedSuppliers extends Command
74 DB::disconnect('custom_mysql'); 74 DB::disconnect('custom_mysql');
75 } 75 }
76 }catch (\Exception $e){ 76 }catch (\Exception $e){
77 - echo date('Y-m-d hH:i:s').'当前项目执行错误:'.$e->getMessage().PHP_EOL; 77 + echo date('Y-m-d H:i:s').'当前项目执行错误:'.$e->getMessage().PHP_EOL;
78 continue; 78 continue;
79 } 79 }
80 } 80 }
@@ -166,7 +166,7 @@ class RecommendedSuppliers extends Command @@ -166,7 +166,7 @@ class RecommendedSuppliers extends Command
166 $saveData = [ 166 $saveData = [
167 'project_id'=>$project_id, 167 'project_id'=>$project_id,
168 'keyword'=>$keyword, 168 'keyword'=>$keyword,
169 - 'data'=>json_encode($res['data'] ?? '') 169 + 'data'=>json_encode($res['data'] ?? [])
170 ]; 170 ];
171 $purchaserModel = new Purchaser(); 171 $purchaserModel = new Purchaser();
172 $purchaserModel->add($saveData); 172 $purchaserModel->add($saveData);
@@ -214,8 +214,6 @@ class RecommendedSuppliers extends Command @@ -214,8 +214,6 @@ class RecommendedSuppliers extends Command
214 $v['mobile'] = json_encode($v['mobile']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 214 $v['mobile'] = json_encode($v['mobile']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
215 $v['social_media'] = json_encode($v['social_media']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 215 $v['social_media'] = json_encode($v['social_media']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
216 $v['image'] = str_replace('admin.hagro.cn','fob.ai.cc',$v['image']??''); 216 $v['image'] = str_replace('admin.hagro.cn','fob.ai.cc',$v['image']??'');
217 -// $v['created_at'] = date('Y-m-d H:i:s');  
218 -// $v['updated_at'] = $v['created_at'];  
219 $param = $v; 217 $param = $v;
220 $info = $purchaserInfoModel->read(['keyword'=>$keyword,'buyer_id'=>$v['buyer_id']??0,'project_id'=>$project_id],['id']); 218 $info = $purchaserInfoModel->read(['keyword'=>$keyword,'buyer_id'=>$v['buyer_id']??0,'project_id'=>$project_id],['id']);
221 if($info === false){ 219 if($info === false){
@@ -6,6 +6,7 @@ namespace App\Helper; @@ -6,6 +6,7 @@ namespace App\Helper;
6 use App\Models\Project\Project; 6 use App\Models\Project\Project;
7 use App\Utils\HttpUtils; 7 use App\Utils\HttpUtils;
8 use GuzzleHttp\Exception\GuzzleException; 8 use GuzzleHttp\Exception\GuzzleException;
  9 +use Illuminate\Support\Facades\Log;
9 10
10 11
11 /** 12 /**
@@ -154,7 +155,7 @@ class FormGlobalsoApi @@ -154,7 +155,7 @@ class FormGlobalsoApi
154 $res = HttpUtils::post($api_url, $data); 155 $res = HttpUtils::post($api_url, $data);
155 $res = Arr::s2a($res); 156 $res = Arr::s2a($res);
156 } catch (\Exception | GuzzleException $e) { 157 } catch (\Exception | GuzzleException $e) {
157 - errorLog('提交询盘信息失败', $data, $e); 158 + Log::channel('inquiry')->info('询盘发送邮件失败' . $e->getMessage(), $data);
158 return false; 159 return false;
159 } 160 }
160 return $res; 161 return $res;
@@ -834,6 +834,16 @@ function ends_with($string, $suffix) @@ -834,6 +834,16 @@ function ends_with($string, $suffix)
834 return substr($string, -strlen($suffix)) === $suffix; 834 return substr($string, -strlen($suffix)) === $suffix;
835 } 835 }
836 836
  837 +function getCustomRouteMap($module_route,$route = '')
  838 +{
  839 + if($module_route == $route){
  840 + $resultRoute = $route;
  841 + }else{
  842 + $resultRoute = $module_route.'_catelog/'.$route;
  843 + }
  844 + return $resultRoute;
  845 +}
  846 +
837 /** 847 /**
838 * @remark :获取二级路由 848 * @remark :获取二级路由
839 * @name :getRouteMap 849 * @name :getRouteMap
@@ -841,11 +851,24 @@ function ends_with($string, $suffix) @@ -841,11 +851,24 @@ function ends_with($string, $suffix)
841 * @method :post 851 * @method :post
842 * @time :2023/11/10 14:29 852 * @time :2023/11/10 14:29
843 */ 853 */
844 -function getRouteMap($source,$source_id){ 854 +function getRouteMap($source,$source_id,$is_upgrade = 0){
845 $route = ''; 855 $route = '';
846 $routeMapModel = new RouteMap(); 856 $routeMapModel = new RouteMap();
847 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]); 857 $info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
848 if($info !== false){ 858 if($info !== false){
  859 + if($is_upgrade == 1){
  860 + if($source == $routeMapModel::SOURCE_NEWS_CATE){
  861 + if($info['route'] != 'news'){
  862 + return $routeMapModel::PATH_NEWS_CATE.'/'.$info['route'];
  863 + }
  864 + }elseif ($source == $routeMapModel::SOURCE_BLOG_CATE){
  865 + if($info['route'] != 'blog'){
  866 + return $routeMapModel::PATH_BLOG_CATE.'/'.$info['route'];
  867 + }
  868 + }
  869 + $route = $info['route'];
  870 + return $route;
  871 + }
849 if(!empty($info['path'])){ 872 if(!empty($info['path'])){
850 if($info['path'] == 'blog'){ 873 if($info['path'] == 'blog'){
851 $info['path'] = $info['path'].'s'; 874 $info['path'] = $info['path'].'s';
@@ -44,6 +44,20 @@ class CheckListController extends BaseController @@ -44,6 +44,20 @@ class CheckListController extends BaseController
44 } 44 }
45 45
46 /** 46 /**
  47 + * @remark :获取分页检查清单数据
  48 + * @name :lists
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2025/4/17 9:31
  52 + */
  53 + public function list(){
  54 + $this->map['status'] = 1;
  55 + $field = ['id','status','sort','text','created_at'];
  56 + $data = $this->model->list($this->map,'id',$field);
  57 + $this->response('success',Code::SUCCESS,$data);
  58 + }
  59 +
  60 + /**
47 * @remark :获取数据详情 61 * @remark :获取数据详情
48 * @name :info 62 * @name :info
49 * @author :lyh 63 * @author :lyh
@@ -68,6 +82,7 @@ class CheckListController extends BaseController @@ -68,6 +82,7 @@ class CheckListController extends BaseController
68 * @time :2025/4/17 9:32 82 * @time :2025/4/17 9:32
69 */ 83 */
70 public function save(){ 84 public function save(){
  85 + $this->param['operator_id'] = $this->manage['id'];
71 if(isset($this->param['id']) && !empty($this->param['id'])){ 86 if(isset($this->param['id']) && !empty($this->param['id'])){
72 $id = $this->param['id']; 87 $id = $this->param['id'];
73 $this->model->edit($this->param,['id'=>$this->param['id']]); 88 $this->model->edit($this->param,['id'=>$this->param['id']]);
@@ -29,7 +29,7 @@ class BlogCategoryController extends BaseController @@ -29,7 +29,7 @@ class BlogCategoryController extends BaseController
29 $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); 29 $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
30 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
31 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
32 - $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']); 32 + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id'],$this->user['is_upgrade']);
33 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']); 33 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
34 $lists[$k] = $v; 34 $lists[$k] = $v;
35 } 35 }
@@ -42,12 +42,7 @@ class CustomModuleCategoryController extends BaseController @@ -42,12 +42,7 @@ class CustomModuleCategoryController extends BaseController
42 $template_id = $this->getModuleTemplateId($this->param['module_id']); 42 $template_id = $this->getModuleTemplateId($this->param['module_id']);
43 foreach ($list as $k => $v){ 43 foreach ($list as $k => $v){
44 $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM); 44 $v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM);
45 - $v['url'] = $this->user['domain'].$v['route'];  
46 - if($this->user['is_upgrade'] == 1){  
47 - if($v['route'] != $moduleInfo['route']){  
48 - $v['url'] = $this->user['domain'].$moduleInfo['route']."_catalog/".$v['route'];  
49 - }  
50 - } 45 + $v['url'] = $this->user['domain'].getCustomRouteMap($moduleInfo['route'],$v['route']);
51 $list[$k] = $v; 46 $list[$k] = $v;
52 } 47 }
53 } 48 }
@@ -37,7 +37,7 @@ class GoogleSearchController extends BaseController @@ -37,7 +37,7 @@ class GoogleSearchController extends BaseController
37 //查询详情数据 37 //查询详情数据
38 $searchDetailModel = new GoogleSearchDetail(); 38 $searchDetailModel = new GoogleSearchDetail();
39 $this->map['project_id'] = $this->user['project_id']; 39 $this->map['project_id'] = $this->user['project_id'];
40 - $data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','impressions_rate']); 40 + $data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','position','impressions_rate']);
41 if(!empty($data)){ 41 if(!empty($data)){
42 if($this->param['type'] == 'country'){ 42 if($this->param['type'] == 'country'){
43 $codeCountryModel = new GoogleCodeCountry(); 43 $codeCountryModel = new GoogleCodeCountry();
@@ -29,7 +29,7 @@ class NewsCategoryController extends BaseController @@ -29,7 +29,7 @@ class NewsCategoryController extends BaseController
29 $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST); 29 $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
30 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
31 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
32 - $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']); 32 + $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id'],$this->user['is_upgrade']);
33 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']); 33 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
34 $lists[$k] = $v; 34 $lists[$k] = $v;
35 } 35 }
@@ -321,6 +321,9 @@ class NewsController extends BaseController @@ -321,6 +321,9 @@ class NewsController extends BaseController
321 'keyword.required' => 'keyword不能为空', 321 'keyword.required' => 'keyword不能为空',
322 ]); 322 ]);
323 $data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true); 323 $data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true);
  324 + if(isset($data['data']['p'][0]) && !empty($data['data']['p'][0])){
  325 + $data['data']['p'][0] = str_replace('&nbsp' ,' ',$data['data']['p'][0]);
  326 + }
324 $this->response('success',Code::SUCCESS,$data); 327 $this->response('success',Code::SUCCESS,$data);
325 } 328 }
326 329
@@ -66,19 +66,6 @@ class InquiryFormData extends Base @@ -66,19 +66,6 @@ class InquiryFormData extends Base
66 return 0; 66 return 0;
67 } 67 }
68 68
69 -  
70 - $model = new self();  
71 - $model->form_id = $form_id;  
72 - $model->domain = $domain;  
73 - $model->ip = $ip;  
74 - $model->country = $country;  
75 - $model->referer = $referer;  
76 - $model->user_agent = $user_agent;  
77 - $model->submit_at = $submit_at;  
78 - $model->data = $data;  
79 - $model->sign = $sign;  
80 - $model->save();  
81 -  
82 if(!empty($data['name']) && !empty($data['email']) && !empty($data['message'])){ 69 if(!empty($data['name']) && !empty($data['email']) && !empty($data['message'])){
83 Log::channel('inquiry')->info('开始发邮件' . PHP_EOL); 70 Log::channel('inquiry')->info('开始发邮件' . PHP_EOL);
84 71
@@ -102,8 +89,24 @@ class InquiryFormData extends Base @@ -102,8 +89,24 @@ class InquiryFormData extends Base
102 if(!$has_file) { 89 if(!$has_file) {
103 $res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data, $traffic); 90 $res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data, $traffic);
104 Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]); 91 Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]);
  92 + if(!$res){
  93 + throw new \Exception('询盘发送邮件失败');
  94 + }
105 } 95 }
106 } 96 }
  97 +
  98 + $model = new self();
  99 + $model->form_id = $form_id;
  100 + $model->domain = $domain;
  101 + $model->ip = $ip;
  102 + $model->country = $country;
  103 + $model->referer = $referer;
  104 + $model->user_agent = $user_agent;
  105 + $model->submit_at = $submit_at;
  106 + $model->data = $data;
  107 + $model->sign = $sign;
  108 + $model->save();
  109 +
107 return $model->id; 110 return $model->id;
108 } 111 }
109 112
@@ -68,6 +68,11 @@ class SyncSubmitTaskService @@ -68,6 +68,11 @@ class SyncSubmitTaskService
68 $project = $checkIpCountry['project']; 68 $project = $checkIpCountry['project'];
69 $data['project_id'] = $project['id']; 69 $data['project_id'] = $project['id'];
70 70
  71 + if(empty($data['data']['url']) && $task['type'] == 'visit'){
  72 + throw new InquiryFilterException( 'url为空');
  73 + }
  74 +
  75 +
71 //特殊处理 76 //特殊处理
72 if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){ 77 if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){
73 throw new InquiryFilterException( '黑名单邮箱'); 78 throw new InquiryFilterException( '黑名单邮箱');
@@ -288,6 +293,7 @@ class SyncSubmitTaskService @@ -288,6 +293,7 @@ class SyncSubmitTaskService
288 $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name']; 293 $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name'];
289 MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']); 294 MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']);
290 }catch (\Exception $e){ 295 }catch (\Exception $e){
  296 + Cache::decrement($ip_cache_key);
291 Log::channel('inquiry')->info($task_id . '询盘失败', [$e->getMessage(), $e->getFile(), $e->getLine()]); 297 Log::channel('inquiry')->info($task_id . '询盘失败', [$e->getMessage(), $e->getFile(), $e->getLine()]);
292 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); 298 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage());
293 } 299 }
@@ -309,7 +309,8 @@ Route::middleware(['aloginauth'])->group(function () { @@ -309,7 +309,8 @@ Route::middleware(['aloginauth'])->group(function () {
309 309
310 //检查列表 310 //检查列表
311 Route::prefix('check_list')->group(function () { 311 Route::prefix('check_list')->group(function () {
312 - Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_list'); 312 + Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
  313 + Route::any('/list', [Aside\Optimize\CheckListController::class, 'list'])->name('admin.check_list');
313 Route::any('/info', [Aside\Optimize\CheckListController::class, 'info'])->name('admin.check_list_info'); 314 Route::any('/info', [Aside\Optimize\CheckListController::class, 'info'])->name('admin.check_list_info');
314 Route::any('/save', [Aside\Optimize\CheckListController::class, 'save'])->name('admin.check_list_save'); 315 Route::any('/save', [Aside\Optimize\CheckListController::class, 'save'])->name('admin.check_list_save');
315 Route::any('/del', [Aside\Optimize\CheckListController::class, 'del'])->name('admin.check_list_del'); 316 Route::any('/del', [Aside\Optimize\CheckListController::class, 'del'])->name('admin.check_list_del');