Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate
正在显示
10 个修改的文件
包含
48 行增加
和
56 行删除
| @@ -331,6 +331,7 @@ class ProjectUpdate extends Command | @@ -331,6 +331,7 @@ class ProjectUpdate extends Command | ||
| 331 | 'status' => Product::STATUS_ON, | 331 | 'status' => Product::STATUS_ON, |
| 332 | 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | 332 | 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), |
| 333 | 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | 333 | 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), |
| 334 | + 'send_time' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 334 | 'sort' => $item['sort'] ?? 0, | 335 | 'sort' => $item['sort'] ?? 0, |
| 335 | 'is_upgrade' => 1, | 336 | 'is_upgrade' => 1, |
| 336 | 'six_read' => 1, | 337 | 'six_read' => 1, |
| @@ -357,6 +358,7 @@ class ProjectUpdate extends Command | @@ -357,6 +358,7 @@ class ProjectUpdate extends Command | ||
| 357 | 'keyword' => $item['keywords'] ?? '', | 358 | 'keyword' => $item['keywords'] ?? '', |
| 358 | 'description' => $item['description'] ?? '' | 359 | 'description' => $item['description'] ?? '' |
| 359 | ]), | 360 | ]), |
| 361 | + 'send_time' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 360 | 'sort' => $item['sort'] ?? 0, | 362 | 'sort' => $item['sort'] ?? 0, |
| 361 | ], ['id' => $id]); | 363 | ], ['id' => $id]); |
| 362 | } | 364 | } |
| @@ -469,6 +471,7 @@ class ProjectUpdate extends Command | @@ -469,6 +471,7 @@ class ProjectUpdate extends Command | ||
| 469 | 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE, | 471 | 'status' => $api_type == 'news' ? News::STATUS_ONE : Blog::STATUS_ONE, |
| 470 | 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | 472 | 'created_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), |
| 471 | 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | 473 | 'updated_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), |
| 474 | + 'release_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 472 | 'sort' => $item['sort'] ?? 0, | 475 | 'sort' => $item['sort'] ?? 0, |
| 473 | 'is_upgrade' => 1, | 476 | 'is_upgrade' => 1, |
| 474 | 'six_read' => 1, | 477 | 'six_read' => 1, |
| @@ -490,6 +493,7 @@ class ProjectUpdate extends Command | @@ -490,6 +493,7 @@ class ProjectUpdate extends Command | ||
| 490 | 'seo_description' => $item['description'] ?? '', | 493 | 'seo_description' => $item['description'] ?? '', |
| 491 | 'text' => $item['content'] ?? '', | 494 | 'text' => $item['content'] ?? '', |
| 492 | 'image' => $new_img, | 495 | 'image' => $new_img, |
| 496 | + 'release_at' => $item['post_date'] ?? date('Y-m-d H:i:s'), | ||
| 493 | 'sort' => $item['sort'] ?? 0, | 497 | 'sort' => $item['sort'] ?? 0, |
| 494 | ], ['id' => $id]); | 498 | ], ['id' => $id]); |
| 495 | } | 499 | } |
| @@ -659,6 +663,7 @@ class ProjectUpdate extends Command | @@ -659,6 +663,7 @@ class ProjectUpdate extends Command | ||
| 659 | 'image' => $new_img, | 663 | 'image' => $new_img, |
| 660 | 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), | 664 | 'created_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), |
| 661 | 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), | 665 | 'updated_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), |
| 666 | + 'release_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), | ||
| 662 | 'is_upgrade' => 1, | 667 | 'is_upgrade' => 1, |
| 663 | 'six_read' => 1, | 668 | 'six_read' => 1, |
| 664 | 'route' => $route | 669 | 'route' => $route |
| @@ -676,6 +681,7 @@ class ProjectUpdate extends Command | @@ -676,6 +681,7 @@ class ProjectUpdate extends Command | ||
| 676 | 'category_id' => $category_id, | 681 | 'category_id' => $category_id, |
| 677 | 'content' => $item['content'] ?? '', | 682 | 'content' => $item['content'] ?? '', |
| 678 | 'sort' => $item['sort'] ?? 0, | 683 | 'sort' => $item['sort'] ?? 0, |
| 684 | + 'release_at' => $item['post_time'] ?? date('Y-m-d H:i:s'), | ||
| 679 | 'image' => $new_img | 685 | 'image' => $new_img |
| 680 | ], ['id' => $id]); | 686 | ], ['id' => $id]); |
| 681 | } | 687 | } |
| @@ -182,7 +182,7 @@ class CustomModuleCategoryController extends BaseController | @@ -182,7 +182,7 @@ class CustomModuleCategoryController extends BaseController | ||
| 182 | * @method :post | 182 | * @method :post |
| 183 | * @time :2024/1/11 9:46 | 183 | * @time :2024/1/11 9:46 |
| 184 | */ | 184 | */ |
| 185 | - public function allSort(CustomModuleContentLogic $logic){ | 185 | + public function allSort(CustomModuleCategoryLogic $logic){ |
| 186 | $logic->setAllSort(); | 186 | $logic->setAllSort(); |
| 187 | $this->response('success'); | 187 | $this->response('success'); |
| 188 | } | 188 | } |
| @@ -106,9 +106,10 @@ class FileManageController extends BaseController | @@ -106,9 +106,10 @@ class FileManageController extends BaseController | ||
| 106 | public function getOnlyFilename($name,$project_id = 0){ | 106 | public function getOnlyFilename($name,$project_id = 0){ |
| 107 | $nameArr = explode('.',$name); | 107 | $nameArr = explode('.',$name); |
| 108 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); | 108 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); |
| 109 | + $fileName = $enName; | ||
| 109 | $i=1; | 110 | $i=1; |
| 110 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 111 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 111 | - $enName = $enName .'-'.$i; | 112 | + $enName = $fileName .'_'.$i; |
| 112 | $i++; | 113 | $i++; |
| 113 | } | 114 | } |
| 114 | return $enName.'.'.$nameArr[1]; | 115 | return $enName.'.'.$nameArr[1]; |
| @@ -330,4 +330,15 @@ class NewsController extends BaseController | @@ -330,4 +330,15 @@ class NewsController extends BaseController | ||
| 330 | $lists = $news->list($this->map); | 330 | $lists = $news->list($this->map); |
| 331 | $this->response('success',Code::SUCCESS,$lists); | 331 | $this->response('success',Code::SUCCESS,$lists); |
| 332 | } | 332 | } |
| 333 | + | ||
| 334 | + /** | ||
| 335 | + * @remark :复制新闻 | ||
| 336 | + * @name :copyNews | ||
| 337 | + * @author :lyh | ||
| 338 | + * @method :post | ||
| 339 | + * @time :2024/4/28 11:53 | ||
| 340 | + */ | ||
| 341 | + public function copyNews(NewsModel $news){ | ||
| 342 | + | ||
| 343 | + } | ||
| 333 | } | 344 | } |
| @@ -166,9 +166,10 @@ class FileController | @@ -166,9 +166,10 @@ class FileController | ||
| 166 | public function getOnlyFilename($name,$project_id = 0){ | 166 | public function getOnlyFilename($name,$project_id = 0){ |
| 167 | $nameArr = explode('.',$name); | 167 | $nameArr = explode('.',$name); |
| 168 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); | 168 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); |
| 169 | + $fileName = $enName; | ||
| 169 | $i=1; | 170 | $i=1; |
| 170 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 171 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 171 | - $enName = $enName .'-'.$i; | 172 | + $enName = $fileName .'_'.$i; |
| 172 | $i++; | 173 | $i++; |
| 173 | } | 174 | } |
| 174 | return $enName.'.'.$nameArr[1]; | 175 | return $enName.'.'.$nameArr[1]; |
| @@ -226,9 +226,10 @@ class ImageController extends Controller | @@ -226,9 +226,10 @@ class ImageController extends Controller | ||
| 226 | public function getOnlyFilename($name,$project_id = 0){ | 226 | public function getOnlyFilename($name,$project_id = 0){ |
| 227 | $nameArr = explode('.',$name); | 227 | $nameArr = explode('.',$name); |
| 228 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); | 228 | $enName = generateRoute(Translate::tran($nameArr[0], 'en')); |
| 229 | + $fileName = $enName; | ||
| 229 | $i=1; | 230 | $i=1; |
| 230 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ | 231 | while($this->onlyName($enName.'.'.$nameArr[1],$project_id)){ |
| 231 | - $enName = $enName .'-'.$i; | 232 | + $enName = $fileName .'_'.$i; |
| 232 | $i++; | 233 | $i++; |
| 233 | } | 234 | } |
| 234 | return $enName.'.'.$nameArr[1]; | 235 | return $enName.'.'.$nameArr[1]; |
| @@ -4,8 +4,11 @@ namespace App\Http\Logic\Bside\Blog; | @@ -4,8 +4,11 @@ namespace App\Http\Logic\Bside\Blog; | ||
| 4 | 4 | ||
| 5 | use App\Helper\Translate; | 5 | use App\Helper\Translate; |
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | +use App\Models\Blog\Blog; | ||
| 7 | use App\Models\Blog\Blog as BlogModel; | 8 | use App\Models\Blog\Blog as BlogModel; |
| 9 | +use App\Models\Blog\BlogCategory; | ||
| 8 | use App\Models\Blog\BlogCategory as BlogCategoryModel; | 10 | use App\Models\Blog\BlogCategory as BlogCategoryModel; |
| 11 | +use App\Models\News\NewsCategory as NewsCategoryModel; | ||
| 9 | use App\Models\RouteMap\RouteMap; | 12 | use App\Models\RouteMap\RouteMap; |
| 10 | use Illuminate\Support\Facades\DB; | 13 | use Illuminate\Support\Facades\DB; |
| 11 | 14 | ||
| @@ -90,32 +93,13 @@ class BlogCategoryLogic extends BaseLogic | @@ -90,32 +93,13 @@ class BlogCategoryLogic extends BaseLogic | ||
| 90 | */ | 93 | */ |
| 91 | public function delBlogCategory(){ | 94 | public function delBlogCategory(){ |
| 92 | foreach ($this->param['id'] as $id){ | 95 | foreach ($this->param['id'] as $id){ |
| 93 | - $this->verifyIsDelete($id); | ||
| 94 | //删除路由 | 96 | //删除路由 |
| 95 | $this->delRoute($id); | 97 | $this->delRoute($id); |
| 96 | $this->model->del(['id'=>$id]); | 98 | $this->model->del(['id'=>$id]); |
| 97 | - } | ||
| 98 | - return $this->success(); | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - /** | ||
| 102 | - * @remark :验证是否可删除 | ||
| 103 | - * @name :VerifyIsDelete | ||
| 104 | - * @author :lyh | ||
| 105 | - * @method :post | ||
| 106 | - * @time :2023/9/7 14:40 | ||
| 107 | - */ | ||
| 108 | - public function verifyIsDelete($id){ | ||
| 109 | - //查询是否有子分类 | ||
| 110 | - $rs = $this->model->read(['pid'=>$id],['id']); | ||
| 111 | - if($rs !== false){ | ||
| 112 | - $this->response('当前分类拥有子分类不允许删除'); | ||
| 113 | - } | ||
| 114 | - //查看当前分内下是否有博客 | ||
| 115 | - $blogModel = new BlogModel(); | ||
| 116 | - $rs = $blogModel->read(['category_id'=>['like','%,'.$id.',%']],['id']); | ||
| 117 | - if($rs !== false){ | ||
| 118 | - $this->response('当前分类拥有博客,不允许删除'); | 99 | + //同步删除产品字段category_id |
| 100 | + $blogModel = new Blog(); | ||
| 101 | + $blogModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]); | ||
| 102 | + $blogModel->edit(['category_id'=>null],['category_id'=>',']); | ||
| 119 | } | 103 | } |
| 120 | return $this->success(); | 104 | return $this->success(); |
| 121 | } | 105 | } |
| @@ -189,18 +189,13 @@ class CustomModuleCategoryLogic extends BaseLogic | @@ -189,18 +189,13 @@ class CustomModuleCategoryLogic extends BaseLogic | ||
| 189 | public function categoryDel(){ | 189 | public function categoryDel(){ |
| 190 | $ids = $this->param['id']; | 190 | $ids = $this->param['id']; |
| 191 | foreach ($ids as $id){ | 191 | foreach ($ids as $id){ |
| 192 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 193 | - if($info !== false){ | ||
| 194 | - $this->fail('分类id:'.$id.'拥有子集不允许删除'); | ||
| 195 | - } | ||
| 196 | - $contentModel = new CustomModuleContent(); | ||
| 197 | - $contentInfo = $contentModel->read(['category_id'=>['like','%,'.$id.',%']]); | ||
| 198 | - if($contentInfo !== false){ | ||
| 199 | - $this->fail('当前分类拥有产品不允许删除'); | ||
| 200 | - } | ||
| 201 | //删除路由 | 192 | //删除路由 |
| 202 | $this->delRoute($id); | 193 | $this->delRoute($id); |
| 203 | $this->model->del(['id'=>$id]); | 194 | $this->model->del(['id'=>$id]); |
| 195 | + //同步删除产品字段category_id | ||
| 196 | + $contentModel = new CustomModuleContent(); | ||
| 197 | + $contentModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]); | ||
| 198 | + $contentModel->edit(['category_id'=>null],['category_id'=>',']); | ||
| 204 | } | 199 | } |
| 205 | return $this->success(); | 200 | return $this->success(); |
| 206 | } | 201 | } |
| @@ -4,8 +4,10 @@ namespace App\Http\Logic\Bside\News; | @@ -4,8 +4,10 @@ namespace App\Http\Logic\Bside\News; | ||
| 4 | 4 | ||
| 5 | use App\Helper\Translate; | 5 | use App\Helper\Translate; |
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | +use App\Models\News\News; | ||
| 7 | use App\Models\News\News as NewsModel; | 8 | use App\Models\News\News as NewsModel; |
| 8 | use App\Models\News\NewsCategory as NewsCategoryModel; | 9 | use App\Models\News\NewsCategory as NewsCategoryModel; |
| 10 | +use App\Models\Product\Product; | ||
| 9 | use App\Models\RouteMap\RouteMap; | 11 | use App\Models\RouteMap\RouteMap; |
| 10 | use Illuminate\Support\Facades\DB; | 12 | use Illuminate\Support\Facades\DB; |
| 11 | 13 | ||
| @@ -88,19 +90,12 @@ class NewsCategoryLogic extends BaseLogic | @@ -88,19 +90,12 @@ class NewsCategoryLogic extends BaseLogic | ||
| 88 | */ | 90 | */ |
| 89 | public function del_news_category(){ | 91 | public function del_news_category(){ |
| 90 | foreach ($this->param['id'] as $id){ | 92 | foreach ($this->param['id'] as $id){ |
| 91 | - //查询是否有子分类 | ||
| 92 | - $rs = $this->model->read(['pid'=>$id],['id']); | ||
| 93 | - if($rs !== false){ | ||
| 94 | - $this->fail('当前分类拥有子分类不允许删除'); | ||
| 95 | - } | ||
| 96 | - //查看当前分内下是否有商品 | ||
| 97 | - $newsModel = new NewsModel(); | ||
| 98 | - $rs = $newsModel->read(['category_id'=>$id],['id']); | ||
| 99 | - if($rs !== false){ | ||
| 100 | - $this->fail('当前分类拥有商品,不允许删除'); | ||
| 101 | - } | ||
| 102 | $this->delRoute($id); | 93 | $this->delRoute($id); |
| 103 | $this->model->del(['id'=>$id]); | 94 | $this->model->del(['id'=>$id]); |
| 95 | + //同步删除产品字段category_id | ||
| 96 | + $newsModel = new NewsModel(); | ||
| 97 | + $newsModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]); | ||
| 98 | + $newsModel->edit(['category_id'=>null],['category_id'=>',']); | ||
| 104 | } | 99 | } |
| 105 | return $this->success(); | 100 | return $this->success(); |
| 106 | } | 101 | } |
| @@ -168,18 +168,16 @@ class CategoryLogic extends BaseLogic | @@ -168,18 +168,16 @@ class CategoryLogic extends BaseLogic | ||
| 168 | public function categoryDelete(){ | 168 | public function categoryDelete(){ |
| 169 | $ids = $this->param['ids']; | 169 | $ids = $this->param['ids']; |
| 170 | foreach ($ids as $id){ | 170 | foreach ($ids as $id){ |
| 171 | - $info = $this->model->read(['pid'=>$id],['id']); | ||
| 172 | - if($info !== false){ | ||
| 173 | - $this->fail('分类id:'.$id.'拥有子集不允许删除'); | ||
| 174 | - } | ||
| 175 | - $productModel = new Product(); | ||
| 176 | - $product_info = $productModel->read(['category_id'=>['like','%,'.$id.',%']]); | ||
| 177 | - if($product_info !== false){ | ||
| 178 | - $this->fail('当前分类拥有产品不允许删除'); | ||
| 179 | - } | ||
| 180 | //删除路由 | 171 | //删除路由 |
| 181 | $this->delRoute($id); | 172 | $this->delRoute($id); |
| 182 | $this->model->del(['id'=>$id]); | 173 | $this->model->del(['id'=>$id]); |
| 174 | + //同步删除关联表 | ||
| 175 | + $categoryRelatedModel = new CategoryRelated(); | ||
| 176 | + $categoryRelatedModel->del(['cate_id'=>$id]); | ||
| 177 | + //同步删除产品字段category_id | ||
| 178 | + $productModel = new Product(); | ||
| 179 | + $productModel->edit(['category_id'=>DB::raw("REPLACE(category_id, ',$id,' , ',')")],['category_id'=>['like','%,'.$id.',%']]); | ||
| 180 | + $productModel->edit(['category_id'=>null],['category_id'=>',']); | ||
| 183 | } | 181 | } |
| 184 | //清除缓存 | 182 | //清除缓存 |
| 185 | Common::del_user_cache('product_category',$this->user['project_id']); | 183 | Common::del_user_cache('product_category',$this->user['project_id']); |
-
请 注册 或 登录 后发表评论