Merge remote-tracking branch 'origin/master' into akun
正在显示
24 个修改的文件
包含
215 行增加
和
114 行删除
| @@ -65,9 +65,9 @@ class Count extends Command | @@ -65,9 +65,9 @@ class Count extends Command | ||
| 65 | $arr['date'] = $yesterday; | 65 | $arr['date'] = $yesterday; |
| 66 | ProjectServer::useProject($v['id']); | 66 | ProjectServer::useProject($v['id']); |
| 67 | //pv统计 | 67 | //pv统计 |
| 68 | - $arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']); | 68 | + $arr['pv_num'] = $this->pv_num($yesterday); |
| 69 | //ip统计 | 69 | //ip统计 |
| 70 | - $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']); | 70 | + $arr['ip_num'] = $this->ip_num($yesterday); |
| 71 | DB::disconnect('custom_mysql'); | 71 | DB::disconnect('custom_mysql'); |
| 72 | //服务达标天数 | 72 | //服务达标天数 |
| 73 | $arr['compliance_day'] = $v['finish_remain_day']; | 73 | $arr['compliance_day'] = $v['finish_remain_day']; |
| @@ -66,9 +66,9 @@ class CountDate extends Command | @@ -66,9 +66,9 @@ class CountDate extends Command | ||
| 66 | $arr['date'] = $yesterday; | 66 | $arr['date'] = $yesterday; |
| 67 | ProjectServer::useProject($v['id']); | 67 | ProjectServer::useProject($v['id']); |
| 68 | //pv统计 | 68 | //pv统计 |
| 69 | - $arr['pv_num'] = $this->pv_num($yesterday,$v['test_domain']); | 69 | + $arr['pv_num'] = $this->pv_num($yesterday); |
| 70 | //ip统计 | 70 | //ip统计 |
| 71 | - $arr['ip_num'] = $this->ip_num($yesterday,$v['test_domain']); | 71 | + $arr['ip_num'] = $this->ip_num($yesterday); |
| 72 | DB::disconnect('custom_mysql'); | 72 | DB::disconnect('custom_mysql'); |
| 73 | //服务达标天数 | 73 | //服务达标天数 |
| 74 | $arr['compliance_day'] = $v['finish_remain_day']; | 74 | $arr['compliance_day'] = $v['finish_remain_day']; |
| @@ -687,7 +687,7 @@ class RelayInquiry extends Command | @@ -687,7 +687,7 @@ class RelayInquiry extends Command | ||
| 687 | $links = []; | 687 | $links = []; |
| 688 | foreach ($xml->url as $url) { | 688 | foreach ($xml->url as $url) { |
| 689 | $loc = (string) $url->loc; | 689 | $loc = (string) $url->loc; |
| 690 | - if(!Str::contains($loc, ['404', 'thanks'])){ | 690 | + if(!Str::contains($loc, ['404', 'thanks', 'test'])){ |
| 691 | $links[] = $loc; | 691 | $links[] = $loc; |
| 692 | } | 692 | } |
| 693 | } | 693 | } |
| @@ -42,22 +42,12 @@ class MonthAllCount extends Command | @@ -42,22 +42,12 @@ class MonthAllCount extends Command | ||
| 42 | $projectModel = new Project(); | 42 | $projectModel = new Project(); |
| 43 | $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]]); | 43 | $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]]); |
| 44 | foreach ($list as $v) { | 44 | foreach ($list as $v) { |
| 45 | - if($v['is_upgrade'] == 1){ | ||
| 46 | - $oldModel = new UpdateOldInfo(); | ||
| 47 | - $info = $oldModel->read(['project_id' => $v['id']]); | ||
| 48 | - if ($info !== false) { | ||
| 49 | - $url = $info['old_domain_online']; | ||
| 50 | - }else{ | ||
| 51 | - continue; | ||
| 52 | - } | ||
| 53 | - }else{ | ||
| 54 | - $domainModel = new DomainInfo(); | ||
| 55 | - $info = $domainModel->read(['project_id'=>$v['id']]); | ||
| 56 | - if($info === false){ | ||
| 57 | - continue; | ||
| 58 | - } | ||
| 59 | - $url = $info['domain']; | 45 | + $domainModel = new DomainInfo(); |
| 46 | + $info = $domainModel->read(['project_id'=>$v['id']]); | ||
| 47 | + if($info === false){ | ||
| 48 | + continue; | ||
| 60 | } | 49 | } |
| 50 | + $url = $info['domain']; | ||
| 61 | ProjectServer::useProject($v['id']); | 51 | ProjectServer::useProject($v['id']); |
| 62 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; | 52 | echo date('Y-m-d H:i:s') . '项目id:'.$v['id'] . PHP_EOL; |
| 63 | $this->count($v['id'], $url ,$v['is_upgrade']); | 53 | $this->count($v['id'], $url ,$v['is_upgrade']); |
| @@ -48,24 +48,14 @@ class MonthCount extends Command | @@ -48,24 +48,14 @@ class MonthCount extends Command | ||
| 48 | if($v['type'] == Project::TYPE_ZERO){ | 48 | if($v['type'] == Project::TYPE_ZERO){ |
| 49 | continue; | 49 | continue; |
| 50 | } | 50 | } |
| 51 | - if($v['is_upgrade'] == 1){ | ||
| 52 | - $oldModel = new UpdateOldInfo(); | ||
| 53 | - $info = $oldModel->read(['project_id' => $v['id']]); | ||
| 54 | - if ($info !== false) { | ||
| 55 | - $url = $info['old_domain_online']; | ||
| 56 | - }else{ | ||
| 57 | - continue; | 51 | + $domainInfo = new DomainInfo(); |
| 52 | + if(!empty($v['domain'])){ | ||
| 53 | + $info = $domainInfo->read(['id'=>$v['domain']]); | ||
| 54 | + if($info !== false){ | ||
| 55 | + $url = $info['domain']; | ||
| 58 | } | 56 | } |
| 59 | }else{ | 57 | }else{ |
| 60 | - $domainInfo = new DomainInfo(); | ||
| 61 | - if(!empty($v['domain'])){ | ||
| 62 | - $info = $domainInfo->read(['id'=>$v['domain']]); | ||
| 63 | - if($info !== false){ | ||
| 64 | - $url = $info['domain']; | ||
| 65 | - } | ||
| 66 | - }else{ | ||
| 67 | - $url = $v['test_domain']; | ||
| 68 | - } | 58 | + $url = $v['test_domain']; |
| 69 | } | 59 | } |
| 70 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 71 | 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; |
| @@ -48,24 +48,14 @@ class MonthCountDate extends Command | @@ -48,24 +48,14 @@ class MonthCountDate extends Command | ||
| 48 | if($v['type'] == Project::TYPE_ZERO){ | 48 | if($v['type'] == Project::TYPE_ZERO){ |
| 49 | continue; | 49 | continue; |
| 50 | } | 50 | } |
| 51 | - if($v['is_upgrade'] == 1){ | ||
| 52 | - $oldModel = new UpdateOldInfo(); | ||
| 53 | - $info = $oldModel->read(['project_id' => $v['id']]); | ||
| 54 | - if ($info !== false) { | ||
| 55 | - $url = $info['old_domain_online']; | ||
| 56 | - }else{ | ||
| 57 | - continue; | 51 | + $domainInfo = new DomainInfo(); |
| 52 | + if(!empty($v['domain'])){ | ||
| 53 | + $info = $domainInfo->read(['id'=>$v['domain']]); | ||
| 54 | + if($info !== false){ | ||
| 55 | + $url = $info['domain']; | ||
| 58 | } | 56 | } |
| 59 | }else{ | 57 | }else{ |
| 60 | - $domainInfo = new DomainInfo(); | ||
| 61 | - if(!empty($v['domain'])){ | ||
| 62 | - $info = $domainInfo->read(['id'=>$v['domain']]); | ||
| 63 | - if($info !== false){ | ||
| 64 | - $url = $info['domain']; | ||
| 65 | - } | ||
| 66 | - }else{ | ||
| 67 | - $url = $v['test_domain']; | ||
| 68 | - } | 58 | + $url = $v['test_domain']; |
| 69 | } | 59 | } |
| 70 | ProjectServer::useProject($v['id']); | 60 | ProjectServer::useProject($v['id']); |
| 71 | 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; |
| @@ -41,15 +41,9 @@ class MonthProjectCount extends Command | @@ -41,15 +41,9 @@ class MonthProjectCount extends Command | ||
| 41 | 41 | ||
| 42 | public function handle(){ | 42 | public function handle(){ |
| 43 | $project_id = $this->argument('project_id'); | 43 | $project_id = $this->argument('project_id'); |
| 44 | - $oldModel = new UpdateOldInfo(); | ||
| 45 | - $info = $oldModel->read(['project_id'=>$project_id]); | ||
| 46 | - if($info !== false){ | ||
| 47 | - $url = $info['old_domain_online']; | ||
| 48 | - }else{ | ||
| 49 | - $domainModel = new DomainInfo(); | ||
| 50 | - $info = $domainModel->read(['project_id'=>$project_id]); | ||
| 51 | - $url = $info['domain']; | ||
| 52 | - } | 44 | + $domainModel = new DomainInfo(); |
| 45 | + $info = $domainModel->read(['project_id'=>$project_id]); | ||
| 46 | + $url = $info['domain']; | ||
| 53 | $projectModel = new Project(); | 47 | $projectModel = new Project(); |
| 54 | $projectInfo = $projectModel->read(['id'=>$project_id]); | 48 | $projectInfo = $projectModel->read(['id'=>$project_id]); |
| 55 | ProjectServer::useProject($project_id); | 49 | ProjectServer::useProject($project_id); |
| @@ -39,7 +39,7 @@ class TemplateLabel extends Command | @@ -39,7 +39,7 @@ class TemplateLabel extends Command | ||
| 39 | */ | 39 | */ |
| 40 | public function handle(){ | 40 | public function handle(){ |
| 41 | //获取最近7天模版的记录 | 41 | //获取最近7天模版的记录 |
| 42 | - $start_time = now()->subDays(90)->startOfDay()->toDateString(); | 42 | + $start_time = now()->subDays(7)->startOfDay()->toDateString(); |
| 43 | $end_time = now()->startOfDay()->toDateString(); | 43 | $end_time = now()->startOfDay()->toDateString(); |
| 44 | $this->setTemplateModule($start_time,$end_time); | 44 | $this->setTemplateModule($start_time,$end_time); |
| 45 | $this->setTemplate($start_time,$end_time); | 45 | $this->setTemplate($start_time,$end_time); |
| @@ -38,6 +38,8 @@ use App\Models\Purchaser\PurchaserInfo; | @@ -38,6 +38,8 @@ use App\Models\Purchaser\PurchaserInfo; | ||
| 38 | use App\Models\RouteMap\RouteMap; | 38 | use App\Models\RouteMap\RouteMap; |
| 39 | use App\Models\Template\BCustomTemplate; | 39 | use App\Models\Template\BCustomTemplate; |
| 40 | use App\Models\Template\BTemplateCom; | 40 | use App\Models\Template\BTemplateCom; |
| 41 | +use App\Models\Template\Setting; | ||
| 42 | +use App\Models\Template\Template; | ||
| 41 | use App\Services\AmazonS3Service; | 43 | use App\Services\AmazonS3Service; |
| 42 | use App\Services\ProjectServer; | 44 | use App\Services\ProjectServer; |
| 43 | use App\Utils\EncryptUtils; | 45 | use App\Utils\EncryptUtils; |
| @@ -64,13 +66,77 @@ class Demo extends Command | @@ -64,13 +66,77 @@ class Demo extends Command | ||
| 64 | protected $description = 'demo'; | 66 | protected $description = 'demo'; |
| 65 | 67 | ||
| 66 | public function handle(){ | 68 | public function handle(){ |
| 69 | +// echo date('Y-m-d H:i:s') . 'project_id:' . PHP_EOL; | ||
| 70 | +// ProjectServer::useProject(3092); | ||
| 71 | +// $this->delProduct(); | ||
| 72 | +// DB::disconnect('custom_mysql'); | ||
| 73 | +// echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 74 | + return $this->projectList(); | ||
| 75 | + } | ||
| 67 | 76 | ||
| 68 | - echo date('Y-m-d H:i:s') . 'project_id:' . PHP_EOL; | ||
| 69 | - ProjectServer::useProject(2837); | ||
| 70 | - $this->ceshi(); | ||
| 71 | - DB::disconnect('custom_mysql'); | ||
| 72 | - | 77 | + public function projectList(){ |
| 78 | + $data = '深圳澄通睿视科技有限公司, 日照源洋包装材料有限公司, 河北途铂机电设备有限责任公司, 宁波市海曙玖鼎纸制品有限公司, 青岛众瑞智能仪器有限公司, 河北新秋国际贸易有限公司, 江西乔森电气有限公司, 沧州艾斯克粉业制造有限公司, 上海希然化工科技有限公司, 石家庄中创进出口有限公司, 东光县恒创利纸箱机械有限公司2021, 天津正能管业有限公司, 河北帷幄纺织有限公司, 广东顺德宝绅源环保科技有限公司, 石家庄艾文尔生物科技有限公司, 浙江福俄电气有限公司, 深圳市嘉盛数据科技有限公司, 江西米德实业有限公司, 苏州稼瑞机械有限公司, 青岛卓亚塑料机械有限公司, 宁波中力螺栓制造有限公司, 中山市万格电器有限公司, 廊坊禹神节水灌溉技术有限公司, 山东索玛特制帽有限公司, 蓝启生物技术(深圳)有限公司, 南宁奥展五金紧固件有限公司, 河北茉悠科技有限公司, 莱科阀门(天津)有限公司, 四川零点自动化系统有限公司, 厦门市戴尔乐新能源汽车有限公司, 宁波爱克利浦电器有限公司, 扬州天定成玩具礼品有限公司, 宁波市金典照明电器有限公司, 杭州法埃姆斯钢构有限公司, 北京迪文科技有限公司, 无锡动为储能科技有限公司, 河北唐蕴生物科技有限公司, 绍兴苏尔黛纺织品有限公司, 河北祈强金属制品有限公司, 上池诊断科技(深圳)有限公司, 泉州市三颖超硬工具有限公司, 宁波杰广电子有限公司, 石家庄德烨管业有限公司, 山东凯特钻具有限公司, 北京思普瑞特科技发展有限公司, 广州市印科标识科技有限公司, 优之科技(深圳)有限公司, 南通赫美特国际贸易有限公司, 天津誉瑞特品科技有限公司, 河北坤焰建材科技有限公司, 绍兴睿博机械有限公司, 西安法斯拓进出口有限公司, 深圳市德诺威电子有限公司, 百润(中国)有限公司, 达时科科技有限责任公司, 陈海英, 四川蓉腾自动化设备有限公司, 石家庄晋吉建材科技有限公司, 石家庄安瑞科气体机械有限公司, 深圳市扬帆纸制品有限公司, 舟山威尔曼机械科技有限公司, 佰纳通科技(北京)有限公司, 宁波嘉佑行科技有限公司, 东莞市凯信脚轮有限公司, 宝鸡轩泰颜料科技有限公司, 东莞市华腾五金制品有限公司, 深圳市思锐宇光电有限公司, 东莞市奥彩数码科技有限公司, 上海垂普国际贸易有限公司, 扬州爱拓户外用品有限公司, 余姚市立鑫电子有限公司, 晋州市金昌盛化工有限公司, 广东阿酷达箱包科技有限公司, 泉州市杰斯特仪器设备有限公司, 三和长兴科技有限公司, 佛山市精一家具有限公司谷腾分公司, 天津市洁雅妇女卫生保健制品有限公司, 江西海瑞天然植物有限公司, 九江贝海玻纤有限公司(客户做新站), 瑞安市齐笙科技有限公司, 石家庄华圣方洲国际贸易有限公司, 深圳市方成教学设备有限公司, 连云港索娜斯贸易有限公司, 睿華電子有限公司, 扬州市极盛照明有限公司, 天津市实丰国际贸易有限责任公司, 厦门亚迅工贸有限公司, 威海旺展旅游用品有限公司, 宁波首安纸业有限公司, 浙江乐马电气有限公司, 广东金莱特智能科技有限公司, 河北科星药业有限公司, 宁波迈可森汽配有限公司, 邯郸市常岚紧固件制造有限公司, 宁波市晶艳贸易有限公司, 苏州荃华生物材料有限公司, 青岛洛城通信息科技有限公司, 合肥领派克机械设备有限公司, 广西绿城工贸有限公司, 一元电气科技有限公司【主站】, 立圣丰(厦门)纺织科技有限公司, 深圳市汉瑞通科技有限公司, 扬州市润芳塑胶包装材料有限公司, 扬州浩邦新能源科技有限公司项目2, 深圳市锦昊安科技有限公司, 四川途乐乐科技有限公司, 天津广大纸业股份有限公司, 西安禾为生物科技有限公司, 西安奥谷生物科技有限公司, 佛山市三水歌谷电器有限公司, 西安麦克斯农用化学有限公司, 瑞安市富锐思进出口有限公司(黑格客户), 北京新科以仁科技发展有限公司, 镇江市惠灵顿膜业有限公司'; | ||
| 79 | + $arr = explode(',',$data); | ||
| 80 | + $projectModel = new Project(); | ||
| 81 | + $opModel = new DeployOptimize(); | ||
| 82 | + foreach ($arr as $k => $v){ | ||
| 83 | + $v = trim($v); | ||
| 84 | + $info = $projectModel->read(['title'=>['like','%'.$v.'%']],['id']); | ||
| 85 | + if($info === false){ | ||
| 86 | + echo date('Y-m-d H:i:s') . '未查询到的项目--'.$v . PHP_EOL; | ||
| 87 | + }else{ | ||
| 88 | + $opInfo = $opModel->read(['project_id'=>$info['id']]); | ||
| 89 | + if (strpos($opInfo['special'], '15') !== false) { | ||
| 90 | + echo date('Y-m-d H:i:s') . '已包含' . PHP_EOL; | ||
| 91 | + } else { | ||
| 92 | + if(!empty($opInfo['special'])){ | ||
| 93 | + $special = ','.trim($opInfo['special'],',').',15,'; | ||
| 94 | + }else{ | ||
| 95 | + $special = ',15,'; | ||
| 96 | + } | ||
| 97 | + $opModel->edit(['special'=>$special],['id'=>$opInfo['id']]); | ||
| 98 | + echo date('Y-m-d H:i:s') . '未包含AI案例的project_id:'.$opInfo['project_id'] . PHP_EOL; | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + } | ||
| 73 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 102 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 103 | + return true; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 107 | + * @remark :删除product | ||
| 108 | + * @name :delProduct | ||
| 109 | + * @author :lyh | ||
| 110 | + * @method :post | ||
| 111 | + * @time :2025/1/10 9:35 | ||
| 112 | + */ | ||
| 113 | + public function delProduct(){ | ||
| 114 | + $productModel = new Product(); | ||
| 115 | + $list = $productModel->list(['status'=>2]); | ||
| 116 | + foreach ($list as $k => $v){ | ||
| 117 | + $routeModel = new RouteMap(); | ||
| 118 | + $routeModel->del(['source'=>'product','source_id'=>$v['id']]); | ||
| 119 | + } | ||
| 120 | + $productModel->del(['status'=>2]); | ||
| 121 | + return true; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + /** | ||
| 125 | + * @remark :统计当前模版使用情况 | ||
| 126 | + * @name :countTemplate | ||
| 127 | + * @author :lyh | ||
| 128 | + * @method :post | ||
| 129 | + * @time :2025/1/9 10:59 | ||
| 130 | + */ | ||
| 131 | + public function countTemplate(){ | ||
| 132 | + $bSettingModel = new Setting(); | ||
| 133 | + $lists = $bSettingModel->list(); | ||
| 134 | + $templateModel = new Template(); | ||
| 135 | + foreach ($lists as $v){ | ||
| 136 | + echo date('Y-m-d H:i:s') . '执行的模版id:' .$v['template_id'] . PHP_EOL; | ||
| 137 | + $templateModel->where(['id'=>$v['template_id']])->increment('number',1); | ||
| 138 | + } | ||
| 139 | + return true; | ||
| 74 | } | 140 | } |
| 75 | 141 | ||
| 76 | /** | 142 | /** |
| @@ -302,10 +302,10 @@ class UpdateRoute extends Command | @@ -302,10 +302,10 @@ class UpdateRoute extends Command | ||
| 302 | // 如果不是以 '-product' 结尾,则拼接上 '-product' | 302 | // 如果不是以 '-product' 结尾,则拼接上 '-product' |
| 303 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 303 | $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 304 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 304 | $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| 305 | - }else{ | ||
| 306 | - echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 307 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 308 | - $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 305 | +// }else{ |
| 306 | +// echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 307 | +// $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | ||
| 308 | +// $productModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 309 | } | 309 | } |
| 310 | // $route = RouteMap::setRoute($v['route'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); | 310 | // $route = RouteMap::setRoute($v['route'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); |
| 311 | // $productModel->edit(['route'=>$route],['id'=>$v['id']]); | 311 | // $productModel->edit(['route'=>$route],['id'=>$v['id']]); |
| @@ -66,45 +66,83 @@ class FileManageController extends BaseController | @@ -66,45 +66,83 @@ class FileManageController extends BaseController | ||
| 66 | { | 66 | { |
| 67 | // 检查参数 | 67 | // 检查参数 |
| 68 | if (!isset($this->param['path']) || empty($this->param['path'])) { | 68 | if (!isset($this->param['path']) || empty($this->param['path'])) { |
| 69 | - $this->response('参数错误', Code::SYSTEM_ERROR); | 69 | + $this->response('参数错误:path 参数缺失或为空', Code::SYSTEM_ERROR); |
| 70 | } | 70 | } |
| 71 | + // 获取文件名和完整 URL | ||
| 71 | $username = basename($this->param['path']); | 72 | $username = basename($this->param['path']); |
| 72 | $parsed_url = parse_url($this->param['path']); | 73 | $parsed_url = parse_url($this->param['path']); |
| 73 | - // 构造文件 URL | ||
| 74 | $fileUrl = isset($parsed_url['scheme']) | 74 | $fileUrl = isset($parsed_url['scheme']) |
| 75 | ? $this->param['path'] | 75 | ? $this->param['path'] |
| 76 | : 'https://file.globalso.com' . $this->param['path']; | 76 | : 'https://file.globalso.com' . $this->param['path']; |
| 77 | - // 初始化 curl | 77 | + // 使用 cURL 获取文件头信息 |
| 78 | $ch = curl_init(); | 78 | $ch = curl_init(); |
| 79 | curl_setopt($ch, CURLOPT_URL, $fileUrl); | 79 | curl_setopt($ch, CURLOPT_URL, $fileUrl); |
| 80 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
| 81 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | ||
| 82 | - curl_setopt($ch, CURLOPT_HEADER, false); | ||
| 83 | - // 跳过 SSL 验证 | ||
| 84 | - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | 80 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 不直接输出,而是返回结果 |
| 81 | + curl_setopt($ch, CURLOPT_HEADER, true); // 获取响应头 | ||
| 82 | + curl_setopt($ch, CURLOPT_NOBODY, true); // 只请求头部,不下载实际文件 | ||
| 83 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 跟随重定向 | ||
| 84 | + curl_setopt($ch, CURLOPT_TIMEOUT, 30); // 设置超时时间 | ||
| 85 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 禁用 SSL 验证 | ||
| 85 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | 86 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
| 86 | - // 执行 curl 请求 | ||
| 87 | - $fileContent = curl_exec($ch); | 87 | + $response = curl_exec($ch); |
| 88 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | 88 | $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); |
| 89 | - $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE); | ||
| 90 | - $curlError = curl_error($ch); | 89 | + $fileSize = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); |
| 91 | curl_close($ch); | 90 | curl_close($ch); |
| 92 | - // 检查 curl 错误或 HTTP 状态码 | ||
| 93 | - if ($fileContent === false || $httpCode != 200) { | ||
| 94 | - $errorMsg = $fileContent === false ? "Curl Error: $curlError" : "HTTP Error: $httpCode"; | ||
| 95 | - $this->response("文件下载失败 - $errorMsg", Code::SYSTEM_ERROR); | 91 | + // 检查文件大小和状态码 |
| 92 | + if ($httpCode != 200 || $fileSize <= 0) { | ||
| 93 | + $this->response('无法获取文件信息或文件不存在', Code::SYSTEM_ERROR); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + // 获取文件类型 | ||
| 97 | + $contentType = 'application/octet-stream'; // 默认类型为二进制流 | ||
| 98 | + if (preg_match('/Content-Type: (.+)/i', $response, $matches)) { | ||
| 99 | + $contentType = $matches[1]; | ||
| 96 | } | 100 | } |
| 97 | // 设置响应头 | 101 | // 设置响应头 |
| 98 | header('Content-Description: File Transfer'); | 102 | header('Content-Description: File Transfer'); |
| 99 | - header('Content-Type: ' . ($contentType ?: 'application/octet-stream')); | 103 | + header('Content-Type: ' . $contentType); |
| 100 | header('Content-Disposition: attachment; filename="' . $username . '"'); | 104 | header('Content-Disposition: attachment; filename="' . $username . '"'); |
| 101 | - header('Content-Length: ' . strlen($fileContent)); | ||
| 102 | - // 输出文件内容 | ||
| 103 | - echo $fileContent; | 105 | + header('Content-Length: ' . $fileSize); |
| 106 | + header('Cache-Control: must-revalidate'); | ||
| 107 | + header('Pragma: public'); | ||
| 108 | + header('Expires: 0'); | ||
| 109 | + // 清空输出缓冲区 | ||
| 110 | + while (ob_get_level() > 0) { | ||
| 111 | + ob_end_clean(); | ||
| 112 | + } | ||
| 113 | + // 初始化 cURL 下载文件 | ||
| 114 | + $ch = curl_init(); | ||
| 115 | + curl_setopt($ch, CURLOPT_URL, $fileUrl); | ||
| 116 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); // 直接输出内容 | ||
| 117 | + curl_setopt($ch, CURLOPT_HEADER, false); | ||
| 118 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // 跟随重定向 | ||
| 119 | + curl_setopt($ch, CURLOPT_BUFFERSIZE, 8192); // 设置缓冲区大小 | ||
| 120 | + curl_setopt($ch, CURLOPT_TIMEOUT, 300); // 设置超时时间 | ||
| 121 | + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); // 连接超时时间 | ||
| 122 | + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // 禁用 SSL 验证 | ||
| 123 | + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); | ||
| 124 | + // 分块输出文件内容 | ||
| 125 | + curl_setopt($ch, CURLOPT_WRITEFUNCTION, function ($ch, $data) { | ||
| 126 | + echo $data; | ||
| 127 | + flush(); // 强制输出缓冲 | ||
| 128 | + return strlen($data); | ||
| 129 | + }); | ||
| 130 | + // 执行 cURL | ||
| 131 | + curl_exec($ch); | ||
| 132 | + // 检查 cURL 错误或 HTTP 状态码 | ||
| 133 | + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
| 134 | + if (curl_errno($ch) || $httpCode != 200) { | ||
| 135 | + $errorMsg = curl_errno($ch) | ||
| 136 | + ? 'cURL 错误: ' . curl_error($ch) | ||
| 137 | + : 'HTTP 错误: ' . $httpCode; | ||
| 138 | + curl_close($ch); | ||
| 139 | + $this->response('文件下载失败: ' . $errorMsg, Code::SYSTEM_ERROR); | ||
| 140 | + } | ||
| 141 | + // 关闭 cURL | ||
| 142 | + curl_close($ch); | ||
| 104 | exit; | 143 | exit; |
| 105 | } | 144 | } |
| 106 | 145 | ||
| 107 | - | ||
| 108 | public function upload(Request $request, FileManage $fileManage){ | 146 | public function upload(Request $request, FileManage $fileManage){ |
| 109 | $request->validate([ | 147 | $request->validate([ |
| 110 | 'file'=>['required'], | 148 | 'file'=>['required'], |
| @@ -187,9 +187,12 @@ class ATemplateLogic extends BaseLogic | @@ -187,9 +187,12 @@ class ATemplateLogic extends BaseLogic | ||
| 187 | 'template_id'=>$this->param['template_id'], | 187 | 'template_id'=>$this->param['template_id'], |
| 188 | ]; | 188 | ]; |
| 189 | $rs = $bSettingModel->add($param); | 189 | $rs = $bSettingModel->add($param); |
| 190 | + | ||
| 190 | }else{ | 191 | }else{ |
| 192 | + $this->model->where(['id'=>$info['template_id']])->decrement('number',1); | ||
| 191 | $rs = $bSettingModel->edit(['template_id'=>$this->param['template_id']],['id'=>$info['id']]); | 193 | $rs = $bSettingModel->edit(['template_id'=>$this->param['template_id']],['id'=>$info['id']]); |
| 192 | } | 194 | } |
| 195 | + $this->model->where(['id'=>$this->param['template_id']])->increment('number',1); | ||
| 193 | $this->saveTemplate($this->param['project_id'],$this->param['template_id']); | 196 | $this->saveTemplate($this->param['project_id'],$this->param['template_id']); |
| 194 | //保存一条装修数据 | 197 | //保存一条装修数据 |
| 195 | if($rs === false){ | 198 | if($rs === false){ |
| @@ -131,11 +131,14 @@ class BlogLogic extends BaseLogic | @@ -131,11 +131,14 @@ class BlogLogic extends BaseLogic | ||
| 131 | foreach ($this->param['id'] as $id){ | 131 | foreach ($this->param['id'] as $id){ |
| 132 | $info = $this->model->read(['id'=>$id],['id','status']); | 132 | $info = $this->model->read(['id'=>$id],['id','status']); |
| 133 | if($info['status'] != 2){ | 133 | if($info['status'] != 2){ |
| 134 | + $this->delRoute($id); | ||
| 134 | $this->model->edit(['status'=>2],['id'=>$id]); | 135 | $this->model->edit(['status'=>2],['id'=>$id]); |
| 135 | }else{ | 136 | }else{ |
| 137 | + //删除路由映射 | ||
| 138 | + $this->delRoute($id); | ||
| 139 | + RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | ||
| 136 | $this->model->del(['id' => $id]); | 140 | $this->model->del(['id' => $id]); |
| 137 | } | 141 | } |
| 138 | - $this->delRoute($id); | ||
| 139 | } | 142 | } |
| 140 | DB::commit(); | 143 | DB::commit(); |
| 141 | }catch (Exception $e){ | 144 | }catch (Exception $e){ |
| @@ -153,8 +156,6 @@ class BlogLogic extends BaseLogic | @@ -153,8 +156,6 @@ class BlogLogic extends BaseLogic | ||
| 153 | * @time :2023/9/7 10:50 | 156 | * @time :2023/9/7 10:50 |
| 154 | */ | 157 | */ |
| 155 | public function delRoute($id){ | 158 | public function delRoute($id){ |
| 156 | - //删除路由映射 | ||
| 157 | - RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); | ||
| 158 | //生成一条删除路由记录 | 159 | //生成一条删除路由记录 |
| 159 | $info = $this->model->read(['id'=>$id],['id','url']); | 160 | $info = $this->model->read(['id'=>$id],['id','url']); |
| 160 | $this->curlDelRoute(['old_route'=>$info['url']]); | 161 | $this->curlDelRoute(['old_route'=>$info['url']]); |
| @@ -76,7 +76,7 @@ class CountLogic extends BaseLogic | @@ -76,7 +76,7 @@ class CountLogic extends BaseLogic | ||
| 76 | $data = [ | 76 | $data = [ |
| 77 | 'total_pv'=>$pv, | 77 | 'total_pv'=>$pv, |
| 78 | 'total_ip'=>$ip, | 78 | 'total_ip'=>$ip, |
| 79 | - 'conversion_rate' => (isset($inquiry_num) && !empty($inquiry_num) && ($ip != 0)) ? round(($inquiry_num / $ip) * 10,2) : 0, | 79 | + 'conversion_rate' => (isset($inquiry_num) && !empty($inquiry_num) && ($ip != 0)) ? round(($inquiry_num / $ip) * 100,2) : 0, |
| 80 | ]; | 80 | ]; |
| 81 | return $this->success($data); | 81 | return $this->success($data); |
| 82 | } | 82 | } |
| @@ -161,11 +161,14 @@ class NewsLogic extends BaseLogic | @@ -161,11 +161,14 @@ class NewsLogic extends BaseLogic | ||
| 161 | foreach ($this->param['id'] as $id) { | 161 | foreach ($this->param['id'] as $id) { |
| 162 | $info = $this->model->read(['id'=>$id],['id','status']); | 162 | $info = $this->model->read(['id'=>$id],['id','status']); |
| 163 | if($info['status'] != 2){ | 163 | if($info['status'] != 2){ |
| 164 | + $this->delRoute($id); | ||
| 164 | $this->model->edit(['status'=>2],['id'=>$id]); | 165 | $this->model->edit(['status'=>2],['id'=>$id]); |
| 165 | }else{ | 166 | }else{ |
| 167 | + //删除路由映射 | ||
| 168 | + RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | ||
| 169 | + $this->delRoute($id); | ||
| 166 | $this->model->del(['id' => $id]); | 170 | $this->model->del(['id' => $id]); |
| 167 | } | 171 | } |
| 168 | - $this->delRoute($id); | ||
| 169 | } | 172 | } |
| 170 | DB::commit(); | 173 | DB::commit(); |
| 171 | } catch (Exception $e) { | 174 | } catch (Exception $e) { |
| @@ -339,8 +342,6 @@ class NewsLogic extends BaseLogic | @@ -339,8 +342,6 @@ class NewsLogic extends BaseLogic | ||
| 339 | */ | 342 | */ |
| 340 | public function delRoute($id) | 343 | public function delRoute($id) |
| 341 | { | 344 | { |
| 342 | - //删除路由映射 | ||
| 343 | - RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); | ||
| 344 | //生成一条删除路由记录 | 345 | //生成一条删除路由记录 |
| 345 | $info = $this->model->read(['id' => $id], ['id', 'url']); | 346 | $info = $this->model->read(['id' => $id], ['id', 'url']); |
| 346 | $this->curlDelRoute(['old_route'=>$info['url']]); | 347 | $this->curlDelRoute(['old_route'=>$info['url']]); |
| @@ -122,6 +122,8 @@ class ProductLogic extends BaseLogic | @@ -122,6 +122,8 @@ class ProductLogic extends BaseLogic | ||
| 122 | } | 122 | } |
| 123 | if(isset($val['column_id']) && $val['column_id'] == 1){ | 123 | if(isset($val['column_id']) && $val['column_id'] == 1){ |
| 124 | $column_id = 1; | 124 | $column_id = 1; |
| 125 | + $columnModel = new Column(); | ||
| 126 | + $column_id = $columnModel->edit(['column_name'=>$val['column_name']],['id'=>$column_id]); | ||
| 125 | }else{ | 127 | }else{ |
| 126 | $columnId = $this->getColumnId($product_id,$val['column_name']); | 128 | $columnId = $this->getColumnId($product_id,$val['column_name']); |
| 127 | $column_id = $columnId['column_id']; | 129 | $column_id = $columnId['column_id']; |
| @@ -430,6 +432,9 @@ class ProductLogic extends BaseLogic | @@ -430,6 +432,9 @@ class ProductLogic extends BaseLogic | ||
| 430 | foreach ($this->param['ids'] as $id) { | 432 | foreach ($this->param['ids'] as $id) { |
| 431 | $info = $this->model->read(['id'=>$id],['id','status']); | 433 | $info = $this->model->read(['id'=>$id],['id','status']); |
| 432 | if($info['status'] == Product::STATUS_RECYCLE){ | 434 | if($info['status'] == Product::STATUS_RECYCLE){ |
| 435 | + //删除路由映射 | ||
| 436 | + RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 437 | + $this->delRoute($id); | ||
| 433 | //删除当前产品模版 | 438 | //删除当前产品模版 |
| 434 | // $this->delProductModule($id); | 439 | // $this->delProductModule($id); |
| 435 | $this->model->del(['id'=>$id]); | 440 | $this->model->del(['id'=>$id]); |
| @@ -437,10 +442,10 @@ class ProductLogic extends BaseLogic | @@ -437,10 +442,10 @@ class ProductLogic extends BaseLogic | ||
| 437 | $cateRelate->del(['product_id'=>$id]); | 442 | $cateRelate->del(['product_id'=>$id]); |
| 438 | $extendInfoModel->del(['product_id'=>$id]); | 443 | $extendInfoModel->del(['product_id'=>$id]); |
| 439 | }else{ | 444 | }else{ |
| 445 | + $this->delRoute($id); | ||
| 440 | //回收站 | 446 | //回收站 |
| 441 | $this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]); | 447 | $this->model->edit(['status'=>Product::STATUS_RECYCLE],['id'=>$id]); |
| 442 | } | 448 | } |
| 443 | - $this->delRoute($id); | ||
| 444 | } | 449 | } |
| 445 | DB::connection('custom_mysql')->commit(); | 450 | DB::connection('custom_mysql')->commit(); |
| 446 | }catch (\Exception $e){ | 451 | }catch (\Exception $e){ |
| @@ -458,8 +463,6 @@ class ProductLogic extends BaseLogic | @@ -458,8 +463,6 @@ class ProductLogic extends BaseLogic | ||
| 458 | * @time :2023/9/7 10:50 | 463 | * @time :2023/9/7 10:50 |
| 459 | */ | 464 | */ |
| 460 | public function delRoute($id){ | 465 | public function delRoute($id){ |
| 461 | - //删除路由映射 | ||
| 462 | - RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); | ||
| 463 | //生成一条删除路由记录 | 466 | //生成一条删除路由记录 |
| 464 | $info = $this->model->read(['id'=>$id],['id','route']); | 467 | $info = $this->model->read(['id'=>$id],['id','route']); |
| 465 | $this->curlDelRoute(['old_route'=>$info['route']]); | 468 | $this->curlDelRoute(['old_route'=>$info['route']]); |
| @@ -689,7 +692,7 @@ class ProductLogic extends BaseLogic | @@ -689,7 +692,7 @@ class ProductLogic extends BaseLogic | ||
| 689 | 'attrs'=>Arr::a2s($info['attrs']), | 692 | 'attrs'=>Arr::a2s($info['attrs']), |
| 690 | 'attr_id'=>Arr::arrToSet($info['attr_id']), | 693 | 'attr_id'=>Arr::arrToSet($info['attr_id']), |
| 691 | 'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '', | 694 | 'category_id'=>!empty($info['category_id']) ? ','.Arr::arrToSet($info['category_id']).',' : '', |
| 692 | - 'keyword_id'=>!empty($info['keyword_id']) ? ','.Arr::arrToSet($info['keyword_id']).',' : '', | 695 | + 'keyword_id'=>'', |
| 693 | 'intro'=>$info['intro'], | 696 | 'intro'=>$info['intro'], |
| 694 | 'content'=>$info['content'], | 697 | 'content'=>$info['content'], |
| 695 | 'describe'=>Arr::a2s($info['describe']), | 698 | 'describe'=>Arr::a2s($info['describe']), |
| @@ -213,6 +213,7 @@ class RankDataLogic extends BaseLogic | @@ -213,6 +213,7 @@ class RankDataLogic extends BaseLogic | ||
| 213 | $ext_projects = $this->getExtendProjects(); | 213 | $ext_projects = $this->getExtendProjects(); |
| 214 | $flg_ext = $this->getExtFlag($ext_projects, $domain, $api_no); | 214 | $flg_ext = $this->getExtFlag($ext_projects, $domain, $api_no); |
| 215 | $ext_domain = str_replace('www.', '', $this->getExtendProjects($api_no)['ext'] ?? ''); | 215 | $ext_domain = str_replace('www.', '', $this->getExtendProjects($api_no)['ext'] ?? ''); |
| 216 | + $main_domain = str_replace('www.', '', $this->getExtendProjects($api_no)['url'] ?? ''); | ||
| 216 | //AI站点域名 | 217 | //AI站点域名 |
| 217 | $ai_projects = $this->getAiProjects()['data'] ?? []; | 218 | $ai_projects = $this->getAiProjects()['data'] ?? []; |
| 218 | $flg_ai = $this->getAiFlag($ai_projects, $domain); | 219 | $flg_ai = $this->getAiFlag($ai_projects, $domain); |
| @@ -243,6 +244,12 @@ class RankDataLogic extends BaseLogic | @@ -243,6 +244,12 @@ class RankDataLogic extends BaseLogic | ||
| 243 | } | 244 | } |
| 244 | } | 245 | } |
| 245 | } | 246 | } |
| 247 | + //当前站是复制站,显示主站的域名 | ||
| 248 | + if($flg_ext == 2 && empty($last['r'])){ | ||
| 249 | + $domain = $main_domain; | ||
| 250 | + $domain_text = '主域名:' . $main_domain; | ||
| 251 | + } | ||
| 252 | + | ||
| 246 | $domain_arr = explode(':', $domain_text); | 253 | $domain_arr = explode(':', $domain_text); |
| 247 | $v = [ | 254 | $v = [ |
| 248 | 'keyword' => $key, | 255 | 'keyword' => $key, |
| @@ -77,8 +77,9 @@ class TranslateLogic extends BaseLogic | @@ -77,8 +77,9 @@ class TranslateLogic extends BaseLogic | ||
| 77 | if($val == ' ' || $val == ''){ | 77 | if($val == ' ' || $val == ''){ |
| 78 | continue; | 78 | continue; |
| 79 | } | 79 | } |
| 80 | - $val = trim(trim($val,' ')); | ||
| 81 | - if (FALSE == in_array(trim(urldecode($val),' '), $old_key)){ | 80 | + $val = str_replace(' ','',urldecode($val));//处理特殊字符 |
| 81 | + $val = trim(str_replace(' ','',$val)); | ||
| 82 | + if (FALSE == in_array($val, $old_key)){ | ||
| 82 | $arr2[] = $val; | 83 | $arr2[] = $val; |
| 83 | } | 84 | } |
| 84 | } | 85 | } |
| @@ -36,7 +36,7 @@ class NavRequest extends FormRequest | @@ -36,7 +36,7 @@ class NavRequest extends FormRequest | ||
| 36 | 'pid' => ['required','integer'], | 36 | 'pid' => ['required','integer'], |
| 37 | 'name' => ['required','max:100'], | 37 | 'name' => ['required','max:100'], |
| 38 | 'url' => ['required'], | 38 | 'url' => ['required'], |
| 39 | - 'remark'=> ['max:500'] | 39 | + 'remark'=> ['max:1500'] |
| 40 | ]; | 40 | ]; |
| 41 | return $rule; | 41 | return $rule; |
| 42 | } | 42 | } |
| @@ -52,7 +52,7 @@ class NavRequest extends FormRequest | @@ -52,7 +52,7 @@ class NavRequest extends FormRequest | ||
| 52 | 'name.required' => '名称必须', | 52 | 'name.required' => '名称必须', |
| 53 | 'name.max' => '名称不能超过100个字符', | 53 | 'name.max' => '名称不能超过100个字符', |
| 54 | 'url.required' => '链接不能为空', | 54 | 'url.required' => '链接不能为空', |
| 55 | - 'remark.max' => '描述超过最长500字符', | 55 | + 'remark.max' => '描述超过最长1500字符', |
| 56 | ]; | 56 | ]; |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| @@ -25,7 +25,7 @@ class NewsRequest extends FormRequest | @@ -25,7 +25,7 @@ class NewsRequest extends FormRequest | ||
| 25 | { | 25 | { |
| 26 | return [ | 26 | return [ |
| 27 | 'name'=>'required|max:200', | 27 | 'name'=>'required|max:200', |
| 28 | - 'remark'=>'max:1000', | 28 | + 'remark'=>'max:2000', |
| 29 | 'url'=>'required', | 29 | 'url'=>'required', |
| 30 | ]; | 30 | ]; |
| 31 | } | 31 | } |
| @@ -36,7 +36,7 @@ class NewsRequest extends FormRequest | @@ -36,7 +36,7 @@ class NewsRequest extends FormRequest | ||
| 36 | 'name.required'=>'请填写名称', | 36 | 'name.required'=>'请填写名称', |
| 37 | 'name.max'=>'名称超过最长长度200', | 37 | 'name.max'=>'名称超过最长长度200', |
| 38 | 'url.required'=>'链接不能为空', | 38 | 'url.required'=>'链接不能为空', |
| 39 | - 'remark.max'=>'描述超过最长长度1000' | 39 | + 'remark.max'=>'描述超过最长长度2000' |
| 40 | ]; | 40 | ]; |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| @@ -63,8 +63,7 @@ class CopyProjectJob implements ShouldQueue | @@ -63,8 +63,7 @@ class CopyProjectJob implements ShouldQueue | ||
| 63 | $data['finish_remain_day'] = 0; | 63 | $data['finish_remain_day'] = 0; |
| 64 | $data['title'] = $data['title'].'-copy'; | 64 | $data['title'] = $data['title'].'-copy'; |
| 65 | $data['delete_status'] = 1; | 65 | $data['delete_status'] = 1; |
| 66 | - $data['uptime'] = null; | ||
| 67 | - unset($data['id']); | 66 | + unset($data['id'],$data['robots'],$data['is_translate_tag'],$data['is_translate'],$data['is_minor_languages'],$data['uptime']); |
| 68 | $project_id = $projectModel->insertGetId($data); | 67 | $project_id = $projectModel->insertGetId($data); |
| 69 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); | 68 | $hashids = new Hashids($data['from_order_id'], 13, 'abcdefghjkmnpqrstuvwxyz1234567890'); |
| 70 | $projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]); | 69 | $projectModel->edit(['from_order_id'=>$hashids->encode($project_id)],['id'=>$project_id]); |
| @@ -95,7 +94,7 @@ class CopyProjectJob implements ShouldQueue | @@ -95,7 +94,7 @@ class CopyProjectJob implements ShouldQueue | ||
| 95 | $optimizeData = $optimizeModel::where('project_id', $this->param['project_id'])->first(); | 94 | $optimizeData = $optimizeModel::where('project_id', $this->param['project_id'])->first(); |
| 96 | if(!empty($optimizeData)){ | 95 | if(!empty($optimizeData)){ |
| 97 | $optimizeData = $optimizeData->getAttributes(); | 96 | $optimizeData = $optimizeData->getAttributes(); |
| 98 | - unset($optimizeData['id'],$optimizeData['domain']); | 97 | + unset($optimizeData['id'],$optimizeData['domain'],$optimizeData['backlink'],$optimizeData['ai_video']); |
| 99 | $optimizeData['project_id'] = $project_id; | 98 | $optimizeData['project_id'] = $project_id; |
| 100 | $optimizeData['api_no'] = 0; | 99 | $optimizeData['api_no'] = 0; |
| 101 | $optimizeModel->insert($optimizeData); | 100 | $optimizeModel->insert($optimizeData); |
| @@ -60,8 +60,8 @@ class InquiryFormData extends Base | @@ -60,8 +60,8 @@ class InquiryFormData extends Base | ||
| 60 | unset($data['__amp_source_origin']); | 60 | unset($data['__amp_source_origin']); |
| 61 | } | 61 | } |
| 62 | $sign = md5(json_encode($sign_data)); | 62 | $sign = md5(json_encode($sign_data)); |
| 63 | - //5分钟内是否有重复数据 | ||
| 64 | - $is_exist = self::where('sign', $sign)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-5 minute')))->first(); | 63 | + //30分钟内是否有重复数据 |
| 64 | + $is_exist = self::where('sign', $sign)->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-30 minute')))->first(); | ||
| 65 | if($is_exist){ | 65 | if($is_exist){ |
| 66 | return 0; | 66 | return 0; |
| 67 | } | 67 | } |
| @@ -17,6 +17,7 @@ use App\Models\SyncSubmitTask\SyncSubmitTask; | @@ -17,6 +17,7 @@ use App\Models\SyncSubmitTask\SyncSubmitTask; | ||
| 17 | use App\Models\Visit\Visit; | 17 | use App\Models\Visit\Visit; |
| 18 | use App\Models\Workchat\MessagePush; | 18 | use App\Models\Workchat\MessagePush; |
| 19 | use App\Utils\LogUtils; | 19 | use App\Utils\LogUtils; |
| 20 | +use Illuminate\Support\Facades\Cache; | ||
| 20 | use Illuminate\Support\Facades\Http; | 21 | use Illuminate\Support\Facades\Http; |
| 21 | use Illuminate\Support\Facades\Log; | 22 | use Illuminate\Support\Facades\Log; |
| 22 | use Illuminate\Support\Facades\URL; | 23 | use Illuminate\Support\Facades\URL; |
| @@ -188,6 +189,22 @@ class SyncSubmitTaskService | @@ -188,6 +189,22 @@ class SyncSubmitTaskService | ||
| 188 | */ | 189 | */ |
| 189 | public function inquiry($data, $date, $task_id, $traffic = 0) | 190 | public function inquiry($data, $date, $task_id, $traffic = 0) |
| 190 | { | 191 | { |
| 192 | + //ip 一分钟请求3次 就半小时内不写入这个ip了 | ||
| 193 | + $ip_cache_key = "inquiry_{$data['project_id']}_{$data['ip']}"; | ||
| 194 | + $ip_lock_cache_key = "inquiry_{$data['project_id']}_{$data['ip']}_lock"; | ||
| 195 | + if (!Cache::get($ip_cache_key)) { | ||
| 196 | + Cache::put($ip_cache_key, 0, 60); | ||
| 197 | + } | ||
| 198 | + $num = Cache::increment($ip_cache_key); | ||
| 199 | + if($num > 2){ | ||
| 200 | + //这个ip 锁半个小时 | ||
| 201 | + Cache::put($ip_lock_cache_key, 1, 1800); | ||
| 202 | + } | ||
| 203 | + if(Cache::get($ip_lock_cache_key)){ | ||
| 204 | + Log::channel('inquiry')->info($task_id . '询盘ip重复锁定', [$data]); | ||
| 205 | + return true; | ||
| 206 | + } | ||
| 207 | + | ||
| 191 | //数组key转为小写 | 208 | //数组key转为小写 |
| 192 | $data['data'] = array_change_key_case($data['data'], CASE_LOWER); | 209 | $data['data'] = array_change_key_case($data['data'], CASE_LOWER); |
| 193 | 210 |
-
请 注册 或 登录 后发表评论