作者 刘锟

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

@@ -62,11 +62,11 @@ class UpdateBuildConfiguration extends Command @@ -62,11 +62,11 @@ class UpdateBuildConfiguration extends Command
62 */ 62 */
63 public function handle(){ 63 public function handle(){
64 $projectModel = new Project(); 64 $projectModel = new Project();
65 - $list = $projectModel->list(['delete_status'=>0,'id'=>['in',[1718]]],'id',['id'],'asc'); 65 + $list = $projectModel->list(['delete_status'=>0,'id'=>3050],'id',['id'],'asc');
66 foreach ($list as $k => $v){ 66 foreach ($list as $k => $v){
67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 67 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
68 ProjectServer::useProject($v['id']); 68 ProjectServer::useProject($v['id']);
69 - $this->getProduct(); 69 + $this->getProduct($v['id']);
70 DB::disconnect('custom_mysql'); 70 DB::disconnect('custom_mysql');
71 } 71 }
72 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 72 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -79,7 +79,14 @@ class UpdateBuildConfiguration extends Command @@ -79,7 +79,14 @@ class UpdateBuildConfiguration extends Command
79 * @method :post 79 * @method :post
80 * @time :2024/12/11 14:40 80 * @time :2024/12/11 14:40
81 */ 81 */
82 - public function getProduct(){ 82 + public function getProduct($project_id){
  83 +// $productModel = new Product();
  84 +// $product_list = $productModel->formatQuery(['status'=>1,'content'=>['!=',null]])->count();
  85 +// $detailModel = new Detail();
  86 +// $lists = $detailModel->count();
  87 +// if(($product_list > 0) && ($lists == 0)){
  88 +// echo date('Y-m-d H:i:s') . '需要处理的项目:'.$project_id . PHP_EOL;
  89 +// }
83 Detail::truncate(); 90 Detail::truncate();
84 Column::truncate(); 91 Column::truncate();
85 $c = new Column(); 92 $c = new Column();
@@ -199,11 +199,15 @@ class ProjectController extends BaseController @@ -199,11 +199,15 @@ class ProjectController extends BaseController
199 * @return mixed 199 * @return mixed
200 */ 200 */
201 public function searchContent(&$query){ 201 public function searchContent(&$query){
202 - if(!empty($this->map['domain'])){  
203 - $parsedUrl = parse_url($this->map['domain']);  
204 - $domain = $parsedUrl['host'] ?? $this->map['domain'];  
205 - $ids = DomainInfo::where('domain', 'like', '%'.$domain.'%')->pluck('id')->toArray();  
206 - $query->whereIn('gl_project_deploy_optimize.domain', $ids); 202 + if(!empty($this->map['domain_type']) && !empty($this->map['domain_search'])){
  203 + if($this->map['domain_type'] == 'domain'){
  204 + $parsedUrl = parse_url($this->map['domain_search']);
  205 + $this->map['domain_search'] = $parsedUrl['host'] ?? $this->map['domain_search'];
  206 + $ids = DomainInfo::where('domain', 'like', '%'.$this->map['domain_search'].'%')->pluck('id')->toArray();
  207 + $query->whereIn('gl_project_deploy_optimize.domain', $ids);
  208 + }else{
  209 + $query->where('gl_project_deploy_build.test_domain','like','%'.$this->map['domain_search'].'%');
  210 + }
207 } 211 }
208 if(!empty($this->map['search']) && !empty($this->map['search_type'])){ 212 if(!empty($this->map['search']) && !empty($this->map['search_type'])){
209 $query->where(function ($subQuery) { 213 $query->where(function ($subQuery) {
@@ -550,17 +550,32 @@ class ProductLogic extends BaseLogic @@ -550,17 +550,32 @@ class ProductLogic extends BaseLogic
550 public function copyColumn($product_id,$new_product_id){ 550 public function copyColumn($product_id,$new_product_id){
551 $columnModel = new Column(); 551 $columnModel = new Column();
552 $columnList = $columnModel->list(['product_id'=>$product_id]); 552 $columnList = $columnModel->list(['product_id'=>$product_id]);
553 - if(!empty($columnInfo)){  
554 - $data = []; 553 + if(!empty($columnList)){
555 foreach ($columnList as $k => $v){ 554 foreach ($columnList as $k => $v){
  555 + $column_id = $v['id'];
556 unset($v['id']); 556 unset($v['id']);
557 $v['product_id'] = $new_product_id; 557 $v['product_id'] = $new_product_id;
558 - $v['created_at'] = date('Y-m-d H:i:s');  
559 - $v['updated_at'] = date('Y-m-d H:i:s');  
560 - $data[] = $v; 558 + $column_news_id = $columnModel->addReturnId($v);
  559 + //执行新增描述
  560 + $detailModel = new Detail();
  561 + $detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>$column_id]);
  562 + if(!empty($detailList)){
  563 + $data = [];
  564 + foreach ($detailList as $val){
  565 + unset($val['id']);
  566 + $val['css'] = Arr::a2s($val['css']);
  567 + $val['content'] = Arr::a2s($val['content']);
  568 + $val['product_id'] = $new_product_id;
  569 + $val['column_id'] = $column_news_id;
  570 + $val['created_at'] = date('Y-m-d H:i:s');
  571 + $val['updated_at'] = date('Y-m-d H:i:s');
  572 + $data[] = $val;
  573 + }
  574 + $detailModel->insert($data);
  575 + }
561 } 576 }
562 - return $columnModel->insert($data);  
563 } 577 }
  578 + return $this->success();
564 } 579 }
565 580
566 /** 581 /**
@@ -572,8 +587,8 @@ class ProductLogic extends BaseLogic @@ -572,8 +587,8 @@ class ProductLogic extends BaseLogic
572 */ 587 */
573 public function copyDetail($product_id,$new_product_id){ 588 public function copyDetail($product_id,$new_product_id){
574 $detailModel = new Detail(); 589 $detailModel = new Detail();
575 - $detailList = $detailModel->list(['product_id'=>$product_id]);  
576 - if(!empty($columnInfo)){ 590 + $detailList = $detailModel->list(['product_id'=>$product_id,'column_id'=>1]);
  591 + if(!empty($detailList)){
577 $data = []; 592 $data = [];
578 foreach ($detailList as $k => $v){ 593 foreach ($detailList as $k => $v){
579 unset($v['id']); 594 unset($v['id']);
@@ -587,7 +602,6 @@ class ProductLogic extends BaseLogic @@ -587,7 +602,6 @@ class ProductLogic extends BaseLogic
587 return $detailModel->insert($data); 602 return $detailModel->insert($data);
588 } 603 }
589 } 604 }
590 -  
591 /** 605 /**
592 * @remark :复制项目扩展字段 606 * @remark :复制项目扩展字段
593 * @name :copyExtendInfo 607 * @name :copyExtendInfo
@@ -280,7 +280,7 @@ class TranslateLogic extends BaseLogic @@ -280,7 +280,7 @@ class TranslateLogic extends BaseLogic
280 try { 280 try {
281 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 281 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
282 if($info === false){ 282 if($info === false){
283 - $sourceInfo = $this->getRouteSource($this->param['url']); 283 + $sourceInfo = $this->getRouteSource($sendData['new_route']);
284 $param = [ 284 $param = [
285 'type'=>$this->param['type'] ?? 1, 285 'type'=>$this->param['type'] ?? 1,
286 'project_id'=>$this->user['project_id'], 286 'project_id'=>$this->user['project_id'],
@@ -291,7 +291,7 @@ class TranslateLogic extends BaseLogic @@ -291,7 +291,7 @@ class TranslateLogic extends BaseLogic
291 'source_id'=>$sourceInfo['source_id'], 291 'source_id'=>$sourceInfo['source_id'],
292 'is_list'=>$sourceInfo['is_list'], 292 'is_list'=>$sourceInfo['is_list'],
293 'is_custom'=>$sourceInfo['is_custom'], 293 'is_custom'=>$sourceInfo['is_custom'],
294 - 'page'=>$sourceInfo['page'] ?? 0 294 + 'page'=>$sendData['page'] ?? 0
295 ]; 295 ];
296 $id = $this->model->addReturnId($param); 296 $id = $this->model->addReturnId($param);
297 TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]); 297 TranslateData::insert(['trans_id'=>$id,'data'=>json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)]);
@@ -331,7 +331,7 @@ class TranslateLogic extends BaseLogic @@ -331,7 +331,7 @@ class TranslateLogic extends BaseLogic
331 $page = 0; 331 $page = 0;
332 if (is_numeric($route)) { 332 if (is_numeric($route)) {
333 $arr = explode('/',$routes); 333 $arr = explode('/',$routes);
334 - $page = $arr[1]; 334 + $page = $route;
335 $route = $arr[0]; 335 $route = $arr[0];
336 } 336 }
337 $routeModel = new RouteMap(); 337 $routeModel = new RouteMap();