Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6
正在显示
8 个修改的文件
包含
116 行增加
和
55 行删除
| @@ -79,22 +79,22 @@ class RemainDay extends Command | @@ -79,22 +79,22 @@ class RemainDay extends Command | ||
| 79 | $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24)); | 79 | $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24)); |
| 80 | }else{ | 80 | }else{ |
| 81 | if($item['type'] == Project::TYPE_TWO){ | 81 | if($item['type'] == Project::TYPE_TWO){ |
| 82 | - $compliance_day = $item->finish_remain_day ?? 0; | ||
| 83 | - if($compliance_day == 0){ | ||
| 84 | - $item->pause_days = 0; | 82 | + $compliance_day = ($item->finish_remain_day ?? 0); |
| 83 | + if($item->finish_remain_day < $item->pause_days){ | ||
| 84 | + $item->pause_days = $item->finish_remain_day; | ||
| 85 | } | 85 | } |
| 86 | $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day; | 86 | $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - $compliance_day; |
| 87 | }else{ | 87 | }else{ |
| 88 | if($item->uptime){ | 88 | if($item->uptime){ |
| 89 | $diff = time() - strtotime($item->uptime); | 89 | $diff = time() - strtotime($item->uptime); |
| 90 | $item->finish_remain_day = floor($diff / (60 * 60 * 24)); | 90 | $item->finish_remain_day = floor($diff / (60 * 60 * 24)); |
| 91 | - $remain_day = $item['deploy_build']['service_duration'] + $item->pause_days - floor($diff / (60 * 60 * 24)); | 91 | + $remain_day = $item['deploy_build']['service_duration'] - floor($diff / (60 * 60 * 24)); |
| 92 | }else{ | 92 | }else{ |
| 93 | $remain_day = $item['deploy_build']['service_duration']; | 93 | $remain_day = $item['deploy_build']['service_duration']; |
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | - $item->remain_day = $remain_day > 0 ? $remain_day : 0; | 97 | + $item->remain_day = ($remain_day > 0 ? $remain_day : 0); |
| 98 | if($item->remain_day == 0){ | 98 | if($item->remain_day == 0){ |
| 99 | $item->extend_type = Project::TYPE_FIVE; | 99 | $item->extend_type = Project::TYPE_FIVE; |
| 100 | $item->site_status = Project::TYPE_ONE;//关闭站点 | 100 | $item->site_status = Project::TYPE_ONE;//关闭站点 |
| @@ -3,20 +3,12 @@ | @@ -3,20 +3,12 @@ | ||
| 3 | namespace App\Console\Commands\Test; | 3 | namespace App\Console\Commands\Test; |
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | -use App\Models\Collect\CollectTask; | ||
| 7 | use App\Models\Com\Notify; | 6 | use App\Models\Com\Notify; |
| 8 | -use App\Models\Com\UpdateLog; | ||
| 9 | -use App\Models\Com\UpdateVisit; | ||
| 10 | use App\Models\Devops\ServerConfig; | 7 | use App\Models\Devops\ServerConfig; |
| 8 | +use App\Models\Devops\ServersIp; | ||
| 11 | use App\Models\Domain\DomainInfo; | 9 | use App\Models\Domain\DomainInfo; |
| 12 | -use App\Models\Product\Product; | ||
| 13 | use App\Models\Project\Project; | 10 | use App\Models\Project\Project; |
| 14 | -use App\Services\ProjectServer; | ||
| 15 | -use App\Utils\HttpUtils; | ||
| 16 | -use GuzzleHttp\Exception\GuzzleException; | ||
| 17 | use Illuminate\Console\Command; | 11 | use Illuminate\Console\Command; |
| 18 | -use Illuminate\Support\Facades\DB; | ||
| 19 | -use Symfony\Component\Process\Process; | ||
| 20 | 12 | ||
| 21 | class Temp extends Command | 13 | class Temp extends Command |
| 22 | { | 14 | { |
| @@ -34,55 +26,72 @@ class Temp extends Command | @@ -34,55 +26,72 @@ class Temp extends Command | ||
| 34 | */ | 26 | */ |
| 35 | protected $description = '临时脚本'; | 27 | protected $description = '临时脚本'; |
| 36 | 28 | ||
| 37 | - public function handle(){ | ||
| 38 | - ProjectServer::useProject(1515); | 29 | + public function handle() |
| 30 | + { | ||
| 31 | + $notify_model = new Notify(); | ||
| 39 | 32 | ||
| 40 | - $products = Product::select(['id','content'])->get(); | 33 | + $domain_list = DomainInfo::where('status', 1)->where('amp_status', 1)->get(); |
| 41 | 34 | ||
| 42 | - foreach ($products as $product){ | ||
| 43 | - $content = $product->content; | ||
| 44 | - $content = str_replace('<h1','<h2', $content); | ||
| 45 | - $content = str_replace('</h1','</h2', $content); | 35 | + foreach ($domain_list as $domain) { |
| 36 | + $project_id = $domain->project_id; | ||
| 37 | + $domain = $domain->domain; | ||
| 46 | 38 | ||
| 47 | - $product->content = $content; | ||
| 48 | - $product->save(); | 39 | + $this->output('项目id:' . $project_id . ',start'); |
| 49 | 40 | ||
| 50 | - $this->output('productID:'.$product->id.',success'); | 41 | + //获取项目所在服务器 |
| 42 | + $project_model = new Project(); | ||
| 43 | + $project_info = $project_model->read(['id' => $project_id], ['serve_id']); | ||
| 44 | + if (!$project_info) { | ||
| 45 | + $this->output('未查询到项目数据'); | ||
| 51 | } | 46 | } |
| 52 | - | ||
| 53 | - $this->output('end'); | 47 | + $serve_ip_model = new ServersIp(); |
| 48 | + $serve_ip_info = $serve_ip_model->read(['id' => $project_info['serve_id']], ['servers_id']); | ||
| 49 | + if (!$serve_ip_info) { | ||
| 50 | + $this->output('未查询到服务器数据'); | ||
| 54 | } | 51 | } |
| 52 | + $servers_id = $serve_ip_info['servers_id']; | ||
| 55 | 53 | ||
| 56 | - public function check_cname($domain, $server_info) | ||
| 57 | - { | ||
| 58 | - $checkA = false; | ||
| 59 | - $checkCname = false; | 54 | + if ($servers_id == ServerConfig::SELF_SITE_ID) { |
| 55 | + //自建站服务器:如果项目已经上线,不请求C端接口,数据直接入库 | ||
| 56 | + //判断是否已有更新进行中 | ||
| 57 | + $data = [ | ||
| 58 | + 'project_id' => $project_id, | ||
| 59 | + 'type' => 3, | ||
| 60 | + 'route' => 1, | ||
| 61 | + 'server_id' => ServerConfig::SELF_SITE_ID, | ||
| 62 | + 'status' => ['!=', Notify::STATUS_FINISH_SITEMAP] | ||
| 63 | + ]; | ||
| 64 | + $notify = $notify_model->read($data, ['id']); | ||
| 60 | 65 | ||
| 61 | - $process = new Process(['nslookup', '-qt=a', $domain]); | ||
| 62 | - $process->run(); | ||
| 63 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 64 | - foreach ($output as $line) { | ||
| 65 | - if ($line) { | ||
| 66 | - $checkA = strpos($line, $server_info['ip']) !== false; | ||
| 67 | - if ($checkA) { | ||
| 68 | - return $domain; | ||
| 69 | - } | ||
| 70 | - } | 66 | + if (!$notify) { |
| 67 | + $domain_array = parse_url($domain); | ||
| 68 | + $host = $domain_array['host'] ?? $domain_array['path']; | ||
| 69 | + $host_array = explode('.', $host); | ||
| 70 | + if (count($host_array) <= 2) { | ||
| 71 | + array_unshift($host_array, 'm'); | ||
| 72 | + } else { | ||
| 73 | + $host_array[0] = 'm'; | ||
| 71 | } | 74 | } |
| 75 | + $domain = implode('.', $host_array); | ||
| 72 | 76 | ||
| 73 | - //是否cname | ||
| 74 | - $process = new Process(['nslookup', '-qt=cname', $domain]); | ||
| 75 | - $process->run(); | ||
| 76 | - $output = explode(PHP_EOL, $process->getOutput()); | ||
| 77 | - foreach ($output as $line) { | ||
| 78 | - if ($line) { | ||
| 79 | - $checkCname = (strpos($line, $server_info['domain']) !== false); | ||
| 80 | - if ($checkCname) { | ||
| 81 | - return $domain; | 77 | + $data['data'] = Arr::a2s(['domain' => $domain, 'url' => [], 'language' => []]); |
| 78 | + $data['status'] = Notify::STATUS_INIT; | ||
| 79 | + $notify_model->add($data); | ||
| 82 | } | 80 | } |
| 81 | + } else { | ||
| 82 | + //其他服务器:请求对应C端接口 | ||
| 83 | + $c_url = $domain . '/api/update_page/'; | ||
| 84 | + $param = [ | ||
| 85 | + 'project_id' => $project_id, | ||
| 86 | + 'type' => 3, | ||
| 87 | + 'route' => 1, | ||
| 88 | + 'url' => [], | ||
| 89 | + 'language' => [] | ||
| 90 | + ]; | ||
| 91 | + http_post($c_url, json_encode($param)); | ||
| 83 | } | 92 | } |
| 93 | + $this->output('项目id:' . $project_id . ',end'); | ||
| 84 | } | 94 | } |
| 85 | - return false; | ||
| 86 | } | 95 | } |
| 87 | 96 | ||
| 88 | public function output($msg) | 97 | public function output($msg) |
| @@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel | @@ -20,7 +20,7 @@ class Kernel extends ConsoleKernel | ||
| 20 | $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 | 20 | $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 |
| 21 | $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 | 21 | $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 |
| 22 | // $schedule->command('inspire')->hourly(); | 22 | // $schedule->command('inspire')->hourly(); |
| 23 | - $schedule->command('remain_day')->dailyAt('08:30')->withoutOverlapping(1); // 项目剩余服务时长 | 23 | + $schedule->command('remain_day')->dailyAt('09:30')->withoutOverlapping(1); // 项目剩余服务时长 |
| 24 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 | 24 | $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 |
| 25 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 | 25 | $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 |
| 26 | $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 | 26 | $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 |
| @@ -196,7 +196,7 @@ class PrivateController extends BaseController | @@ -196,7 +196,7 @@ class PrivateController extends BaseController | ||
| 196 | return $this->error('未找到当前域名对应的项目!'); | 196 | return $this->error('未找到当前域名对应的项目!'); |
| 197 | } | 197 | } |
| 198 | ProjectServer::useProject($project->id); | 198 | ProjectServer::useProject($project->id); |
| 199 | - $feature_category = Category::whereIn('title', ['Featured','featured'])->pluck('id'); | 199 | + $feature_category = Category::whereIn('title', ['Featured','featured', 'Featured Products'])->pluck('id'); |
| 200 | $feature_product = CategoryRelated::whereIn('cate_id',$feature_category)->pluck('product_id')->unique()->toArray(); | 200 | $feature_product = CategoryRelated::whereIn('cate_id',$feature_category)->pluck('product_id')->unique()->toArray(); |
| 201 | $product_route = Product::where(['status' => Product::STATUS_ON])->whereNotIn('id', $feature_product)->pluck('route')->toArray(); | 201 | $product_route = Product::where(['status' => Product::STATUS_ON])->whereNotIn('id', $feature_product)->pluck('route')->toArray(); |
| 202 | return $this->success($product_route); | 202 | return $this->success($product_route); |
| @@ -67,6 +67,16 @@ class ExtensionModuleController extends BaseController | @@ -67,6 +67,16 @@ class ExtensionModuleController extends BaseController | ||
| 67 | ]); | 67 | ]); |
| 68 | $moduleFieldModel = new ExtensionModuleField(); | 68 | $moduleFieldModel = new ExtensionModuleField(); |
| 69 | $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']]); | 69 | $list = $moduleFieldModel->list(['module_id'=>$this->param['module_id']]); |
| 70 | + $moduleValueModel = new ExtensionModuleValue(); | ||
| 71 | + foreach ($list as $k => $v){ | ||
| 72 | + $v['is_use'] = 0; | ||
| 73 | + //查看当前字段是否已使用 | ||
| 74 | + $info = $moduleValueModel->read(['field_id'=>$v['id']],['id']); | ||
| 75 | + if($info !== false){ | ||
| 76 | + $v['is_use'] = 1; | ||
| 77 | + } | ||
| 78 | + $list[$k] = $v; | ||
| 79 | + } | ||
| 70 | $this->response('success',Code::SUCCESS,$list); | 80 | $this->response('success',Code::SUCCESS,$list); |
| 71 | } | 81 | } |
| 72 | 82 | ||
| @@ -131,7 +141,12 @@ class ExtensionModuleController extends BaseController | @@ -131,7 +141,12 @@ class ExtensionModuleController extends BaseController | ||
| 131 | $data[$v['uuid']][$v['field_id']] = $v['value']; | 141 | $data[$v['uuid']][$v['field_id']] = $v['value']; |
| 132 | } | 142 | } |
| 133 | } | 143 | } |
| 134 | - $this->response('success',Code::SUCCESS,$data); | 144 | + $resultData = []; |
| 145 | + foreach ($data as $k => $v){ | ||
| 146 | + $v['uuid'] = $k; | ||
| 147 | + $resultData[] = $v; | ||
| 148 | + } | ||
| 149 | + $this->response('success',Code::SUCCESS,$resultData); | ||
| 135 | } | 150 | } |
| 136 | 151 | ||
| 137 | /** | 152 | /** |
| @@ -198,6 +213,18 @@ class ExtensionModuleController extends BaseController | @@ -198,6 +213,18 @@ class ExtensionModuleController extends BaseController | ||
| 198 | ]; | 213 | ]; |
| 199 | $moduleValueModel->addReturnId($data); | 214 | $moduleValueModel->addReturnId($data); |
| 200 | } | 215 | } |
| 201 | - $this->response('success',Code::SUCCESS,['uuid'=>$this->param['uuid']]); | 216 | + $this->response('success',Code::SUCCESS,['uuid'=>$uuid]); |
| 217 | + } | ||
| 218 | + | ||
| 219 | + /** | ||
| 220 | + * @remark :生成唯一的字符串 | ||
| 221 | + * @name :sendUniqueStr | ||
| 222 | + * @author :lyh | ||
| 223 | + * @method :post | ||
| 224 | + * @time :2024/8/20 10:31 | ||
| 225 | + */ | ||
| 226 | + public function sendUniqueStr(){ | ||
| 227 | + $uniqueString = md5(time() . rand(1000, 9999)); | ||
| 228 | + $this->response('success',Code::SUCCESS,['str'=>$uniqueString]); | ||
| 202 | } | 229 | } |
| 203 | } | 230 | } |
| @@ -403,7 +403,7 @@ class ProductLogic extends BaseLogic | @@ -403,7 +403,7 @@ class ProductLogic extends BaseLogic | ||
| 403 | $cateList = $cateModel->list($status,'id',['id','pid']); | 403 | $cateList = $cateModel->list($status,'id',['id','pid']); |
| 404 | $this->param['featured_status'] = $this->param['featured_status'] ?? 0; | 404 | $this->param['featured_status'] = $this->param['featured_status'] ?? 0; |
| 405 | if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){ | 405 | if(!empty($cateList) && ($this->param['featured_status'] != $cateModel::STATUS_ACTIVE)){ |
| 406 | - $featured_ids = $cateModel->where('title', 'like', 'Featured%')->pluck('id')->toArray(); | 406 | + $featured_ids = $cateModel->where('title', 'Featured')->pluck('id')->toArray(); |
| 407 | //获取当前的子集 | 407 | //获取当前的子集 |
| 408 | $featured_arr = []; | 408 | $featured_arr = []; |
| 409 | foreach ($featured_ids as $id){ | 409 | foreach ($featured_ids as $id){ |
| @@ -95,6 +95,18 @@ class RankDataLogic extends BaseLogic | @@ -95,6 +95,18 @@ class RankDataLogic extends BaseLogic | ||
| 95 | $languageList = $languageModel->list(['project_id'=>$project['id']]); | 95 | $languageList = $languageModel->list(['project_id'=>$project['id']]); |
| 96 | if(!empty($languageList) && is_array($languageList)){ | 96 | if(!empty($languageList) && is_array($languageList)){ |
| 97 | foreach($languageList as $lang){ | 97 | foreach($languageList as $lang){ |
| 98 | + if($lang['lang'] =='ja'){ | ||
| 99 | + $lang['lang'] ='jp'; | ||
| 100 | + } | ||
| 101 | + if($lang['lang'] == 'ko'){ | ||
| 102 | + $lang['lang'] ='kr'; | ||
| 103 | + } | ||
| 104 | + if($lang['lang'] =='ms'){ | ||
| 105 | + $lang['lang']='my'; | ||
| 106 | + } | ||
| 107 | + if($lang['lang'] == 'vi'){ | ||
| 108 | + $lang['lang'] ='vn'; | ||
| 109 | + } | ||
| 98 | $remain_day = $lang_data[$lang['lang']]['dabiao_day'] ?? 0; | 110 | $remain_day = $lang_data[$lang['lang']]['dabiao_day'] ?? 0; |
| 99 | $data['langs'][$lang['language'] ?? ''] = [ | 111 | $data['langs'][$lang['language'] ?? ''] = [ |
| 100 | 'lang'=>$lang['lang'], | 112 | 'lang'=>$lang['lang'], |
| @@ -390,6 +402,18 @@ class RankDataLogic extends BaseLogic | @@ -390,6 +402,18 @@ class RankDataLogic extends BaseLogic | ||
| 390 | $lang_list = $api->getLangList(); | 402 | $lang_list = $api->getLangList(); |
| 391 | if (!empty($lang_list[$api_no])) { | 403 | if (!empty($lang_list[$api_no])) { |
| 392 | foreach ($lang_list[$api_no] as $lang){ | 404 | foreach ($lang_list[$api_no] as $lang){ |
| 405 | + if($lang =='ja'){ | ||
| 406 | + $lang ='jp'; | ||
| 407 | + } | ||
| 408 | + if($lang == 'ko'){ | ||
| 409 | + $lang ='kr'; | ||
| 410 | + } | ||
| 411 | + if($lang =='ms'){ | ||
| 412 | + $lang='my'; | ||
| 413 | + } | ||
| 414 | + if($lang == 'vi'){ | ||
| 415 | + $lang ='vn'; | ||
| 416 | + } | ||
| 393 | $model = RankData::where('project_id', $project_id)->where('lang', $lang)->first(); | 417 | $model = RankData::where('project_id', $project_id)->where('lang', $lang)->first(); |
| 394 | if (!$model || $model->updated_date != date('Y-m-d') || $force) { | 418 | if (!$model || $model->updated_date != date('Y-m-d') || $force) { |
| 395 | $res = $api->getGoogleRank($api_no, $lang, 7, $force); | 419 | $res = $api->getGoogleRank($api_no, $lang, 7, $force); |
| @@ -577,6 +577,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -577,6 +577,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 577 | Route::any('/getModuleValueList', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getModuleValueList'])->name('extension_module_getModuleValueList'); | 577 | Route::any('/getModuleValueList', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'getModuleValueList'])->name('extension_module_getModuleValueList'); |
| 578 | Route::any('/addModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'addModuleValue'])->name('extension_module_addModuleValue'); | 578 | Route::any('/addModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'addModuleValue'])->name('extension_module_addModuleValue'); |
| 579 | Route::any('/editModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'editModuleValue'])->name('extension_module_editModuleValue'); | 579 | Route::any('/editModuleValue', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'editModuleValue'])->name('extension_module_editModuleValue'); |
| 580 | + Route::any('/sendUniqueStr', [\App\Http\Controllers\Bside\ExtensionModule\ExtensionModuleController::class, 'sendUniqueStr'])->name('extension_module_sendUniqueStr'); | ||
| 580 | }); | 581 | }); |
| 581 | 582 | ||
| 582 | //自定义小语种文本信息 | 583 | //自定义小语种文本信息 |
-
请 注册 或 登录 后发表评论