作者 lyh

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

@@ -135,7 +135,7 @@ class Count extends Command @@ -135,7 +135,7 @@ class Count extends Command
135 * @time :2023/6/14 15:44 135 * @time :2023/6/14 15:44
136 */ 136 */
137 public function inquiry($arr,$domain,$project_id){ 137 public function inquiry($arr,$domain,$project_id){
138 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 138 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
139 if($inquiry_list == false){ 139 if($inquiry_list == false){
140 return false; 140 return false;
141 } 141 }
@@ -143,17 +143,9 @@ class Count extends Command @@ -143,17 +143,9 @@ class Count extends Command
143 $arr['inquiry_num'] = 0; 143 $arr['inquiry_num'] = 0;
144 $countryArr = []; 144 $countryArr = [];
145 }else{ 145 }else{
146 - $arr['inquiry_num'] = $inquiry_list['data']['total']; 146 + $arr['inquiry_num'] = $inquiry_list['data']['count'];
147 //询盘国家统计 147 //询盘国家统计
148 - $countryData = $inquiry_list['data']['data'];  
149 - $countryArr = [];  
150 - foreach ($countryData as $v1){  
151 - if(isset($countryArr[$v1['country']])){  
152 - $countryArr[$v1['country']]++;  
153 - }else{  
154 - $countryArr[$v1['country']] = 1;  
155 - }  
156 - } 148 + $countryArr = $inquiry_list['data']['country'];
157 } 149 }
158 //加上其他询盘 150 //加上其他询盘
159 ProjectServer::useProject($project_id); 151 ProjectServer::useProject($project_id);
@@ -102,7 +102,7 @@ class CountAll extends Command @@ -102,7 +102,7 @@ class CountAll extends Command
102 * @time :2023/6/14 15:44 102 * @time :2023/6/14 15:44
103 */ 103 */
104 public function inquiry($arr,$domain,$project_id){ 104 public function inquiry($arr,$domain,$project_id){
105 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 105 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
106 if($inquiry_list == false){ 106 if($inquiry_list == false){
107 return false; 107 return false;
108 } 108 }
@@ -110,17 +110,9 @@ class CountAll extends Command @@ -110,17 +110,9 @@ class CountAll extends Command
110 $arr['inquiry_num'] = 0; 110 $arr['inquiry_num'] = 0;
111 $countryArr = []; 111 $countryArr = [];
112 }else{ 112 }else{
113 - $arr['inquiry_num'] = $inquiry_list['data']['total']; 113 + $arr['inquiry_num'] = $inquiry_list['data']['count'];
114 //询盘国家统计 114 //询盘国家统计
115 - $countryData = $inquiry_list['data']['data'];  
116 - $countryArr = [];  
117 - foreach ($countryData as $v1){  
118 - if(isset($countryArr[$v1['country']])){  
119 - $countryArr[$v1['country']]++;  
120 - }else{  
121 - $countryArr[$v1['country']] = 1;  
122 - }  
123 - } 115 + $countryArr = $inquiry_list['data']['country'];
124 } 116 }
125 //加上其他询盘 117 //加上其他询盘
126 ProjectServer::useProject($project_id); 118 ProjectServer::useProject($project_id);
@@ -145,25 +145,18 @@ class CountProject extends Command @@ -145,25 +145,18 @@ class CountProject extends Command
145 * @time :2023/6/14 15:44 145 * @time :2023/6/14 15:44
146 */ 146 */
147 public function inquiry($arr,$domain,$project_id){ 147 public function inquiry($arr,$domain,$project_id){
148 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 148 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
149 if($inquiry_list == false){ 149 if($inquiry_list == false){
150 return false; 150 return false;
151 } 151 }
  152 + echo date('Y-m-d H:i:s') . '拉取询盘状态:' .json_encode($inquiry_list) . PHP_EOL;
152 if($inquiry_list['status'] == self::STATUS_ERROR){ 153 if($inquiry_list['status'] == self::STATUS_ERROR){
153 $arr['inquiry_num'] = 0; 154 $arr['inquiry_num'] = 0;
154 $countryArr = []; 155 $countryArr = [];
155 }else{ 156 }else{
156 - $arr['inquiry_num'] = $inquiry_list['data']['total']; 157 + $arr['inquiry_num'] = $inquiry_list['data']['count'];
157 //询盘国家统计 158 //询盘国家统计
158 - $countryData = $inquiry_list['data']['data'];  
159 - $countryArr = [];  
160 - foreach ($countryData as $v1){  
161 - if(isset($countryArr[$v1['country']])){  
162 - $countryArr[$v1['country']]++;  
163 - }else{  
164 - $countryArr[$v1['country']] = 1;  
165 - }  
166 - } 159 + $countryArr = $inquiry_list['data']['country'];
167 } 160 }
168 //加上其他询盘 161 //加上其他询盘
169 ProjectServer::useProject($project_id); 162 ProjectServer::useProject($project_id);
@@ -85,25 +85,23 @@ class MonthAllCount extends Command @@ -85,25 +85,23 @@ 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 = $this->inquiry($url,$v['month']);  
89 - $arr['total'] = $arr['month_total'] = 0; 88 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
  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;
92 - $arr['month_total'] = $res['data']['count'];  
93 - //获取上一个的count  
94 - $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));  
95 - $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);  
96 - if($previousInfo === false){  
97 - $arr['total'] = $arr['month_total'];  
98 - }else{  
99 - $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0);  
100 - } 92 + $arr['month_total'] = $res['data']['count'] + InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);
  93 + }
  94 + //获取上一个的count
  95 + $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));
  96 + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);
  97 + if($previousInfo === false){
  98 + $arr['total'] = $arr['month_total'];
  99 + }else{
  100 + $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
101 } 101 }
102 - //获取当月的其他询盘  
103 - $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);  
104 $country = []; 102 $country = [];
105 - if(isset($res['data']['data'])){  
106 - $country = $res['data']['data']; 103 + if(isset($res['data']['country'])){
  104 + $country = $res['data']['country'];
107 } 105 }
108 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 106 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
109 foreach ($countryData as $v1){ 107 foreach ($countryData as $v1){
@@ -193,13 +191,4 @@ class MonthAllCount extends Command @@ -193,13 +191,4 @@ class MonthAllCount extends Command
193 return $arr; 191 return $arr;
194 } 192 }
195 193
196 - public function inquiry($url,$month){  
197 - $url = 'https://'.$url.'/';  
198 - $token = md5($url.date("Y-m-d"));  
199 - $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;  
200 - $res = http_get($url,['charset=utf-8']);  
201 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
202 - return $res;  
203 - }  
204 -  
205 } 194 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Console\Commands\MonthlyCount; 10 namespace App\Console\Commands\MonthlyCount;
11 11
  12 +use App\Helper\FormGlobalsoApi;
