diff --git a/application/api/controller/Publish.php b/application/api/controller/Publish.php index c52d5da..7f6658c 100644 --- a/application/api/controller/Publish.php +++ b/application/api/controller/Publish.php @@ -34,7 +34,24 @@ class Publish extends Base $pra = []; $pra['issn'] = $t_journal_info['issn']; $res = object_to_array(json_decode(myPost($url, $pra))); - $re['stages'] = $res['data']['stages']; + + $stages = $res['data']['stages']; + foreach ($stages as $k =>$v){ + foreach ($v['articles'] as $key =>$val){ + $a = explode('/',$val['doi']); + if(!isset($a[1])){ + continue; + } + $pro_info = $this->production_article_obj->where('doi',$a[1])->where('state',2)->find(); + if (!$pro_info){ + $stages[$k]['articles'][$key]['tg_article_id'] = 0 ; + continue; + } + $stages[$k]['articles'][$key]['tg_article_id'] = $pro_info['article_id']; + } + } + + $re['stages'] = $stages; return jsonSuccess($re); } @@ -167,7 +184,7 @@ class Publish extends Base if(!$check){ $this->addArticleMainEx($product['article_id']); } - $mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select(); + $mains = $this->article_main_obj->where("article_id",$product['article_id'])->whereIn("state",[0,2])->order("sort asc")->select(); if(!$mains){ return jsonError("error"); } @@ -204,7 +221,7 @@ class Publish extends Base if(!$check){ return jsonError("not find"); } - $mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select(); + $mains = $this->article_main_obj->where("article_id",$product['article_id'])->whereIn("state",[0,2])->order("sort asc")->select(); foreach ($mains as $k=>$main) { if($main['type']==0){ continue; @@ -255,10 +272,12 @@ class Publish extends Base if (!$pro_info){ $pid = $this->createEmptyProduction($v); $articles[$k]['refers'] = []; + $articles[$k]['tg_article_id'] = 0 ; $articles[$k]['p_article_id'] = $pid; continue; } $articles[$k]['p_article_id'] = $pro_info['p_article_id']; + $articles[$k]['tg_article_id'] = $pro_info['article_id']; $articles[$k]['refers'] = [];//$this->production_article_refer_obj->where("p_article_id",$pro_info['p_article_id'])->where('state',0)->order("index")->select(); }