作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -3,7 +3,9 @@ @@ -3,7 +3,9 @@
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Helper\FormGlobalsoApi; 5 use App\Helper\FormGlobalsoApi;
  6 +use App\Models\Inquiry\InquiryOther;
6 use App\Models\Project\Project; 7 use App\Models\Project\Project;
  8 +use App\Services\ProjectServer;
7 use Illuminate\Console\Command; 9 use Illuminate\Console\Command;
8 10
9 /** 11 /**
@@ -51,13 +53,19 @@ class LastInquiry extends Command @@ -51,13 +53,19 @@ class LastInquiry extends Command
51 } 53 }
52 $api = new FormGlobalsoApi(); 54 $api = new FormGlobalsoApi();
53 $res = $api->getInquiryList($item['deploy_optimize']['domain']); 55 $res = $api->getInquiryList($item['deploy_optimize']['domain']);
54 - if($res && $res['status'] == 200){  
55 - if(empty($res['data']['data'][0])){  
56 - continue;  
57 - }  
58 - $item->last_inquiry_time = $res['data']['data'][0]['submit_time'];  
59 - $item->save(); 56 + $last_time = $res['data']['data'][0] ?? '';
  57 + //其他询盘的最新时间
  58 + ProjectServer::useProject($item['id']);
  59 + $other_last_time = InquiryOther::orderBy('id', 'desc')->value('submit_time');
  60 +
  61 + $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time;
  62 +
  63 + if(!$last_inquiry_time){
  64 + continue;
60 } 65 }
  66 +
  67 + $item->last_inquiry_time = $last_inquiry_time;
  68 + $item->save();
61 } 69 }
62 } 70 }
63 } 71 }
@@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi; @@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\HomeCount\Count; 7 use App\Models\HomeCount\Count;
8 use App\Models\HomeCount\MonthCount; 8 use App\Models\HomeCount\MonthCount;
  9 +use App\Models\Inquiry\InquiryOther;
9 use App\Models\Project\DeployOptimize; 10 use App\Models\Project\DeployOptimize;
  11 +use App\Services\ProjectServer;
10 use Carbon\Carbon; 12 use Carbon\Carbon;
11 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
12 14
@@ -67,8 +69,8 @@ class MonthCountLogic extends BaseLogic @@ -67,8 +69,8 @@ class MonthCountLogic extends BaseLogic
67 //数据详情 69 //数据详情
68 $data = $inquiry_list['data']['data'] ?? ''; 70 $data = $inquiry_list['data']['data'] ?? '';
69 $arr['month_total'] = 0; 71 $arr['month_total'] = 0;
  72 + $countryArr = [];
70 if(isset($data) && !empty($data)){ 73 if(isset($data) && !empty($data)){
71 - $countryArr = [];  
72 foreach ($data as $v){ 74 foreach ($data as $v){
73 if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){ 75 if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
74 $arr['month_total']++; 76 $arr['month_total']++;
@@ -76,14 +78,28 @@ class MonthCountLogic extends BaseLogic @@ -76,14 +78,28 @@ class MonthCountLogic extends BaseLogic
76 if(isset($countryArr[$v['country']])){ 78 if(isset($countryArr[$v['country']])){
77 $countryArr[$v['country']]++; 79 $countryArr[$v['country']]++;
78 }else{ 80 }else{
79 - $countryArr[$v['country']] = 0; 81 + $countryArr[$v['country']] = 1;
80 } 82 }
81 } 83 }
82 - arsort($countryArr);  
83 - $top20 = array_slice($countryArr, 0, 15, true);  
84 - $arr['country'] = $top20;  
85 } 84 }
86 } 85 }
  86 + //加上其他询盘
  87 + ProjectServer::useProject($this->user['project_id']);
  88 + $arr['total'] += InquiryOther::count();
  89 + $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count();
  90 + $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime])
  91 + ->select("country",DB::raw('COUNT(*) as count'))
  92 + ->groupBy('country')->get()->toArray();
  93 + foreach ($countryData as $v1){
  94 + if(isset($countryArr[$v1['country']])){
  95 + $countryArr[$v1['country']] += $v1['count'];
  96 + }else{
  97 + $countryArr[$v1['country']] = $v1['count'];
  98 + }
  99 + }
  100 + arsort($countryArr);
  101 + $top20 = array_slice($countryArr, 0, 15, true);
  102 + $arr['country'] = $top20;
87 return $arr; 103 return $arr;
88 } 104 }
89 105
@@ -60,6 +60,7 @@ class ProductLogic extends BaseLogic @@ -60,6 +60,7 @@ class ProductLogic extends BaseLogic
60 //查看路由是否更新 60 //查看路由是否更新
61 $this->editProductRoute($this->param['id'],$this->param['route']); 61 $this->editProductRoute($this->param['id'],$this->param['route']);
62 $this->model->edit($this->param,['id'=>$this->param['id']]); 62 $this->model->edit($this->param,['id'=>$this->param['id']]);
  63 + $id = $this->param['id'];
63 }else{ 64 }else{
64 $this->param = $this->addHandleParam($this->param); 65 $this->param = $this->addHandleParam($this->param);
65 $id = $this->model->addReturnId($this->param); 66 $id = $this->model->addReturnId($this->param);
@@ -156,7 +157,7 @@ class ProductLogic extends BaseLogic @@ -156,7 +157,7 @@ class ProductLogic extends BaseLogic
156 try { 157 try {
157 if(isset($this->param['route']) && !empty($this->param['route'])){ 158 if(isset($this->param['route']) && !empty($this->param['route'])){
158 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); 159 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
159 - $this->editProductRoute($this->param['route']); 160 + $this->editProductRoute($this->param['id'],$this->param['route']);
160 } 161 }
161 $this->model->edit($this->param,['id'=>$this->param['id']]); 162 $this->model->edit($this->param,['id'=>$this->param['id']]);
162 }catch (\Exception $e){ 163 }catch (\Exception $e){