12 use App\Models\Com\UpdateOldInfo; 13 use App\Models\Com\UpdateOldInfo;
13 use App\Models\Domain\DomainInfo; 14 use App\Models\Domain\DomainInfo;
14 use App\Models\Inquiry\InquiryFormData; 15 use App\Models\Inquiry\InquiryFormData;
@@ -108,25 +109,23 @@ class MonthCount extends Command @@ -108,25 +109,23 @@ class MonthCount extends Command
108 // 获取当月结束时间 109 // 获取当月结束时间
109 $end = date('Y-m-t', strtotime($v['month'])); 110 $end = date('Y-m-t', strtotime($v['month']));
110 $arr['project_id'] = $project_id; 111 $arr['project_id'] = $project_id;
111 - $res = $this->inquiry($url,$v['month']); 112 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v['month']);
112 $arr['total'] = $arr['month_total'] = 0; 113 $arr['total'] = $arr['month_total'] = 0;
113 if(isset($res['data']['count'])){ 114 if(isset($res['data']['count'])){
114 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;
115 - $arr['month_total'] = $res['data']['count'];  
116 - //获取上一个的count  
117 - $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));  
118 - $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);  
119 - if($previousInfo === false){  
120 - $arr['total'] = $arr['month_total'];  
121 - }else{  
122 - $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0);  
123 - } 116 + $arr['month_total'] = $res['data']['count'] + InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);
  117 + }
  118 + //获取上一个的count
  119 + $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));
  120 + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);
  121 + if($previousInfo === false){
  122 + $arr['total'] = $arr['month_total'];
  123 + }else{
  124 + $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
124 } 125 }
125 - //获取当月的其他询盘  
126 - $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);  
127 $country = []; 126 $country = [];
128 - if(isset($res['data']['data'])){  
129 - $country = $res['data']['data']; 127 + if(isset($res['data']['country'])){
  128 + $country = $res['data']['country'];
130 } 129 }
131 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 130 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
132 foreach ($countryData as $v1){ 131 foreach ($countryData as $v1){
@@ -145,7 +144,6 @@ class MonthCount extends Command @@ -145,7 +144,6 @@ class MonthCount extends Command
145 $firstDayOfNextMonth = date('Y-m-01 01:00:00', strtotime("$selectedDate +1 month")); 144 $firstDayOfNextMonth = date('Y-m-01 01:00:00', strtotime("$selectedDate +1 month"));
146 $arr['created_at'] = $firstDayOfNextMonth; 145 $arr['created_at'] = $firstDayOfNextMonth;
147 $arr['updated_at'] = $firstDayOfNextMonth; 146 $arr['updated_at'] = $firstDayOfNextMonth;
148 -// echo date('Y-m-d H:i:s') . '数据:'.json_encode($arr) . PHP_EOL;  
149 $monthCountModel->insert($arr); 147 $monthCountModel->insert($arr);
150 }else{ 148 }else{
151 $monthCountModel->edit($arr,['id'=>$info['id']]); 149 $monthCountModel->edit($arr,['id'=>$info['id']]);
@@ -215,13 +213,4 @@ class MonthCount extends Command @@ -215,13 +213,4 @@ class MonthCount extends Command
215 return $arr; 213 return $arr;
216 } 214 }
217 215
218 - public function inquiry($url,$month){  
219 - $url = 'https://'.$url.'/';  
220 - $token = md5($url.date("Y-m-d"));  
221 - $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;  
222 - $res = http_get($url,['charset=utf-8']);  
223 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
224 - return $res;  
225 - }  
226 -  
227 } 216 }
@@ -18,6 +18,7 @@ use App\Models\Project\Project; @@ -18,6 +18,7 @@ use App\Models\Project\Project;
18 use App\Models\Visit\Visit; 18 use App\Models\Visit\Visit;
19 use App\Services\ProjectServer; 19 use App\Services\ProjectServer;
20 use Illuminate\Console\Command; 20 use Illuminate\Console\Command;
  21 +use Illuminate\Support\Carbon;
21 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
22 use App\Models\HomeCount\Count; 23 use App\Models\HomeCount\Count;
23 24
@@ -61,38 +62,43 @@ class MonthProjectCount extends Command @@ -61,38 +62,43 @@ class MonthProjectCount extends Command
61 * @time :2024/1/8 9:05 62 * @time :2024/1/8 9:05
62 */ 63 */
63 public function count($project_id,$url){ 64 public function count($project_id,$url){
  65 + $data = [];
64 $list = DB::connection('custom_mysql')->table('gl_customer_visit') 66 $list = DB::connection('custom_mysql')->table('gl_customer_visit')
65 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month')) 67 ->select(DB::raw('DATE_FORMAT(updated_date, "%Y-%m") as month'))
  68 + ->orderBy('month', 'asc')
66 ->groupBy('month')->get()->toArray(); 69 ->groupBy('month')->get()->toArray();
67 - foreach ($list as $k=>$v){ 70 + foreach ($list as $v){
  71 + $data[] = $v->month;
  72 + }
  73 + $list = $this->fillMissingMonths($data);
  74 + foreach ($list as $v){
68 $arr = []; 75 $arr = [];
69 - $v = (array)$v;  
70 $monthCountModel = new MonthCount(); 76 $monthCountModel = new MonthCount();
71 - $info = $monthCountModel->read(['month'=>$v['month'],'project_id'=>$project_id]); 77 + $info = $monthCountModel->read(['month'=>$v,'project_id'=>$project_id]);
72 // 获取当月开始时间 78 // 获取当月开始时间
73 - $start = date('Y-m-01', strtotime($v['month'])); 79 + $start = date('Y-m-01', strtotime($v));
74 // 获取当月结束时间 80 // 获取当月结束时间
75 - $end = date('Y-m-t', strtotime($v['month'])); 81 + $end = date('Y-m-t', strtotime($v));
76 $arr['project_id'] = $project_id; 82 $arr['project_id'] = $project_id;
77 - $res = $this->inquiry($url,$v['month']); 83 + $res = (new FormGlobalsoApi())->getInquiryAll($url,$v);
  84 + echo date('Y-m-d H:i:s') . '月份:'.$v. PHP_EOL;
78 $arr['total'] = $arr['month_total'] = 0; 85 $arr['total'] = $arr['month_total'] = 0;
79 if(isset($res['data']['count'])){ 86 if(isset($res['data']['count'])){
80 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL; 87 echo date('Y-m-d H:i:s') . '数据:'.$res['data']['count'] . PHP_EOL;
81 - $arr['month_total'] = $res['data']['count'];  
82 - //获取上一个的count  
83 - $previousMonth = date('Y-m', strtotime($v['month'] . ' -1 month'));  
84 - $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);  
85 - if($previousInfo === false){  
86 - $arr['total'] = $arr['month_total'];  
87 - }else{  
88 - $arr['total'] = $res['data']['count'] + ($previousInfo['total'] ?? 0);  
89 - } 88 + $arr['month_total'] = $res['data']['count'] + InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']);
90 } 89 }
91 - //获取当月的其他询盘  
92 - $arr['total'] += InquiryFormData::getCount([$start.' 00:00:00',$end.' 00:00:00']); 90 + //获取上一个的count
  91 + $previousMonth = date('Y-m', strtotime($v . ' -1 month'));
  92 + $previousInfo = $monthCountModel->read(['month'=>$previousMonth,'project_id'=>$project_id]);
  93 + if($previousInfo === false){
  94 + $arr['total'] = $arr['month_total'];
  95 + }else{
  96 + $arr['total'] = $arr['month_total'] + ($previousInfo['total'] ?? 0);
  97 + }
  98 + echo date('Y-m-d H:i:s') . '加上其他询盘:'.$arr['total'] . PHP_EOL;
93 $country = []; 99 $country = [];
94 - if(isset($res['data']['data'])){  
95 - $country = $res['data']['data']; 100 + if(isset($res['data']['country'])){
  101 + $country = $res['data']['country'];
96 } 102 }
97 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']); 103 $countryData = InquiryFormData::getCountryCount([$start.' 00:00:00',$end.' 00:00:00']);
98 foreach ($countryData as $v1){ 104 foreach ($countryData as $v1){
@@ -103,7 +109,7 @@ class MonthProjectCount extends Command @@ -103,7 +109,7 @@ class MonthProjectCount extends Command
103 } 109 }
104 } 110 }
105 $arr['country'] = json_encode($country); 111 $arr['country'] = json_encode($country);
106 - $arr['month'] = $v['month']; 112 + $arr['month'] = $v;
107 $arr = $this->pv_ip($arr,$start,$end,$project_id); 113 $arr = $this->pv_ip($arr,$start,$end,$project_id);
108 $arr = $this->sourceCount($arr,$start,$end); 114 $arr = $this->sourceCount($arr,$start,$end);
109 if($info === false){ 115 if($info === false){
@@ -182,13 +188,37 @@ class MonthProjectCount extends Command @@ -182,13 +188,37 @@ class MonthProjectCount extends Command
182 return $arr; 188 return $arr;
183 } 189 }
184 190
185 - public function inquiry($url,$month){  
186 - $url = 'https://'.$url.'/';  
187 - $token = md5($url.date("Y-m-d"));  
188 - $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;  
189 - $res = http_get($url,['charset=utf-8']);  
190 - echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;  
191 - return $res; 191 + /**
  192 + * @remark :补齐月份
  193 + * @name :fillMissingMonths
  194 + * @author :lyh
  195 + * @method :post
  196 + * @time :2024/8/14 11:11
  197 + */
  198 + public function fillMissingMonths($dates) {
  199 + // 将字符串日期转换为 Carbon 对象
  200 + $carbonDates = array_map(function($date) {
  201 + return Carbon::createFromFormat('Y-m', $date);
  202 + }, $dates);
  203 + // 排序日期,确保列表按时间顺序排列
  204 + usort($carbonDates, function($a, $b) {
  205 + return $a->gt($b);
  206 + });
  207 + // 用于存储完整日期的数组
  208 + $completeDates = [];
  209 + // 遍历日期列表,补齐中间缺失的月份
  210 + for ($i = 0; $i < count($carbonDates) - 1; $i++) {
  211 + $current = $carbonDates[$i];
  212 + $next = $carbonDates[$i + 1];
  213 + // 将当前月份加入完整日期数组
  214 + array_push($completeDates, $current->format('Y-m'));
  215 + // 循环补齐中间缺失的月份
  216 + while ($current->addMonth()->lt($next)) {
  217 + array_push($completeDates, $current->format('Y-m'));
  218 + }
  219 + }
  220 + // 加入最后一个月份
  221 + array_push($completeDates, $carbonDates[count($carbonDates) - 1]->format('Y-m'));
  222 + return $completeDates;
192 } 223 }
193 -  
194 } 224 }
@@ -22,6 +22,8 @@ use App\Models\File\File; @@ -22,6 +22,8 @@ use App\Models\File\File;
22 use App\Models\File\File as FileModel; 22 use App\Models\File\File as FileModel;
23 use App\Models\File\Image; 23 use App\Models\File\Image;
24 use App\Models\File\Image as ImageModel; 24 use App\Models\File\Image as ImageModel;
  25 +use App\Models\News\News;
  26 +use App\Models\News\NewsCategory;
