作者 赵彬吉
@@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command @@ -33,7 +33,7 @@ class UpgradeProjectCount extends Command
33 protected $description = '升级项目统计'; 33 protected $description = '升级项目统计';
34 34
35 public function handle(){ 35 public function handle(){
36 - $project_id = 769; 36 + $project_id = 528;
37 ProjectServer::useProject($project_id); 37 ProjectServer::useProject($project_id);
38 $this->count($project_id); 38 $this->count($project_id);
39 DB::disconnect('custom_mysql'); 39 DB::disconnect('custom_mysql');
@@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command @@ -36,7 +36,7 @@ class UpgradeProjectCount extends Command
36 protected $description = '升级项目统计'; 36 protected $description = '升级项目统计';
37 37
38 public function handle(){ 38 public function handle(){
39 - $project_id = 769; 39 + $project_id = 528;
40 $oldModel = new UpdateOldInfo(); 40 $oldModel = new UpdateOldInfo();
41 $info = $oldModel->read(['project_id'=>$project_id]); 41 $info = $oldModel->read(['project_id'=>$project_id]);
42 $url = $info['old_domain_online']; 42 $url = $info['old_domain_online'];
@@ -50,7 +50,7 @@ class UpdateProductCategory extends Command @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
50 public function handle(){ 50 public function handle(){
51 //获取所有项目 51 //获取所有项目
52 $projectModel = new Project(); 52 $projectModel = new Project();
53 - $list = $projectModel->list(['id'=>['in',[475]]],'id',['id']); 53 + $list = $projectModel->list(['id'=>['in',[302]]],'id',['id']);
54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; 54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
55 try { 55 try {
56 foreach ($list as $v) { 56 foreach ($list as $v) {
@@ -27,8 +27,6 @@ class ATemplateModuleController extends BaseController @@ -27,8 +27,6 @@ class ATemplateModuleController extends BaseController
27 public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ 27 public function lists(ATemplateModuleLogic $ATemplateModuleLogic){
28 if(isset($this->map['type']) && ($this->map['type'] == 99)){ 28 if(isset($this->map['type']) && ($this->map['type'] == 99)){
29 $this->map['type'] = 99; 29 $this->map['type'] = 99;
30 - }else{  
31 - $this->map['project_id'] = 0;  
32 } 30 }
33 $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); 31 $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order);
34 $this->response('success',Code::SUCCESS,$lists); 32 $this->response('success',Code::SUCCESS,$lists);
@@ -65,7 +65,11 @@ class CustomTemplateLogic extends BaseLogic @@ -65,7 +65,11 @@ class CustomTemplateLogic extends BaseLogic
65 public function customTemplateSave(){ 65 public function customTemplateSave(){
66 $this->param['url'] = str_replace_url($this->param['url']); 66 $this->param['url'] = str_replace_url($this->param['url']);
67 if(isset($this->param['id']) && !empty($this->param['id'])){ 67 if(isset($this->param['id']) && !empty($this->param['id'])){
68 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']); 68 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  69 + $six_read = $this->param['six_read'] ?? 0;//5.0数据时,是否按6.0显示
  70 + if($is_upgrade == 0 || $six_read == 1) {
  71 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
  72 + }
69 $this->editCustomRoute($this->param['url']); 73 $this->editCustomRoute($this->param['url']);
70 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 74 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
71 }else{ 75 }else{
@@ -34,7 +34,11 @@ class BlogLogic extends BaseLogic @@ -34,7 +34,11 @@ class BlogLogic extends BaseLogic
34 try { 34 try {
35 $this->param = $this->paramProcessing($this->param); 35 $this->param = $this->paramProcessing($this->param);
36 if(isset($this->param['id']) && !empty($this->param['id'])){ 36 if(isset($this->param['id']) && !empty($this->param['id'])){
37 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']); 37 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  38 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  39 + if($is_upgrade == 0 || $six_read == 1){
  40 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
  41 + }
38 $route = $this->param['url']; 42 $route = $this->param['url'];
39 $this->edit($this->param,['id'=>$this->param['id']]); 43 $this->edit($this->param,['id'=>$this->param['id']]);
40 }else{ 44 }else{
@@ -195,7 +199,7 @@ class BlogLogic extends BaseLogic @@ -195,7 +199,7 @@ class BlogLogic extends BaseLogic
195 foreach ($category as $v){ 199 foreach ($category as $v){
196 $str .= $v.','; 200 $str .= $v.',';
197 } 201 }
198 - return !empty($str) ? ','.$str : ''; 202 + return !empty(trim($str,',')) ? ','.$str.',' : '';
199 } 203 }
200 204
201 /** 205 /**
@@ -150,6 +150,7 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -150,6 +150,7 @@ class CustomModuleCategoryLogic extends BaseLogic
150 * @time :2023/12/5 10:55 150 * @time :2023/12/5 10:55
151 */ 151 */
152 public function categoryEdit(){ 152 public function categoryEdit(){
  153 +
153 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE, 154 $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE_CATE,
154 $this->param['id'], $this->user['project_id']); 155 $this->param['id'], $this->user['project_id']);
155 $this->editRoute($this->param['id'],$route); 156 $this->editRoute($this->param['id'],$route);
@@ -186,9 +186,12 @@ class CustomModuleContentLogic extends BaseLogic @@ -186,9 +186,12 @@ class CustomModuleContentLogic extends BaseLogic
186 * @time :2023/12/7 15:04 186 * @time :2023/12/7 15:04
187 */ 187 */
188 public function contentEdit(){ 188 public function contentEdit(){
189 - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE,  
190 - $this->param['id'], $this->user['project_id']);  
191 - $this->editRoute($this->param['id'],$route); 189 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//5.0数据 1:6.0
  190 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  191 + if($is_upgrade == 0 || $six_read == 1) {
  192 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_MODULE, $this->param['id'], $this->user['project_id']);
  193 + }
  194 + $this->editRoute($this->param['id'],$this->param['route']);
192 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 195 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
193 if($rs === false){ 196 if($rs === false){
194 $this->fail('系统错误,请连续管理员'); 197 $this->fail('系统错误,请连续管理员');
@@ -64,7 +64,11 @@ class NewsLogic extends BaseLogic @@ -64,7 +64,11 @@ class NewsLogic extends BaseLogic
64 try { 64 try {
65 $this->param = $this->paramProcessing($this->param); 65 $this->param = $this->paramProcessing($this->param);
66 if (isset($this->param['id']) && !empty($this->param['id'])) { 66 if (isset($this->param['id']) && !empty($this->param['id'])) {
67 - $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']); 67 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  68 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  69 + if($is_upgrade == 0 || $six_read == 1) {
  70 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
  71 + }
68 //是否更新路由 72 //是否更新路由
69 $route = $this->param['url']; 73 $route = $this->param['url'];
70 $this->edit($this->param, ['id' => $this->param['id']]); 74 $this->edit($this->param, ['id' => $this->param['id']]);
@@ -213,7 +217,7 @@ class NewsLogic extends BaseLogic @@ -213,7 +217,7 @@ class NewsLogic extends BaseLogic
213 foreach ($category as $v){ 217 foreach ($category as $v){
214 $str .= $v.','; 218 $str .= $v.',';
215 } 219 }
216 - return !empty($str) ? ','.$str : ''; 220 + return !empty(trim($str,',')) ? ','.$str.',' : '';
217 } 221 }
218 222
219 /** 223 /**
@@ -248,7 +248,7 @@ class CategoryLogic extends BaseLogic @@ -248,7 +248,7 @@ class CategoryLogic extends BaseLogic
248 $str .= $v.','; 248 $str .= $v.',';
249 } 249 }
250 } 250 }
251 - return !empty($str) ? ','.$str : ''; 251 + return !empty(trim($str,',')) ? ','.$str.',' : '';
252 } 252 }
253 253
254 /** 254 /**
@@ -46,7 +46,11 @@ class ProductLogic extends BaseLogic @@ -46,7 +46,11 @@ class ProductLogic extends BaseLogic
46 $this->param = $this->handleSaveParam($this->param); 46 $this->param = $this->handleSaveParam($this->param);
47 try { 47 try {
48 if(isset($this->param['id']) && !empty($this->param['id'])){ 48 if(isset($this->param['id']) && !empty($this->param['id'])){
49 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id'],$this->param['six_read'] ?? 1); 49 + $is_upgrade = $this->param['is_upgrade'] ?? 0;//1:5.0数据 0:6.0
  50 + $six_read = $this->param['six_read'] ?? 0;//是否按6.0显示
  51 + if($is_upgrade == 0 || $six_read == 1){
  52 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  53 + }
50 $route = $this->param['route']; 54 $route = $this->param['route'];
51 $this->model->edit($this->param,['id'=>$this->param['id']]); 55 $this->model->edit($this->param,['id'=>$this->param['id']]);
52 $id = $this->param['id']; 56 $id = $this->param['id'];
@@ -193,6 +197,7 @@ class ProductLogic extends BaseLogic @@ -193,6 +197,7 @@ class ProductLogic extends BaseLogic
193 * @time :2023/10/26 9:49 197 * @time :2023/10/26 9:49
194 */ 198 */
195 public function editList(){ 199 public function editList(){
  200 + $category_ids = $this->param['category_id'];
196 $this->param['category_id'] = $this->handleListCategory($this->param['category_id']); 201 $this->param['category_id'] = $this->handleListCategory($this->param['category_id']);
197 $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']); 202 $this->param['keyword_id'] = $this->saveKeyword($this->param['keyword_id']);
198 if(isset($this->param['gallery']) && !empty($this->param['gallery'])){ 203 if(isset($this->param['gallery']) && !empty($this->param['gallery'])){
@@ -211,6 +216,8 @@ class ProductLogic extends BaseLogic @@ -211,6 +216,8 @@ class ProductLogic extends BaseLogic
211 $this->editProductRoute($this->param['id'],$this->param['route']); 216 $this->editProductRoute($this->param['id'],$this->param['route']);
212 } 217 }
213 $this->model->edit($this->param,['id'=>$this->param['id']]); 218 $this->model->edit($this->param,['id'=>$this->param['id']]);
  219 + //产品分类关联
  220 + CategoryRelated::saveRelated($this->param['id'], $category_ids);
214 }catch (\Exception $e){ 221 }catch (\Exception $e){
215 $this->fail('系统错误,请连续管理员'); 222 $this->fail('系统错误,请连续管理员');
216 } 223 }
@@ -313,7 +320,7 @@ class ProductLogic extends BaseLogic @@ -313,7 +320,7 @@ class ProductLogic extends BaseLogic
313 $str .= $v.','; 320 $str .= $v.',';
314 } 321 }
315 } 322 }
316 - return !empty($str) ? ','.$str : ''; 323 + return !empty(trim($str,',')) ? ','.$str.',' : '';
317 } 324 }
318 325
319 /** 326 /**
@@ -111,10 +111,7 @@ class RouteMap extends Base @@ -111,10 +111,7 @@ class RouteMap extends Base
111 * @author zbj 111 * @author zbj
112 * @date 2023/4/17 112 * @date 2023/4/17
113 */ 113 */
114 - public static function setRoute($title, $source, $source_id, $project_id = 0,$is_upgrade = 0){  
115 - if($is_upgrade != 0){//5.0数据编辑路由时,直接返回路由  
116 - return $title;  
117 - } 114 + public static function setRoute($title, $source, $source_id, $project_id = 0){
118 $route = self::generateRoute($title, $source, $source_id, $project_id); 115 $route = self::generateRoute($title, $source, $source_id, $project_id);
119 if(!$route){ 116 if(!$route){
120 throw new \Exception('路由生成失败'); 117 throw new \Exception('路由生成失败');