generated from liutk/owl-admin-base
调整文章分类同步
parent
892dc51c15
commit
a095811702
|
|
@ -20,10 +20,9 @@ class ArticleCategorySeeder extends Seeder
|
||||||
|
|
||||||
DB::connection('djc_mysql')->getPdo()->exec("SET NAMES 'utf8'");
|
DB::connection('djc_mysql')->getPdo()->exec("SET NAMES 'utf8'");
|
||||||
$oldCates = DB::connection('djc_mysql')->table('t_article_type')->get()->sortBy('pid');
|
$oldCates = DB::connection('djc_mysql')->table('t_article_type')->get()->sortBy('pid');
|
||||||
|
|
||||||
$newCategories = [];
|
$newCategories = [];
|
||||||
foreach($oldCates as $cate){
|
foreach($oldCates as $cate){
|
||||||
if(empty($cate->name) || empty($dict->valid)){
|
if(empty($cate->name) || empty($cate->valid)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$_category = [
|
$_category = [
|
||||||
|
|
@ -39,10 +38,8 @@ class ArticleCategorySeeder extends Seeder
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$newCategories[$cate->id] = $_category;
|
$newCategories[$cate->id] = $_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($newCategories) > 0){
|
if(count($newCategories) > 0){
|
||||||
DB::table('article_categories')->truncate();
|
DB::table('article_categories')->truncate();
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue