作者 刘锟

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

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