Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
6 个修改的文件
包含
36 行增加
和
12 行删除
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | * @remark : | 3 | * @remark : |
| 4 | - * @name :AfterCount.php | 4 | + * @name :AfterDayCount.php |
| 5 | * @author :lyh | 5 | * @author :lyh |
| 6 | * @method :post | 6 | * @method :post |
| 7 | * @time :2025/3/26 15:28 | 7 | * @time :2025/3/26 15:28 |
| @@ -16,7 +16,7 @@ use Carbon\Carbon; | @@ -16,7 +16,7 @@ use Carbon\Carbon; | ||
| 16 | use App\Models\HomeCount\AfterCount as AfterCountModel; | 16 | use App\Models\HomeCount\AfterCount as AfterCountModel; |
| 17 | use Illuminate\Console\Command; | 17 | use Illuminate\Console\Command; |
| 18 | 18 | ||
| 19 | -class AfterCount extends Command | 19 | +class AfterDayCount extends Command |
| 20 | { | 20 | { |
| 21 | /** | 21 | /** |
| 22 | * The name and signature of the console command. | 22 | * The name and signature of the console command. |
| @@ -44,6 +44,7 @@ class AfterCount extends Command | @@ -44,6 +44,7 @@ class AfterCount extends Command | ||
| 44 | echo date('Y-m-d H:i:s').'统计start->'.PHP_EOL; | 44 | echo date('Y-m-d H:i:s').'统计start->'.PHP_EOL; |
| 45 | $saveData = $this->_action(); | 45 | $saveData = $this->_action(); |
| 46 | $afterModel = new AfterCountModel(); | 46 | $afterModel = new AfterCountModel(); |
| 47 | + //保存数据 | ||
| 47 | $afterModel->insertAll($saveData); | 48 | $afterModel->insertAll($saveData); |
| 48 | echo date('Y-m-d H:i:s').'->统计end'.PHP_EOL; | 49 | echo date('Y-m-d H:i:s').'->统计end'.PHP_EOL; |
| 49 | return true; | 50 | return true; |
| @@ -62,7 +63,7 @@ class AfterCount extends Command | @@ -62,7 +63,7 @@ class AfterCount extends Command | ||
| 62 | $rankDataLogModel = new RankDataLog(); | 63 | $rankDataLogModel = new RankDataLog(); |
| 63 | $todayMidnight = date('Y-m-d 00:00:00', strtotime('today')); | 64 | $todayMidnight = date('Y-m-d 00:00:00', strtotime('today')); |
| 64 | $saveData = []; | 65 | $saveData = []; |
| 65 | - $projectIdArr = $rankDataLogModel->selectField(['is_compliance'=>1,'lang'=>null,'date'=>date('Y-m-d', strtotime('-3 months'))],'project_id');//3个月前达标的项目id | 66 | + $projectIdArr = $rankDataLogModel->selectField(['is_compliance'=>1,'lang'=>'','date'=>date('Y-m-d', strtotime('-3 months'))],'project_id');//3个月前达标的项目id |
| 66 | foreach ($this->after_manager as $key => $valM){ | 67 | foreach ($this->after_manager as $key => $valM){ |
| 67 | $idArr = $this->managerHrModel->selectField(['name'=>['in',$valM]],'id'); | 68 | $idArr = $this->managerHrModel->selectField(['name'=>['in',$valM]],'id'); |
| 68 | $project_count = $projectModel->where('gl_project.extend_type',0) | 69 | $project_count = $projectModel->where('gl_project.extend_type',0) |
| @@ -108,9 +109,9 @@ class AfterCount extends Command | @@ -108,9 +109,9 @@ class AfterCount extends Command | ||
| 108 | 'project_count'=>$project_count, | 109 | 'project_count'=>$project_count, |
| 109 | 'qualified_count'=>$qualified_count, | 110 | 'qualified_count'=>$qualified_count, |
| 110 | 'rate'=>$rate, | 111 | 'rate'=>$rate, |
| 111 | - 'three_project_count'=>$project_count - $three_project_count, | ||
| 112 | - 'three_qualified_count'=>$qualified_count - $three_qualified_count, | ||
| 113 | - 'three_rate'=>$rate - $three_rate, | 112 | + 'three_project_count'=>$three_project_count, |
| 113 | + 'three_qualified_count'=>$three_qualified_count, | ||
| 114 | + 'three_rate'=>$three_rate, | ||
| 114 | 'data' => json_encode($data,true) | 115 | 'data' => json_encode($data,true) |
| 115 | ]; | 116 | ]; |
| 116 | } | 117 | } |
| @@ -66,7 +66,27 @@ class UpdateRoute extends Command | @@ -66,7 +66,27 @@ class UpdateRoute extends Command | ||
| 66 | */ | 66 | */ |
| 67 | public function handle() | 67 | public function handle() |
| 68 | { | 68 | { |
| 69 | - $this->insertData(); | 69 | + return $this->_action(); |
| 70 | + } | ||
| 71 | + | ||
| 72 | + /** | ||
| 73 | + * @remark :清洗数据 | ||
| 74 | + * @name :_action | ||
| 75 | + * @author :lyh | ||
| 76 | + * @method :post | ||
| 77 | + * @time :2025/4/10 17:08 | ||
| 78 | + */ | ||
| 79 | + public function _action(){ | ||
| 80 | + $projectModel = new Project(); | ||
| 81 | + $lists = $projectModel->list(['delete_status'=>0,'extend_type'=>0,'type'=>['!=',0]],'id',['id']); | ||
| 82 | + $keywordModel = new Keyword(); | ||
| 83 | + foreach ($lists as $v){ | ||
| 84 | + ProjectServer::useProject($v['id']); | ||
| 85 | + echo date('Y-m-d H:i:s').' 执行的项目id:'.$v['id'].PHP_EOL; | ||
| 86 | + $keywordModel->edit(['type'=>1],['id'=>['!=',0]]); | ||
| 87 | + DB::disconnect('custom_mysql'); | ||
| 88 | + } | ||
| 89 | + return true; | ||
| 70 | } | 90 | } |
| 71 | /** | 91 | /** |
| 72 | * @remark : | 92 | * @remark : |
| @@ -73,10 +73,9 @@ class OptimizeSetKeywordSync extends Command | @@ -73,10 +73,9 @@ class OptimizeSetKeywordSync extends Command | ||
| 73 | { | 73 | { |
| 74 | $keywords = explode("\n", $keywords); | 74 | $keywords = explode("\n", $keywords); |
| 75 | $keywords = array_unique(array_filter($keywords)); | 75 | $keywords = array_unique(array_filter($keywords)); |
| 76 | - | ||
| 77 | ProjectServer::useProject($project_id); | 76 | ProjectServer::useProject($project_id); |
| 78 | $keywordModel = new Keyword(); | 77 | $keywordModel = new Keyword(); |
| 79 | - $keywordModel->saveBKeyword($project_id,$keywords); | 78 | + $keywordModel->saveBKeyword($project_id,$keywords,Keyword::TYPE_ORDER_KEYWORD); |
| 80 | DB::disconnect('custom_mysql'); | 79 | DB::disconnect('custom_mysql'); |
| 81 | return true; | 80 | return true; |
| 82 | } | 81 | } |
| @@ -576,6 +576,7 @@ class ProjectLogic extends BaseLogic | @@ -576,6 +576,7 @@ class ProjectLogic extends BaseLogic | ||
| 576 | 'main_keyword'=>$project_keyword['main_keyword'] ?? '', | 576 | 'main_keyword'=>$project_keyword['main_keyword'] ?? '', |
| 577 | 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '', | 577 | 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '', |
| 578 | 'search_keywords'=>$project_keyword['search_keywords'] ?? '', | 578 | 'search_keywords'=>$project_keyword['search_keywords'] ?? '', |
| 579 | + 'seo_keywords'=>$project_keyword['seo_keywords'] ?? '', | ||
| 579 | ]; | 580 | ]; |
| 580 | if(isset($project_keyword['operator_log']) && !empty($project_keyword['operator_log'])){ | 581 | if(isset($project_keyword['operator_log']) && !empty($project_keyword['operator_log'])){ |
| 581 | $data['operator_log'] = json_encode($project_keyword['operator_log'] ?? []); | 582 | $data['operator_log'] = json_encode($project_keyword['operator_log'] ?? []); |
| @@ -21,6 +21,8 @@ class Keyword extends Base | @@ -21,6 +21,8 @@ class Keyword extends Base | ||
| 21 | //连接数据库 | 21 | //连接数据库 |
| 22 | protected $connection = 'custom_mysql'; | 22 | protected $connection = 'custom_mysql'; |
| 23 | 23 | ||
| 24 | + const TYPE_ORDER_KEYWORD = 1;//关键词标识,预约关键词标识 | ||
| 25 | + | ||
| 24 | const STATUS_ACTIVE = 1; | 26 | const STATUS_ACTIVE = 1; |
| 25 | //获取字母对应数字 | 27 | //获取字母对应数字 |
| 26 | public $firstNumWord = [ | 28 | public $firstNumWord = [ |
| @@ -110,7 +112,7 @@ class Keyword extends Base | @@ -110,7 +112,7 @@ class Keyword extends Base | ||
| 110 | public static function extendKeyword($project_id) | 112 | public static function extendKeyword($project_id) |
| 111 | { | 113 | { |
| 112 | $result = []; | 114 | $result = []; |
| 113 | - $keywords = self::where(['project_id' => $project_id])->pluck('seo_title', 'title')->toArray(); | 115 | + $keywords = self::where(['project_id' => $project_id])->where('type',self::TYPE_ORDER_KEYWORD)->pluck('seo_title', 'title')->toArray(); |
| 114 | if (empty($keywords)) | 116 | if (empty($keywords)) |
| 115 | return $result; | 117 | return $result; |
| 116 | // $item:前缀 + 关键词 + 后缀 | 118 | // $item:前缀 + 关键词 + 后缀 |
| @@ -149,7 +151,7 @@ class Keyword extends Base | @@ -149,7 +151,7 @@ class Keyword extends Base | ||
| 149 | * @method :post | 151 | * @method :post |
| 150 | * @time :2025/3/25 16:28 | 152 | * @time :2025/3/25 16:28 |
| 151 | */ | 153 | */ |
| 152 | - public function saveBKeyword($project_id,$keywords){ | 154 | + public function saveBKeyword($project_id,$keywords,$type = 0){ |
| 153 | foreach ($keywords as $v){ | 155 | foreach ($keywords as $v){ |
| 154 | if(empty($v)){ | 156 | if(empty($v)){ |
| 155 | continue; | 157 | continue; |
| @@ -159,6 +161,7 @@ class Keyword extends Base | @@ -159,6 +161,7 @@ class Keyword extends Base | ||
| 159 | $param['project_id'] = $project_id; | 161 | $param['project_id'] = $project_id; |
| 160 | $param['title'] = $v; | 162 | $param['title'] = $v; |
| 161 | $param['first_word'] = $this->first_word($param['title']); | 163 | $param['first_word'] = $this->first_word($param['title']); |
| 164 | + $param['type'] = $type; | ||
| 162 | $this->addReturnId($param); | 165 | $this->addReturnId($param); |
| 163 | } | 166 | } |
| 164 | } | 167 | } |
-
请 注册 或 登录 后发表评论