作者 赵彬吉
... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo;
use App\Models\Geo\GeoQuestionLog;
use App\Models\Geo\GeoQuestionResult;
use App\Models\Project\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use App\Models\Geo\GeoCount as GeoCountModel;
... ... @@ -61,18 +62,26 @@ class GeoCount extends Command
if(empty($project_id)){
return true;
}
$projectModel = new Project();
$geo_qualify_day = $projectModel->getValue(['id'=>$project_id],['geo_qualify_day']);
$geoQuestionResModel = new GeoQuestionResult();
$platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude'];
foreach ($project_id as $item){
$this->output('执行的项目ID----'.$item);
//收录总数
$total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
$qualify_total = $geoQuestionResModel->counts(['platform'=>['in',['openai', 'gemini','google_ai_overview']],'project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
if($qualify_total > $geo_qualify_day){
$is_qualify = 1;
}
$data = [
'project_id' => $item,
'date' => $date,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'total'=>$total,//收录总数
'is_qualify'=>$is_qualify,
'qualify_total'=>$qualify_total
];
foreach ($platforms as $platform){
if($platform == 'openai-not-network'){
... ...
... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\Geo;
use App\Models\Geo\GeoQuestionLog;
use App\Models\Geo\GeoQuestionResult;
use App\Models\Project\Project;
use Illuminate\Console\Command;
use Illuminate\Support\Carbon;
use App\Models\Geo\GeoCount as GeoCountModel;
... ... @@ -65,18 +66,26 @@ class GeoCountAll extends Command
if(empty($project_id)){
return true;
}
$projectModel = new Project();
$geo_qualify_day = $projectModel->getValue(['id'=>$project_id],['geo_qualify_day']);
$geoQuestionResModel = new GeoQuestionLog();
$platforms = ['gemini','openai','deepseek','poe','perplexity','google_ai_overview','openai-not-network','claude'];
foreach ($project_id as $item){
$this->output('执行的项目ID----'.$item);
//收录总数
$total = $geoQuestionResModel->counts(['project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
$qualify_total = $geoQuestionResModel->counts(['platform'=>['in',['openai', 'gemini','google_ai_overview']],'project_id' => $item,'hit'=>['!=',0],'created_at' => ['between',[$start,$end]]]);
if($total > $geo_qualify_day){
$is_qualify = 1;
}
$data = [
'project_id' => $item,
'date' => $date,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'total'=>$total,//收录总数
'is_qualify'=>$is_qualify,
'qualify_total'=>$qualify_total
];
foreach ($platforms as $platform){
if($platform == 'openai-not-network'){
... ...
... ... @@ -33,11 +33,11 @@ class SyncImage extends Command
public function handle(){
$str = $this->getProjectConfig(4636);
$str = $this->getProjectConfig(2123);
$imageModel = new Image();
// $strImage = '/upload/p/4240/image_other/2025-09/picture-18-copy-3.jpg,/upload/p/4240/image_other/2025-09/picture-17-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-16-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-3.jpg,/upload/p/4240/image_other/2025-09/picture-5-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-6-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy-2.jpg,/upload/p/4240/image_other/2025-09/4-1.jpg,/upload/p/4240/image_other/2025-09/picture-18-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-16-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-17-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-15-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-13-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-14-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-2.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-20-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-18-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-19-copy-1.jpg,/upload/p/4240/image_other/2025-09/image-1-copy.jpg,/upload/p/4240/image_other/2025-09/image-2-copy.jpg,/upload/p/4240/image_other/2025-09/picture-3-copy.jpg,/upload/p/4240/image_other/2025-09/picture-6-copy.jpg,/upload/p/4240/image_other/2025-09/picture-4-copy.jpg,/upload/p/4240/image_other/2025-09/picture-5-copy.jpg,/upload/p/4240/image_other/2025-09/picture-9-copy.jpg,/upload/p/4240/image_other/2025-09/picture-7-copy.jpg,/upload/p/4240/image_other/2025-09/picture-8-copy.jpg,/upload/p/4240/image_other/2025-09/picture-15-copy-1.jpg,/upload/p/4240/image_other/2025-09/picture-14-copy.jpg,/upload/p/4240/image_other/2025-09/picture-13-copy.jpg,/upload/p/4240/image_other/2025-09/picture-12-copy-1.jpg,/upload/p/4240/image_other/2025-08/picture-44-copy.jpg,/upload/p/4240/image_other/2025-08/45.jpg,/upload/p/4240/image_other/2025-09/picture-10-copy.jpg,/upload/p/4240/image_other/2025-09/picture-11-copy.jpg,/upload/p/4240/image_other/2025-08/43.jpg,/upload/p/4240/image_other/2025-08/42.jpg,/upload/p/4240/image_other/2025-08/picture-38-copy.jpg,/upload/p/4240/image_other/2025-08/picture-37-copy.jpg,/upload/p/4240/image_other/2025-08/picture-36-copy.jpg,/upload/p/4240/image_other/2025-08/picture-35-copy-1.jpg,/upload/p/4240/image_other/2025-08/picture-30-copy.jpg,/upload/p/4240/image_other/2025-08/29.jpg,/upload/p/4240/image_other/2025-08/28-1.jpg,/upload/p/4240/image_other/2025-08/27-1.jpg,/upload/p/4240/image_other/2025-08/picture-23-copy.jpg,/upload/p/4240/image_other/2025-08/22-1.jpg,/upload/p/4240/image_other/2025-08/21.jpg,/upload/p/4240/image_other/2025-08/17.jpg,/upload/p/4240/image_other/2025-08/16.jpg,/upload/p/4240/image_other/2025-08/picture-15-copy.jpg,/upload/p/4240/image_other/2025-08/11-2.jpg,/upload/p/4240/image_other/2025-08/10-1.jpg,/upload/p/4240/image_other/2025-08/picture-6.jpg,/upload/p/4240/image_other/2025-08/picture-5.jpg,/upload/p/4240/image_other/2025-08/picture-4.jpg,/upload/p/4240/image_other/2025-08/api-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/gb-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/gost-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/jis-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/asmeastm-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/en-standard-welded-pipe.jpg,/upload/p/4240/image_other/2025-08/api-corrosion-resistant-alloy-cra-pipe.jpg,/upload/p/4240/image_other/2025-08/nickel-alloy-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/duplexsuper-duplex-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/super-austenitic-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/austenitic-stainless-steel-seamless-pipe.jpg,/upload/p/4240/image_other/2025-08/thick-zinc-coated-pipe.jpg,/upload/p/4240/image_other/2025-08/galvanized-fbe-pipe.jpg,/upload/p/4240/image_other/2025-08/electro-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/hot-dip-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/q235-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/q195-galvanized-pipe.jpg,/upload/p/4240/image_other/2025-08/bare-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/fbe-coated-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/x52-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/q235b-ssaw-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/low-alloy-steel-erw-pipe.jpg,/upload/p/4240/image_other/2025-08/carbon-steel-erw-pipe.jpg,/upload/p/4240/image_other/2025-08/black-carbon-steel-pipe.jpg,/upload/p/4240/image_other/2025-08/picture-19-copy.jpg,/upload/p/4240/image_other/2025-08/hydrogen-energy-skid.jpg';
$lists = $imageModel->selectField(['project_id'=>4636],'path');
// $lists = explode(',',$strImage);
$strImage = '/upload/p/2123/image_other/2025-10/1-361.jpg,/upload/p/2123/image_other/2025-10/3-255.jpg,/upload/p/2123/image_other/2025-10/4-237.jpg,/upload/p/2123/image_other/2025-10/5-104.jpg,/upload/p/2123/image_other/2025-10/6-53.jpg,/upload/p/2123/image_other/2025-10/7-31.jpg,/upload/p/2123/image_other/2025-10/8-27.jpg,/upload/p/2123/image_other/2025-10/5-105.jpg';
// $lists = $imageModel->selectField(['project_id'=>4636],'path');
$lists = explode(',',$strImage);
$domain = 'http://globalso-v6-1309677403.cos.ap-hongkong.myqcloud.com';//cos域名
foreach ($lists as $v){
$url = $domain . $v.'?'.$str;
... ...
... ... @@ -49,7 +49,120 @@ class Temp extends Command
public function handle()
{
$this->inquiryAiCheck(17259, 27468);
}
/**
* 4301项目特殊产品数据导入
* @return bool
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
* @author Akun
* @date 2025/10/21 10:11
*/
public function specialImport4301()
{
$file_url = 'D:\work\特维整理后表格.csv';
$project_id = 4301;
$img_path = '/upload/p/' . $project_id . '/image_product/2025-10/';
$is_gbk = 0;
$file_code_type = $this->get_code_type($file_url);
if ($file_code_type === false) {
$this->output('import fail, error: 文件编码格式错误');
return true;
} elseif ($file_code_type === 'GBK') {
$is_gbk = 1;
setlocale(LC_ALL, 'zh_CN');
}
//读取csv文件
$line_of_text = [];
try {
$opts = [
'http' => [
'method' => 'GET',
'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'
],
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
]
];
$file_handle = fopen($file_url, 'r', null, stream_context_create($opts));
while (!feof($file_handle)) {
$line_of_text[] = fgetcsv($file_handle, 0, ',');
}
fclose($file_handle);
} catch (\Exception $e) {
$this->output('import fail, error: ' . $e->getMessage());
return true;
}
$new_csv = [];
if (count($line_of_text) > 1) {
foreach ($line_of_text as $k => $v) {
if ($k > 0 && isset($v[0]) && $v[0]) {
if ($is_gbk) {
foreach ($v as $kk => $vv) {
$v[$kk] = mb_convert_encoding($vv, 'utf-8', 'gbk');
}
}
$images = glob('D:\work\特维产品图\TW24\\' . $v[8] . '*');
$new_images = [];
foreach ($images as $img) {
$img_arr = explode('\\', $img);
$new_images[] = getImageUrl($img_path . end($img_arr), 1);
}
$new_csv[] = [
$this->special2str($v[0]),
$v[1],
$v[2],
$v[3],
Arr::a2s([
'Number' => $v[8],
'Price' => $v[9],
'Unit' => $v[10],
'Packaging' => $v[11],
'Length' => $v[12],
'Width' => $v[13],
'Height' => $v[14],
'Box Length' => $v[15],
'Box Width' => $v[16],
'Box Height' => $v[17],
'Material Volume' => $v[18],
'Volume' => $v[19],
'Box Number' => $v[20],
'Weight' => $v[21],
'Product Weight' => $v[22],
'Category' => $v[23],
'Color' => $v[24],
'Minimum Order Quantity' => $v[25],
]),
$v[5],
$v[6],
implode('^v6sp$', $new_images)
];
}
}
}
$map = ['产品标题', '自定义路由', '分类(支持多级,用 ^v6sp$ 分割)', '关键词(支持多个,用 ^v6sp$分割)', '参数(json格式)', '短描述', '产品描述', '产品图片集(支持多张,用 ^v6sp$ 分割)'];
//生成文件,发送到客户端
if ($new_csv) {
$table = new BatchExportService($project_id . '_products_need_import');
$file = $table->head($map)->data($new_csv)->save();
if (!$file) {
$this->output('文件生成失败,请重试');
} else {
$this->output('export success');
}
} else {
$this->output('no data');
}
return true;
}
/**
... ... @@ -159,7 +272,7 @@ class Temp extends Command
* @author Akun
* @date 2025/06/05 10:47
*/
public function specialImport()
public function specialImport3531()
{
$file_url = 'https://ecdn6.globalso.com/upload/p/3531/file/2025-07/www-cninfo-com-cn_news_v1-2.csv';
$domain = 'static.cninfo.com.cn';
... ...
... ... @@ -123,10 +123,6 @@ class ProjectLogic extends BaseLogic
$info['collect_test_domain'] = $info['is_upgrade'] ? CollectLog::getCollectTestDomain($id) : '';
//获取项目所属行业
$info['deploy_optimize']['industry'] = ProjectIndustryRelated::where('project_id', $id)->pluck('industry_id')->toArray();
$questionModel = new GeoQuestionResult();
$info['question_qualify_count'] = $questionModel->where('project_id', $id)
->where('hit','!=',0)->whereIn('platform',['openai', 'gemini','google_ai_overview'])
->count();
return $this->success($info);
}
... ...
... ... @@ -101,6 +101,10 @@ class CountLogic extends BaseLogic
* @time :2023/5/24 14:03
*/
public function keyword_data_count(){
$version = $this->project['version'] ?? '';
if(!empty($version) && $version != '7.5'){
}
$yesterday = date('Y-m-d');
$rankDataModel = new RankDataModel();
$param = [
... ...
... ... @@ -93,7 +93,7 @@ class ProductLogic extends BaseLogic
$route = $param['route'];
$is_upgrade = $param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
$six_read = $param['six_read'] ?? 0;//是否按6.0显示
if($six_read == 0 && $is_upgrade == 1){
if($six_read == 1 && $is_upgrade == 1){
unset($param['route']);
}else{
$param['route'] = RouteMap::setRoute($param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
... ...