25 use App\Models\Product\Keyword; 27 use App\Models\Product\Keyword;
26 use App\Models\Product\Product; 28 use App\Models\Product\Product;
27 use App\Models\Project\DeployOptimize; 29 use App\Models\Project\DeployOptimize;
@@ -33,6 +35,7 @@ use App\Models\Template\BTemplateCom; @@ -33,6 +35,7 @@ use App\Models\Template\BTemplateCom;
33 use App\Services\AmazonS3Service; 35 use App\Services\AmazonS3Service;
34 use App\Services\ProjectServer; 36 use App\Services\ProjectServer;
35 use App\Utils\EncryptUtils; 37 use App\Utils\EncryptUtils;
  38 +use GuzzleHttp\Exception\GuzzleException;
36 use Illuminate\Console\Command; 39 use Illuminate\Console\Command;
37 use Illuminate\Support\Facades\DB; 40 use Illuminate\Support\Facades\DB;
38 use Illuminate\Support\Facades\Schema; 41 use Illuminate\Support\Facades\Schema;
@@ -55,37 +58,73 @@ class Demo extends Command @@ -55,37 +58,73 @@ class Demo extends Command
55 protected $description = 'demo'; 58 protected $description = 'demo';
56 59
57 public function handle(){ 60 public function handle(){
58 - $projectModel = new Project();  
59 - $list = $projectModel->list(['id'=>1462]);  
60 - foreach ($list as $v){  
61 - echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;  
62 - ProjectServer::useProject($v['id']);  
63 - $blogModel = new Blog();  
64 - $blogList = $blogModel->list(['status'=>0],'id',['*'],'asc');  
65 - foreach ($blogList as $blogV){  
66 - $customContentModel = new CustomModuleContent();  
67 - $id = $customContentModel->addReturnId([  
68 - 'name'=>$blogV['name'],  
69 - 'status'=>0,  
70 - 'sort'=>$blogV['sort'],  
71 - 'remark'=>$blogV['remark'],  
72 - 'route'=>$blogV['url'],  
73 - 'image'=>$blogV['image'],  
74 - 'seo_title'=>$blogV['seo_title'],  
75 - 'seo_keywords'=>$blogV['seo_keywords'],  
76 - 'seo_description'=>$blogV['seo_description'],  
77 - 'project_id'=>$blogV['project_id'],  
78 - 'created_at'=>$blogV['created_at'],  
79 - 'updated_at'=>$blogV['updated_at'],  
80 - 'module_id'=>8,  
81 - 'video'=>null,  
82 - 'release_at'=>$blogV['release_at'],  
83 - 'operator_id'=>$blogV['operator_id']  
84 - ]);  
85 - RouteMap::setRoute($blogV['url'],RouteMap::SOURCE_MODULE,$id,1462);  
86 - }  
87 - DB::disconnect('custom_mysql'); 61 + $domain = "https://www.xawellauto.com/";
  62 + $token = md5($domain.date("Y-m-d"));
  63 + $url = "https://form.globalso.com/api/external-interface/domain_con/15243d63ed5a5738?domain=$domain&token=$token&source=1,2,3,4&num=15";
  64 + $url = $url."&sta_date=2024-07";
  65 + try {
  66 + $res = http_get($url,['charset=utf-8']);
  67 + } catch (\Exception | GuzzleException $e) {
  68 + errorLog('提交询盘信息失败', $domain, $e);
  69 + return false;
88 } 70 }
  71 + echo date('Y-m-d H:i:s') . '数据:'.json_encode($res) . PHP_EOL;
  72 + return $res;
89 } 73 }
90 74
  75 +// public function handle(){
  76 +// $projectModel = new Project();
  77 +// $list = $projectModel->list(['id'=>503]);
  78 +// foreach ($list as $v){
  79 +// echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  80 +// ProjectServer::useProject($v['id']);
  81 +// $newsModel = new News();
  82 +// $blogList = $newsModel->list(['status'=>1],'id',['*'],'asc');
  83 +// foreach ($blogList as $blogV){
  84 +// $customContentModel = new CustomModuleContent();
  85 +// $id = $customContentModel->addReturnId([
  86 +// 'name'=>$blogV['name'],
  87 +// 'status'=>0,
  88 +// 'sort'=>$blogV['sort'],
  89 +// 'remark'=>$blogV['remark'],
  90 +// 'route'=>$blogV['url'],
  91 +// 'image'=>$blogV['image'],
  92 +// 'seo_title'=>$blogV['seo_title'],
  93 +// 'seo_keywords'=>$blogV['seo_keywords'],
  94 +// 'seo_description'=>$blogV['seo_description'],
  95 +// 'project_id'=>$blogV['project_id'],
  96 +// 'created_at'=>$blogV['created_at'],
  97 +// 'updated_at'=>$blogV['updated_at'],
  98 +// 'module_id'=>10,
  99 +// 'video'=>null,
  100 +// 'release_at'=>$blogV['release_at'],
  101 +// 'operator_id'=>$blogV['operator_id']
  102 +// ]);
  103 +// RouteMap::setRoute($blogV['url'],RouteMap::SOURCE_MODULE,$id,503);
  104 +// }
  105 +// DB::disconnect('custom_mysql');
  106 +// }
  107 +// }
  108 +// public function handle(){
  109 +// ProjectServer::useProject(503);
  110 +// $newsCate = new NewsCategory();
  111 +// $newsList = $newsCate->list();
  112 +// foreach ($newsList as $v){
  113 +// $data = [
  114 +// 'name'=>$v['name'],
  115 +// 'status'=>0,
  116 +// 'sort'=>$v['sort'],
  117 +// 'pid'=>$v['pid'],
  118 +// 'route'=>$v['alias'],
  119 +// 'project_id'=>503,
  120 +// 'operator_id'=>$v['operator_id'],
  121 +// 'create_id'=>1101,
  122 +// 'module_id'=>10,
  123 +// ];
  124 +// $moduleCateModel = new CustomModuleCategory();
  125 +// $id = $moduleCateModel->addReturnId($data);
  126 +// RouteMap::setRoute($v['alias'],RouteMap::SOURCE_MODULE_CATE,$id,503);
  127 +// }
  128 +// DB::disconnect('custom_mysql');
  129 +// }
