Merge remote-tracking branch 'origin/master' into akun
正在显示
8 个修改的文件
包含
468 行增加
和
26 行删除
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :DeleteProductCategory.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/5/16 14:59 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\DeleteCategory; | ||
| 11 | + | ||
| 12 | +use App\Helper\Arr; | ||
| 13 | +use App\Models\Blog\Blog; | ||
| 14 | +use App\Models\Blog\BlogCategory; | ||
| 15 | +use App\Models\Com\NoticeLog; | ||
| 16 | +use App\Models\Project\Project; | ||
| 17 | +use App\Services\ProjectServer; | ||
| 18 | +use Illuminate\Console\Command; | ||
| 19 | +use Illuminate\Support\Facades\DB; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @remark :删除分类 | ||
| 23 | + * @name :DeleteProductCategory | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2024/5/16 15:00 | ||
| 27 | + */ | ||
| 28 | +class DeleteBlogCategory extends Command | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * The name and signature of the console command. | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + protected $signature = 'delete_blog_category'; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * The console command description. | ||
| 39 | + * | ||
| 40 | + * @var string | ||
| 41 | + */ | ||
| 42 | + protected $description = '删除博客分类'; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Create a new command instance. | ||
| 46 | + * | ||
| 47 | + * @return void | ||
| 48 | + */ | ||
| 49 | + public function __construct() | ||
| 50 | + { | ||
| 51 | + parent::__construct(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :批量处理 | ||
| 56 | + * @name :handle | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2024/5/16 15:02 | ||
| 60 | + */ | ||
| 61 | + public function handle(){ | ||
| 62 | + while (true){ | ||
| 63 | + $noticeLogModel = new NoticeLog(); | ||
| 64 | + $list = $noticeLogModel->list(['status'=>NoticeLog::STATUS_PENDING,'type'=>NoticeLog::DELETE_BLOG_CATEGORY],'id',['*'],'asc',100); | ||
| 65 | + if(empty($list)){ | ||
| 66 | + sleep(100); | ||
| 67 | + } | ||
| 68 | + foreach ($list as $item){ | ||
| 69 | + echo 'start:' . $item['id'] . PHP_EOL; | ||
| 70 | + try { | ||
| 71 | + $projectModel = new Project(); | ||
| 72 | + $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); | ||
| 73 | + if($projectInfo === false){ | ||
| 74 | + continue; | ||
| 75 | + } | ||
| 76 | + ProjectServer::useProject($projectInfo['id']); | ||
| 77 | + $this->updateCategory(); | ||
| 78 | + DB::disconnect('custom_mysql'); | ||
| 79 | + $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); | ||
| 80 | + echo 'success:' . $item['id'] . PHP_EOL; | ||
| 81 | + }catch (\Exception $e){ | ||
| 82 | + echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 83 | + errorLog('项目初始化失败', $item, $e); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + return true; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @remark :更新分类 | ||
| 92 | + * @name :updateProductCategory | ||
| 93 | + * @author :lyh | ||
| 94 | + * @method :post | ||
| 95 | + * @time :2024/5/16 15:38 | ||
| 96 | + */ | ||
| 97 | + public function updateCategory(){ | ||
| 98 | + $page = 1; | ||
| 99 | + $blogModel = new Blog(); | ||
| 100 | + while (true){ | ||
| 101 | + $blogList = $blogModel->lists(['status'=>1],$page,1000,'id',['id','category_id']); | ||
| 102 | + if(empty($blogList) || empty($blogList['list'])){ | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + foreach ($blogList['list'] as $v){ | ||
| 106 | + $category_id_arr = Arr::setToArr(trim($v['category_id'],',')); | ||
| 107 | + if(empty($category_id_arr)){ | ||
| 108 | + continue; | ||
| 109 | + } | ||
| 110 | + $categoryModel = new BlogCategory(); | ||
| 111 | + foreach ($category_id_arr as $k=>$cate_id){ | ||
| 112 | + $cateInfo = $categoryModel->read(['id'=>$cate_id],['id']); | ||
| 113 | + if($cateInfo == false){ | ||
| 114 | + //删除关联表 | ||
| 115 | + unset($category_id_arr[$k]); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + $str = !empty($category_id_arr) ? ','.Arr::arrToSet($category_id_arr).',' : ''; | ||
| 119 | + $blogModel->edit(['category_id'=>$str],['id'=>$v['id']]); | ||
| 120 | + } | ||
| 121 | + $page++; | ||
| 122 | + } | ||
| 123 | + return true; | ||
| 124 | + } | ||
| 125 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :DeleteProductCategory.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/5/16 14:59 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\DeleteCategory; | ||
| 11 | + | ||
| 12 | +use App\Helper\Arr; | ||
| 13 | +use App\Models\Com\NoticeLog; | ||
| 14 | +use App\Models\CustomModule\CustomModuleCategory; | ||
| 15 | +use App\Models\CustomModule\CustomModuleContent; | ||
| 16 | +use App\Models\Project\Project; | ||
| 17 | +use App\Services\ProjectServer; | ||
| 18 | +use Illuminate\Console\Command; | ||
| 19 | +use Illuminate\Support\Facades\DB; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @remark :删除分类 | ||
| 23 | + * @name :DeleteProductCategory | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2024/5/16 15:00 | ||
| 27 | + */ | ||
| 28 | +class DeleteCustomCategory extends Command | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * The name and signature of the console command. | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + protected $signature = 'delete_custom_category'; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * The console command description. | ||
| 39 | + * | ||
| 40 | + * @var string | ||
| 41 | + */ | ||
| 42 | + protected $description = '删除扩展模块分类'; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Create a new command instance. | ||
| 46 | + * | ||
| 47 | + * @return void | ||
| 48 | + */ | ||
| 49 | + public function __construct() | ||
| 50 | + { | ||
| 51 | + parent::__construct(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :批量处理 | ||
| 56 | + * @name :handle | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2024/5/16 15:02 | ||
| 60 | + */ | ||
| 61 | + public function handle(){ | ||
| 62 | + while (true){ | ||
| 63 | + $noticeLogModel = new NoticeLog(); | ||
| 64 | + $list = $noticeLogModel->list(['status'=>NoticeLog::STATUS_PENDING,'type'=>NoticeLog::DELETE_CUSTOM_CATEGORY],'id',['*'],'asc',100); | ||
| 65 | + if(empty($list)){ | ||
| 66 | + sleep(100); | ||
| 67 | + } | ||
| 68 | + foreach ($list as $item){ | ||
| 69 | + echo 'start:' . $item['id'] . PHP_EOL; | ||
| 70 | + try { | ||
| 71 | + $projectModel = new Project(); | ||
| 72 | + $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); | ||
| 73 | + if($projectInfo === false){ | ||
| 74 | + continue; | ||
| 75 | + } | ||
| 76 | + ProjectServer::useProject($projectInfo['id']); | ||
| 77 | + $this->updateCategory(); | ||
| 78 | + DB::disconnect('custom_mysql'); | ||
| 79 | + $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); | ||
| 80 | + echo 'success:' . $item['id'] . PHP_EOL; | ||
| 81 | + }catch (\Exception $e){ | ||
| 82 | + echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 83 | + errorLog('项目初始化失败', $item, $e); | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + return true; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @remark :更新分类 | ||
| 92 | + * @name :updateProductCategory | ||
| 93 | + * @author :lyh | ||
| 94 | + * @method :post | ||
| 95 | + * @time :2024/5/16 15:38 | ||
| 96 | + */ | ||
| 97 | + public function updateCategory(){ | ||
| 98 | + $page = 1; | ||
| 99 | + $customModel = new CustomModuleContent(); | ||
| 100 | + while (true){ | ||
| 101 | + $customList = $customModel->lists(['status'=>0],$page,1000,'id',['id','category_id']); | ||
| 102 | + if(empty($customList) || empty($customList['list'])){ | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + foreach ($customList['list'] as $v){ | ||
| 106 | + $category_id_arr = Arr::setToArr(trim($v['category_id'],',')); | ||
| 107 | + if(empty($category_id_arr)){ | ||
| 108 | + continue; | ||
| 109 | + } | ||
| 110 | + $categoryModel = new CustomModuleCategory(); | ||
| 111 | + foreach ($category_id_arr as $k=>$cate_id){ | ||
| 112 | + $cateInfo = $categoryModel->read(['id'=>$cate_id],['id']); | ||
| 113 | + if($cateInfo == false){ | ||
| 114 | + //删除关联表 | ||
| 115 | + unset($category_id_arr[$k]); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + $str = !empty($category_id_arr) ? ','.Arr::arrToSet($category_id_arr).',' : ''; | ||
| 119 | + $customModel->edit(['category_id'=>$str],['id'=>$v['id']]); | ||
| 120 | + } | ||
| 121 | + $page++; | ||
| 122 | + } | ||
| 123 | + return true; | ||
| 124 | + } | ||
| 125 | +} |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * @remark : | ||
| 4 | + * @name :DeleteProductCategory.php | ||
| 5 | + * @author :lyh | ||
| 6 | + * @method :post | ||
| 7 | + * @time :2024/5/16 14:59 | ||
| 8 | + */ | ||
| 9 | + | ||
| 10 | +namespace App\Console\Commands\DeleteCategory; | ||
| 11 | + | ||
| 12 | +use App\Helper\Arr; | ||
| 13 | +use App\Models\Com\NoticeLog; | ||
| 14 | +use App\Models\News\News; | ||
| 15 | +use App\Models\News\NewsCategory; | ||
| 16 | +use App\Models\Project\Project; | ||
| 17 | +use App\Services\ProjectServer; | ||
| 18 | +use Illuminate\Console\Command; | ||
| 19 | +use Illuminate\Support\Facades\DB; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @remark :删除分类 | ||
| 23 | + * @name :DeleteProductCategory | ||
| 24 | + * @author :lyh | ||
| 25 | + * @method :post | ||
| 26 | + * @time :2024/5/16 15:00 | ||
| 27 | + */ | ||
| 28 | +class DeleteNewsCategory extends Command | ||
| 29 | +{ | ||
| 30 | + /** | ||
| 31 | + * The name and signature of the console command. | ||
| 32 | + * | ||
| 33 | + * @var string | ||
| 34 | + */ | ||
| 35 | + protected $signature = 'delete_news_category'; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * The console command description. | ||
| 39 | + * | ||
| 40 | + * @var string | ||
| 41 | + */ | ||
| 42 | + protected $description = '删除新闻分类'; | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * Create a new command instance. | ||
| 46 | + * | ||
| 47 | + * @return void | ||
| 48 | + */ | ||
| 49 | + public function __construct() | ||
| 50 | + { | ||
| 51 | + parent::__construct(); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * @remark :批量处理 | ||
| 56 | + * @name :handle | ||
| 57 | + * @author :lyh | ||
| 58 | + * @method :post | ||
| 59 | + * @time :2024/5/16 15:02 | ||
| 60 | + */ | ||
| 61 | + public function handle(){ | ||
| 62 | + while (true){ | ||
| 63 | + $noticeLogModel = new NoticeLog(); | ||
| 64 | + $list = $noticeLogModel->list(['status'=>NoticeLog::STATUS_PENDING,'type'=>NoticeLog::DELETE_NEWS_CATEGORY],'id',['*'],'asc',100); | ||
| 65 | + if(empty($list)){ | ||
| 66 | + sleep(100); | ||
| 67 | + } | ||
| 68 | + foreach ($list as $item){ | ||
| 69 | + echo 'start:' . $item['id'] . PHP_EOL; | ||
| 70 | +// try { | ||
| 71 | + $projectModel = new Project(); | ||
| 72 | + $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); | ||
| 73 | + if($projectInfo === false){ | ||
| 74 | + continue; | ||
| 75 | + } | ||
| 76 | + ProjectServer::useProject($projectInfo['id']); | ||
| 77 | + $this->updateCategory(); | ||
| 78 | + DB::disconnect('custom_mysql'); | ||
| 79 | + $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); | ||
| 80 | + echo 'success:' . $item['id'] . PHP_EOL; | ||
| 81 | +// }catch (\Exception $e){ | ||
| 82 | +// echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 83 | +// errorLog('项目初始化失败', $item, $e); | ||
| 84 | +// } | ||
| 85 | + } | ||
| 86 | + return true; | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * @remark :更新分类 | ||
| 92 | + * @name :updateProductCategory | ||
| 93 | + * @author :lyh | ||
| 94 | + * @method :post | ||
| 95 | + * @time :2024/5/16 15:38 | ||
| 96 | + */ | ||
| 97 | + public function updateCategory(){ | ||
| 98 | + $page = 1; | ||
| 99 | + $newsModel = new News(); | ||
| 100 | + while (true){ | ||
| 101 | + $newsList = $newsModel->lists(['status'=>1],$page,1000,'id',['id','category_id']); | ||
| 102 | + if(empty($newsList) || empty($newsList['list'])){ | ||
| 103 | + return false; | ||
| 104 | + } | ||
| 105 | + foreach ($newsList['list'] as $v){ | ||
| 106 | + $category_id_arr = Arr::setToArr(trim($v['category_id'],',')); | ||
| 107 | + if(empty($category_id_arr)){ | ||
| 108 | + continue; | ||
| 109 | + } | ||
| 110 | + $categoryModel = new NewsCategory(); | ||
| 111 | + foreach ($category_id_arr as $k=>$cate_id){ | ||
| 112 | + $cateInfo = $categoryModel->read(['id'=>$cate_id],['id']); | ||
| 113 | + if($cateInfo === false){ | ||
| 114 | + //删除关联表 | ||
| 115 | + unset($category_id_arr[$k]); | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + $str = !empty($category_id_arr) ? ','.Arr::arrToSet($category_id_arr).',' : ''; | ||
| 119 | + $newsModel->edit(['category_id'=>$str],['id'=>$v['id']]); | ||
| 120 | + } | ||
| 121 | + $page++; | ||
| 122 | + } | ||
| 123 | + return true; | ||
| 124 | + } | ||
| 125 | +} |
| @@ -9,8 +9,15 @@ | @@ -9,8 +9,15 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Console\Commands\DeleteCategory; | 10 | namespace App\Console\Commands\DeleteCategory; |
| 11 | 11 | ||
| 12 | +use App\Helper\Arr; | ||
| 12 | use App\Models\Com\NoticeLog; | 13 | use App\Models\Com\NoticeLog; |
| 14 | +use App\Models\Product\Category; | ||
| 15 | +use App\Models\Product\CategoryRelated; | ||
| 16 | +use App\Models\Product\Product; | ||
| 17 | +use App\Models\Project\Project; | ||
| 18 | +use App\Services\ProjectServer; | ||
| 13 | use Illuminate\Console\Command; | 19 | use Illuminate\Console\Command; |
| 20 | +use Illuminate\Support\Facades\DB; | ||
| 14 | 21 | ||
| 15 | /** | 22 | /** |
| 16 | * @remark :删除分类 | 23 | * @remark :删除分类 |
| @@ -33,7 +40,7 @@ class DeleteProductCategory extends Command | @@ -33,7 +40,7 @@ class DeleteProductCategory extends Command | ||
| 33 | * | 40 | * |
| 34 | * @var string | 41 | * @var string |
| 35 | */ | 42 | */ |
| 36 | - protected $description = '删除产品关键字'; | 43 | + protected $description = '删除产品分类'; |
| 37 | 44 | ||
| 38 | /** | 45 | /** |
| 39 | * Create a new command instance. | 46 | * Create a new command instance. |
| @@ -55,13 +62,68 @@ class DeleteProductCategory extends Command | @@ -55,13 +62,68 @@ class DeleteProductCategory extends Command | ||
| 55 | public function handle(){ | 62 | public function handle(){ |
| 56 | while (true){ | 63 | while (true){ |
| 57 | $noticeLogModel = new NoticeLog(); | 64 | $noticeLogModel = new NoticeLog(); |
| 58 | - $list = $noticeLogModel->list(['status'=>NoticeLog::STATUS_PENDING,'type'=>NoticeLog::DELETE_PRODUCT_CATEGORY],'id',['*'],'asc','100'); | 65 | + $list = $noticeLogModel->list(['status'=>NoticeLog::STATUS_PENDING,'type'=>NoticeLog::DELETE_PRODUCT_CATEGORY],'id',['*'],'asc',100); |
| 59 | if(empty($list)){ | 66 | if(empty($list)){ |
| 60 | sleep(100); | 67 | sleep(100); |
| 61 | } | 68 | } |
| 62 | - foreach ($list as $v){ | ||
| 63 | - | 69 | + foreach ($list as $item){ |
| 70 | + echo 'start:' . $item['id'] . PHP_EOL; | ||
| 71 | + try { | ||
| 72 | + $projectModel = new Project(); | ||
| 73 | + $projectInfo = $projectModel->read(['id'=>$item['data']['project_id']]); | ||
| 74 | + if($projectInfo === false){ | ||
| 75 | + continue; | ||
| 76 | + } | ||
| 77 | + ProjectServer::useProject($projectInfo['id']); | ||
| 78 | + $this->updateCategory(); | ||
| 79 | + DB::disconnect('custom_mysql'); | ||
| 80 | + $noticeLogModel->edit(['status'=>NoticeLog::STATUS_SUCCESS],['id'=>$item['id']]); | ||
| 81 | + echo 'success:' . $item['id'] . PHP_EOL; | ||
| 82 | + }catch (\Exception $e){ | ||
| 83 | + echo 'error:' . $item['id'] . $e->getMessage() . PHP_EOL; | ||
| 84 | + errorLog('项目初始化失败', $item, $e); | ||
| 85 | + } | ||
| 64 | } | 86 | } |
| 87 | + return true; | ||
| 65 | } | 88 | } |
| 66 | } | 89 | } |
| 90 | + | ||
| 91 | + /** | ||
| 92 | + * @remark :更新分类 | ||
| 93 | + * @name :updateProductCategory | ||
| 94 | + * @author :lyh | ||
| 95 | + * @method :post | ||
| 96 | + * @time :2024/5/16 15:38 | ||
| 97 | + */ | ||
| 98 | + public function updateCategory(){ | ||
| 99 | + $page = 1; | ||
| 100 | + while (true){ | ||
| 101 | + $productModel = new Product(); | ||
| 102 | + $productList = $productModel->lists(['status'=>1],$page,1000,'id',['id','category_id']); | ||
| 103 | + if(empty($productList) || empty($productList['list'])){ | ||
| 104 | + return false; | ||
| 105 | + } | ||
| 106 | + foreach ($productList['list'] as $v){ | ||
| 107 | + $categoryRelatedModel = new CategoryRelated(); | ||
| 108 | + if(empty($v['category_id'])){ | ||
| 109 | + $categoryRelatedModel->del(['product_id'=>$v['id']]); | ||
| 110 | + continue; | ||
| 111 | + } | ||
| 112 | + $category_id_arr = $v['category_id']; | ||
| 113 | + $categoryModel = new Category(); | ||
| 114 | + foreach ($category_id_arr as $k=>$cate_id){ | ||
| 115 | + $cateInfo = $categoryModel->read(['id'=>$cate_id],['id']); | ||
| 116 | + if($cateInfo == false){ | ||
| 117 | + //删除关联表 | ||
| 118 | + $categoryRelatedModel->del(['cate_id'=>$cate_id]); | ||
| 119 | + unset($category_id_arr[$k]); | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + $str = !empty($category_id_arr) ? ','.Arr::arrToSet($category_id_arr).',' : ''; | ||
| 123 | + $productModel->edit(['category_id'=>$str],['id'=>$v['id']]); | ||
| 124 | + } | ||
| 125 | + $page++; | ||
| 126 | + } | ||
| 127 | + return true; | ||
| 128 | + } | ||
| 67 | } | 129 | } |
| @@ -62,22 +62,23 @@ class ReplaceHtml extends Command | @@ -62,22 +62,23 @@ class ReplaceHtml extends Command | ||
| 62 | while (true){ | 62 | while (true){ |
| 63 | $replaceHtmlModel = new TemplateReplaceHtml(); | 63 | $replaceHtmlModel = new TemplateReplaceHtml(); |
| 64 | $replaceHtmlList = $replaceHtmlModel->list(['status'=>$replaceHtmlModel::STATUS]); | 64 | $replaceHtmlList = $replaceHtmlModel->list(['status'=>$replaceHtmlModel::STATUS]); |
| 65 | - if(!empty($replaceHtmlList)){ | ||
| 66 | - foreach ($replaceHtmlList as $v){ | ||
| 67 | - ProjectServer::useProject($v['project_id']); | ||
| 68 | - echo '开始,任务id:'.$v['id'].PHP_EOL; | ||
| 69 | - if($v['source'] == 9){//单页面 | ||
| 70 | - $count = $this->createReplacePageHtmlLog($v); | ||
| 71 | - }else{ | ||
| 72 | - $count = $this->createReplaceHtmlLog($v); | ||
| 73 | - } | ||
| 74 | - //修改当前主任务状态为待执行 | ||
| 75 | - $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START,'total_num'=>$count],['id'=>$v['id']]); | ||
| 76 | - echo '结束'.PHP_EOL; | ||
| 77 | - DB::disconnect('custom_mysql'); | 65 | + if(empty($replaceHtmlList)){ |
| 66 | + sleep(100); | ||
| 67 | + return true; | ||
| 68 | + } | ||
| 69 | + foreach ($replaceHtmlList as $v){ | ||
| 70 | + ProjectServer::useProject($v['project_id']); | ||
| 71 | + echo '开始,任务id:'.$v['id'].PHP_EOL; | ||
| 72 | + if($v['source'] == 9){//单页面 | ||
| 73 | + $count = $this->createReplacePageHtmlLog($v); | ||
| 74 | + }else{ | ||
| 75 | + $count = $this->createReplaceHtmlLog($v); | ||
| 78 | } | 76 | } |
| 77 | + //修改当前主任务状态为待执行 | ||
| 78 | + $replaceHtmlModel->edit(['status'=>$replaceHtmlModel::STATUS_START,'total_num'=>$count],['id'=>$v['id']]); | ||
| 79 | + echo '结束'.PHP_EOL; | ||
| 80 | + DB::disconnect('custom_mysql'); | ||
| 79 | } | 81 | } |
| 80 | - sleep(5); | ||
| 81 | return true; | 82 | return true; |
| 82 | } | 83 | } |
| 83 | } | 84 | } |
| @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\CustomModule; | @@ -11,6 +11,7 @@ namespace App\Http\Logic\Bside\CustomModule; | ||
| 11 | 11 | ||
| 12 | use App\Helper\Arr; | 12 | use App\Helper\Arr; |
| 13 | use App\Http\Logic\Bside\BaseLogic; | 13 | use App\Http\Logic\Bside\BaseLogic; |
| 14 | +use App\Models\Com\NoticeLog; | ||
| 14 | use App\Models\CustomModule\CustomModuleCategory; | 15 | use App\Models\CustomModule\CustomModuleCategory; |
| 15 | use App\Models\CustomModule\CustomModuleContent; | 16 | use App\Models\CustomModule\CustomModuleContent; |
| 16 | use App\Models\RouteMap\RouteMap; | 17 | use App\Models\RouteMap\RouteMap; |
| @@ -190,14 +191,16 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -190,14 +191,16 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 190 | public function categoryDel(){ | 191 | public function categoryDel(){ |
| 191 | $ids = $this->param['id']; | 192 | $ids = $this->param['id']; |
| 192 | foreach ($ids as $id){ | 193 | foreach ($ids as $id){ |
| 193 | - //删除路由 | ||
| 194 | - $this->delRoute($id); | ||
| 195 | - $this->model->del(['id'=>$id]); | ||
| 196 | - //同步删除产品字段category_id | ||
| 197 | - $contentModel = new CustomModuleContent(); | ||
| 198 | - $contentModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]); | ||
| 199 | - $contentModel->edit(['category_id'=>null],['category_id'=>',']); | 194 | + $str = []; |
| 195 | + $this->getAllSub($id,$str); | ||
| 196 | + $str[] = $id; | ||
| 197 | + foreach ($str as $value){ | ||
| 198 | + //删除路由 | ||
| 199 | + $this->delRoute($value); | ||
| 200 | + $this->model->del(['id'=>$value]); | ||
| 201 | + } | ||
| 200 | } | 202 | } |
| 203 | + NoticeLog::createLog(NoticeLog::DELETE_CUSTOM_CATEGORY, ['project_id' => $this->user['project_id']]); | ||
| 201 | return $this->success(); | 204 | return $this->success(); |
| 202 | } | 205 | } |
| 203 | 206 |
| @@ -17,6 +17,7 @@ class NoticeLog extends Base | @@ -17,6 +17,7 @@ class NoticeLog extends Base | ||
| 17 | const DELETE_PRODUCT_CATEGORY = 'delete_product_category'; | 17 | const DELETE_PRODUCT_CATEGORY = 'delete_product_category'; |
| 18 | const DELETE_BLOG_CATEGORY = 'delete_blog_category'; | 18 | const DELETE_BLOG_CATEGORY = 'delete_blog_category'; |
| 19 | const DELETE_NEWS_CATEGORY = 'delete_news_category'; | 19 | const DELETE_NEWS_CATEGORY = 'delete_news_category'; |
| 20 | + const DELETE_CUSTOM_CATEGORY = 'delete_custom_category'; | ||
| 20 | const STATUS_PENDING = 0; | 21 | const STATUS_PENDING = 0; |
| 21 | const STATUS_SUCCESS = 1; | 22 | const STATUS_SUCCESS = 1; |
| 22 | const STATUS_FAIL = 2; | 23 | const STATUS_FAIL = 2; |
| @@ -21,7 +21,7 @@ class Visit extends Base | @@ -21,7 +21,7 @@ class Visit extends Base | ||
| 21 | //连接数据库 | 21 | //连接数据库 |
| 22 | protected $connection = 'custom_mysql'; | 22 | protected $connection = 'custom_mysql'; |
| 23 | protected $appends = ['device_text']; | 23 | protected $appends = ['device_text']; |
| 24 | -// protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at']; | 24 | + protected $fillable = ['id','ip','device_port','country','city','url','referrer_url','depth','domain','updated_date', 'created_at']; |
| 25 | 25 | ||
| 26 | const DEVICE_PC = 1; | 26 | const DEVICE_PC = 1; |
| 27 | const DEVICE_MOBILE = 2; | 27 | const DEVICE_MOBILE = 2; |
-
请 注册 或 登录 后发表评论