作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into develop

@@ -55,8 +55,9 @@ class UpdateController extends BaseController @@ -55,8 +55,9 @@ class UpdateController extends BaseController
55 $list = DB::connection('custom_mysql')->table('gl_product')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray(); 55 $list = DB::connection('custom_mysql')->table('gl_product')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
56 if(!empty($list)){ 56 if(!empty($list)){
57 foreach ($list as $v){ 57 foreach ($list as $v){
  58 + $v = (array)$v;
58 if(!empty($v['seo_mate'])){ 59 if(!empty($v['seo_mate'])){
59 - $seo_arr = $v['seo_mate']; 60 + $seo_arr = json_decode($v['seo_mate'], true);
60 //更新seo_title 61 //更新seo_title
61 if(!isset($seo_arr['title'])){ 62 if(!isset($seo_arr['title'])){
62 //生成seo_title 63 //生成seo_title
@@ -89,6 +90,7 @@ class UpdateController extends BaseController @@ -89,6 +90,7 @@ class UpdateController extends BaseController
89 $list = DB::connection('custom_mysql')->table('gl_news')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray(); 90 $list = DB::connection('custom_mysql')->table('gl_news')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
90 if(!empty($list)){ 91 if(!empty($list)){
91 foreach ($list as $k => $v){ 92 foreach ($list as $k => $v){
  93 + $v = (array)$v;
92 $data = []; 94 $data = [];
93 if(empty($v['seo_title'])){ 95 if(empty($v['seo_title'])){
94 $data['seo_title'] = $this->ai_send('news_seo_title',$v['name']); 96 $data['seo_title'] = $this->ai_send('news_seo_title',$v['name']);
@@ -116,6 +118,7 @@ class UpdateController extends BaseController @@ -116,6 +118,7 @@ class UpdateController extends BaseController
116 $list = DB::connection('custom_mysql')->table('gl_blog')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray(); 118 $list = DB::connection('custom_mysql')->table('gl_blog')->where(['status'=>1,'project_id'=>$project_id])->get()->toArray();
117 if(!empty($list)){ 119 if(!empty($list)){
118 foreach ($list as $k => $v){ 120 foreach ($list as $k => $v){
  121 + $v = (array)$v;
119 $data = []; 122 $data = [];
120 if(empty($v['seo_title'])){ 123 if(empty($v['seo_title'])){
121 $data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']); 124 $data['seo_title'] = $this->ai_send('blog_seo_title',$v['name']);
@@ -571,18 +571,36 @@ class ProjectController extends BaseController @@ -571,18 +571,36 @@ class ProjectController extends BaseController
571 */ 571 */
572 public function getProjectByChannel(){ 572 public function getProjectByChannel(){
573 $id = $this->param['id'] ?? []; 573 $id = $this->param['id'] ?? [];
574 - $source_id = $this->param['channel_id']; //原系统渠道id 574 + $source_id = $this->param['channel_id'] ?? 0; //原系统渠道id
575 $size = $this->param['page_size'] ?? 20; 575 $size = $this->param['page_size'] ?? 20;
576 $type = $this->param['type'] ?? ''; 576 $type = $this->param['type'] ?? '';
577 $company = $this->param['company'] ?? ''; 577 $company = $this->param['company'] ?? '';
  578 +
  579 + if(!$source_id && !$id){
  580 + $this->response('参数异常',Code::SYSTEM_ERROR);
  581 + }
  582 +
  583 + $channel_id = 0;
  584 + if($source_id){
578 $channel = Channel::where('source_id', $source_id)->first(); 585 $channel = Channel::where('source_id', $source_id)->first();
579 if(!$channel){ 586 if(!$channel){
580 $this->response('渠道不存在',Code::SYSTEM_ERROR); 587 $this->response('渠道不存在',Code::SYSTEM_ERROR);
581 } 588 }
582 - if ($id && FALSE == is_array($id)) 589 + $channel_id = $channel->id;
  590 + }
  591 +
  592 + if ($id){
  593 + if(!is_array($id)){
583 $id = explode(',', $id); 594 $id = explode(',', $id);
  595 + }
  596 + }
584 597
585 - $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])->where(['channel->channel_id' => $channel->id, 'delete_status' => 0])->where(function ($query) use ($type, $company, $id){ 598 + $data = Project::with(['deploy_build', 'deploy_optimize', 'online_check'])
  599 + ->where('delete_status', 0)
  600 + ->where(function ($query) use ($channel_id, $type, $company, $id){
  601 + if ($channel_id) {
  602 + $query->where('channel->channel_id', $channel_id);
  603 + }
586 if ($type) { 604 if ($type) {
587 $query->where('type', $type); 605 $query->where('type', $type);
588 } 606 }