91 } 130 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SyncTimeFiles.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/14 14:23
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\File\ErrorFile;
  13 +use App\Models\File\File;
  14 +use Illuminate\Console\Command;
  15 +
  16 +class SyncTimeFiles extends Command
  17 +{
  18 + /**
  19 + * The name and signature of the console command.
  20 + *
  21 + * @var string
  22 + */
  23 + protected $signature = 'sync_videos';
  24 +
  25 + /**
  26 + * The console command description.
  27 + *
  28 + * @var string
  29 + */
  30 + protected $description = '按时间同步图片与文件';
  31 +
  32 + public function handle()
  33 + {
  34 + $fileModel = new File();
  35 + $start = '2024-08-10 00:00:00';
  36 + $end = date('Y-m-d H:i:s');
  37 + $lists = $fileModel->list(['created_at'=>['between',[$start,$end]]]);
  38 + foreach ($lists as $v){
  39 + $path = $v['path'];
  40 + $this->param['name'] = basename($path);
  41 + $this->param['path'] = str_replace('/'.$this->param['name'],'',$path);
  42 + $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,0);
  43 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
  44 + echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
  45 + $code = shell_exec($cmd);
  46 + if(200 != (int)$code){
  47 + echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
  48 +// $errorFileModel = new ErrorFile();
  49 +// $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
  50 + }
  51 + echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
  52 + }
  53 + return true;
  54 + }
  55 +
  56 + /**
  57 + * @remark :获取图片文件链接
  58 + * @name :getUrl
  59 + * @author :lyh
  60 + * @method :post
  61 + * @time :2024/5/22 11:53
  62 + */
  63 + public function getUrl($path,$storage_type,$location){
  64 + if(is_array($path)){
  65 + $url =[];
  66 + foreach ($path as $v){
  67 + $url[] = $this->getUrl($v,$storage_type,$location);
  68 + }
  69 + }else{
  70 + if(empty($path)){
  71 + return '';
  72 + }
  73 + if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
  74 + return $path;
  75 + }
  76 + if(substr($path,0,2) == '//'){
  77 + return 'https:'.$path;
  78 + }
  79 + if($location == 0){
  80 + $cos = config('filesystems.disks.cos');
  81 + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  82 + $url = $cosCdn.$path;
  83 + }else{
  84 + $s3 = config('filesystems.disks.s3');
  85 + $cdn = $s3['cdn'];
  86 + $url = $cdn.$path;
  87 + }
  88 + }
  89 + return $url;
  90 + }
  91 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SyncVideo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/8/14 13:50
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\File\ErrorFile;
  13 +use Illuminate\Console\Command;
  14 +
  15 +class SyncVideo extends Command
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'sync_video {path}';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '同步图片与文件';
  30 + public function handle()
  31 + {
  32 + $path = $this->argument('path');
  33 + $this->param['name'] = basename($path);
  34 + $this->param['path'] = str_replace('/'.$this->param['name'],'',$path);
  35 + $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,0);
  36 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
  37 + echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
  38 + $code = shell_exec($cmd);
  39 + if(200 != (int)$code){
  40 + $errorFileModel = new ErrorFile();
  41 + $errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
  42 + }
  43 + return true;
  44 + }
  45 +
  46 + /**
  47 + * @remark :获取图片文件链接
  48 + * @name :getUrl
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/5/22 11:53
  52 + */
  53 + public function getUrl($path,$storage_type,$location){
  54 + if(is_array($path)){
  55 + $url =[];
  56 + foreach ($path as $v){
  57 + $url[] = $this->getUrl($v,$storage_type,$location);
  58 + }
  59 + }else{
  60 + if(empty($path)){
  61 + return '';
  62 + }
  63 + if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
  64 + return $path;
  65 + }
  66 + if(substr($path,0,2) == '//'){
  67 + return 'https:'.$path;
  68 + }
  69 + if($location == 0){
  70 + $cos = config('filesystems.disks.cos');
  71 + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  72 + $url = $cosCdn.$path;
  73 + }else{
  74 + $s3 = config('filesystems.disks.s3');
  75 + $cdn = $s3['cdn'];
  76 + $url = $cdn.$path;
  77 + }
  78 + }
  79 + return $url;
  80 + }
  81 +}
