作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -56,15 +56,15 @@ class UpdateRoute extends Command @@ -56,15 +56,15 @@ class UpdateRoute extends Command
56 */ 56 */
57 public function handle(){ 57 public function handle(){
58 $projectModel = new Project(); 58 $projectModel = new Project();
59 - $list = $projectModel->list(['id'=>['in',[2321]]]); 59 + $list = $projectModel->list(['id'=>['in',[1871]]]);
60 $data = []; 60 $data = [];
61 foreach ($list as $v){ 61 foreach ($list as $v){
62 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 62 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
63 ProjectServer::useProject($v['id']); 63 ProjectServer::useProject($v['id']);
64 -// $this->getProduct(); 64 + $this->getProduct();
65 // $this->setProductKeyword(); 65 // $this->setProductKeyword();
66 // $this->getBlog(); 66 // $this->getBlog();
67 - $this->setCustomRoute($v['id']); 67 +// $this->setCustomRoute($v['id']);
68 DB::disconnect('custom_mysql'); 68 DB::disconnect('custom_mysql');
69 } 69 }
70 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 70 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -222,18 +222,18 @@ class UpdateRoute extends Command @@ -222,18 +222,18 @@ class UpdateRoute extends Command
222 if(!empty($lists)){ 222 if(!empty($lists)){
223 foreach ($lists as $v){ 223 foreach ($lists as $v){
224 if(!empty($v['route'])){ 224 if(!empty($v['route'])){
225 -// $tag = "-product";  
226 -// if (!(substr($v['route'], -strlen($tag)) === $tag)) {  
227 -// echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;  
228 -// $route = $v['route'].$tag;  
229 -// // 如果不是以 '-product' 结尾,则拼接上 '-product'  
230 -// $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);  
231 -// $productModel->edit(['route'=>$route],['id'=>$v['id']]);  
232 -// }else{ 225 + $tag = "-product";
  226 + if (!(substr($v['route'], -strlen($tag)) === $tag)) {
  227 + echo date('Y-m-d H:i:s') . '拼接'.$tag . PHP_EOL;
  228 + $route = $v['route'].$tag;
  229 + // 如果不是以 '-product' 结尾,则拼接上 '-product'
  230 + $route = RouteMap::setRoute($route, RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
  231 + $productModel->edit(['route'=>$route],['id'=>$v['id']]);
  232 + }else{
233 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; 233 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
234 $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']); 234 $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT, $v['id'], $v['project_id']);
235 $productModel->edit(['route'=>$route],['id'=>$v['id']]); 235 $productModel->edit(['route'=>$route],['id'=>$v['id']]);
236 -// } 236 + }
237 continue; 237 continue;
238 }else{ 238 }else{
239 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; 239 echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL;
@@ -153,6 +153,10 @@ class ComController extends BaseController @@ -153,6 +153,10 @@ class ComController extends BaseController
153 if($projectCode != 1){ 153 if($projectCode != 1){
154 $data[] = 50; 154 $data[] = 50;
155 } 155 }
  156 + $is_subscribe = $this->getIsSubscribe();
  157 + if(!$is_subscribe){
  158 + $data[] = 52;
  159 + }
156 if(!empty($data)){ 160 if(!empty($data)){
157 $this->map['id'] = ['not in',$data]; 161 $this->map['id'] = ['not in',$data];
158 } 162 }
@@ -24,7 +24,7 @@ class CommentController extends BaseController @@ -24,7 +24,7 @@ class CommentController extends BaseController
24 */ 24 */
25 public function lists(){ 25 public function lists(){
26 $commentModel = new Comment(); 26 $commentModel = new Comment();
27 - $lists = $commentModel->list(); 27 + $lists = $commentModel->lists($this->map,$this->page,$this->row);
28 $this->response('success',Code::SUCCESS,$lists); 28 $this->response('success',Code::SUCCESS,$lists);
29 } 29 }
30 30
@@ -153,7 +153,7 @@ class FileManageController extends BaseController @@ -153,7 +153,7 @@ class FileManageController extends BaseController
153 if($file->getSize()/1024/1024 > $this->upload_config['upload_max_size']){ 153 if($file->getSize()/1024/1024 > $this->upload_config['upload_max_size']){
154 $this->fail('超出最大允许上传文件大小:'. $this->upload_config['upload_max_size'] .'M'); 154 $this->fail('超出最大允许上传文件大小:'. $this->upload_config['upload_max_size'] .'M');
155 } 155 }
156 - $extension = $file->getClientOriginalExtension(); 156 + $extension = strtolower($file->getClientOriginalExtension());
157 if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){ 157 if(!in_array($extension, explode(',', $this->upload_config['allow_file_type']))){
158 $this->fail('不允许上传的文件类型'); 158 $this->fail('不允许上传的文件类型');
159 } 159 }
@@ -47,7 +47,40 @@ class ProductController extends BaseController @@ -47,7 +47,40 @@ class ProductController extends BaseController
47 */ 47 */
48 public function index(Product $product) 48 public function index(Product $product)
49 { 49 {
50 - $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' , 'intro' , 'content' , 50 + $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,
  51 + 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
  52 + $this->order = 'sort';
  53 + $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc');
  54 + $query = $this->searchParam($query);
  55 + $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
  56 + if(!empty($lists)){
  57 + $lists = $lists->toArray();
  58 + $cate_data = $this->getCategoryList();//分类
  59 + $key_data = $this->keywordNameLists($lists['list']);//关键字
  60 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
  61 + $userModel = new User();
  62 + foreach ($lists['list'] as $k=>$v){
  63 + $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_PRODUCT,$v['id']);
  64 + $v['category_id_text'] = $this->categoryName($v['id'],$cate_data);
  65 + $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
  66 + $v['created_uid_text'] = $userModel->getName($v['created_uid']);
  67 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
  68 + $v = $this->getHandleFileImage($v);
  69 + $lists['list'][$k] = $v;
  70 + }
  71 + }
  72 + $this->response('success',Code::SUCCESS,$lists);
  73 + }
  74 + /**
  75 + * @remark :列表
  76 + * @name :index
  77 + * @author :lyh
  78 + * @method :post
  79 + * @time :2023/8/28 16:30
  80 + */
  81 + public function downloadProduct(Product $product)
  82 + {
  83 + $filed = ['id', 'project_id', 'title', 'sort' ,'thumb' ,'product_type' , 'route' ,'intro','content',
51 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read']; 84 'category_id', 'keyword_id', 'status', 'created_uid', 'is_upgrade' ,'created_at', 'updated_at','six_read'];
52 $this->order = 'sort'; 85 $this->order = 'sort';
53 $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc'); 86 $query = $product->orderBy($this->order ,'desc')->orderBy('id','desc');
@@ -71,7 +104,6 @@ class ProductController extends BaseController @@ -71,7 +104,6 @@ class ProductController extends BaseController
71 } 104 }
72 $this->response('success',Code::SUCCESS,$lists); 105 $this->response('success',Code::SUCCESS,$lists);
73 } 106 }
74 -  
75 /** 107 /**
76 * @remark :获取当前页的所有关键字名称 108 * @remark :获取当前页的所有关键字名称
77 * @name :keywordNameLists 109 * @name :keywordNameLists
@@ -86,6 +86,7 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -86,6 +86,7 @@ class CustomModuleCategoryLogic extends BaseLogic
86 $this->fail('当前数据不存在或已被删除'); 86 $this->fail('当前数据不存在或已被删除');
87 } 87 }
88 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); 88 $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']);
  89 + $info['banner_image'] = getImageUrl($info['banner_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
89 return $this->success($info); 90 return $this->success($info);
90 } 91 }
91 92
@@ -118,6 +119,9 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -118,6 +119,9 @@ class CustomModuleCategoryLogic extends BaseLogic
118 if(!isset($param['id']) || empty($param['id'])){ 119 if(!isset($param['id']) || empty($param['id'])){
119 $param['project_id'] = $this->user['project_id']; 120 $param['project_id'] = $this->user['project_id'];
120 } 121 }
  122 + if(isset($param['banner_image']) && !empty($param['banner_image'])){
  123 + $param['banner_image'] = str_replace_url($param['banner_image']);
  124 + }
121 if(isset($param['image']) && !empty($param['image'])){ 125 if(isset($param['image']) && !empty($param['image'])){
122 $param['image'] = str_replace_url($param['image']); 126 $param['image'] = str_replace_url($param['image']);
123 } 127 }
@@ -32,10 +32,30 @@ class NewsCategoryLogic extends BaseLogic @@ -32,10 +32,30 @@ class NewsCategoryLogic extends BaseLogic
32 public function info_news_category(){ 32 public function info_news_category(){
33 $info = $this->model->read($this->param); 33 $info = $this->model->read($this->param);
34 $info['url'] = $this->user['domain'] . $info['alias']; 34 $info['url'] = $this->user['domain'] . $info['alias'];
  35 + if(!empty($info['banner_image'])){
  36 + $info['banner_image'] = getImageUrl($info['banner_image'],$this->user['storage_type'] ?? 0,$this->user['project_location']);
  37 + }
35 return $this->success($info); 38 return $this->success($info);
36 } 39 }
37 40
38 /** 41 /**
  42 + * @remark :保存处理字段
  43 + * @name :handleParam
  44 + * @author :lyh
  45 + * @method :post
  46 + * @time :2024/9/13 9:15
  47 + */
  48 + public function handleParam($param)
  49 + {
  50 + if(isset($param['banner_image']) && !empty($param['banner_image'])){
  51 + $param['banner_image'] = str_replace_url($param['banner_image']);
  52 + }
  53 + if(isset($param['image']) && !empty($param['image'])){
  54 + $param['image'] = str_replace_url($param['image']);
  55 + }
  56 + return $this->success($param);
  57 + }
  58 + /**
39 * @remark :保存数据 59 * @remark :保存数据
40 * @name :newsCategorySave 60 * @name :newsCategorySave
41 * @author :lyh 61 * @author :lyh
@@ -45,6 +65,7 @@ class NewsCategoryLogic extends BaseLogic @@ -45,6 +65,7 @@ class NewsCategoryLogic extends BaseLogic
45 public function newsCategorySave(){ 65 public function newsCategorySave(){
46 //验证名称是否存在 66 //验证名称是否存在
47 $this->verifyParamName($this->param['name']); 67 $this->verifyParamName($this->param['name']);
  68 + $this->param = $this->handleParam($this->param);
48 DB::beginTransaction(); 69 DB::beginTransaction();
49 try { 70 try {
50 if(isset($this->param['id']) && !empty($this->param['id'])){ 71 if(isset($this->param['id']) && !empty($this->param['id'])){
@@ -242,6 +242,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -242,6 +242,7 @@ Route::middleware(['bloginauth'])->group(function () {
242 Route::prefix('product')->group(function () { 242 Route::prefix('product')->group(function () {
243 //产品 243 //产品
244 Route::any('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product'); 244 Route::any('/', [\App\Http\Controllers\Bside\Product\ProductController::class, 'index'])->name('product');
  245 + Route::any('/downloadProduct', [\App\Http\Controllers\Bside\Product\ProductController::class, 'downloadProduct'])->name('downloadProduct');
245 Route::any('/productNoPage', [\App\Http\Controllers\Bside\Product\ProductController::class, 'productNoPage'])->name('product_productNoPage'); 246 Route::any('/productNoPage', [\App\Http\Controllers\Bside\Product\ProductController::class, 'productNoPage'])->name('product_productNoPage');
246 Route::any('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info'); 247 Route::any('/info', [\App\Http\Controllers\Bside\Product\ProductController::class, 'info'])->name('product_info');
247 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save'); 248 Route::post('/save', [\App\Http\Controllers\Bside\Product\ProductController::class, 'save'])->name('product_save');