作者 刘锟

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

... ... @@ -67,10 +67,14 @@ class SendKeyword extends Command
$send_num = [30 => 1000, 50 => 2000, 60 => 4000, 70 => 6000];
$ban_domain = $this->banDomain();
foreach ($projects as $item) {
if (empty($item->is_auto_keywords))
if (empty($item->is_auto_keywords)) {
$this->output('项目ID:' . $item->id . ', 未开启推送配置;');
continue;
if (in_array($item->domain, $ban_domain))
}
if (in_array($item->domain, $ban_domain)) {
$this->output('项目ID:' . $item->id . ', 域名被禁用;');
continue;
}
if (empty($item->api_no)) {
$this->output('项目ID:' . $item->id . ', api_no为空;');
continue;
... ... @@ -89,11 +93,15 @@ class SendKeyword extends Command
// 项目是否达标
$compliance = RankData::where(['project_id' => $item->id, 'api_no' => $item->api_no, 'lang' => ''])->value('is_compliance');
if (FALSE == empty($compliance))
return false;
if (FALSE == empty($compliance)) {
$this->output('项目ID:' . $item->id . ', 项目已达标,不需要推送;');
continue;
}
$project = ProjectServer::useProject($item->id);
if (empty($project)) {
$this->output('项目ID:' . $item->id . ', 项目链接失败;');
DB::disconnect('custom_mysql');
continue;
}
... ... @@ -109,6 +117,7 @@ class SendKeyword extends Command
$item['apino'] = $item['api_no'];
$this->sendNotice($item);
}
$this->output('项目ID:' . $item['id'] . ', ' . ($send ? '推送完成' : '无推送关键词;'));
}
return true;
}
... ...
... ... @@ -74,7 +74,7 @@ class RecommendedSuppliers extends Command
DB::disconnect('custom_mysql');
}
}catch (\Exception $e){
echo date('Y-m-d hH:i:s').'当前项目执行错误:'.$e->getMessage().PHP_EOL;
echo date('Y-m-d H:i:s').'当前项目执行错误:'.$e->getMessage().PHP_EOL;
continue;
}
}
... ... @@ -166,7 +166,7 @@ class RecommendedSuppliers extends Command
$saveData = [
'project_id'=>$project_id,
'keyword'=>$keyword,
'data'=>json_encode($res['data'] ?? '')
'data'=>json_encode($res['data'] ?? [])
];
$purchaserModel = new Purchaser();
$purchaserModel->add($saveData);
... ... @@ -214,8 +214,6 @@ class RecommendedSuppliers extends Command
$v['mobile'] = json_encode($v['mobile']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$v['social_media'] = json_encode($v['social_media']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$v['image'] = str_replace('admin.hagro.cn','fob.ai.cc',$v['image']??'');
// $v['created_at'] = date('Y-m-d H:i:s');
// $v['updated_at'] = $v['created_at'];
$param = $v;
$info = $purchaserInfoModel->read(['keyword'=>$keyword,'buyer_id'=>$v['buyer_id']??0,'project_id'=>$project_id],['id']);
if($info === false){
... ...
... ... @@ -6,6 +6,7 @@ namespace App\Helper;
use App\Models\Project\Project;
use App\Utils\HttpUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Facades\Log;
/**
... ... @@ -154,7 +155,7 @@ class FormGlobalsoApi
$res = HttpUtils::post($api_url, $data);
$res = Arr::s2a($res);
} catch (\Exception | GuzzleException $e) {
errorLog('提交询盘信息失败', $data, $e);
Log::channel('inquiry')->info('询盘发送邮件失败' . $e->getMessage(), $data);
return false;
}
return $res;
... ...
... ... @@ -834,6 +834,16 @@ function ends_with($string, $suffix)
return substr($string, -strlen($suffix)) === $suffix;
}
function getCustomRouteMap($module_route,$route = '')
{
if($module_route == $route){
$resultRoute = $route;
}else{
$resultRoute = $module_route.'_catelog/'.$route;
}
return $resultRoute;
}
/**
* @remark :获取二级路由
* @name :getRouteMap
... ... @@ -841,11 +851,24 @@ function ends_with($string, $suffix)
* @method :post
* @time :2023/11/10 14:29
*/
function getRouteMap($source,$source_id){
function getRouteMap($source,$source_id,$is_upgrade = 0){
$route = '';
$routeMapModel = new RouteMap();
$info = $routeMapModel->read(['source'=>$source,'source_id'=>$source_id]);
if($info !== false){
if($is_upgrade == 1){
if($source == $routeMapModel::SOURCE_NEWS_CATE){
if($info['route'] != 'news'){
return $routeMapModel::PATH_NEWS_CATE.'/'.$info['route'];
}
}elseif ($source == $routeMapModel::SOURCE_BLOG_CATE){
if($info['route'] != 'blog'){
return $routeMapModel::PATH_BLOG_CATE.'/'.$info['route'];
}
}
$route = $info['route'];
return $route;
}
if(!empty($info['path'])){
if($info['path'] == 'blog'){
$info['path'] = $info['path'].'s';
... ...
... ... @@ -44,6 +44,20 @@ class CheckListController extends BaseController
}
/**
* @remark :获取分页检查清单数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/4/17 9:31
*/
public function list(){
$this->map['status'] = 1;
$field = ['id','status','sort','text','created_at'];
$data = $this->model->list($this->map,'id',$field);
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取数据详情
* @name :info
* @author :lyh
... ... @@ -68,6 +82,7 @@ class CheckListController extends BaseController
* @time :2025/4/17 9:32
*/
public function save(){
$this->param['operator_id'] = $this->manage['id'];
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
... ...
... ... @@ -29,7 +29,7 @@ class BlogCategoryController extends BaseController
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']);
$v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id'],$this->user['is_upgrade']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
... ...
... ... @@ -42,12 +42,7 @@ class CustomModuleCategoryController extends BaseController
$template_id = $this->getModuleTemplateId($this->param['module_id']);
foreach ($list as $k => $v){
$v['is_renovation'] = $this->getIsRenovation($v['module_id'],BTemplate::IS_LIST,$template_id,$v['id'],BTemplate::IS_CUSTOM);
$v['url'] = $this->user['domain'].$v['route'];
if($this->user['is_upgrade'] == 1){
if($v['route'] != $moduleInfo['route']){
$v['url'] = $this->user['domain'].$moduleInfo['route']."_catalog/".$v['route'];
}
}
$v['url'] = $this->user['domain'].getCustomRouteMap($moduleInfo['route'],$v['route']);
$list[$k] = $v;
}
}
... ...
... ... @@ -37,7 +37,7 @@ class GoogleSearchController extends BaseController
//查询详情数据
$searchDetailModel = new GoogleSearchDetail();
$this->map['project_id'] = $this->user['project_id'];
$data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','impressions_rate']);
$data = $searchDetailModel->lists($this->map,$this->page,$this->row,'impressions',['keys','click_rate','position','impressions_rate']);
if(!empty($data)){
if($this->param['type'] == 'country'){
$codeCountryModel = new GoogleCodeCountry();
... ...
... ... @@ -29,7 +29,7 @@ class NewsCategoryController extends BaseController
$template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
foreach ($lists as $k => $v){
$v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']);
$v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id'],$this->user['is_upgrade']);
$v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
$lists[$k] = $v;
}
... ...
... ... @@ -321,6 +321,9 @@ class NewsController extends BaseController
'keyword.required' => 'keyword不能为空',
]);
$data = curl_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],true);
if(isset($data['data']['p'][0]) && !empty($data['data']['p'][0])){
$data['data']['p'][0] = str_replace('&nbsp' ,' ',$data['data']['p'][0]);
}
$this->response('success',Code::SUCCESS,$data);
}
... ...
... ... @@ -66,19 +66,6 @@ class InquiryFormData extends Base
return 0;
}
$model = new self();
$model->form_id = $form_id;
$model->domain = $domain;
$model->ip = $ip;
$model->country = $country;
$model->referer = $referer;
$model->user_agent = $user_agent;
$model->submit_at = $submit_at;
$model->data = $data;
$model->sign = $sign;
$model->save();
if(!empty($data['name']) && !empty($data['email']) && !empty($data['message'])){
Log::channel('inquiry')->info('开始发邮件' . PHP_EOL);
... ... @@ -102,8 +89,24 @@ class InquiryFormData extends Base
if(!$has_file) {
$res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data, $traffic);
Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]);
if(!$res){
throw new \Exception('询盘发送邮件失败');
}
}
}
$model = new self();
$model->form_id = $form_id;
$model->domain = $domain;
$model->ip = $ip;
$model->country = $country;
$model->referer = $referer;
$model->user_agent = $user_agent;
$model->submit_at = $submit_at;
$model->data = $data;
$model->sign = $sign;
$model->save();
return $model->id;
}
... ...
... ... @@ -68,6 +68,11 @@ class SyncSubmitTaskService
$project = $checkIpCountry['project'];
$data['project_id'] = $project['id'];
if(empty($data['data']['url']) && $task['type'] == 'visit'){
throw new InquiryFilterException( 'url为空');
}
//特殊处理
if($project['id'] == 455 && !empty($data['email']) && $data['email'] == 'alb@marketingtu.org'){
throw new InquiryFilterException( '黑名单邮箱');
... ... @@ -288,6 +293,7 @@ class SyncSubmitTaskService
$name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name'];
MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']);
}catch (\Exception $e){
Cache::decrement($ip_cache_key);
Log::channel('inquiry')->info($task_id . '询盘失败', [$e->getMessage(), $e->getFile(), $e->getLine()]);
LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage());
}
... ...
... ... @@ -309,7 +309,8 @@ Route::middleware(['aloginauth'])->group(function () {
//检查列表
Route::prefix('check_list')->group(function () {
Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_list');
Route::any('/', [Aside\Optimize\CheckListController::class, 'lists'])->name('admin.check_lists');
Route::any('/list', [Aside\Optimize\CheckListController::class, 'list'])->name('admin.check_list');
Route::any('/info', [Aside\Optimize\CheckListController::class, 'info'])->name('admin.check_list_info');
Route::any('/save', [Aside\Optimize\CheckListController::class, 'save'])->name('admin.check_list_save');
Route::any('/del', [Aside\Optimize\CheckListController::class, 'del'])->name('admin.check_list_del');
... ...