@@ -150,24 +150,15 @@ class Test extends Command @@ -150,24 +150,15 @@ class Test extends Command
150 } 150 }
151 151
152 public function inquiry($arr,$domain,$project_id){ 152 public function inquiry($arr,$domain,$project_id){
153 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 153 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
154 if($inquiry_list['status'] == 400){ 154 if($inquiry_list['status'] == 400){
155 $arr['inquiry_num'] = 0; 155 $arr['inquiry_num'] = 0;
156 $countryArr = []; 156 $countryArr = [];
157 }else{ 157 }else{
158 - $arr['inquiry_num'] = $inquiry_list['data']['total']; 158 + $arr['inquiry_num'] = $inquiry_list['data']['count'];
159 //询盘国家统计 159 //询盘国家统计
160 - $countryData = $inquiry_list['data']['data'];  
161 - $countryArr = [];  
162 - foreach ($countryData as $v1){  
163 - if(isset($countryArr[$v1['country']])){  
164 - $countryArr[$v1['country']]++;  
165 - }else{  
166 - $countryArr[$v1['country']] = 1;  
167 - }  
168 - } 160 + $countryArr = $inquiry_list['data']['country'];
169 } 161 }
170 -  
171 //加上其他询盘 162 //加上其他询盘
172 $arr['inquiry_num'] += InquiryFormData::getCount(); 163 $arr['inquiry_num'] += InquiryFormData::getCount();
173 $countryData = InquiryFormData::getCountryCount(); 164 $countryData = InquiryFormData::getCountryCount();
@@ -597,6 +597,7 @@ class ProjectUpdate extends Command @@ -597,6 +597,7 @@ class ProjectUpdate extends Command
597 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]); 597 $url = $api_url . '?' . http_build_query(['w' => $api_type, 'page' => 1, 'pagesize' => 0]);
598 $data = curl_c($url); 598 $data = curl_c($url);
599 if (isset($data['code']) && $data['code'] == 200) { 599 if (isset($data['code']) && $data['code'] == 200) {
  600 + $category = $data['data']['category'];
600 //判断分类里面是否存在自定义模块路由 601 //判断分类里面是否存在自定义模块路由
601 $is_exist = 0; 602 $is_exist = 0;
602 if ($data['data']['category'] ?? []) { 603 if ($data['data']['category'] ?? []) {
@@ -607,21 +608,15 @@ class ProjectUpdate extends Command @@ -607,21 +608,15 @@ class ProjectUpdate extends Command
607 } 608 }
608 } 609 }
609 } 610 }
610 - if ($is_exist) {  
611 - //存在,无需添加自定义模块路由为分类路由  
612 - $category = $data['data']['category'];  
613 - } else {  
614 - //不存在,需要添加自定义模块路由为分类路由  
615 - $category = [  
616 - [  
617 - 'id' => 0,  
618 - 'name' => $custom_info['route'],  
619 - 'url' => '/' . $custom_info['route'],  
620 - 'parent' => $data['data']['category'] ?? []  
621 - ]  
622 - ]; 611 + if (!$is_exist) {
  612 + array_push($category, [
  613 + 'id' => 0,
  614 + 'name' => $custom_info['route'],
  615 + 'url' => '/' . $custom_info['route'],
  616 + 'parent' => 0
  617 + ]);
623 } 618 }
624 - $this->category_custom_insert($project_id, $custom_info['id'], $category, 0); 619 + $this->category_custom_insert($project_id, $custom_info['id'], $category);
625 620
626 $count = $data['data']['count'] ?? 0; 621 $count = $data['data']['count'] ?? 0;
627 622
@@ -914,35 +909,28 @@ class ProjectUpdate extends Command @@ -914,35 +909,28 @@ class ProjectUpdate extends Command
914 } 909 }
915 910
916 //扩展模块多级分类入库 911 //扩展模块多级分类入库
917 - protected function category_custom_insert($project_id, $module_id, $items, $pid = 0) 912 + protected function category_custom_insert($project_id, $module_id, $items)
918 { 913 {
919 $model = new CustomModuleCategory(); 914 $model = new CustomModuleCategory();
920 foreach ($items as $item) { 915 foreach ($items as $item) {
921 $route = $this->get_url_route($item['url'] ?? ''); 916 $route = $this->get_url_route($item['url'] ?? '');
922 if ($route) { 917 if ($route) {
923 - $parent = $model->read(['pid' => $pid, 'route' => $route], 'id');  
924 - if (!$parent) { 918 + $cate = $model->read(['route' => $route], 'id');
  919 + if (!$cate) {
925 try { 920 try {
926 $item['name'] = $this->special2str($item['name'] ?? ''); 921 $item['name'] = $this->special2str($item['name'] ?? '');
927 - $parent_id = $model->addReturnId([ 922 + $cate_id = $model->addReturnId([
928 'project_id' => $project_id, 923 'project_id' => $project_id,
929 'module_id' => $module_id, 924 'module_id' => $module_id,
930 'name' => $item['name'], 925 'name' => $item['name'],
931 - 'pid' => $pid,  
932 'original_id' => $item['id'], 926 'original_id' => $item['id'],
933 'route' => $route 927 'route' => $route
934 ]); 928 ]);
935 - $this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $parent_id, $project_id); 929 + $this->set_map($route, RouteMap::SOURCE_MODULE_CATE, $cate_id, $project_id);
936 } catch (\Exception $e) { 930 } catch (\Exception $e) {
937 echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL; 931 echo 'date:' . date('Y-m-d H:i:s') . ', category_custom_insert error: ' . $e->getMessage() . PHP_EOL;
938 continue; 932 continue;
939 } 933 }
940 - } else {  
941 - $parent_id = $parent['id'];  
942 - }  
943 -  
944 - if (!empty($item['children'] ?? [])) {  
945 - $this->category_custom_insert($project_id, $module_id, $item['children'], $parent_id);  
946 } 934 }
947 } 935 }
948 } 936 }
@@ -15,6 +15,7 @@ class Kernel extends ConsoleKernel @@ -15,6 +15,7 @@ class Kernel extends ConsoleKernel
15 */ 15 */
16 protected function schedule(Schedule $schedule) 16 protected function schedule(Schedule $schedule)
17 { 17 {
  18 + $schedule->command('sync_file')->everyThirtyMinutes()->withoutOverlapping(1);//每半小时执行同步
18 // 每日更新最新模块 19 // 每日更新最新模块
19 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 20 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
20 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 21 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
@@ -32,8 +32,22 @@ class LogFormatterFactory @@ -32,8 +32,22 @@ class LogFormatterFactory
32 $path = date('Y-m', $time) . '/' . date('d', $time) . '_' . $suffix . '.log'; 32 $path = date('Y-m', $time) . '/' . date('d', $time) . '_' . $suffix . '.log';
33 $path = 'logs/' . $config['prefix'] . '/' . $path; 33 $path = 'logs/' . $config['prefix'] . '/' . $path;
34 $path = storage_path($path); 34 $path = storage_path($path);
  35 +
  36 + try {
  37 + if (!file_exists($path)) {
  38 + $directory = pathinfo($path, PATHINFO_DIRNAME);
  39 + if(!file_exists($directory)){
  40 + mkdir($directory, 0644, true);
  41 + chown($directory, 'www');
  42 + }
  43 + touch($path);
  44 + chown($path, 'www');
  45 + }
  46 + }catch (\Throwable $exception){}
  47 +
35 $handler = new StreamHandler($path, $level, false); 48 $handler = new StreamHandler($path, $level, false);
36 $handler->setFormatter(new LineFormatter(null, 'Y-m-d H:i:s', false, true)); 49 $handler->setFormatter(new LineFormatter(null, 'Y-m-d H:i:s', false, true));
  50 +
37 return $handler; 51 return $handler;
38 } 52 }
39 53
@@ -70,7 +70,7 @@ class FormGlobalsoApi @@ -70,7 +70,7 @@ class FormGlobalsoApi
70 $res = HttpUtils::get($api_url, $params); 70 $res = HttpUtils::get($api_url, $params);
71 $res = Arr::s2a($res); 71 $res = Arr::s2a($res);
72 } catch (\Exception | GuzzleException $e) { 72 } catch (\Exception | GuzzleException $e) {
73 - errorLog('询盘列表', $params, $e); 73 + errorLog('询盘列表'.$api_url, $params, $e);
74 return false; 74 return false;
75 } 75 }
76 return $res; 76 return $res;
@@ -155,5 +155,28 @@ class FormGlobalsoApi @@ -155,5 +155,28 @@ class FormGlobalsoApi
155 return $res; 155 return $res;
156 } 156 }
157 157
158 - 158 + /**
  159 + * @remark :获取当前项目所有询盘及询盘国家
  160 + * @name :getInquiryAll
  161 + * @author :lyh
  162 + * @method :post
  163 + * @time :2024/8/15 14:16
  164 + */
  165 + public function getInquiryAll($domain,$start_month = ''){
  166 + if (!(strpos($domain, 'https://') === 0)) {
  167 + $domain = 'https://'.$domain.'/';
  168 + }
  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";
  171 + if(!empty($start_month)){
  172 + $url = $url."&sta_date=$start_month";
  173 + }
  174 + try {
  175 + $res = http_get($url,['charset=utf-8']);
  176 + } catch (\Exception | GuzzleException $e) {
  177 + errorLog('提交询盘信息失败', $domain, $e);
  178 + return false;
  179 + }
  180 + return $res;
  181 + }
