作者 赵彬吉
... ... @@ -31,14 +31,72 @@ class Temp extends Command
*
* @var string
*/
protected $description = '临时脚本';
protected $description = '临时脚本(akun)';
public function handle()
{
$this->relation_all_keywords();
}
/**
* 转移灾备服务器后,判断项目是否正常访问
* @author Akun
* @date 2024/12/11 10:15
*/
public function check_zb_complete_project_site()
{
$server_id = 15;
$server_name = '美服1';
$server_ip_model = new ServersIp();
$server_ip_ids = $server_ip_model->where('servers_id', $server_id)->get()->pluck('id')->toArray();
$project_list = Project::select(['id', 'serve_id', 'title'])->whereIn('serve_id', $server_ip_ids)->get();
$domain_model = new DomainInfo();
$data = [];
foreach ($project_list as $value) {
$domain_info = $domain_model->read(['project_id' => $value->id, 'status' => 1], ['id', 'domain']);
if (!$domain_info) {
//过滤未绑定正式域名的项目
continue;
}
$domain = $domain_info['domain'];
$check = dns_get_record($domain, DNS_A);
$ip = $check[0]['ip'] ?? '';
$host = $check[0]['host'] ?? '';
$code = check_curl_status($domain);
$data[] = [
$value->id,
$value->title,
$domain,
$host,
$ip,
$code
];
}
$map = ['项目id', '名称', '域名', 'CNAME', 'IP', '站点状态'];
if ($data) {
$table = new BatchExportService($server_name . '站点解析情况及访问状态');
$file = $table->head($map)->data($data)->save();
if (!$file) {
$this->output('文件生成失败,请重试');
} else {
$this->output('export success');
}
} else {
$this->output('no data');
}
}
/**
* 检查服务器上没有解析cname的项目
* @author Akun
* @date 2024/12/11 10:15
*/
public function handle7()
public function check_no_cname_projects()
{
$server_id = 15;
$server_name = '美服1';
... ... @@ -90,7 +148,7 @@ class Temp extends Command
* @author Akun
* @date 2024/12/10 10:43
*/
public function handle6()
public function wx_tg_projects()
{
//获取所有组内推广项目
$leader_mid = 16;
... ... @@ -178,9 +236,9 @@ class Temp extends Command
* @author Akun
* @date 2024/11/18 15:07
*/
public function handle()
public function relation_all_keywords()
{
$projects = Project::where('id', 874)->select(['id'])->orderBy('id', 'asc')->get();
$projects = Project::select(['id'])->orderBy('id', 'asc')->get();
foreach ($projects as $project) {
ProjectServer::useProject($project->id);
... ... @@ -204,7 +262,7 @@ class Temp extends Command
* @author Akun
* @date 2024/10/30 15:37
*/
public function handle4()
public function keywords_first_word()
{
$projects = Project::select(['id'])->orderBy('id', 'asc')->get();
foreach ($projects as $project) {
... ... @@ -279,7 +337,7 @@ class Temp extends Command
* @author Akun
* @date 2024/09/30 17:01
*/
public function handle3()
public function get_all_projects_by_server()
{
$server_id = 1;
... ... @@ -325,7 +383,7 @@ class Temp extends Command
* @author Akun
* @date 2024/09/26 10:48
*/
public function handle2()
public function check_no_server_projects()
{
$server_id = 15;
... ... @@ -377,7 +435,7 @@ class Temp extends Command
* @author Akun
* @date 2024/09/26 10:48
*/
public function handle1()
public function create_all_amp_notify()
{
$notify_model = new Notify();
$project_model = new Project();
... ...
... ... @@ -40,7 +40,7 @@ class UpdateBuildConfiguration extends Command
* @method :post
* @time :2024/12/11 11:49
*/
public function handle(){
public function handles(){
//查询当前的所有项目都开启可视化
$buildModel = new DeployBuild();
$lists = $buildModel->list();
... ... @@ -59,9 +59,9 @@ class UpdateBuildConfiguration extends Command
* @method :post
* @time :2024/12/11 14:33
*/
public function handles(){
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0]);
$list = $projectModel->list(['delete_status'=>0,'id'=>['>',1671]],'id',['id'],'asc');
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
... ... @@ -79,21 +79,48 @@ class UpdateBuildConfiguration extends Command
* @time :2024/12/11 14:40
*/
public function getProduct(){
Detail::truncate();
$productModel = new Product();
$lists = $productModel->list();
$page = 1;
while (true){
$lists = $productModel->lists([],$page,50,['id','describe']);
$detailModel = new Detail();
foreach ($lists as $k => $v){
if(!empty($lists['list'])){
foreach ($lists['list'] as $k => $v){
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
if(empty($v['describe'])){
continue;
}
foreach ($v['describe'] as $key => $value){
if(isset($value['title']) && ($value['title'] == null)){
$value['title'] = '';
}
if(isset($value['text']) && ($value['text'] == null)){
$value['text'] = '';
}
if(empty($value['text'])){
continue;
}
$data = [
'product_id'=>$v['id'],
'column_id'=>1,
'text_type'=>1,
'title'=>'',
'title'=>$value['title'] ?? '',
'sort'=>1,
'content'=>$v['describe']
'content'=>json_encode(['content'=>$value['text'] ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
'created_at'=>date('Y-m-d H:i:s'),
'updated_at'=>date('Y-m-d H:i:s')
];
$detailModel->add($data);
$detailModel->insert($data);
}
}
}else{
break;
return false;
}
$page++;
}
return true;
}
}
... ...
... ... @@ -108,18 +108,4 @@ class UpdateKeyword extends Command
return true;
}
/**
* @remark :更新产品关键词
* @name :updatedProductKeyword
* @author :lyh
* @method :post
* @time :2024/11/27 14:26
*/
public function updatedProductKeyword(){
$productModel = new Product();
$lists = $productModel->list();
foreach ($lists as $k => $v){
}
}
}
... ...
... ... @@ -1001,6 +1001,40 @@ if (!function_exists('check_domain_record')) {
}
}
if (!function_exists('check_curl_status')) {
/**
* 获取域名访问状态码
* @param $url
* @return int
* @author Akun
* @date 2024/12/12 15:52
*/
function check_curl_status($url){
$header = array(
'Expect:',
'Content-Type: application/json; charset=utf-8'
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 120);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSLVERSION, 'all');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_exec($ch);
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
curl_close($ch);
return $http_code;
}
}
/**
* 邮箱脱敏
* @author zbj
... ...
... ... @@ -8,6 +8,7 @@ use App\Http\Logic\Bside\Product\KeywordLogic;
use App\Http\Requests\Bside\Product\KeywordRequest;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordPage;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -35,7 +36,7 @@ class KeywordController extends BaseController
$data = $keyword->lists($this->map,$this->page,$this->row,$this->order,$filed);
if(!empty($data)){
foreach ($data['list'] as &$v){
$v['product_num'] = Product::where('keyword_id','like' ,'%,'.$v['id'].',%')->count();
$v['product_num'] = KeywordRelated::where('keyword_id',$v['id'])->count();
if(!empty($v['seo_title']) || !empty($v['seo_keywords']) || !empty($v['seo_description'])){
$v['tdk'] = 1;
}else{
... ...
... ... @@ -208,8 +208,11 @@ class ProductLogic extends BaseLogic
public function editList(){
$category_ids = $this->param['category_id'];
$this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
$keyword_arr = $this->param['keyword_id'];
$this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
$keyword_arr = $this->saveKeyword($this->param['keyword_id']);
$this->param['keyword_id'] = '';
if(!empty($keyword_arr)){
$this->param['keyword_id'] = ','.implode(',',$keyword_arr).',';
}
if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
foreach ($this->param['gallery'] as $k => $v){
$v['url'] = str_replace_url($v['url']);
... ... @@ -242,7 +245,7 @@ class ProductLogic extends BaseLogic
* @time :2023/10/26 9:51
*/
public function saveKeyword($keyword){
$str = '';
$arr = [];
if(isset($keyword) && !empty($keyword)){
$arr = [];
$keywordModel = new Keyword();
... ... @@ -267,9 +270,8 @@ class ProductLogic extends BaseLogic
$arr[] = $info['id'];
}
}
$str = ','.implode(',',$arr).',';
}
return $str;
return $arr;
}
/**
... ...
... ... @@ -267,7 +267,6 @@ class UserLoginLogic
$info['uptime'] = $project['uptime'];
$info['is_update_language'] = $project['is_update_language'];
$info['is_watermark'] = $project['is_watermark'];
$project['deploy_build']['configuration']['is_product'] = $project['deploy_build']['configuration']['is_news'] = $project['deploy_build']['configuration']['is_blogs'] = $project['deploy_build']['configuration']['is_module'] = "1";
$info['configuration'] = $project['deploy_build']['configuration'];
$info['project_type'] = $project['type'];
$info['storage_type'] = $project['storage_type'];
... ...