作者 赵彬吉
... ... @@ -42,6 +42,7 @@ class DownloadProject extends Command
public function handle(){
ProjectServer::useProject(1225);
echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
$data = $this->downloadProduct();
DB::disconnect('custom_mysql');
echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
... ... @@ -58,6 +59,7 @@ class DownloadProject extends Command
if(!empty($lists)){
$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::处理图片及文件
... ... @@ -69,7 +71,6 @@ class DownloadProject extends Command
$lists[$k] = $v;
}
}
echo date('Y-m-d H:i:s') . '数据详情$v:'. json_encode($lists) . PHP_EOL;
return $lists;
}
public function categoryName($product_id,$data){
... ... @@ -153,7 +154,9 @@ class DownloadProject extends Command
$sheet->setCellValue('E1', '产品分类');
$sheet->setCellValue('F1', '产品状态');
$sheet->setCellValue('G1', '产品主图');
$sheet->setCellValue('H1', '产品TDK');
$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']);
... ... @@ -163,7 +166,9 @@ class DownloadProject extends Command
$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']);
$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 对象
... ...
... ... @@ -248,7 +248,7 @@ class ProjectLogic extends BaseLogic
public function createAuthor($project_id,$mch_id,$key){
//查看当前项目是否已经创建了作者
$aiBlogTaskModel = new AiBlogTask();
$count = $aiBlogTaskModel->counts();
$count = $aiBlogTaskModel->count();
if($count > 0){
return true;
}
... ...