159 } 182 }
@@ -927,3 +927,5 @@ function base62_encode($num) { @@ -927,3 +927,5 @@ function base62_encode($num) {
927 } 927 }
928 928
929 929
  930 +
  931 +
@@ -14,6 +14,7 @@ use App\Helper\Arr; @@ -14,6 +14,7 @@ use App\Helper\Arr;
14 use App\Helper\FormGlobalsoApi; 14 use App\Helper\FormGlobalsoApi;
15 use App\Models\Domain\DomainInfo; 15 use App\Models\Domain\DomainInfo;
16 use App\Models\HomeCount\Count; 16 use App\Models\HomeCount\Count;
  17 +use App\Models\HomeCount\MonthCount;
17 use App\Models\Inquiry\InquiryFormData; 18 use App\Models\Inquiry\InquiryFormData;
18 use App\Models\Project\Project; 19 use App\Models\Project\Project;
19 use App\Models\RankData\ExternalLinks; 20 use App\Models\RankData\ExternalLinks;
@@ -115,7 +116,7 @@ class OptimizationReportController extends BaseController @@ -115,7 +116,7 @@ class OptimizationReportController extends BaseController
115 // 获取当前月的结束时间 116 // 获取当前月的结束时间
116 $endTime = date('Y-m-t', strtotime($this->param['date'])); 117 $endTime = date('Y-m-t', strtotime($this->param['date']));
117 $arr = []; 118 $arr = [];
118 - $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain); 119 + $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain,$project_id);
119 $arr = $this->flowCount($arr,$startTime,$endTime,$project_id); 120 $arr = $this->flowCount($arr,$startTime,$endTime,$project_id);
120 $arr = $this->sourceCount($arr,$startTime,$endTime,$domain); 121 $arr = $this->sourceCount($arr,$startTime,$endTime,$domain);
121 $arr['month'] = date('Y-m',time()); 122 $arr['month'] = date('Y-m',time());
@@ -131,42 +132,15 @@ class OptimizationReportController extends BaseController @@ -131,42 +132,15 @@ class OptimizationReportController extends BaseController
131 * @method :post 132 * @method :post
132 * @time :2023/6/30 14:29 133 * @time :2023/6/30 14:29
133 */ 134 */
134 - public function inquiryCount(&$arr,&$startTime,&$endTime,$domain){  
135 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000);  
136 - if(!empty($inquiry_list)){  
137 - //总数  
138 - $arr['total'] = $inquiry_list['data']['total'] ?? 0;  
139 - //数据详情  
140 - $data = $inquiry_list['data']['data'] ?? '';  
141 - $arr['month_total'] = 0;  
142 - $countryArr = [];  
143 - if(isset($data) && !empty($data)){  
144 - foreach ($data as $v){  
145 - if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){  
146 - $arr['month_total']++;  
147 - if(isset($countryArr[$v['country']])){  
148 - $countryArr[$v['country']]++;  
149 - }else{  
150 - $countryArr[$v['country']] = 1;  
151 - }  
152 - }  
153 - }  
154 - }  
155 - }  
156 - //加上其他询盘  
157 - $arr['total'] += InquiryFormData::getCount();  
158 - $arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]);  
159 - $countryData = InquiryFormData::getCountryCount([$startTime, $endTime]);  
160 - foreach ($countryData as $v1){  
161 - if(isset($countryArr[$v1['country']])){  
162 - $countryArr[$v1['country']] += $v1['count'];  
163 - }else{  
164 - $countryArr[$v1['country']] = $v1['count'];  
165 - } 135 + public function inquiryCount(&$arr, &$startTime, $project_id){
  136 + $month = date('Y-m',strtotime($startTime));
  137 + $monthCountModel = new MonthCount();
  138 + $info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$month]);
  139 + if($info !== false){
  140 + $arr['country'] = $info['country'];
  141 + $arr['total'] = $info['total'];
  142 + $arr['month_total'] = $info['month_total'];
166 } 143 }
167 - arsort($countryArr);  
168 - $top20 = array_slice($countryArr, 0, 15, true);  
169 - $arr['country'] = $top20;  
170 return $arr; 144 return $arr;
171 } 145 }
172 146
@@ -350,9 +324,9 @@ class OptimizationReportController extends BaseController @@ -350,9 +324,9 @@ class OptimizationReportController extends BaseController
350 public function pv_ip($domain){ 324 public function pv_ip($domain){
351 $pv = (new VisitItem())->count(); 325 $pv = (new VisitItem())->count();
352 $ip = (new Visit())->count(); 326 $ip = (new Visit())->count();
353 - $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); 327 + $inquiry_list = (new FormGlobalsoApi())->getInquiryAll($domain);
354 if(!empty($inquiry_list)){ 328 if(!empty($inquiry_list)){
355 - $total = $inquiry_list['data']['total'] ?? 0; 329 + $total = $inquiry_list['data']['count'] ?? 0;
356 } 330 }
357 return [ 331 return [
358 'total_pv'=>$pv, 332 'total_pv'=>$pv,
@@ -177,4 +177,21 @@ class KeywordVideoController extends BaseController @@ -177,4 +177,21 @@ class KeywordVideoController extends BaseController
177 $data['end_total'] = $keywordModel->formatQuery(['status'=>1])->count(); 177 $data['end_total'] = $keywordModel->formatQuery(['status'=>1])->count();
178 $this->response('success',Code::SUCCESS,$data); 178 $this->response('success',Code::SUCCESS,$data);
179 } 179 }
  180 +
  181 + /**
  182 + * @remark :当月视频总数量
  183 + * @name :getVideoCount
  184 + * @author :lyh
  185 + * @method :post
  186 + * @time :2024/8/14 9:58
  187 + */
  188 + public function getVideoCount(){
  189 + // 当月的开始时间
  190 + $start_of_month = date("Y-m-01 00:00:00");
  191 + // 当月的结束时间:使用 strtotime() 计算最后一天
  192 + $end_of_month = date("Y-m-d 23:59:59", strtotime("last day of this month"));
  193 + $taskLogModel = new KeywordVideoTaskLog();
  194 + $count = $taskLogModel->formatQuery(['created_at'=>['between',[$start_of_month,$end_of_month]]])->count();
  195 + $this->response('success',Code::SUCCESS,['count'=>$count]);
  196 + }
180 } 197 }
@@ -16,6 +16,7 @@ use App\Models\Com\UpdateOldInfo; @@ -16,6 +16,7 @@ use App\Models\Com\UpdateOldInfo;
16 use App\Models\Domain\DomainInfo; 16 use App\Models\Domain\DomainInfo;
17 use App\Models\News\NewsCategory; 17 use App\Models\News\NewsCategory;
18 use App\Models\Product\Category; 18 use App\Models\Product\Category;
  19 +use App\Models\Product\Product;
