作者 lyh

gx脚本导出产品

... ... @@ -17,7 +17,6 @@ yarn-error.log
/.idea
/.vscode
composer.lock
app/Console/Commands/Test/Demo.php
app/Console/Commands/Test/DataRecovery.php
/public/upload
/public/runtime
... ...
<?php
/**
* Created by PhpStorm.
* User: zhl
* Date: 2023/2/7
* Time: 17:58
* @remark :
* @name :Demo.php
* @author :lyh
* @method :post
* @time :2025/2/20 9:19
*/
namespace App\Console\Commands\Test;
namespace App\Console\Commands\Test;
use App\Helper\Arr;
use App\Helper\Translate;
use App\Mail\TextMail;
use App\Models\Blog\Blog;
use App\Models\Blog\BlogCategory;
use App\Models\Com\KeywordVideoTask;
use App\Models\Com\KeywordVideoTaskLog;
use App\Models\CustomModule\CustomModuleCategory;
use App\Models\CustomModule\CustomModuleContent;
use App\Models\CustomModule\CustomModuleExtentContent;
use App\Models\Devops\ServerConfig;
use App\Models\Devops\Servers;
use App\Models\Devops\ServersIp;
use App\Models\ExtentModule\ExtensionModuleValue;
use App\Models\File\File;
use App\Models\File\File as FileModel;
use App\Models\File\Image;
use App\Models\File\Image as ImageModel;
use App\Models\News\News;
use App\Models\News\NewsCategory;
use App\Models\Product\Keyword;
use App\Models\Product\KeywordRelated;
use App\Models\Product\Product;
use App\Models\Project\AutoEmailLog;
use App\Models\Project\DeployOptimize;
use App\Models\Project\MinorLanguages;
use App\Models\Project\Project;
use App\Models\Purchaser\Purchaser;
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 Hashids\Hashids;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Schema;
class Demo extends Command
{
... ... @@ -64,32 +25,35 @@ class Demo extends Command
*
* @var string
*/
protected $description = 'demo';
protected $description = '';
public function handle(){
return true;
return $this->getExtendProjects();
}
public function toQueue(){
$info = [
'email' => '1123736022@qq.com', // 收件人邮箱
'title' => '测试邮件', // 邮件标题
'content' => '这是来自163邮箱的测试邮件', // 邮件内容
];
Config::set('mail.mailers.smtp.host', 'smtp.163.com');
Config::set('mail.mailers.smtp.username', 'lyh103433@163.com');
Config::set('mail.mailers.smtp.password', 'BMf8B327Nhncunnb');
Config::set('mail.from.address', 'lyh103433@163.com');
Config::set('mail.from.name', 'lyh');
try {
$status = AutoEmailLog::STATUS_SUCCESS;
Mail::to([$info['email']])->send(new TextMail(['subject' => $info['title'], 'text' => $info['content']]));
} catch (\Exception $e) {
$status = AutoEmailLog::STATUS_ERROR;
$this->output('任务:' . $info['id'] . ' 邮箱' . $info['email'] . '发送失败,' . $e->getMessage());
public function getExtendProjects($api_no = null)
{
$key = 'extend_projects_list';
$data = Cache::get($key);
if (!$data) {
$api_url = 'http://api.quanqiusou.cn/google-rank/api/extend_projects.php';
try {
$data = HttpUtils::get($api_url, []);
if ($data) {
$data = Arr::s2a($data);
Cache::put($key, $data, 4 * 3600);
}
} catch (\Exception | GuzzleException $e) {
errorLog('复制站点项目获取失败', [], $e);
return false;
}
}
if ($api_no !== null) {
$data = collect($data)->where('apino', $api_no)->first();
return $data ?: [];
}
return $status;
echo date('Y-m-d H:i:s') . 'end'.json_encode($data) . PHP_EOL;
return $data;
}
}
... ...