|
...
|
...
|
@@ -7,17 +7,13 @@ |
|
|
|
* @time :2024/9/26 14:19
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Project;
|
|
|
|
namespace App\Console\Commands\LyhTest;
|
|
|
|
|
|
|
|
use App\Helper\Common;
|
|
|
|
use App\Models\Domain\DomainInfo;
|
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\CategoryRelated;
|
|
|
|
use App\Models\Product\Detail;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Visit\Visit;
|
|
|
|
use App\Models\Visit\VisitItem;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
...
|
...
|
@@ -41,7 +37,7 @@ class DownloadProject extends Command |
|
|
|
protected $description = '导出项目数据';
|
|
|
|
|
|
|
|
public function handle(){
|
|
|
|
ProjectServer::useProject(1225);
|
|
|
|
ProjectServer::useProject(1646);
|
|
|
|
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
|
|
|
|
$data = $this->downloadProduct();
|
|
|
|
DB::disconnect('custom_mysql');
|
|
...
|
...
|
@@ -52,22 +48,23 @@ class DownloadProject extends Command |
|
|
|
public function downloadProduct()
|
|
|
|
{
|
|
|
|
$product = new Product();
|
|
|
|
$filed = ['id', 'project_id', 'title' ,'thumb' , 'route' ,'intro','content',
|
|
|
|
'category_id', 'status','seo_mate'];
|
|
|
|
// $filed = ['id', 'project_id', 'title' ,'thumb' , 'route' ,'intro','content',
|
|
|
|
// 'category_id', 'status','seo_mate'];
|
|
|
|
$filed = ['id','title'];
|
|
|
|
$this->order = 'sort';
|
|
|
|
$lists = $product->list(['status'=>1],'id',$filed);
|
|
|
|
if(!empty($lists)){
|
|
|
|
$cate_data = $this->getCategoryList();//分类
|
|
|
|
// $cate_data = $this->getCategoryList();//分类
|
|
|
|
foreach ($lists as $k => $v){
|
|
|
|
echo date('Y-m-d H:i:s') . '产品id:'.$v['id'] . PHP_EOL;
|
|
|
|
$v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
|
|
|
|
$v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
|
|
|
|
//ToDo::处理图片及文件
|
|
|
|
if(!empty($v['thumb']) && !empty($v['thumb']['url'])){
|
|
|
|
$v['images'] = getImageUrl($v['thumb']['url']);
|
|
|
|
}else{
|
|
|
|
$v['images'] = '';
|
|
|
|
}
|
|
|
|
// $v['url'] = 'https://www.autsikinta.com/' . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
|
|
|
|
// $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
|
|
|
|
// //ToDo::处理图片及文件
|
|
|
|
// if(!empty($v['thumb']) && !empty($v['thumb']['url'])){
|
|
|
|
// $v['images'] = getImageUrl($v['thumb']['url']);
|
|
|
|
// }else{
|
|
|
|
// $v['images'] = '';
|
|
|
|
// }
|
|
|
|
$lists[$k] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -148,27 +145,27 @@ class DownloadProject extends Command |
|
|
|
$sheet = $spreadsheet->getActiveSheet();
|
|
|
|
// 添加表头
|
|
|
|
$sheet->setCellValue('A1', '产品名称');
|
|
|
|
$sheet->setCellValue('B1', '产品短描述');
|
|
|
|
$sheet->setCellValue('C1', '产品内容');
|
|
|
|
$sheet->setCellValue('D1', '产品路由');
|
|
|
|
$sheet->setCellValue('E1', '产品分类');
|
|
|
|
$sheet->setCellValue('F1', '产品状态');
|
|
|
|
$sheet->setCellValue('G1', '产品主图');
|
|
|
|
$sheet->setCellValue('H1', '产品seo_title');
|
|
|
|
$sheet->setCellValue('I1', '产品seo_keyword');
|
|
|
|
$sheet->setCellValue('J1', '产品seo_title');
|
|
|
|
// $sheet->setCellValue('B1', '产品短描述');
|
|
|
|
// $sheet->setCellValue('C1', '产品内容');
|
|
|
|
// $sheet->setCellValue('D1', '产品路由');
|
|
|
|
// $sheet->setCellValue('E1', '产品分类');
|
|
|
|
// $sheet->setCellValue('F1', '产品状态');
|
|
|
|
// $sheet->setCellValue('G1', '产品主图');
|
|
|
|
// $sheet->setCellValue('H1', '产品seo_title');
|
|
|
|
// $sheet->setCellValue('I1', '产品seo_keyword');
|
|
|
|
// $sheet->setCellValue('J1', '产品seo_title');
|
|
|
|
$rowCount = 2;
|
|
|
|
foreach ($data as $v) {
|
|
|
|
$sheet->setCellValue('A' . $rowCount, $v['title']);
|
|
|
|
$sheet->setCellValue('B' . $rowCount, $v['intro']);
|
|
|
|
$sheet->setCellValue('C' . $rowCount, $v['content']);
|
|
|
|
$sheet->setCellValue('D' . $rowCount, $v['url']);
|
|
|
|
$sheet->setCellValue('E' . $rowCount, $v['category_id_text']);
|
|
|
|
$sheet->setCellValue('F' . $rowCount, '发布中');
|
|
|
|
$sheet->setCellValue('G' . $rowCount, $v['images']);
|
|
|
|
$sheet->setCellValue('H' . $rowCount, $v['seo_mate']['title']);
|
|
|
|
$sheet->setCellValue('I' . $rowCount, $v['seo_mate']['keyword']);
|
|
|
|
$sheet->setCellValue('J' . $rowCount, $v['seo_mate']['description']);
|
|
|
|
// $sheet->setCellValue('B' . $rowCount, $v['intro']);
|
|
|
|
// $sheet->setCellValue('C' . $rowCount, $v['content']);
|
|
|
|
// $sheet->setCellValue('D' . $rowCount, $v['url']);
|
|
|
|
// $sheet->setCellValue('E' . $rowCount, $v['category_id_text']);
|
|
|
|
// $sheet->setCellValue('F' . $rowCount, '发布中');
|
|
|
|
// $sheet->setCellValue('G' . $rowCount, $v['images']);
|
|
|
|
// $sheet->setCellValue('H' . $rowCount, $v['seo_mate']['title']);
|
|
|
|
// $sheet->setCellValue('I' . $rowCount, $v['seo_mate']['keyword']);
|
|
|
|
// $sheet->setCellValue('J' . $rowCount, $v['seo_mate']['description']);
|
|
|
|
$rowCount++;
|
|
|
|
}
|
|
|
|
// 创建一个新的 Excel Writer 对象
|
...
|
...
|
|