19 use App\Models\Project\ProjectUpdateTdk; 20 use App\Models\Project\ProjectUpdateTdk;
20 use App\Models\Template\BTemplate; 21 use App\Models\Template\BTemplate;
21 use App\Models\Template\Setting; 22 use App\Models\Template\Setting;
@@ -121,6 +122,17 @@ class UpdateController extends BaseController @@ -121,6 +122,17 @@ class UpdateController extends BaseController
121 } 122 }
122 } 123 }
123 124
  125 + //如果自己创建了6.0产品关联了分类,也不能再重采分类
  126 + $product_v6_list = Product::where('project_id', $this->param['project_id'])->where('is_upgrade', 0)->get();
  127 + if ($product_v6_list->count() > 0) {
  128 + foreach ($product_v6_list as $product_v6) {
  129 + if ($product_v6->category_id) {
  130 + $product_cate_type = 0;
  131 + break;
  132 + }
  133 + }
  134 + }
  135 +
124 //新闻分类重采之前,判断新闻分类是否开启了可视化 136 //新闻分类重采之前,判断新闻分类是否开启了可视化
125 $category_news_list = NewsCategory::where('project_id', $this->param['project_id'])->get(); 137 $category_news_list = NewsCategory::where('project_id', $this->param['project_id'])->get();
126 if ($category_news_list->count() > 0) { 138 if ($category_news_list->count() > 0) {
@@ -88,9 +88,7 @@ class AyrReleaseController extends BaseController @@ -88,9 +88,7 @@ class AyrReleaseController extends BaseController
88 } 88 }
89 //发送请求发布社交文章 89 //发送请求发布社交文章
90 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']); 90 $res = $ayrShare->post_send_msg($param,$share_info['profile_key']);
91 - if($res){  
92 - $ayrReleaseLogic->release_add($res);  
93 - } 91 + $res = $ayrReleaseLogic->release_add($res);
94 //保存返回的内容 92 //保存返回的内容
95 $this->response('success',Code::SUCCESS,json_decode($res)); 93 $this->response('success',Code::SUCCESS,json_decode($res));
96 } 94 }
@@ -65,6 +65,7 @@ class CNoticeController extends BaseController @@ -65,6 +65,7 @@ class CNoticeController extends BaseController
65 if($domain_info){ 65 if($domain_info){
66 //判断是否已有更新进行中 66 //判断是否已有更新进行中
67 $notify_model = new Notify(); 67 $notify_model = new Notify();
  68 + $type = $is_sitemap == 1 ? Notify::TYPE_ALL_SITEMAP : $type;
68 $data = [ 69 $data = [
69 'project_id' => $project_id, 70 'project_id' => $project_id,
70 'type' => $type, 71 'type' => $type,
@@ -90,6 +91,7 @@ class CNoticeController extends BaseController @@ -90,6 +91,7 @@ class CNoticeController extends BaseController
90 91
91 $data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$url,'language'=>$language]); 92 $data['data'] = Arr::a2s(['domain'=>$domain,'url'=>$url,'language'=>$language]);
92 $data['status'] = $is_sitemap == 1 ? Notify::STATUS_FINISH_PAGE : Notify::STATUS_INIT; 93 $data['status'] = $is_sitemap == 1 ? Notify::STATUS_FINISH_PAGE : Notify::STATUS_INIT;
  94 + $data['is_pull_html_zip'] = $is_sitemap == 1 ? Notify::IS_PULL_HTML_ZIP_TRUE : Notify::IS_PULL_HTML_ZIP_FALSE;
93 $notify_model->add($data); 95 $notify_model->add($data);
94 } 96 }
95 } 97 }
@@ -64,10 +64,13 @@ class MonthReportController extends BaseController @@ -64,10 +64,13 @@ class MonthReportController extends BaseController
64 if(!empty($info['country'])){ 64 if(!empty($info['country'])){
65 $info['country'] = json_decode($info['country']); 65 $info['country'] = json_decode($info['country']);
66 } 66 }
67 - // 获取上个月的开始时间  
68 - $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();  
69 - // 获取上个月的结束时间  
70 - $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString(); 67 + // 创建指定年月的 DateTime 对象
  68 + $date = $this->map['month'];
  69 + $start = new \DateTime("$date-01 00:00:00");
  70 + // 克隆 $start 对象并设置到下个月的第一天,减去1秒得到该月的最后一秒
  71 + $end = (clone $start)->modify('last day of this month')->setTime(23, 59, 59);
  72 + $startTime = $start->format('Y-m-d H:i:s');
  73 + $endTime = $end->format('Y-m-d H:i:s');
71 $param = [ 74 $param = [
72 'date' => ['between',[$startTime,$endTime]], 75 'date' => ['between',[$startTime,$endTime]],
73 'project_id' => $this->user['project_id'] 76 'project_id' => $this->user['project_id']
@@ -254,6 +254,7 @@ class LoginController extends BaseController @@ -254,6 +254,7 @@ class LoginController extends BaseController
254 } 254 }
255 //没有from_order_id的项目 进入演示版 运营中心 255 //没有from_order_id的项目 进入演示版 运营中心
256 $arr['from_order_id'] = $arr['from_order_id'] ?? 0; 256 $arr['from_order_id'] = $arr['from_order_id'] ?? 0;
  257 + $arr['phone'] = $arr['phone'] ?? '';
257 if(!$arr['from_order_id']){ 258 if(!$arr['from_order_id']){
258 //有账号就直接登录, 没有账号创建账号登录 259 //有账号就直接登录, 没有账号创建账号登录
259 $user = (new User())->where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $arr['phone'])->first(); 260 $user = (new User())->where('project_id', Project::DEMO_PROJECT_ID)->where('mobile', $arr['phone'])->first();
@@ -277,16 +278,25 @@ class LoginController extends BaseController @@ -277,16 +278,25 @@ class LoginController extends BaseController
277 'manager_id'=>0, 278 'manager_id'=>0,
278 ]; 279 ];
279 }else{ 280 }else{
280 - //有from_order_id, 找到对应的项目并登录账号 281 + //有from_order_id, 找到对应的项目并登录对应账号
281 $project = (new Project())->read(['from_order_id'=>$arr['from_order_id'], 'delete_status' => Project::IS_DEL_FALSE]); 282 $project = (new Project())->read(['from_order_id'=>$arr['from_order_id'], 'delete_status' => Project::IS_DEL_FALSE]);
282 if(!$project){ 283 if(!$project){
283 $this->response('项目不存在,请联系管理员',Code::USER_ERROR); 284 $this->response('项目不存在,请联系管理员',Code::USER_ERROR);
284 } 285 }
285 - $data = [  
286 - 'project_id'=>$project['id'],  
287 - 'manager_id'=>0,  
288 - ]; 286 + $user = (new User())->where('project_id', $project['id'])->where('mobile', $arr['phone'])->first();
  287 + if(!$user){
  288 + $data = [
  289 + 'project_id'=>$project['id'],
  290 + 'manager_id'=>0,
  291 + ];
  292 + }else{
  293 + $data = [
  294 + 'user_id'=>$user['id'],
  295 + 'manager_id'=>0,
  296 + ];
  297 + }
289 } 298 }
  299 +
290 $info = $logic->autologin($data); 300 $info = $logic->autologin($data);
291 $this->response('success',Code::SUCCESS,['info'=>$info]); 301 $this->response('success',Code::SUCCESS,['info'=>$info]);
292 } 302 }
@@ -346,23 +346,43 @@ class ProductController extends BaseController @@ -346,23 +346,43 @@ class ProductController extends BaseController
346 return []; 346 return [];
347 } 347 }
348 $extendInfoModel = new ExtendInfo(); 348 $extendInfoModel = new ExtendInfo();
  349 + $infoList = $extendInfoModel->list(['product_id'=>$product_id],'created_at');
