正在显示
1 个修改的文件
包含
42 行增加
和
4 行删除
| @@ -10,12 +10,15 @@ | @@ -10,12 +10,15 @@ | ||
| 10 | namespace App\Console\Commands\LyhTest; | 10 | namespace App\Console\Commands\LyhTest; |
| 11 | 11 | ||
| 12 | use App\Helper\Common; | 12 | use App\Helper\Common; |
| 13 | +use App\Models\Blog\Blog; | ||
| 13 | use App\Models\Com\V6WeeklyReport; | 14 | use App\Models\Com\V6WeeklyReport; |
| 15 | +use App\Models\News\News; | ||
| 14 | use App\Models\Product\Category; | 16 | use App\Models\Product\Category; |
| 15 | use App\Models\Product\CategoryRelated; | 17 | use App\Models\Product\CategoryRelated; |
| 16 | use App\Models\Product\Product; | 18 | use App\Models\Product\Product; |
| 17 | use App\Models\ProjectAssociation\ProjectAssociation; | 19 | use App\Models\ProjectAssociation\ProjectAssociation; |
| 18 | use App\Models\RouteMap\RouteMap; | 20 | use App\Models\RouteMap\RouteMap; |
| 21 | +use App\Models\Template\BTemplate; | ||
| 19 | use App\Models\Visit\Visit; | 22 | use App\Models\Visit\Visit; |
| 20 | use App\Models\Visit\VisitItem; | 23 | use App\Models\Visit\VisitItem; |
| 21 | use App\Models\Workchat\MessagePush; | 24 | use App\Models\Workchat\MessagePush; |
| @@ -43,16 +46,51 @@ class DownloadProject extends Command | @@ -43,16 +46,51 @@ class DownloadProject extends Command | ||
| 43 | 46 | ||
| 44 | public function handle(){ | 47 | public function handle(){ |
| 45 | echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; | 48 | echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; |
| 46 | - ProjectServer::useProject(535); | ||
| 47 | - $this->model = new Visit(); | ||
| 48 | - $data = $this->importVisit(); | ||
| 49 | - dd($data); | 49 | + ProjectServer::useProject(671); |
| 50 | + $this->newsImportBlog(); | ||
| 50 | DB::disconnect('custom_mysql'); | 51 | DB::disconnect('custom_mysql'); |
| 51 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 52 | echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; |
| 52 | return true; | 53 | return true; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | /** | 56 | /** |
| 57 | + * @remark :新闻导入到博客 | ||
| 58 | + * @name :newsImportBlog | ||
| 59 | + * @author :lyh | ||
| 60 | + * @method :post | ||
| 61 | + * @time :2025/6/7 11:12 | ||
| 62 | + */ | ||
| 63 | + public function newsImportBlog(){ | ||
| 64 | + $newsModel = new News(); | ||
| 65 | + $newsLists = $newsModel->list(['status'=>1]); | ||
| 66 | + $blogModel = new Blog(); | ||
| 67 | + foreach ($newsLists as $item){ | ||
| 68 | + $data = [ | ||
| 69 | + 'name'=>$item['name'], | ||
| 70 | + 'status'=>1, | ||
| 71 | + 'remark'=>$item['remark'], | ||
| 72 | + 'text'=>$item['text'], | ||
| 73 | + 'image'=>$item['image'], | ||
| 74 | + 'url'=>$item['url'], | ||
| 75 | + 'seo_title'=>$item['seo_title'], | ||
| 76 | + 'seo_description'=>$item['seo_title'], | ||
| 77 | + 'seo_keywords'=>$item['seo_title'], | ||
| 78 | + 'project_id'=>671, | ||
| 79 | + 'release_at'=>$item['release_at'], | ||
| 80 | + 'og_image'=>$item['og_image'] | ||
| 81 | + ]; | ||
| 82 | + $id = $blogModel->addReturnId($data); | ||
| 83 | + RouteMap::delRoute(RouteMap::SOURCE_NEWS,$item['id'],671); | ||
| 84 | + $route = RouteMap::setRoute($item['url'],RouteMap::SOURCE_BLOG,$id,671); | ||
| 85 | + $blogModel->edit(['url'=>$route],['id'=>$id]); | ||
| 86 | + //更新当前的可视化归宿 | ||
| 87 | + $templateModel = new BTemplate(); | ||
| 88 | + $templateModel->edit(['source'=>3,'source_id'=>$id],['source'=>4,'source_id'=>$item['id'],'is_custom'=>0,'is_list'=>0]); | ||
| 89 | + } | ||
| 90 | + return true; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + /** | ||
| 56 | * @remark :导出明细 | 94 | * @remark :导出明细 |
| 57 | * @name :importVisit | 95 | * @name :importVisit |
| 58 | * @author :lyh | 96 | * @author :lyh |
-
请 注册 或 登录 后发表评论