|
@@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic |
|
@@ -599,6 +599,20 @@ class ProductLogic extends BaseLogic |
|
599
|
}
|
599
|
}
|
|
600
|
|
600
|
|
|
601
|
/**
|
601
|
/**
|
|
|
|
602
|
+ * @remark :
|
|
|
|
603
|
+ * @name :setAllSort
|
|
|
|
604
|
+ * @author :lyh
|
|
|
|
605
|
+ * @method :post
|
|
|
|
606
|
+ * @time :2024/1/10 15:40
|
|
|
|
607
|
+ */
|
|
|
|
608
|
+ public function setAllSort(){
|
|
|
|
609
|
+ foreach ($this->param['data'] as $k => $v){
|
|
|
|
610
|
+ $this->model->edit(['sort'=>$v['sort']],['id'=>$v['id']]);
|
|
|
|
611
|
+ }
|
|
|
|
612
|
+ return $this->success();
|
|
|
|
613
|
+ }
|
|
|
|
614
|
+
|
|
|
|
615
|
+ /**
|
|
602
|
* 产品导入
|
616
|
* 产品导入
|
|
603
|
* @param $project_id
|
617
|
* @param $project_id
|
|
604
|
* @param $user_id
|
618
|
* @param $user_id
|
|
@@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic |
|
@@ -722,13 +736,11 @@ class ProductLogic extends BaseLogic |
|
722
|
if($data[10]??''){
|
736
|
if($data[10]??''){
|
|
723
|
$seo_description = substr(strip_tags($data[10]),0,200);
|
737
|
$seo_description = substr(strip_tags($data[10]),0,200);
|
|
724
|
}
|
738
|
}
|
|
725
|
-
|
|
|
|
726
|
$seo_mate = [
|
739
|
$seo_mate = [
|
|
727
|
'title' => $seo_title,
|
740
|
'title' => $seo_title,
|
|
728
|
'keyword' => $seo_keywords,
|
741
|
'keyword' => $seo_keywords,
|
|
729
|
'description' => $seo_description
|
742
|
'description' => $seo_description
|
|
730
|
];
|
743
|
];
|
|
731
|
-
|
|
|
|
732
|
//处理参数
|
744
|
//处理参数
|
|
733
|
$attrs = [];
|
745
|
$attrs = [];
|
|
734
|
if($data[4]??''){
|
746
|
if($data[4]??''){
|
|
@@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic |
|
@@ -746,10 +758,8 @@ class ProductLogic extends BaseLogic |
|
746
|
}
|
758
|
}
|
|
747
|
}
|
759
|
}
|
|
748
|
}
|
760
|
}
|
|
749
|
-
|
|
|
|
750
|
//处理描述切换栏
|
761
|
//处理描述切换栏
|
|
751
|
$describe = [];
|
762
|
$describe = [];
|
|
752
|
-
|
|
|
|
753
|
for ($i=11;$i<=20;$i+=2){
|
763
|
for ($i=11;$i<=20;$i+=2){
|
|
754
|
if(($data[$i]??'') && ($data[$i+1]??'')){
|
764
|
if(($data[$i]??'') && ($data[$i+1]??'')){
|
|
755
|
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc);
|
765
|
preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc);
|
|
@@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic |
|
@@ -759,7 +769,6 @@ class ProductLogic extends BaseLogic |
|
759
|
$new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]);
|
769
|
$new_vdesc_img && $data[$i+1] = str_replace($vdesc_img,$new_vdesc_img,$data[$i+1]);
|
|
760
|
}
|
770
|
}
|
|
761
|
}
|
771
|
}
|
|
762
|
-
|
|
|
|
763
|
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video);
|
772
|
preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $data[$i+1], $result_desc_video);
|
|
764
|
if($result_desc_video[2]??[]){
|
773
|
if($result_desc_video[2]??[]){
|
|
765
|
foreach ($result_desc_video[2] as $vdesc_video){
|
774
|
foreach ($result_desc_video[2] as $vdesc_video){
|
|
@@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic |
|
@@ -776,7 +785,6 @@ class ProductLogic extends BaseLogic |
|
776
|
break;
|
785
|
break;
|
|
777
|
}
|
786
|
}
|
|
778
|
}
|
787
|
}
|
|
779
|
-
|
|
|
|
780
|
$id = $this->model->addReturnId(
|
788
|
$id = $this->model->addReturnId(
|
|
781
|
[
|
789
|
[
|
|
782
|
'project_id' => $project_id,
|
790
|
'project_id' => $project_id,
|
|
@@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic |
|
@@ -794,7 +802,6 @@ class ProductLogic extends BaseLogic |
|
794
|
'status' => Product::STATUS_ON
|
802
|
'status' => Product::STATUS_ON
|
|
795
|
]
|
803
|
]
|
|
796
|
);
|
804
|
);
|
|
797
|
-
|
|
|
|
798
|
//更新路由
|
805
|
//更新路由
|
|
799
|
if($route){
|
806
|
if($route){
|
|
800
|
$route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first();
|
807
|
$route_map = RouteMap::where('project_id', $project_id)->where('source', RouteMap::SOURCE_PRODUCT)->where('source_id', $id)->first();
|
|
@@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic |
|
@@ -810,17 +817,13 @@ class ProductLogic extends BaseLogic |
|
810
|
}else{
|
817
|
}else{
|
|
811
|
$route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
818
|
$route = RouteMap::setRoute($data[0], RouteMap::SOURCE_PRODUCT, $id, $project_id);
|
|
812
|
}
|
819
|
}
|
|
813
|
-
|
|
|
|
814
|
$this->edit(['route' => $route], ['id' => $id]);
|
820
|
$this->edit(['route' => $route], ['id' => $id]);
|
|
815
|
-
|
|
|
|
816
|
//关联分类
|
821
|
//关联分类
|
|
817
|
if($category_arr){
|
822
|
if($category_arr){
|
|
818
|
CategoryRelated::saveRelated($id, $category_arr);
|
823
|
CategoryRelated::saveRelated($id, $category_arr);
|
|
819
|
}
|
824
|
}
|
|
820
|
-
|
|
|
|
821
|
return true;
|
825
|
return true;
|
|
822
|
}
|
826
|
}
|
|
823
|
-
|
|
|
|
824
|
return false;
|
827
|
return false;
|
|
825
|
}
|
828
|
}
|
|
826
|
} |
829
|
} |