349 foreach ($list as $k=>$v){ 350 foreach ($list as $k=>$v){
350 - $info = $extendInfoModel->read(['key'=>$v['key'],'product_id'=>$product_id]);  
351 - if($info == false){  
352 - if($v['type'] == 3 || $v['type'] == 4){  
353 - $v['values'] = [];  
354 - }else{  
355 - $v['values'] = ''; 351 + foreach ($infoList as $values){
  352 + if($v['key'] == $values['key']){
  353 + $v = $this->setTypValues($v,$values);
  354 + break;
356 } 355 }
357 - }else{  
358 - $v = $this->setTypValues($v,$info);  
359 } 356 }
360 $list[$k] = $v; 357 $list[$k] = $v;
361 } 358 }
  359 + $list = $this->handleExtentList($list);
362 return $list; 360 return $list;
363 } 361 }
364 362
365 /** 363 /**
  364 + * @remark :处理详情数据(初始化)
  365 + * @name :handleList
  366 + * @author :lyh
  367 + * @method :post
  368 + * @time :2024/8/14 18:26
  369 + */
  370 + public function handleExtentList($list){
  371 + foreach ($list as $k => $v){
  372 + if($v['type'] == 3 || $v['type'] == 4){
  373 + if(!isset($v['values'])){
  374 + $v['values'] = [];
  375 + }
  376 + }else{
  377 + if(!isset($v['values'])){
  378 + $v['values'] = '';
  379 + }
  380 + }
  381 + $list[$k] = $v;
  382 + }
  383 + return $this->success($list);
  384 + }
  385 + /**
366 * @remark :扩展字段根据type返回类型 386 * @remark :扩展字段根据type返回类型
367 * @name :setTypValues 387 * @name :setTypValues
368 * @author :lyh 388 * @author :lyh
@@ -50,11 +50,12 @@ class AyrReleaseLogic extends BaseLogic @@ -50,11 +50,12 @@ class AyrReleaseLogic extends BaseLogic
50 $this->model->add($this->param); 50 $this->model->add($this->param);
51 }else{ 51 }else{
52 $result_data = json_decode($this->param['result_data']); 52 $result_data = json_decode($this->param['result_data']);
53 - if(isset($result_data['status']) && $result_data['status'] == 'success'){ 53 + if(isset($result_data->status) && $result_data->status == 'success'){
54 $this->model->edit($this->param,['id'=>$info['id']]); 54 $this->model->edit($this->param,['id'=>$info['id']]);
  55 + return $this->param['result_data'];
55 } 56 }
56 } 57 }
57 - return $this->success(); 58 + return $this->param['result_data'];
58 } 59 }
59 /** 60 /**
60 * @name :(上传第三方图片参数处理)get_param 61 * @name :(上传第三方图片参数处理)get_param
@@ -261,6 +261,8 @@ class TranslateLogic extends BaseLogic @@ -261,6 +261,8 @@ class TranslateLogic extends BaseLogic
261 foreach ($this->param['data'] as $k => $v){ 261 foreach ($this->param['data'] as $k => $v){
262 if(!empty($v) && is_array($v)){ 262 if(!empty($v) && is_array($v)){
263 foreach ($v as $text => $translate){ 263 foreach ($v as $text => $translate){
  264 + $text = str_replace(['%22', '%', '+'], ['"', '%', '+'], $text);
  265 + $translate = str_replace(['%22', '%', '+'], ['"', '%', '+'], $translate);
264 $data[$text] = $translate; 266 $data[$text] = $translate;
265 } 267 }
266 } 268 }
@@ -312,7 +314,8 @@ class TranslateLogic extends BaseLogic @@ -312,7 +314,8 @@ class TranslateLogic extends BaseLogic
312 * @time :2024/5/17 15:11 314 * @time :2024/5/17 15:11
313 */ 315 */
314 public function getRouteSource($route){ 316 public function getRouteSource($route){
315 - $data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0]; 317 + $routes = $route;
  318 + $data = ['source'=>0,'source_id'=>0,'is_list'=>0,'is_custom'=>0,'page'=>0];
316 if(strtolower($route) == 'all'){ 319 if(strtolower($route) == 'all'){
317 return $this->success($data); 320 return $this->success($data);
318 } 321 }
@@ -321,12 +324,20 @@ class TranslateLogic extends BaseLogic @@ -321,12 +324,20 @@ class TranslateLogic extends BaseLogic
321 return $this->success($data); 324 return $this->success($data);
322 } 325 }
323 $route = basename($route); 326 $route = basename($route);
  327 + $page = 0;
  328 + if (is_numeric($route)) {
  329 + $arr = explode('/',$routes);
  330 + $page = $arr[1];
  331 + $route = $arr[0];
  332 + }
324 $routeModel = new RouteMap(); 333 $routeModel = new RouteMap();
325 $routeInfo = $routeModel->read(['route'=>$route]); 334 $routeInfo = $routeModel->read(['route'=>$route]);
326 if($routeInfo === false){ 335 if($routeInfo === false){
327 return $data; 336 return $data;
328 } 337 }
329 - return $this->resultData($routeInfo,$data); 338 + $data = $this->resultData($routeInfo,$data);
  339 + $data['page'] = $page;
  340 + return $data;
330 } 341 }
331 342
332 /** 343 /**
@@ -18,11 +18,12 @@ class Notify extends Base @@ -18,11 +18,12 @@ class Notify extends Base
18 const STATUS_ERROR = 9; 18 const STATUS_ERROR = 9;
19 19
20 /** 20 /**
21 - * 类型 1:主站, 2:小语种, 3:amp 21 + * 类型 1:主站, 2:小语种, 3:amp,4:sitemap
22 */ 22 */
23 const TYPE_MASTER = 1; 23 const TYPE_MASTER = 1;
24 const TYPE_MINOR = 2; 24 const TYPE_MINOR = 2;
25 const TYPE_AMP = 3; 25 const TYPE_AMP = 3;
  26 + const TYPE_ALL_SITEMAP = 4;
26 27
27 /** 28 /**
28 * 路由 29 * 路由
@@ -41,6 +42,14 @@ class Notify extends Base @@ -41,6 +42,14 @@ class Notify extends Base
41 const ROUTE_PRODUCT_VIDEO_KEYWORD = 6; 42 const ROUTE_PRODUCT_VIDEO_KEYWORD = 6;
42 43
43 /** 44 /**
  45 + * 是否拉取HTML压缩包
  46 + * 0:默认不拉取
  47 + * 1:拉取
  48 + */
  49 + const IS_PULL_HTML_ZIP_FALSE = 0;
  50 + const IS_PULL_HTML_ZIP_TRUE = 1;
  51 +
  52 + /**
44 * 类型 53 * 类型
45 * @return array 54 * @return array
46 */ 55 */
@@ -351,6 +351,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -351,6 +351,7 @@ Route::middleware(['aloginauth'])->group(function () {
351 Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit'); 351 Route::any('/edit', [Aside\Com\KeywordVideoController::class, 'edit'])->name('keyword_video_edit');
352 Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog'); 352 Route::any('/getVideoTaskLog', [Aside\Com\KeywordVideoController::class, 'getVideoTaskLog'])->name('keyword_video_getVideoTaskLog');
353 Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum'); 353 Route::any('/taskNum', [Aside\Com\KeywordVideoController::class, 'taskNum'])->name('keyword_video_taskNum');
  354 + Route::any('/getVideoCount', [Aside\Com\KeywordVideoController::class, 'getVideoCount'])->name('keyword_video_getVideoCount');
354 }); 355 });
355 356
356 // 公共主题模版 357 // 公共主题模版