Merge remote-tracking branch 'origin/master' into akun
正在显示
19 个修改的文件
包含
160 行增加
和
41 行删除
| @@ -82,7 +82,7 @@ class Count extends Command | @@ -82,7 +82,7 @@ class Count extends Command | ||
| 82 | $arr['created_at'] = date('Y-m-d H:i:s'); | 82 | $arr['created_at'] = date('Y-m-d H:i:s'); |
| 83 | $arr['updated_at'] = date('Y-m-d H:i:s'); | 83 | $arr['updated_at'] = date('Y-m-d H:i:s'); |
| 84 | //询盘统计 | 84 | //询盘统计 |
| 85 | - $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); | 85 | + $arr = $this->inquiry($arr,$v['test_domain'], $v['id'] , $v['is_upgrade'] ?? 0); |
| 86 | if($arr === false){ | 86 | if($arr === false){ |
| 87 | continue; | 87 | continue; |
| 88 | } | 88 | } |
| @@ -134,8 +134,8 @@ class Count extends Command | @@ -134,8 +134,8 @@ class Count extends Command | ||
| 134 | * @method :post | 134 | * @method :post |
| 135 | * @time :2023/6/14 15:44 | 135 | * @time :2023/6/14 15:44 |
| 136 | */ | 136 | */ |
| 137 | - public function inquiry($arr,$domain,$project_id){ | ||
| 138 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 137 | + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ |
| 138 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade); | ||
| 139 | if($inquiry_list == false){ | 139 | if($inquiry_list == false){ |
| 140 | return false; | 140 | return false; |
| 141 | } | 141 | } |
| @@ -175,6 +175,7 @@ class Count extends Command | @@ -175,6 +175,7 @@ class Count extends Command | ||
| 175 | 'gl_project.id AS id', | 175 | 'gl_project.id AS id', |
| 176 | 'gl_project.type AS type', | 176 | 'gl_project.type AS type', |
| 177 | 'gl_project.extend_type AS extend_type', | 177 | 'gl_project.extend_type AS extend_type', |
| 178 | + 'gl_project.is_upgrade AS is_upgrade', | ||
| 178 | 'gl_project.remain_day AS remain_day', | 179 | 'gl_project.remain_day AS remain_day', |
| 179 | 'gl_project.finish_remain_day AS finish_remain_day', | 180 | 'gl_project.finish_remain_day AS finish_remain_day', |
| 180 | 'gl_project_deploy_build.test_domain AS test_domain', | 181 | 'gl_project_deploy_build.test_domain AS test_domain', |
| @@ -101,8 +101,8 @@ class CountAll extends Command | @@ -101,8 +101,8 @@ class CountAll extends Command | ||
| 101 | * @method :post | 101 | * @method :post |
| 102 | * @time :2023/6/14 15:44 | 102 | * @time :2023/6/14 15:44 |
| 103 | */ | 103 | */ |
| 104 | - public function inquiry($arr,$domain,$project_id){ | ||
| 105 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 104 | + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ |
| 105 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade); | ||
| 106 | if($inquiry_list == false){ | 106 | if($inquiry_list == false){ |
| 107 | return false; | 107 | return false; |
| 108 | } | 108 | } |
| @@ -32,7 +32,7 @@ class CountDate extends Command | @@ -32,7 +32,7 @@ class CountDate extends Command | ||
| 32 | * | 32 | * |
| 33 | * @var string | 33 | * @var string |
| 34 | */ | 34 | */ |
| 35 | - protected $description = '统计昨日数据'; | 35 | + protected $description = '时间统计记录'; |
| 36 | 36 | ||
| 37 | /** | 37 | /** |
| 38 | * @name :(定时执行生成昨日数据统计)handle | 38 | * @name :(定时执行生成昨日数据统计)handle |
| @@ -84,7 +84,7 @@ class CountDate extends Command | @@ -84,7 +84,7 @@ class CountDate extends Command | ||
| 84 | $arr['created_at'] = date('Y-m-d H:i:s'); | 84 | $arr['created_at'] = date('Y-m-d H:i:s'); |
| 85 | $arr['updated_at'] = date('Y-m-d H:i:s'); | 85 | $arr['updated_at'] = date('Y-m-d H:i:s'); |
| 86 | //询盘统计 | 86 | //询盘统计 |
| 87 | - $arr = $this->inquiry($arr,$v['test_domain'], $v['id']); | 87 | + $arr = $this->inquiry($arr,$v['test_domain'], $v['id'],$v['is_upgrade'] ?? 0); |
| 88 | if($arr === false){ | 88 | if($arr === false){ |
| 89 | continue; | 89 | continue; |
| 90 | } | 90 | } |
| @@ -136,8 +136,8 @@ class CountDate extends Command | @@ -136,8 +136,8 @@ class CountDate extends Command | ||
| 136 | * @method :post | 136 | * @method :post |
| 137 | * @time :2023/6/14 15:44 | 137 | * @time :2023/6/14 15:44 |
| 138 | */ | 138 | */ |
| 139 | - public function inquiry($arr,$domain,$project_id){ | ||
| 140 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 139 | + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ |
| 140 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade); | ||
| 141 | if($inquiry_list == false){ | 141 | if($inquiry_list == false){ |
| 142 | return false; | 142 | return false; |
| 143 | } | 143 | } |
| @@ -177,6 +177,7 @@ class CountDate extends Command | @@ -177,6 +177,7 @@ class CountDate extends Command | ||
| 177 | 'gl_project.id AS id', | 177 | 'gl_project.id AS id', |
| 178 | 'gl_project.type AS type', | 178 | 'gl_project.type AS type', |
| 179 | 'gl_project.extend_type AS extend_type', | 179 | 'gl_project.extend_type AS extend_type', |
| 180 | + 'gl_project.is_upgrade AS is_upgrade', | ||
| 180 | 'gl_project.remain_day AS remain_day', | 181 | 'gl_project.remain_day AS remain_day', |
| 181 | 'gl_project.finish_remain_day AS finish_remain_day', | 182 | 'gl_project.finish_remain_day AS finish_remain_day', |
| 182 | 'gl_project_deploy_build.test_domain AS test_domain', | 183 | 'gl_project_deploy_build.test_domain AS test_domain', |
| @@ -52,7 +52,7 @@ class CountProject extends Command | @@ -52,7 +52,7 @@ class CountProject extends Command | ||
| 52 | * @method :post | 52 | * @method :post |
| 53 | * @time :2024/1/8 9:05 | 53 | * @time :2024/1/8 9:05 |
| 54 | */ | 54 | */ |
| 55 | - public function count($project_id){ | 55 | + public function count($project_id,$is_upgrade = 0){ |
| 56 | $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date') | 56 | $list = DB::connection('custom_mysql')->table('gl_customer_visit')->select('updated_date') |
| 57 | ->groupBy('updated_date')->get()->toArray(); | 57 | ->groupBy('updated_date')->get()->toArray(); |
| 58 | $project = new Project(); | 58 | $project = new Project(); |
| @@ -87,7 +87,7 @@ class CountProject extends Command | @@ -87,7 +87,7 @@ class CountProject extends Command | ||
| 87 | $arr['compliance_day'] = $projectInfo['finish_remain_day']; | 87 | $arr['compliance_day'] = $projectInfo['finish_remain_day']; |
| 88 | //剩余服务时常 | 88 | //剩余服务时常 |
| 89 | $arr['service_day'] = $projectInfo['remain_day']; | 89 | $arr['service_day'] = $projectInfo['remain_day']; |
| 90 | - $arr = $this->inquiry($arr,$domain, $project_id); | 90 | + $arr = $this->inquiry($arr,$domain, $project_id,$projectInfo['is_upgrade'] ?? 0); |
| 91 | //查询当天数据是否存在 存在则更新 | 91 | //查询当天数据是否存在 存在则更新 |
| 92 | $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]); | 92 | $info = $count->read(['date'=>$v['updated_date'],'project_id'=>$project_id]); |
| 93 | if($info === false){ | 93 | if($info === false){ |
| @@ -144,8 +144,8 @@ class CountProject extends Command | @@ -144,8 +144,8 @@ class CountProject extends Command | ||
| 144 | * @method :post | 144 | * @method :post |
| 145 | * @time :2023/6/14 15:44 | 145 | * @time :2023/6/14 15:44 |
| 146 | */ | 146 | */ |
| 147 | - public function inquiry($arr,$domain,$project_id){ | ||
| 148 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 147 | + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ |
| 148 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade); | ||
| 149 | if($inquiry_list == false){ | 149 | if($inquiry_list == false){ |
| 150 | return false; | 150 | return false; |
| 151 | } | 151 | } |
| @@ -53,6 +53,7 @@ class SyncInquiry extends Command | @@ -53,6 +53,7 @@ class SyncInquiry extends Command | ||
| 53 | { | 53 | { |
| 54 | while (true) { | 54 | while (true) { |
| 55 | $result = $this->getInquiry(); | 55 | $result = $this->getInquiry(); |
| 56 | + $this->output('新的询盘:' . count($result)); | ||
| 56 | if (!$result){ | 57 | if (!$result){ |
| 57 | //5分钟同步一次 | 58 | //5分钟同步一次 |
| 58 | sleep(300); | 59 | sleep(300); |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: zhl | ||
| 5 | + * Date: 2024/09/30 | ||
| 6 | + * Time: 14:01 | ||
| 7 | + */ | ||
| 8 | +namespace App\Console\Commands\Inquiry; | ||
| 9 | + | ||
| 10 | +use App\Enums\Common\Code; | ||
| 11 | +use App\Helper\Arr; | ||
| 12 | +use App\Models\Inquiry\ReInquiryForm; | ||
| 13 | +use App\Models\Inquiry\ReInquiryText; | ||
| 14 | +use App\Utils\HttpUtils; | ||
| 15 | +use GuzzleHttp\Exception\GuzzleException; | ||
| 16 | +use Illuminate\Console\Command; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * Class SyncInquiry | ||
| 20 | + * @package App\Console\Commands\Inquiry | ||
| 21 | + */ | ||
| 22 | +class SyncInquiryText extends Command | ||
| 23 | +{ | ||
| 24 | + /** | ||
| 25 | + * The name and signature of the console command. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $signature = 'sync_inquiry_text'; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * The console command description. | ||
| 33 | + * | ||
| 34 | + * @var string | ||
| 35 | + */ | ||
| 36 | + protected $description = '同步询盘文案'; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Create a new command instance. | ||
| 40 | + * | ||
| 41 | + * @return void | ||
| 42 | + */ | ||
| 43 | + public function __construct() | ||
| 44 | + { | ||
| 45 | + parent::__construct(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * @return bool | ||
| 50 | + */ | ||
| 51 | + public function handle() | ||
| 52 | + { | ||
| 53 | + $res = HttpUtils::get('https://fob.ai.cc/api/get_inquiry_text', ['type' => 'all']); | ||
| 54 | + if($res){ | ||
| 55 | + $res = Arr::s2a($res); | ||
| 56 | + foreach ($res as $item){ | ||
| 57 | + ReInquiryText::createText($item['id'], $item['title'], $item['content'], $item['status']); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | +} |
| @@ -49,6 +49,7 @@ class postInquiry extends Command | @@ -49,6 +49,7 @@ class postInquiry extends Command | ||
| 49 | } | 49 | } |
| 50 | // 询盘数据入库 | 50 | // 询盘数据入库 |
| 51 | foreach ($list as $key => $val) { | 51 | foreach ($list as $key => $val) { |
| 52 | + $this->output('开始执行' . $val->id); | ||
| 52 | try { | 53 | try { |
| 53 | $detail = ReInquiryDetail::find($val['detail_id']); | 54 | $detail = ReInquiryDetail::find($val['detail_id']); |
| 54 | if($val['type'] == 1){ | 55 | if($val['type'] == 1){ |
| @@ -68,7 +69,11 @@ class postInquiry extends Command | @@ -68,7 +69,11 @@ class postInquiry extends Command | ||
| 68 | } | 69 | } |
| 69 | } | 70 | } |
| 70 | }catch (\Exception $e){ | 71 | }catch (\Exception $e){ |
| 72 | + Log::channel('inquiry_relay')->error('inquiry_relay handle error', [$e->getMessage(), $e->getFile(), $e->getLine()]); | ||
| 71 | 73 | ||
| 74 | + $val->status = ReInquiryDetailLog::STATUS_FAIL; | ||
| 75 | + $val->remark = mb_substr($e->getMessage(), 0, 200); | ||
| 76 | + $val->save(); | ||
| 72 | } | 77 | } |
| 73 | } | 78 | } |
| 74 | } | 79 | } |
| @@ -90,6 +95,7 @@ class postInquiry extends Command | @@ -90,6 +95,7 @@ class postInquiry extends Command | ||
| 90 | $log->save(); | 95 | $log->save(); |
| 91 | 96 | ||
| 92 | Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $detail['re_website'] . 'api/traffic_visit/',$data]); | 97 | Log::channel('inquiry_relay')->error('inquiry_relay visit error', [$res, $detail['re_website'] . 'api/traffic_visit/',$data]); |
| 98 | + return false; | ||
| 93 | } | 99 | } |
| 94 | }else{ | 100 | }else{ |
| 95 | //v4 v5分离项目 往测试链接推 | 101 | //v4 v5分离项目 往测试链接推 |
| @@ -118,8 +124,12 @@ class postInquiry extends Command | @@ -118,8 +124,12 @@ class postInquiry extends Command | ||
| 118 | $log->save(); | 124 | $log->save(); |
| 119 | 125 | ||
| 120 | Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 visit error', [$res, $website . 'wp-admin/admin-ajax.php', $data]); | 126 | Log::channel('inquiry_relay')->error('inquiry_relay v4|v5 visit error', [$res, $website . 'wp-admin/admin-ajax.php', $data]); |
| 127 | + return false; | ||
| 121 | } | 128 | } |
| 122 | } | 129 | } |
| 130 | + $log->status = ReInquiryDetailLog::STATUS_SUCCESS; | ||
| 131 | + $log->save(); | ||
| 132 | + return true; | ||
| 123 | } | 133 | } |
| 124 | 134 | ||
| 125 | public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ | 135 | public function inquiry(ReInquiryDetail $detail, ReInquiryDetailLog $log){ |
| @@ -170,6 +180,8 @@ class postInquiry extends Command | @@ -170,6 +180,8 @@ class postInquiry extends Command | ||
| 170 | return false; | 180 | return false; |
| 171 | } | 181 | } |
| 172 | } | 182 | } |
| 183 | + $log->status = ReInquiryDetailLog::STATUS_SUCCESS; | ||
| 184 | + $log->save(); | ||
| 173 | return true; | 185 | return true; |
| 174 | } | 186 | } |
| 175 | 187 |
| @@ -59,7 +59,7 @@ class MonthAllCount extends Command | @@ -59,7 +59,7 @@ class MonthAllCount extends Command | ||
| 59 | } | 59 | } |
| 60 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 61 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; | 61 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; |
| 62 | - $this->count($v['id'], $url); | 62 | + $this->count($v['id'], $url ,$v['is_upgrade']); |
| 63 | DB::disconnect('custom_mysql'); | 63 | DB::disconnect('custom_mysql'); |
| 64 | } | 64 | } |
| 65 | } | 65 | } |
| @@ -71,7 +71,7 @@ class MonthAllCount extends Command | @@ -71,7 +71,7 @@ class MonthAllCount extends Command | ||
| 71 | * @method :post | 71 | * @method :post |
| 72 | * @time :2024/1/8 9:05 | 72 | * @time :2024/1/8 9:05 |
| 73 | */ | 73 | */ |
| 74 | - public function count($project_id,$url){ | 74 | + public function count($project_id,$url,$is_upgrade = 0){ |
| 75 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') | 75 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 76 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) | 76 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) |
| 77 | ->groupBy('month')->get()->toArray(); | 77 | ->groupBy('month')->get()->toArray(); |
| @@ -85,7 +85,7 @@ class MonthAllCount extends Command | @@ -85,7 +85,7 @@ class MonthAllCount extends Command | ||
| 85 | // 获取当月结束时间 | 85 | // 获取当月结束时间 |
| 86 | $end = date('Y-m-t', strtotime($v['month'])); | 86 | $end = date('Y-m-t', strtotime($v['month'])); |
| 87 | $arr['project_id'] = $project_id; | 87 | $arr['project_id'] = $project_id; |
| 88 | - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); | 88 | + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0); |
| 89 | $arr['total'] = $arr['month_total'] = 0; | 89 | $arr['total'] = $arr['month_total'] = 0; |
| 90 | if(isset($res['data']['count'])){ | 90 | if(isset($res['data']['count'])){ |
| 91 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; | 91 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; |
| @@ -67,7 +67,7 @@ class MonthCount extends Command | @@ -67,7 +67,7 @@ class MonthCount extends Command | ||
| 67 | } | 67 | } |
| 68 | ProjectServer::useProject($v['id']); | 68 | ProjectServer::useProject($v['id']); |
| 69 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; | 69 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; |
| 70 | - $this->count($v['id'], $url); | 70 | + $this->count($v['id'], $url ,$v['is_upgrade'] ?? 0); |
| 71 | DB::disconnect('custom_mysql'); | 71 | DB::disconnect('custom_mysql'); |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| @@ -99,7 +99,7 @@ class MonthCount extends Command | @@ -99,7 +99,7 @@ class MonthCount extends Command | ||
| 99 | * @method :post | 99 | * @method :post |
| 100 | * @time :2024/1/8 9:05 | 100 | * @time :2024/1/8 9:05 |
| 101 | */ | 101 | */ |
| 102 | - public function count($project_id,$url){ | 102 | + public function count($project_id,$url,$is_upgrade = 0){ |
| 103 | $arr = []; | 103 | $arr = []; |
| 104 | $v = ['month'=>date('Y-m')]; | 104 | $v = ['month'=>date('Y-m')]; |
| 105 | $monthCountModel = new MonthCountModel(); | 105 | $monthCountModel = new MonthCountModel(); |
| @@ -109,7 +109,7 @@ class MonthCount extends Command | @@ -109,7 +109,7 @@ class MonthCount extends Command | ||
| 109 | // 获取当月结束时间 | 109 | // 获取当月结束时间 |
| 110 | $end = date('Y-m-t', strtotime($v['month'])); | 110 | $end = date('Y-m-t', strtotime($v['month'])); |
| 111 | $arr['project_id'] = $project_id; | 111 | $arr['project_id'] = $project_id; |
| 112 | - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); | 112 | + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0); |
| 113 | $arr['total'] = $arr['month_total'] = 0; | 113 | $arr['total'] = $arr['month_total'] = 0; |
| 114 | if(isset($res['data']['count'])){ | 114 | if(isset($res['data']['count'])){ |
| 115 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; | 115 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; |
| @@ -67,7 +67,7 @@ class MonthCountDate extends Command | @@ -67,7 +67,7 @@ class MonthCountDate extends Command | ||
| 67 | } | 67 | } |
| 68 | ProjectServer::useProject($v['id']); | 68 | ProjectServer::useProject($v['id']); |
| 69 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; | 69 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; |
| 70 | - $this->count($v['id'], $url); | 70 | + $this->count($v['id'], $url , $v['is_upgrade'] ?? 0); |
| 71 | DB::disconnect('custom_mysql'); | 71 | DB::disconnect('custom_mysql'); |
| 72 | } | 72 | } |
| 73 | } | 73 | } |
| @@ -99,7 +99,7 @@ class MonthCountDate extends Command | @@ -99,7 +99,7 @@ class MonthCountDate extends Command | ||
| 99 | * @method :post | 99 | * @method :post |
| 100 | * @time :2024/1/8 9:05 | 100 | * @time :2024/1/8 9:05 |
| 101 | */ | 101 | */ |
| 102 | - public function count($project_id,$url){ | 102 | + public function count($project_id,$url,$is_upgrade){ |
| 103 | $arr = []; | 103 | $arr = []; |
| 104 | $date = $this->argument('date'); | 104 | $date = $this->argument('date'); |
| 105 | $v = ['month'=>$date]; | 105 | $v = ['month'=>$date]; |
| @@ -110,7 +110,7 @@ class MonthCountDate extends Command | @@ -110,7 +110,7 @@ class MonthCountDate extends Command | ||
| 110 | // 获取当月结束时间 | 110 | // 获取当月结束时间 |
| 111 | $end = date('Y-m-t', strtotime($v['month'])); | 111 | $end = date('Y-m-t', strtotime($v['month'])); |
| 112 | $arr['project_id'] = $project_id; | 112 | $arr['project_id'] = $project_id; |
| 113 | - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month']); | 113 | + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v['month'],$is_upgrade ?? 0); |
| 114 | $arr['total'] = $arr['month_total'] = 0; | 114 | $arr['total'] = $arr['month_total'] = 0; |
| 115 | if(isset($res['data']['count'])){ | 115 | if(isset($res['data']['count'])){ |
| 116 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; | 116 | echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; |
| @@ -49,8 +49,10 @@ class MonthProjectCount extends Command | @@ -49,8 +49,10 @@ class MonthProjectCount extends Command | ||
| 49 | $info = $domainModel->read(['project_id'=>$project_id]); | 49 | $info = $domainModel->read(['project_id'=>$project_id]); |
| 50 | $url = $info['domain']; | 50 | $url = $info['domain']; |
| 51 | } | 51 | } |
| 52 | + $projectModel = new Project(); | ||
| 53 | + $projectInfo = $projectModel->read(['id'=>$project_id]); | ||
| 52 | ProjectServer::useProject($project_id); | 54 | ProjectServer::useProject($project_id); |
| 53 | - $this->count($project_id,$url); | 55 | + $this->count($project_id,$url,$projectInfo['is_upgrade'] ?? 0); |
| 54 | DB::disconnect('custom_mysql'); | 56 | DB::disconnect('custom_mysql'); |
| 55 | } | 57 | } |
| 56 | 58 | ||
| @@ -61,7 +63,7 @@ class MonthProjectCount extends Command | @@ -61,7 +63,7 @@ class MonthProjectCount extends Command | ||
| 61 | * @method :post | 63 | * @method :post |
| 62 | * @time :2024/1/8 9:05 | 64 | * @time :2024/1/8 9:05 |
| 63 | */ | 65 | */ |
| 64 | - public function count($project_id,$url){ | 66 | + public function count($project_id,$url,$is_upgrade = 0){ |
| 65 | $data = []; | 67 | $data = []; |
| 66 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') | 68 | $list = DB::connection('custom_mysql')->table('gl_customer_visit') |
| 67 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) | 69 | ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) |
| @@ -80,7 +82,7 @@ class MonthProjectCount extends Command | @@ -80,7 +82,7 @@ class MonthProjectCount extends Command | ||
| 80 | // 获取当月结束时间 | 82 | // 获取当月结束时间 |
| 81 | $end = date('Y-m-t', strtotime($v)); | 83 | $end = date('Y-m-t', strtotime($v)); |
| 82 | $arr['project_id'] = $project_id; | 84 | $arr['project_id'] = $project_id; |
| 83 | - $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v); | 85 | + $res = (new FormGlobalsoApi())->getMonthInquiry($url,$v ,$is_upgrade ?? 0); |
| 84 | echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL; | 86 | echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL; |
| 85 | $arr['total'] = $arr['month_total'] = 0; | 87 | $arr['total'] = $arr['month_total'] = 0; |
| 86 | if(isset($res['data']['count'])){ | 88 | if(isset($res['data']['count'])){ |
| @@ -2,8 +2,10 @@ | @@ -2,8 +2,10 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands\RankData; | 3 | namespace App\Console\Commands\RankData; |
| 4 | 4 | ||
| 5 | +use App\Helper\QuanqiusouApi; | ||
| 5 | use App\Http\Logic\Bside\RankData\RankDataLogic; | 6 | use App\Http\Logic\Bside\RankData\RankDataLogic; |
| 6 | use App\Models\Project\DeployOptimize; | 7 | use App\Models\Project\DeployOptimize; |
| 8 | +use App\Models\RankData\RankData; | ||
| 7 | use Illuminate\Support\Facades\Log; | 9 | use Illuminate\Support\Facades\Log; |
| 8 | 10 | ||
| 9 | /** | 11 | /** |
| @@ -34,6 +36,23 @@ class IndexedPages extends BaseCommands | @@ -34,6 +36,23 @@ class IndexedPages extends BaseCommands | ||
| 34 | * @date 2023/5/11 | 36 | * @date 2023/5/11 |
| 35 | */ | 37 | */ |
| 36 | public function do(){ | 38 | public function do(){ |
| 39 | + $api = new QuanqiusouApi(); | ||
| 40 | + $site_res = $api->getSiteRes(); | ||
| 41 | + if (!$site_res) { | ||
| 42 | + Log::channel('rank_data')->error('谷歌收录数据获取失败'); | ||
| 43 | + }else{ | ||
| 44 | + foreach ($site_res as $api_no => $num){ | ||
| 45 | + $project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id'); | ||
| 46 | + foreach ($project_ids as $project_id){ | ||
| 47 | + $rank_data = RankData::where('project_id', $project_id)->where('lang', '')->first(); | ||
| 48 | + if($rank_data){ | ||
| 49 | + $rank_data->indexed_pages_num = $num; | ||
| 50 | + $rank_data->save(); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 37 | //有排名api编号的项目 | 56 | //有排名api编号的项目 |
| 38 | $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray(); | 57 | $list = DeployOptimize::where('api_no', '>', 0)->pluck('api_no', 'project_id')->toArray(); |
| 39 | Log::channel('rank_data')->info('开始-页面收录数据-'.count($list)); | 58 | Log::channel('rank_data')->info('开始-页面收录数据-'.count($list)); |
| @@ -144,7 +144,7 @@ class Test extends Command | @@ -144,7 +144,7 @@ class Test extends Command | ||
| 144 | try { | 144 | try { |
| 145 | $list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get(); | 145 | $list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get(); |
| 146 | foreach ($list as $v){ | 146 | foreach ($list as $v){ |
| 147 | - $arr = $this->inquiry([],$test_domain, $v['id']); | 147 | + $arr = $this->inquiry([],$test_domain, $v['id'],$project->is_upgrade ?? 0); |
| 148 | $v->inquiry_num = $arr['inquiry_num']; | 148 | $v->inquiry_num = $arr['inquiry_num']; |
| 149 | $v->country = $arr['country']; | 149 | $v->country = $arr['country']; |
| 150 | $v->save(); | 150 | $v->save(); |
| @@ -157,8 +157,8 @@ class Test extends Command | @@ -157,8 +157,8 @@ class Test extends Command | ||
| 157 | echo "finish"; | 157 | echo "finish"; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | - public function inquiry($arr,$domain,$project_id){ | ||
| 161 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 160 | + public function inquiry($arr,$domain,$project_id,$is_upgrade = 0){ |
| 161 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade ?? 0); | ||
| 162 | if($inquiry_list['status'] == 400){ | 162 | if($inquiry_list['status'] == 400){ |
| 163 | $arr['inquiry_num'] = 0; | 163 | $arr['inquiry_num'] = 0; |
| 164 | $countryArr = []; | 164 | $countryArr = []; |
| @@ -56,16 +56,16 @@ class UpdateRoute extends Command | @@ -56,16 +56,16 @@ class UpdateRoute extends Command | ||
| 56 | */ | 56 | */ |
| 57 | public function handle(){ | 57 | public function handle(){ |
| 58 | $projectModel = new Project(); | 58 | $projectModel = new Project(); |
| 59 | - $list = $projectModel->list(['id'=>['in',[1799]]]); | 59 | + $list = $projectModel->list(['id'=>['in',[1148]]]); |
| 60 | $data = []; | 60 | $data = []; |
| 61 | foreach ($list as $v){ | 61 | foreach ($list as $v){ |
| 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | 62 | echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; |
| 63 | ProjectServer::useProject($v['id']); | 63 | ProjectServer::useProject($v['id']); |
| 64 | // $this->getProduct(); | 64 | // $this->getProduct(); |
| 65 | -// $this->setProductKeyword(); | 65 | + $this->setProductKeyword(); |
| 66 | // $this->getBlog(); | 66 | // $this->getBlog(); |
| 67 | // $this->setCustomRoute($v['id']); | 67 | // $this->setCustomRoute($v['id']); |
| 68 | - $this->editProductAlt(); | 68 | +// $this->editProductAlt(); |
| 69 | DB::disconnect('custom_mysql'); | 69 | DB::disconnect('custom_mysql'); |
| 70 | } | 70 | } |
| 71 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 71 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| @@ -131,6 +131,8 @@ class UpdateRoute extends Command | @@ -131,6 +131,8 @@ class UpdateRoute extends Command | ||
| 131 | foreach ($lists as $v){ | 131 | foreach ($lists as $v){ |
| 132 | if(!empty($v['route'])){ | 132 | if(!empty($v['route'])){ |
| 133 | echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL; | 133 | echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL; |
| 134 | + $route = $this->setRoute($v['route'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $v['project_id']); | ||
| 135 | + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 134 | continue; | 136 | continue; |
| 135 | }else{ | 137 | }else{ |
| 136 | echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL; | 138 | echo date('Y-m-d H:i:s') . 'route :'.$v['id'] . PHP_EOL; |
| @@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel | @@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel | ||
| 42 | // 每日推送已完成视频任务项目生成对应界面 | 42 | // 每日推送已完成视频任务项目生成对应界面 |
| 43 | //更新AI站点数据 | 43 | //更新AI站点数据 |
| 44 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); | 44 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); |
| 45 | + //每日同步询盘文案 | ||
| 46 | + $schedule->command('sync_inquiry_text')->dailyAt('09:00')->withoutOverlapping(1); | ||
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | /** | 49 | /** |
| @@ -162,12 +162,19 @@ class FormGlobalsoApi | @@ -162,12 +162,19 @@ class FormGlobalsoApi | ||
| 162 | * @method :post | 162 | * @method :post |
| 163 | * @time :2024/8/15 14:16 | 163 | * @time :2024/8/15 14:16 |
| 164 | */ | 164 | */ |
| 165 | - public function getInquiryAll($domain){ | 165 | + public function getInquiryAll($domain,$is_upgrade = 0){ |
| 166 | if (!(strpos($domain, 'https://') === 0)) { | 166 | if (!(strpos($domain, 'https://') === 0)) { |
| 167 | $domain = 'https://'.$domain.'/'; | 167 | $domain = 'https://'.$domain.'/'; |
| 168 | } | 168 | } |
| 169 | $token = md5($domain.date("Y-m-d")); | 169 | $token = md5($domain.date("Y-m-d")); |
| 170 | - $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15"; | 170 | + $data = [ |
| 171 | + 'domain' => $domain, | ||
| 172 | + 'token' => $token, | ||
| 173 | + 'source'=> $is_upgrade ? '1,2,3,4' : '1,3', | ||
| 174 | + 'num'=>15, | ||
| 175 | + ]; | ||
| 176 | + $queryString = http_build_query($data); | ||
| 177 | + $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?".$queryString; | ||
| 171 | try { | 178 | try { |
| 172 | $res = http_get($url,['charset=utf-8']); | 179 | $res = http_get($url,['charset=utf-8']); |
| 173 | } catch (\Exception | GuzzleException $e) { | 180 | } catch (\Exception | GuzzleException $e) { |
| @@ -184,10 +191,18 @@ class FormGlobalsoApi | @@ -184,10 +191,18 @@ class FormGlobalsoApi | ||
| 184 | * @method :post | 191 | * @method :post |
| 185 | * @time :2024/8/16 10:16 | 192 | * @time :2024/8/16 10:16 |
| 186 | */ | 193 | */ |
| 187 | - public function getMonthInquiry($url,$month){ | 194 | + public function getMonthInquiry($url,$month,$is_upgrade = 0){ |
| 188 | $url = 'https://'.$url.'/'; | 195 | $url = 'https://'.$url.'/'; |
| 189 | $token = md5($url.date("Y-m-d")); | 196 | $token = md5($url.date("Y-m-d")); |
| 190 | - $url = 'https://form.globalso.com/api/external-interface/country_con/15243d63ed5a5738?domain='.$url.'&token='.$token.'&source=1,2,3,4&model=month&sta_date='.$month; | 197 | + $data = [ |
| 198 | + 'domain' => $url, | ||
| 199 | + 'token' => $token, | ||
| 200 | + 'source'=> $is_upgrade ? '1,2,3,4' : '1,3', | ||
| 201 | + 'model' => 'month', | ||
| 202 | + 'sta_date'=>$month, | ||
| 203 | + ]; | ||
| 204 | + $queryString = http_build_query($data); | ||
| 205 | + $url = 'https://form.globalso.com/api/external-interface/country_con/15243d63ed5a5738?'.$queryString; | ||
| 191 | $res = http_get($url,['charset=utf-8']); | 206 | $res = http_get($url,['charset=utf-8']); |
| 192 | echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL; | 207 | echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL; |
| 193 | return $res; | 208 | return $res; |
| @@ -75,7 +75,7 @@ class OptimizationReportController extends BaseController | @@ -75,7 +75,7 @@ class OptimizationReportController extends BaseController | ||
| 75 | //关键词排名明细 | 75 | //关键词排名明细 |
| 76 | $data['keywords_rank_list'] = $this->keywords_rank_list($this->param['project_id'],$projectInfo); | 76 | $data['keywords_rank_list'] = $this->keywords_rank_list($this->param['project_id'],$projectInfo); |
| 77 | //pv_ip统计 | 77 | //pv_ip统计 |
| 78 | - $data['pv_ip'] = $this->pv_ip($domain_info['domain']); | 78 | + $data['pv_ip'] = $this->pv_ip($domain_info['domain'],$projectInfo['is_upgrade']); |
| 79 | //30天统计 | 79 | //30天统计 |
| 80 | $data['count_30'] = $this->count_30_total(); | 80 | $data['count_30'] = $this->count_30_total(); |
| 81 | //访问国家前10 | 81 | //访问国家前10 |
| @@ -321,10 +321,10 @@ class OptimizationReportController extends BaseController | @@ -321,10 +321,10 @@ class OptimizationReportController extends BaseController | ||
| 321 | * @method :post | 321 | * @method :post |
| 322 | * @time :2024/3/7 16:53 | 322 | * @time :2024/3/7 16:53 |
| 323 | */ | 323 | */ |
| 324 | - public function pv_ip($domain){ | 324 | + public function pv_ip($domain,$is_upgrade = 0){ |
| 325 | $pv = (new VisitItem())->count(); | 325 | $pv = (new VisitItem())->count(); |
| 326 | $ip = (new Visit())->count(); | 326 | $ip = (new Visit())->count(); |
| 327 | - $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain); | 327 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain,$is_upgrade ?? 0); |
| 328 | if(!empty($inquiry_list)){ | 328 | if(!empty($inquiry_list)){ |
| 329 | $total = $inquiry_list['data']['count'] ?? 0; | 329 | $total = $inquiry_list['data']['count'] ?? 0; |
| 330 | } | 330 | } |
| @@ -124,7 +124,8 @@ class AdsController extends BaseController | @@ -124,7 +124,8 @@ class AdsController extends BaseController | ||
| 124 | $channel = Project::where('id', $domain_info['project_id'])->value('channel'); | 124 | $channel = Project::where('id', $domain_info['project_id'])->value('channel'); |
| 125 | $data = [ | 125 | $data = [ |
| 126 | 'is_v6' => 1, | 126 | 'is_v6' => 1, |
| 127 | - 'agent' => Channel::getChannelText($channel['user_id']??0) | 127 | + 'agent' => Channel::getChannelText($channel['user_id']??0), |
| 128 | + 'domain' => $domain, | ||
| 128 | ]; | 129 | ]; |
| 129 | return $this->response('success', Code::SUCCESS, $data); | 130 | return $this->response('success', Code::SUCCESS, $data); |
| 130 | } | 131 | } |
| @@ -141,7 +142,8 @@ class AdsController extends BaseController | @@ -141,7 +142,8 @@ class AdsController extends BaseController | ||
| 141 | } | 142 | } |
| 142 | $data = [ | 143 | $data = [ |
| 143 | 'is_v6' => 0, | 144 | 'is_v6' => 0, |
| 144 | - 'agent' => $res['data'] | 145 | + 'agent' => $res['data'], |
| 146 | + 'domain' => $domain, | ||
| 145 | ]; | 147 | ]; |
| 146 | return $this->response('success', Code::SUCCESS, $data); | 148 | return $this->response('success', Code::SUCCESS, $data); |
| 147 | } | 149 | } |
| @@ -111,7 +111,7 @@ class TaskController extends BaseController | @@ -111,7 +111,7 @@ class TaskController extends BaseController | ||
| 111 | 'id.required' => 'ID不能为空' | 111 | 'id.required' => 'ID不能为空' |
| 112 | ]); | 112 | ]); |
| 113 | $data = $logic->getTaskInfo(); | 113 | $data = $logic->getTaskInfo(); |
| 114 | - return $this->response('success',Code::SUCCESS,$data); | 114 | + $this->response('success',Code::SUCCESS,$data); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /** | 117 | /** |
-
请 注册 或 登录 后发表评论