作者 刘锟

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

... ... @@ -135,7 +135,7 @@ class Count extends Command
* @time :2023/6/14 15:44
*/
public function inquiry($arr,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
if($inquiry_list == false){
return false;
}
... ... @@ -143,17 +143,9 @@ class Count extends Command
$arr['inquiry_num'] = 0;
$countryArr = [];
}else{
$arr['inquiry_num'] = $inquiry_list['data']['total'];
$arr['inquiry_num'] = $inquiry_list['data']['count'];
//询盘国家统计
$countryData = $inquiry_list['data']['data'];
$countryArr = [];
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']]++;
}else{
$countryArr[$v1['country']] = 1;
}
}
$countryArr = $inquiry_list['data']['country'];
}
//加上其他询盘
ProjectServer::useProject($project_id);
... ...
... ... @@ -102,7 +102,7 @@ class CountAll extends Command
* @time :2023/6/14 15:44
*/
public function inquiry($arr,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
if($inquiry_list == false){
return false;
}
... ... @@ -110,17 +110,9 @@ class CountAll extends Command
$arr['inquiry_num'] = 0;
$countryArr = [];
}else{
$arr['inquiry_num'] = $inquiry_list['data']['total'];
$arr['inquiry_num'] = $inquiry_list['data']['count'];
//询盘国家统计
$countryData = $inquiry_list['data']['data'];
$countryArr = [];
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']]++;
}else{
$countryArr[$v1['country']] = 1;
}
}
$countryArr = $inquiry_list['data']['country'];
}
//加上其他询盘
ProjectServer::useProject($project_id);
... ...
... ... @@ -145,7 +145,7 @@ class CountProject extends Command
* @time :2023/6/14 15:44
*/
public function inquiry($arr,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
if($inquiry_list == false){
return false;
}
... ... @@ -154,17 +154,9 @@ class CountProject extends Command
$arr['inquiry_num'] = 0;
$countryArr = [];
}else{
$arr['inquiry_num'] = $inquiry_list['data']['total'];
$arr['inquiry_num'] = $inquiry_list['data']['count'];
//询盘国家统计
$countryData = $inquiry_list['data']['data'];
$countryArr = [];
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']]++;
}else{
$countryArr[$v1['country']] = 1;
}
}
$countryArr = $inquiry_list['data']['country'];
}
//加上其他询盘
ProjectServer::useProject($project_id);
... ...
... ... @@ -85,7 +85,7 @@ class MonthAllCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
... ... @@ -100,8 +100,8 @@ class MonthAllCount extends Command
$arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
}
$country = [];
if(isset($res['data']['data'])){
$country = $res['data']['data'];
if(isset($res['data']['country'])){
$country = $res['data']['country'];
}
$countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
foreach ($countryData as $v1){
... ... @@ -191,13 +191,4 @@ class MonthAllCount extends Command
return $arr;
}
public function inquiry($url,$month){
$url = 'https://'.$url.'/';
$token = md5($url.date("Y-m-d"));
$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;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Console\Commands\MonthlyCount;
use App\Helper\FormGlobalsoApi;
use App\Models\Com\UpdateOldInfo;
use App\Models\Domain\DomainInfo;
use App\Models\Inquiry\InquiryFormData;
... ... @@ -108,7 +109,7 @@ class MonthCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v['month']));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v['month']);
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
... ... @@ -123,8 +124,8 @@ class MonthCount extends Command
$arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
}
$country = [];
if(isset($res['data']['data'])){
$country = $res['data']['data'];
if(isset($res['data']['country'])){
$country = $res['data']['country'];
}
$countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
foreach ($countryData as $v1){
... ... @@ -212,13 +213,4 @@ class MonthCount extends Command
return $arr;
}
public function inquiry($url,$month){
$url = 'https://'.$url.'/';
$token = md5($url.date("Y-m-d"));
$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;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
}
... ...
... ... @@ -80,7 +80,7 @@ class MonthProjectCount extends Command
// 获取当月结束时间
$end = date('Y-m-t', strtotime($v));
$arr['project_id'] = $project_id;
$res = $this->inquiry($url,$v);
$res = (new FormGlobalsoApi())->getInquiryAll($url,$v);
echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL;
$arr['total'] = $arr['month_total'] = 0;
if(isset($res['data']['count'])){
... ... @@ -97,8 +97,8 @@ class MonthProjectCount extends Command
}
echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL;
$country = [];
if(isset($res['data']['data'])){
$country = $res['data']['data'];
if(isset($res['data']['country'])){
$country = $res['data']['country'];
}
$countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
foreach ($countryData as $v1){
... ... @@ -188,15 +188,6 @@ class MonthProjectCount extends Command
return $arr;
}
public function inquiry($url,$month){
$url = 'https://'.$url.'/';
$token = md5($url.date("Y-m-d"));
$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;
$res = http_get($url,['charset=utf-8']);
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
/**
* @remark :补齐月份
* @name :fillMissingMonths
... ...
... ... @@ -61,6 +61,7 @@ class Demo extends Command
$domain = "https://www.xawellauto.com/";
$token = md5($domain.date("Y-m-d"));
$url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
$url = $url."&sta_date=2024-07";
try {
$res = http_get($url,['charset=utf-8']);
} catch (\Exception | GuzzleException $e) {
... ... @@ -68,7 +69,7 @@ class Demo extends Command
return false;
}
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return true;
return $res;
}
// public function handle(){
... ...
... ... @@ -150,24 +150,15 @@ class Test extends Command
}
public function inquiry($arr,$domain,$project_id){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
if($inquiry_list['status'] == 400){
$arr['inquiry_num'] = 0;
$countryArr = [];
}else{
$arr['inquiry_num'] = $inquiry_list['data']['total'];
$arr['inquiry_num'] = $inquiry_list['data']['count'];
//询盘国家统计
$countryData = $inquiry_list['data']['data'];
$countryArr = [];
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']]++;
}else{
$countryArr[$v1['country']] = 1;
}
}
$countryArr = $inquiry_list['data']['country'];
}
//加上其他询盘
$arr['inquiry_num'] += InquiryFormData::getCount();
$countryData = InquiryFormData::getCountryCount();
... ...
... ... @@ -162,17 +162,21 @@ class FormGlobalsoApi
* @method :post
* @time :2024/8/15 14:16
*/
public function getInquiryAll($domain){
$domain = 'https://'.$domain.'/';
public function getInquiryAll($domain,$start_month = ''){
if (!(strpos($domain, 'https://') === 0)) {
$domain = 'https://'.$domain.'/';
}
$token = md5($domain.date("Y-m-d"));
$url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
if(!empty($start_month)){
$url = $url."&sta_date=$start_month";
}
try {
$res = http_get($url,['charset=utf-8']);
} catch (\Exception | GuzzleException $e) {
errorLog('提交询盘信息失败', $domain, $e);
return false;
}
echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
return $res;
}
}
... ...
... ... @@ -927,3 +927,5 @@ function base62_encode($num) {
}
... ...
... ... @@ -14,6 +14,7 @@ use App\Helper\Arr;
use App\Helper\FormGlobalsoApi;
use App\Models\Domain\DomainInfo;
use App\Models\HomeCount\Count;
use App\Models\HomeCount\MonthCount;
use App\Models\Inquiry\InquiryFormData;
use App\Models\Project\Project;
use App\Models\RankData\ExternalLinks;
... ... @@ -115,7 +116,7 @@ class OptimizationReportController extends BaseController
// 获取当前月的结束时间
$endTime = date('Y-m-t', strtotime($this->param['date']));
$arr = [];
$arr = $this->inquiryCount($arr,$startTime,$endTime,$domain);
$arr = $this->inquiryCount($arr,$startTime,$endTime,$domain,$project_id);
$arr = $this->flowCount($arr,$startTime,$endTime,$project_id);
$arr = $this->sourceCount($arr,$startTime,$endTime,$domain);
$arr['month'] = date('Y-m',time());
... ... @@ -131,42 +132,15 @@ class OptimizationReportController extends BaseController
* @method :post
* @time :2023/6/30 14:29
*/
public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
if(!empty($inquiry_list)){
//总数
$arr['total'] = $inquiry_list['data']['total'] ?? 0;
//数据详情
$data = $inquiry_list['data']['data'] ?? '';
$arr['month_total'] = 0;
$countryArr = [];
if(isset($data) && !empty($data)){
foreach ($data as $v){
if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
$arr['month_total']++;
if(isset($countryArr[$v['country']])){
$countryArr[$v['country']]++;
}else{
$countryArr[$v['country']] = 1;
}
}
}
}
}
//加上其他询盘
$arr['total'] += InquiryFormData::getCount();
$arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]);
$countryData = InquiryFormData::getCountryCount([$startTime, $endTime]);
foreach ($countryData as $v1){
if(isset($countryArr[$v1['country']])){
$countryArr[$v1['country']] += $v1['count'];
}else{
$countryArr[$v1['country']] = $v1['count'];
}
public function inquiryCount(&$arr, &$startTime, $project_id){
$month = date('Y-m',strtotime($startTime));
$monthCountModel = new MonthCount();
$info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$month]);
if($info !== false){
$arr['country'] = $info['country'];
$arr['total'] = $info['total'];
$arr['month_total'] = $info['month_total'];
}
arsort($countryArr);
$top20 = array_slice($countryArr, 0, 15, true);
$arr['country'] = $top20;
return $arr;
}
... ... @@ -350,9 +324,9 @@ class OptimizationReportController extends BaseController
public function pv_ip($domain){
$pv = (new VisitItem())->count();
$ip = (new Visit())->count();
$inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);
$inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
if(!empty($inquiry_list)){
$total = $inquiry_list['data']['total'] ?? 0;
$total = $inquiry_list['data']['count'] ?? 0;
}
return [
'total_pv'=>$pv,
... ...
... ... @@ -47,11 +47,7 @@ class ProductLogic extends BaseLogic
$this->param = $this->handleSaveParam($this->param);
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
$six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
if($is_upgrade == 0 || $six_read == 1){
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
}
$this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
$route = $this->param['route'];
$this->model->edit($this->param,['id'=>$this->param['id']]);
$id = $this->param['id'];
... ...