This commit is contained in:
wangjinlei
2024-12-22 17:10:15 +08:00
parent 3f03d9357a
commit 145b0ab8a5
4 changed files with 429 additions and 26 deletions

View File

@@ -1113,6 +1113,122 @@ class Production extends Base
return jsonSuccess([]);
}
public function doTypeSettingNew(){
$data = $this->request->post();
$rule = new Validate([
"article_id"=>"require"
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$p_info = $this->production_article_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->find();
if(!$p_info){
return jsonError("error");
}
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
$typesetInfo = [];
$typesetInfo['info_title'] = $p_info['title'];
$typesetInfo['info_type'] = $p_info['type'];
$typesetInfo['doi'] = $p_info['doi'];
$typesetInfo['topic'] = '';
// $typesetInfo['mainText'] = $p_info['main'];
$au_res = $this->authorFormate($p_info['p_article_id']);
$typesetInfo['author'] = $au_res['author'];
$typesetInfo['authorAddress'] = $au_res['address'];
$typesetInfo['authorContribution'] = $p_info['author_contribution'];
//查询通讯作者
$corr_authors = $this->production_article_author_obj->where('p_article_id', $p_info['p_article_id'])->where('is_report', 1)->where('state', 0)->select();
$corrauthor = '';
$corremail = '';
foreach ($corr_authors as $v) {
$corrauthor .= trim($v['first_name']) . ' ' . trim($v['last_name']) . '. ';
$corremail .= $v['email'] . '. ';
}
$typesetInfo['authorCorresponding'] = substr(trim($corrauthor), 0, -1);
$typesetInfo['authorCorrespondingEmail'] = substr(trim($corremail), 0, -1);
$typesetInfo['traditon'] = $p_info['tradition'];
$typesetInfo['journal'] = $journal_info['title'];
$typesetInfo['jabbr'] = $journal_info['jabbr'];
//查询分期
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
$cs['journal_stage_id'] = $p_info['journal_stage_id'];
$list = object_to_array(json_decode(myPost($url, $cs)));
$stage_re = $list['data']['stage'];
$typesetInfo['stage'] = $stage_re['stage_year'] . ';' . $stage_re['stage_vol'] . '(' . $stage_re['stage_no'] . '):' . $p_info['npp']; //2022;6(1):17
$typesetInfo['little_author'] = $p_info['abbr'];
$typesetInfo['website'] = $journal_info['website'];
$typesetInfo['acknowledgment'] = $p_info['acknowledgment'];
$typesetInfo['received_date'] = date("d F Y", $article_info['ctime']);;
$typesetInfo['accepted_date'] = date("d F Y", $article_info['rtime']);
$typesetInfo['online_date'] = $p_info['pub_date']; //这里可能会有问题
$typesetInfo['abbreviation'] = $p_info['abbreviation'];
$typesetInfo['abstractText'] = $p_info['abstract'];
$typesetInfo['keywords'] = $p_info['keywords'];
$typesetInfo['userAccount'] = $editor_info['nickname'];
$files = $this->article_file_obj
->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt')
->order('ctime desc')
->limit(1)
->select();
if (count($files) == 0) {
return jsonError('No Manuscript');
}
$typesetInfo['filename'] = "http://api.tmrjournals.com/public/" . $files[0]['file_url'];
$rs = $this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where('state', 0)->order("index")->select();
$typesetInfo['refers'] = json_encode($rs);
$main_list = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort")->select();
$mainList = [];
$images = [];
$tables = [];
foreach ($main_list as $k =>$item){
$main_string = "";
if($item['type']==1){
$info = $this->article_main_image_obj->where("ami_id",$item['ami_id'])->find();
$arr['image'] = $info['url'];
$arr['note'] = $info['note'];
$images[$info['ami_id']] = $arr;
$main_string = "<img src='https://submission.tmrjournals.com/public/articleImage/".$info['url']."' imageId='".$info['ami_id']."'/>";
}else if($item['type']==2){
$info = $this->article_main_table_obj->where("amt_id",$item['amt_id'])->find();
$arr_table['title'] = $info['title'];
$arr_table['table_data'] = $info['table_data'];
$arr_table['note'] = $info['note'];
$tables[$info['amt_id']] = $arr_table;
$main_string = "<table tableId='".$info['amt_id']."'/>";
}else{
$main_string = $item['content'];
}
$mainList[] = $main_string;
}
$typesetInfo['mainText'] = json_encode($mainList);
$typesetInfo['images'] = $images;
$typesetInfo['tables'] = $tables;
$url = $this->ts_base_url."api/typeset/webGetDocx";
// $url = "http://192.168.110.110:8081/typeset/createDocx";
$res = object_to_array(json_decode(myPost1($url, $typesetInfo)));
if (!isset($res['data']['file']) || $res['data']['file'] == '') {
return jsonError('create error');
}
return jsonSuccess($res);
}
/**
* 获取生产实例详情
*/