Compare commits

..

38 Commits

Author SHA1 Message Date
chengxl
f17c1e2308 审稿人推荐调整 2026-02-13 16:04:09 +08:00
chengxl
da658e6880 审稿人推荐调整 2026-02-13 15:51:17 +08:00
chengxl
1e210b2ba1 排版相关调整 2026-02-13 13:37:44 +08:00
chengxl
9bace438b9 排版相关调整 2026-02-13 13:35:01 +08:00
chengxl
d411d53a82 排版相关调整 2026-02-13 09:28:58 +08:00
chengxl
da54478a64 排版相关调整 2026-02-12 17:46:55 +08:00
chengxl
62e89e32ec 排版相关调整 2026-02-12 11:40:07 +08:00
chengxl
b215fc1ab8 新增获取文章底部信息方法 2026-02-12 09:48:21 +08:00
chengxl
71c94933f9 新增获取文章底部信息方法 2026-02-12 09:44:00 +08:00
chengxl
46ebbc3f0e 排版相关调整 2026-02-12 09:37:27 +08:00
chengxl
dad360489e 排版相关调整 2026-02-11 13:58:38 +08:00
chengxl
efc766cf1c 排版相关调整 2026-02-11 11:29:27 +08:00
chengxl
9c0f14d8d7 排版相关调整 2026-02-11 11:26:28 +08:00
chengxl
736d32bf91 测试问题修改 2026-02-11 09:39:16 +08:00
chengxl
e9bcaa5c24 判断是否是草稿箱 2026-02-06 17:50:23 +08:00
chengxl
c55e764a48 审稿人机构及草稿状态区分 2026-02-06 17:31:08 +08:00
chengxl
44b88a83ca 新增字段排版相关的 2026-02-06 17:27:43 +08:00
chengxl
6f417f6e9f 判断是否是草稿箱 2026-02-05 13:08:08 +08:00
chengxl
8319777d3e 判断是否是草稿箱 2026-02-04 17:55:28 +08:00
chengxl
71ec3c2ccd 查询终审审稿人的机构调整 2026-02-04 17:27:15 +08:00
chengxl
56dd707f9b 查询终审审稿人的机构调整 2026-02-04 13:37:40 +08:00
chengxl
d2fe34a7a3 排版问题处理 2026-02-04 10:47:40 +08:00
chengxl
2f921a4ea2 查询终审审稿人的机构调整 2026-02-03 17:28:59 +08:00
wangjinlei
e109a84eff Merge remote-tracking branch 'origin/master' 2026-02-03 14:00:03 +08:00
wangjinlei
31da31b252 latex update 2026-02-03 13:59:57 +08:00
chengxl
7c54b4f518 排版图片修改 2026-02-03 13:48:12 +08:00
chengxl
8fe397ff50 排版相关调整 2026-02-03 09:52:07 +08:00
wangjinlei
f9e29ad876 Merge remote-tracking branch 'origin/master' 2026-02-02 11:23:56 +08:00
wangjinlei
875d486ab5 latex update 2026-02-02 11:23:50 +08:00
chengxl
a80897644e 新增方法 2026-01-30 15:58:17 +08:00
chengxl
d518097f18 排版公共方法修改 2026-01-30 15:07:12 +08:00
wangjinlei
63a89b4af7 Merge remote-tracking branch 'origin/master' 2026-01-27 15:44:23 +08:00
wangjinlei
fd6d9de32f latex update 2026-01-27 15:44:19 +08:00
chengxl
0029b96308 处理表格和图片关联 2026-01-27 15:44:05 +08:00
wangjinlei
14e425c057 Merge remote-tracking branch 'origin/master' 2026-01-27 11:22:39 +08:00
wangjinlei
1d0581e46e latex update 2026-01-27 11:22:35 +08:00
chengxl
56e8bb2a17 生成长表格 2026-01-27 10:17:00 +08:00
chengxl
fda672ddc3 排版修改 2026-01-27 10:11:46 +08:00
14 changed files with 1175 additions and 897 deletions

View File

@@ -129,6 +129,12 @@ class Article extends Base
} }
} }
$res[$key]['proof'] = $proof_state; $res[$key]['proof'] = $proof_state;
//新增是否是草稿删除 20260204 start
$res[$key]['is_draft'] = 2;
if(!empty($val['accept_sn']) && substr($val['accept_sn'], 0, 5) === 'Draft'){
$res[$key]['is_draft'] = 1;
}
//新增是否是草稿删除 20260204 end
} }
//返回数据 //返回数据
@@ -585,6 +591,14 @@ class Article extends Base
} }
} }
//查询终审意见 chengxiaoling 20250828 end //查询终审意见 chengxiaoling 20250828 end
//新增是否是草稿删除 20260204 start
if(!empty($article_res)){
$article_res['is_draft'] = 2;
if(!empty($article_res['accept_sn']) && substr($article_res['accept_sn'], 0, 5) === 'Draft'){
$article_res['is_draft'] = 1;
}
}
//新增是否是草稿删除 20260204 end
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res, 'suggest' => $suggest, 'transfer' => $transfer_res, 'transinfo' => $transfer_info, "major" => $major,'suggest_final' => $aFinal]); return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res, 'suggest' => $suggest, 'transfer' => $transfer_res, 'transinfo' => $transfer_info, "major" => $major,'suggest_final' => $aFinal]);
} }

View File

@@ -67,7 +67,7 @@ class Base extends Controller
protected $production_article_author_to_organ_obj = ''; protected $production_article_author_to_organ_obj = '';
protected $production_article_frag_obj = ''; protected $production_article_frag_obj = '';
protected $production_article_main_obj = ''; protected $production_article_main_obj = '';
protected $production_article_main_img_obj = ''; // protected $production_article_main_img_obj = '';
protected $apply_reviewer_obj = ''; protected $apply_reviewer_obj = '';
protected $promotion_obj = ''; protected $promotion_obj = '';
protected $promotion_email_obj = ''; protected $promotion_email_obj = '';
@@ -150,7 +150,7 @@ class Base extends Controller
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ'); $this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
$this->production_article_frag_obj = Db::name('production_article_frag'); $this->production_article_frag_obj = Db::name('production_article_frag');
$this->production_article_main_obj = Db::name('production_article_main'); $this->production_article_main_obj = Db::name('production_article_main');
$this->production_article_main_img_obj = Db::name("production_article_main_img"); // $this->production_article_main_img_obj = Db::name("production_article_main_img");
$this->apply_reviewer_obj = Db::name("apply_reviewer"); $this->apply_reviewer_obj = Db::name("apply_reviewer");
$this->promotion_obj = Db::name("promotion"); $this->promotion_obj = Db::name("promotion");
$this->promotion_email_obj = Db::name("promotion_email"); $this->promotion_email_obj = Db::name("promotion_email");
@@ -437,7 +437,7 @@ class Base extends Controller
$article_info = $this->article_obj->where('article_id', $article_id)->find(); $article_info = $this->article_obj->where('article_id', $article_id)->find();
$check = $this->article_main_obj->where("article_id",$article_id)->whereIn("state",[0,2])->find(); $check = $this->article_main_obj->where("article_id",$article_id)->whereIn("state",[0,2])->find();
if($check){ if($check){//防止重复添加
return ; return ;
} }
@@ -523,7 +523,10 @@ class Base extends Controller
$this->article_main_table_obj->insert($ins); $this->article_main_table_obj->insert($ins);
} }
//写入处理内容里table和figure队列-排版 20260121 start
\think\Queue::later(60,'app\api\job\DealMainFigureOrTable@fire', ['article_id' => $article_id], 'DealMainFigureOrTable');
//写入处理内容里table和figure队列-排版 20260121 end
$pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->order("file_id desc")->limit(1)->select(); $pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->order("file_id desc")->limit(1)->select();
if(!isset($pics[0])){ if(!isset($pics[0])){
return ; return ;
@@ -843,95 +846,95 @@ class Base extends Controller
} }
public function getProductionMainImgs($p_article_id) // public function getProductionMainImgs($p_article_id)
{ // {
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select(); // $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
if (count($mains) == 0) { // if (count($mains) == 0) {
$this->creatMainData($p_article_id); // $this->creatMainData($p_article_id);
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select(); // $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
} // }
$frag = []; // $frag = [];
foreach ($mains as $v) { // foreach ($mains as $v) {
$frag[] = $v; // $frag[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find(); // $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) { // if ($ca) {
$frag[] = $ca; // $frag[] = $ca;
$pre_id = $ca['p_main_img_id']; // $pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) { // while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find(); // $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) { // if ($cac) {
$frag[] = $cac; // $frag[] = $cac;
$pre_id = $cac['p_main_img_id']; // $pre_id = $cac['p_main_img_id'];
} else { // } else {
$pre_id = 0; // $pre_id = 0;
} // }
} // }
} // }
} // }
return $frag; // return $frag;
} // }
private function creatMainData($p_article_id) // private function creatMainData($p_article_id)
{ // {
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find(); // $p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find(); // $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$files = $this->article_file_obj // $files = $this->article_file_obj
->where('article_id', $article_info['article_id']) // ->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt') // ->where('type_name', 'manuscirpt')
->order('ctime desc') // ->order('ctime desc')
->limit(1) // ->limit(1)
->select(); // ->select();
if (count($files) == 0) { // if (count($files) == 0) {
return jsonError('No Manuscript'); // return jsonError('No Manuscript');
} // }
$url = $this->ts_base_url."api/typeset/webReaddoc"; // $url = $this->ts_base_url."api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url']; // $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program))); // $res = object_to_array(json_decode(myPost($url, $program)));
//
$file_runs = $res['data']; // $file_runs = $res['data'];
//
//整理信息 // //整理信息
$frag = []; // $frag = [];
$aa = []; // $aa = [];
$frag['title'] = $article_info['title']; // $frag['title'] = $article_info['title'];
$start_refer = false; // $start_refer = false;
foreach ($file_runs as $k => $v) { // foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') { // if ($start_refer && $v != '') {
if (strlen($v) > 500) { // if (strlen($v) > 500) {
$start_refer = false; // $start_refer = false;
$frag['main'][] = $v; // $frag['main'][] = $v;
continue; // continue;
} // }
$frag['references'][] = $v; // $frag['references'][] = $v;
continue; // continue;
} // }
$g_val = trim(preg_replace('/\<.*?\>/', '', $v)); // $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val; // $aa[] = $g_val;
//
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) { // if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v; // $frag['keywords'] = $v;
continue; // continue;
} // }
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') { // if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true; // $start_refer = true;
continue; // continue;
} // }
$frag['main'][] = $v; // $frag['main'][] = $v;
} // }
if (!isset($frag['main'])) { // if (!isset($frag['main'])) {
return jsonError("manuscript file error!"); // return jsonError("manuscript file error!");
} // }
//
//
//将主体内容写入数据库 // //将主体内容写入数据库
foreach ($frag['main'] as $v) { // foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id; // $ca['p_article_id'] = $p_article_id;
$ca['content'] = $v; // $ca['content'] = $v;
$ca['content_g'] = ''; // $ca['content_g'] = '';
$ca['ctime'] = time(); // $ca['ctime'] = time();
$this->production_article_main_obj->insert($ca); // $this->production_article_main_obj->insert($ca);
} // }
} // }
public function refuseReferIndex($p_article_id) public function refuseReferIndex($p_article_id)
{ {
@@ -946,83 +949,83 @@ class Base extends Controller
} }
public function getProductionMainImgsByNew($p_article_id, $file) // public function getProductionMainImgsByNew($p_article_id, $file)
{ // {
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find(); // $p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find(); // $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$url = $this->ts_base_url."api/typeset/webReaddoc"; // $url = $this->ts_base_url."api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/" . $file; // $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/" . $file;
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/20230706/87628e769c4ee8a8414219b05c72a028.docx" ; //// $program['fileRoute'] = "https://submission.tmrjournals.com/public/completedManuscirpt/20230706/87628e769c4ee8a8414219b05c72a028.docx" ;
$res = object_to_array(json_decode(myPost($url, $program))); // $res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data']; // $file_runs = $res['data'];
if (count($file_runs) == 0) { // if (count($file_runs) == 0) {
return jsonError("File crawl failed"); // return jsonError("File crawl failed");
} // }
//清空之前的 // //清空之前的
$this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]); // $this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]);
//
//整理信息 // //整理信息
$frag = []; // $frag = [];
$aa = []; // $aa = [];
$frag['title'] = $article_info['title']; // $frag['title'] = $article_info['title'];
$start_refer = false; // $start_refer = false;
foreach ($file_runs as $k => $v) { // foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') { // if ($start_refer && $v != '') {
if (strlen($v) > 500) { // if (strlen($v) > 500) {
$start_refer = false; // $start_refer = false;
$frag['main'][] = $v; // $frag['main'][] = $v;
continue; // continue;
} // }
$frag['references'][] = $v; // $frag['references'][] = $v;
continue; // continue;
} // }
$g_val = trim(preg_replace('/\<.*?\>/', '', $v)); // $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val; // $aa[] = $g_val;
//
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) { // if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v; // $frag['keywords'] = $v;
continue; // continue;
} // }
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') { // if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true; // $start_refer = true;
continue; // continue;
} // }
$frag['main'][] = $v; // $frag['main'][] = $v;
} // }
if (!isset($frag['main'])) { // if (!isset($frag['main'])) {
return jsonError("manuscript file error!"); // return jsonError("manuscript file error!");
} // }
//
//将主体内容写入数据库 // //将主体内容写入数据库
foreach ($frag['main'] as $v) { // foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id; // $ca['p_article_id'] = $p_article_id;
$ca['content'] = $v; // $ca['content'] = $v;
$ca['content_g'] = ''; // $ca['content_g'] = '';
$ca['ctime'] = time(); // $ca['ctime'] = time();
$this->production_article_main_obj->insert($ca); // $this->production_article_main_obj->insert($ca);
} // }
//
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select(); // $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
$f = []; // $f = [];
foreach ($mains as $v) { // foreach ($mains as $v) {
$f[] = $v; // $f[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find(); // $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) { // if ($ca) {
$f[] = $ca; // $f[] = $ca;
$pre_id = $ca['p_main_img_id']; // $pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) { // while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find(); // $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) { // if ($cac) {
$f[] = $cac; // $f[] = $cac;
$pre_id = $cac['p_main_img_id']; // $pre_id = $cac['p_main_img_id'];
} else { // } else {
$pre_id = 0; // $pre_id = 0;
} // }
} // }
} // }
} // }
return $f; // return $f;
} // }
/**创建空production实例应对main和refers /**创建空production实例应对main和refers

View File

@@ -21,7 +21,7 @@ class Contribute extends Base
} }
/** /**
* 自动投稿 * 自动投稿,提交存储文章相关信息
* @param file_url 文件地址 * @param file_url 文件地址
*/ */
public function contribute($aParam = []){ public function contribute($aParam = []){

View File

@@ -1167,9 +1167,17 @@ class Finalreview extends Base
if(empty($aReviewerFinal)){ if(empty($aReviewerFinal)){
return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']); return json_encode(['status' => 3,'msg' => 'Review record does not exist or review has been completed']);
} }
//查询审稿人基本信息
$aWhere = ['user_id' => $iReviewerId]; $aWhere = ['user_id' => $iReviewerId];
$aUser = Db::name('user')->field('realname')->where($aWhere)->find(); $aUser = Db::name('user')->field('realname,email')->where($aWhere)->find();
$aReviewerFinal['realname'] = empty($aUser['realname']) ? '' : $aUser['realname']; $aReviewerFinal['realname'] = empty($aUser['realname']) ? '' : $aUser['realname'];
$aReviewerFinal['email'] = empty($aUser['email']) ? '' : $aUser['email'];
//查询审稿人机构
if(!empty($aUser)){
$aWhere = ['reviewer_id' => $iReviewerId,'state' => 0];
$aReviewerInfo = Db::name('user_reviewer_info')->field('company')->where($aWhere)->find();
$aReviewerFinal['company'] = empty($aReviewerInfo['company']) ? '' : $aReviewerInfo['company'];
}
return json_encode(['status' => 1,'msg' => 'success','data' => $aReviewerFinal]); return json_encode(['status' => 1,'msg' => 'success','data' => $aReviewerFinal]);
} }

View File

@@ -1,341 +0,0 @@
<?php
namespace app\api\controller;
class Latex extends Base
{
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
}
public function generateLatexPdf()
{
$data = $this->request->post();
$rule = new Validate([
'p_article_id' => 'require|number'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
try {
// 获取文章信息
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
if (!$p_info) {
return jsonError('文章实例不存在');
}
// 获取作者信息
$authors = $this->production_article_author_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
// 获取机构信息
$organs = $this->production_article_organ_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
// 获取正文内容
$main_contents = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->order('p_main_id')->select();
// 获取参考文献
$references = $this->production_article_refer_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->order('index')->select();
// 构建LaTeX内容
$latex_content = $this->buildLatexContent($p_info, $authors, $organs, $main_contents, $references);
// 创建临时目录
$temp_dir = ROOT_PATH . 'public' . DS . 'temp_latex' . DS;
if (!is_dir($temp_dir)) {
mkdir($temp_dir, 0755, true);
}
// 生成唯一的文件名
$filename = 'article_' . $p_info['p_article_id'] . '_' . time();
$tex_file = $temp_dir . $filename . '.tex';
$pdf_file = $temp_dir . $filename . '.pdf';
// 写入LaTeX文件
file_put_contents($tex_file, $latex_content);
// 执行LaTeX编译命令生成PDF
$command = sprintf(
'cd %s && pdflatex -interaction=nonstopmode -output-directory=%s %s',
escapeshellarg($temp_dir),
escapeshellarg($temp_dir),
escapeshellarg($tex_file)
);
// 执行命令
$output = [];
$return_var = 0;
exec($command, $output, $return_var);
// 检查PDF是否生成成功
if (!file_exists($pdf_file) || filesize($pdf_file) == 0) {
return jsonError('PDF生成失败请检查LaTeX内容或系统环境');
}
// 移动PDF到正式目录
$pdf_dir = ROOT_PATH . 'public' . DS . 'latex_pdfs' . DS;
if (!is_dir($pdf_dir)) {
mkdir($pdf_dir, 0755, true);
}
$final_pdf_path = $pdf_dir . $filename . '.pdf';
rename($pdf_file, $final_pdf_path);
// 清理临时文件
if (file_exists($tex_file)) {
unlink($tex_file);
}
// 清理辅助文件(.aux, .log等)
$aux_file = $temp_dir . $filename . '.aux';
$log_file = $temp_dir . $filename . '.log';
if (file_exists($aux_file)) unlink($aux_file);
if (file_exists($log_file)) unlink($log_file);
// 返回PDF路径
$relative_path = 'latex_pdfs/' . $filename . '.pdf';
return jsonSuccess([
'pdf_url' => $relative_path,
'message' => 'PDF生成成功'
]);
} catch (\Exception $e) {
return jsonError('生成过程中发生错误: ' . $e->getMessage());
}
}
/**
* 构建LaTeX文档内容
* @param $p_info
* @param $authors
* @param $organs
* @param $main_contents
* @param $references
* @return string
*/
private function buildLatexContent($p_info, $authors, $organs, $main_contents, $references)
{
// 构建机构映射
$organ_map = [];
foreach ($organs as $index => $organ) {
$organ_map[$organ['p_article_organ_id']] = $index + 1;
}
// LaTeX文档开始
$latex = '\documentclass[twocolumn]{article}' . "\n";
$latex .= '\usepackage[utf8]{inputenc}' . "\n";
$latex .= '\usepackage[T1]{fontenc}' . "\n";
$latex .= '\usepackage{geometry}' . "\n";
$latex .= '\usepackage{graphicx}' . "\n";
$latex .= '\usepackage{amsmath}' . "\n";
$latex .= '\usepackage{amsfonts}' . "\n";
$latex .= '\usepackage{amssymb}' . "\n";
$latex .= '\usepackage{setspace}' . "\n";
$latex .= '\usepackage{titlesec}' . "\n";
$latex .= '\usepackage{hyperref}' . "\n";
$latex .= '\usepackage{caption}' . "\n";
$latex .= '\usepackage{multicol}' . "\n";
$latex .= '\usepackage{abstract}' . "\n";
$latex .= '\geometry{left=1.5cm,right=1.5cm,top=2.5cm,bottom=2.5cm}' . "\n";
$latex .= '\setstretch{1.5}' . "\n";
$latex .= '\title{' . $this->escapeLatexText($p_info['title']) . '}' . "\n";
// 处理作者和机构
if (!empty($authors)) {
$author_text = '';
$affiliations = [];
foreach ($authors as $author) {
if ($author_text !== '') {
$author_text .= ', ';
}
$author_text .= $this->escapeLatexText($author['first_name'] . ' ' . $author['last_name']);
// 获取作者的机构
$author_organs = $this->production_article_author_to_organ_obj
->where('p_article_author_id', $author['p_article_author_id'])
->where('state', 0)
->select();
foreach ($author_organs as $ao) {
if (isset($organ_map[$ao['p_article_organ_id']])) {
$author_text .= '$^{' . $organ_map[$ao['p_article_organ_id']] . '}$';
}
}
if ($author['is_report'] == 1) {
$author_text .= '$^{*}$';
}
}
$latex .= '\author{' . $author_text . "\n";
// 添加机构信息
foreach ($organs as $index => $organ) {
$latex .= '\\\\$' . ($index + 1) . '$ ' . $this->escapeLatexText($organ['organ_name']) . "\n";
}
if (!empty($authors)) {
// 查找通讯作者
$corresponding_authors = array_filter($authors, function($author) {
return $author['is_report'] == 1;
});
if (!empty($corresponding_authors)) {
$corr_author = reset($corresponding_authors);
$latex .= '\\\\$*$ Corresponding author: ' .
$this->escapeLatexText($corr_author['email']) . "\n";
}
}
$latex .= '}' . "\n";
}
$latex .= '\date{}' . "\n";
$latex .= '\begin{document}' . "\n";
$latex .= '\maketitle' . "\n";
// 摘要
if (!empty($p_info['abstract'])) {
$latex .= '\begin{abstract}' . "\n";
$latex .= $this->escapeLatexText($p_info['abstract']) . "\n";
$latex .= '\end{abstract}' . "\n";
}
// 关键词
if (!empty($p_info['keywords'])) {
$latex .= '\textbf{Keywords:} ' . $this->escapeLatexText($p_info['keywords']) . "\n";
$latex .= '\sectionbreak' . "\n";
}
// 正文内容
$in_section = false;
$section_count = 0;
foreach ($main_contents as $content) {
$text = trim($content['content']);
// 跳过空内容
if (empty($text)) {
continue;
}
// 检查是否是标题
$clean_text = strip_tags($text);
$lower_text = strtolower($clean_text);
// 判断是否为章节标题
if (stripos($lower_text, 'introduction') === 0 ||
stripos($lower_text, 'methods') === 0 ||
stripos($lower_text, 'results') === 0 ||
stripos($lower_text, 'discussion') === 0 ||
stripos($lower_text, 'conclusion') === 0 ||
stripos($lower_text, 'references') === 0) {
// 结束前一节
if ($in_section) {
$latex .= "\n" . '\sectionbreak' . "\n";
}
// 开始新节
$section_count++;
$section_title = $this->escapeLatexText($clean_text);
$latex .= '\section{' . $section_title . '}' . "\n";
$in_section = true;
}
// 检查是否是图片或表格占位符
else if (preg_match('/<img[^>]*imageId=[\'"]([^\'"]+)[\'"][^>]*>/i', $text, $img_matches)) {
$image_id = $img_matches[1];
// 这里可以添加图片处理逻辑
$latex .= '% 图片插入位置 (ID: ' . $image_id . ')' . "\n";
$latex .= '\begin{figure}[htbp]' . "\n";
$latex .= '\centering' . "\n";
$latex .= '\includegraphics[width=0.8\textwidth]{image_' . $image_id . '}' . "\n";
$latex .= '\caption{图片说明}' . "\n";
$latex .= '\end{figure}' . "\n";
}
else if (preg_match('/<table[^>]*tableId=[\'"]([^\'"]+)[\'"][^>]*>/i', $text, $table_matches)) {
$table_id = $table_matches[1];
// 这里可以添加表格处理逻辑
$latex .= '% 表格插入位置 (ID: ' . $table_id . ')' . "\n";
$latex .= '\begin{table}[htbp]' . "\n";
$latex .= '\centering' . "\n";
$latex .= '\caption{表格说明}' . "\n";
$latex .= '\begin{tabular}{|c|c|c|}' . "\n";
$latex .= '\hline' . "\n";
$latex .= '列1 & 列2 & 列3 \\\\' . "\n";
$latex .= '\hline' . "\n";
$latex .= '% 表格数据' . "\n";
$latex .= '\hline' . "\n";
$latex .= '\end{tabular}' . "\n";
$latex .= '\end{table}' . "\n";
}
// 普通段落文本
else {
// 移除HTML标签并转义特殊字符
$plain_text = $this->escapeLatexText(strip_tags($text));
$latex .= $plain_text . "\n\n";
}
}
// 参考文献
if (!empty($references)) {
$latex .= '\section*{References}' . "\n";
$latex .= '\begin{thebibliography}{99}' . "\n";
foreach ($references as $index => $ref) {
$ref_text = isset($ref['refer_frag']) ? $ref['refer_frag'] : $ref['refer_content'];
$latex .= '\bibitem{} ' . $this->escapeLatexText($ref_text) . "\n";
}
$latex .= '\end{thebibliography}' . "\n";
}
$latex .= '\end{document}' . "\n";
return $latex;
}
/**
* 转义LaTeX特殊字符
* @param string $text
* @return string
*/
private function escapeLatexText($text)
{
// 移除HTML标签
$text = strip_tags($text);
// 转义LaTeX特殊字符
$escape_chars = [
'\\' => '\\textbackslash{}',
'&' => '\\&',
'%' => '\\%',
'$' => '\\$',
'#' => '\\#',
'_' => '\\_',
'{' => '\\{',
'}' => '\\}',
'~' => '\\textasciitilde{}',
'^' => '\\textasciicircum{}',
'"' => '\\"{}',
'\'' => '\\\'{}',
'<' => '\\textless{}',
'>' => '\\textgreater{}',
];
foreach ($escape_chars as $char => $replacement) {
$text = str_replace($char, $replacement, $text);
}
return $text;
}
}

View File

@@ -45,6 +45,12 @@ class Preaccept extends Base
}else{ }else{
$list[$k]['is_repeat'] = 0; $list[$k]['is_repeat'] = 0;
} }
if(strpos($v['refer_content'],'retraction')!==false||strpos($v['refer_content'],'retracted')!==false){
$list[$k]['retract'] = 1;
}else{
$list[$k]['retract'] = 0;
}
} }
$re["refers"] = $list; $re["refers"] = $list;
$re['repeat'] = empty($aRepeat) ? [] : $aRepeat; $re['repeat'] = empty($aRepeat) ? [] : $aRepeat;
@@ -321,8 +327,15 @@ class Preaccept extends Base
$insert['ami_id'] = $data['ami_id']; $insert['ami_id'] = $data['ami_id'];
$insert['sort'] = $am_info['sort']+1; $insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_obj->insert($insert); //$this->article_main_obj->insert($insert);
return jsonSuccess([]); // return jsonSuccess([]);
//返回更新数据 20260120 start
$iId = $this->article_main_obj->insertGetId($insert);
$insert = empty($insert) ? [] : array_merge($insert,['am_id' => empty($iId) ? 0 : $iId]);
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260120 end
} }
public function removeImage(){ public function removeImage(){
@@ -384,8 +397,15 @@ class Preaccept extends Base
$insert["content"] = "<table tableId='".$amt_info['amt_id']."' />"; $insert["content"] = "<table tableId='".$amt_info['amt_id']."' />";
$insert['sort'] = $am_info['sort']+1; $insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_obj->insert($insert); // $this->article_main_obj->insert($insert);
return jsonSuccess([]); // return jsonSuccess([]);
//返回更新数据 20260120 start
$iId = $this->article_main_obj->insertGetId($insert);
$insert = empty($insert) ? [] : array_merge($insert,['am_id' => empty($iId) ? 0 : $iId]);
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260120 end
} }
@@ -832,7 +852,14 @@ class Preaccept extends Base
$this->addBRow($am_info['article_id'],$data['am_id']); $this->addBRow($am_info['article_id'],$data['am_id']);
} }
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"is_h2"=>0,"is_h3"=>0]); $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>1,"is_h2"=>0,"is_h3"=>0]);
return jsonSuccess([]); // return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>1,"is_h2"=>0,"is_h3"=>0]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
} }
public function changeH2(){ public function changeH2(){
@@ -850,7 +877,14 @@ class Preaccept extends Base
$this->addBRow($am_info['article_id'],$p_list[0]['am_id']); $this->addBRow($am_info['article_id'],$p_list[0]['am_id']);
} }
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>1,"is_h3"=>0]); $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>1,"is_h3"=>0]);
return jsonSuccess([]); // return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>0,"is_h2"=>1,"is_h3"=>0]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
} }
public function changeH3(){ public function changeH3(){
@@ -863,7 +897,14 @@ class Preaccept extends Base
} }
$am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find(); $am_info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>1]); $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>1]);
return jsonSuccess([]); // return jsonSuccess([]);
//返回数据 20260119 start
$am_info = empty($am_info) ? [] : array_merge($am_info,["is_h1"=>0,"is_h2"=>0,"is_h3"=>1]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $am_info : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
} }
public function changeNormal(){ public function changeNormal(){
@@ -875,7 +916,13 @@ class Preaccept extends Base
return jsonError($rule->getError()); return jsonError($rule->getError());
} }
$this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>0]); $this->article_main_obj->where("am_id",$data['am_id'])->update(["is_h1"=>0,"is_h2"=>0,"is_h3"=>0]);
return jsonSuccess([]); // return jsonSuccess([]);
//返回数据 20260119 start
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? [] : $aResult;
return jsonSuccess($aResult);
//返回数据 20260119 end
} }
public function addBlankRow(){ public function addBlankRow(){
@@ -892,14 +939,26 @@ class Preaccept extends Base
}else{ }else{
$row = 1; $row = 1;
} }
// while ($row>0){
// $this->addBRow($data['article_id'],$data['am_id']);
// $row--;
// }
// return jsonSuccess([]);
//返回添加数据 20260119 start
$aId = [];
while ($row>0){ while ($row>0){
$this->addBRow($data['article_id'],$data['am_id']); $iId = $this->addBRow($data['article_id'],$data['am_id']);
$row--; $row--;
if(!empty($iId)){
$aId[] = $iId;
}
} }
return jsonSuccess([]); $aResult = $this->_getRowInfo($aId);
$aResult = empty($aResult) ? $aId : $aResult;
return jsonSuccess($aResult);
//返回添加数据 20260119 end
} }
/**添加批量主体内容 /**添加批量主体内容
* @return \think\response\Json * @return \think\response\Json
* @throws \think\Exception * @throws \think\Exception
@@ -926,15 +985,32 @@ class Preaccept extends Base
$this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">",$r['sort'])->inc("sort",count($data['rows']))->update(); $this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">",$r['sort'])->inc("sort",count($data['rows']))->update();
$sort = $r['sort']+1; $sort = $r['sort']+1;
} }
// foreach ($data['rows'] as $v){
// $insert['article_id'] = $data['article_id'];
// $insert['content'] = $v;
// $insert['sort'] = $sort;
// $insert['ctime'] = time();
// $this->article_main_obj->insert($insert);
// $sort++;
// }
// return jsonSuccess([]);
//返回数组数据 20260119 start
$aInsert = [];
foreach ($data['rows'] as $v){ foreach ($data['rows'] as $v){
$insert['article_id'] = $data['article_id']; $insert['article_id'] = $data['article_id'];
$insert['content'] = $v; $insert['content'] = $v;
$insert['sort'] = $sort; $insert['sort'] = $sort;
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_obj->insert($insert); $iId = $this->article_main_obj->insertGetId($insert);
$sort++; $sort++;
$aInsert[] = empty($iId) ? $insert : array_merge($insert,['am_id' => $iId]);
} }
return jsonSuccess([]); $aId = empty($aInsert) ? [] : array_column($aInsert, 'am_id');
$aResult = $this->_getRowInfo($aId);
$aResult = empty($aResult) ? $aInsert : $aResult;
return jsonSuccess($aResult);
//返回数组数据 20260119 end
} }
@@ -945,7 +1021,10 @@ class Preaccept extends Base
$insert['content'] = ""; $insert['content'] = "";
$insert['sort'] = 1; $insert['sort'] = 1;
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_obj->insert($insert); // $this->article_main_obj->insert($insert);
//返回主键ID 0119 start
return $this->article_main_obj->insertGetId($insert);
//返回主键ID 0119 end
}else{ }else{
$am_info = $this->article_main_obj->where("am_id",$am_id)->find(); $am_info = $this->article_main_obj->where("am_id",$am_id)->find();
$this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->inc("sort",1)->update(); $this->article_main_obj->where("article_id",$article_id)->where("sort",">",$am_info['sort'])->inc("sort",1)->update();
@@ -953,7 +1032,10 @@ class Preaccept extends Base
$insert['content'] = ""; $insert['content'] = "";
$insert['sort'] = $am_info['sort']+1; $insert['sort'] = $am_info['sort']+1;
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_obj->insert($insert); // $this->article_main_obj->insert($insert);
//返回主键ID 0119 start
return $this->article_main_obj->insertGetId($insert);
//返回主键ID 0119 end
} }
} }
@@ -1063,7 +1145,14 @@ class Preaccept extends Base
$update['content'] = $this->formatMain($data['content']); $update['content'] = $this->formatMain($data['content']);
$update['state'] = 0; $update['state'] = 0;
$this->article_main_obj->where("am_id",$data['am_id'])->update($update); $this->article_main_obj->where("am_id",$data['am_id'])->update($update);
return jsonSuccess([]); // return jsonSuccess([]);
//返回更新数据 20260119 start
$update = empty($update) ? [] : array_merge($update,['am_id' => empty($data['am_id']) ? 0 : $data['am_id']]);
$iId = empty($data['am_id']) ? 0 : $data['am_id'];
$aResult = $this->_getMainRow($iId);
$aResult = empty($aResult) ? $update : $aResult;
return jsonSuccess($aResult);
//返回更新数据 20260119 end
} }
public function getArticleMainsRecycle(){ public function getArticleMainsRecycle(){
@@ -1099,11 +1188,18 @@ class Preaccept extends Base
$insert['title'] = $data['title']; $insert['title'] = $data['title'];
} }
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_image_obj->insert($insert); // $this->article_main_image_obj->insert($insert);
$re['url'] = $data['url']; // $re['url'] = $data['url'];
return jsonSuccess($re); // return jsonSuccess($re);
//返回新增数据 20260119 start
$iId = $this->article_main_image_obj->insertGetId($insert);
$insert = empty($iId) ? $insert : array_merge(['ami_id' => $iId],$insert);
$aResult = $this->_getImageInfo($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回新增数据 20260119 end
} }
public function editMainImage(){ public function editMainImage(){
@@ -1119,7 +1215,18 @@ class Preaccept extends Base
$update['note'] = isset($data['note'])?$data['note']:""; $update['note'] = isset($data['note'])?$data['note']:"";
$update['title'] = isset($data['title'])?$data['title']:""; $update['title'] = isset($data['title'])?$data['title']:"";
$this->article_main_image_obj->where("ami_id",$data['ami_id'])->update($update); $this->article_main_image_obj->where("ami_id",$data['ami_id'])->update($update);
return jsonSuccess([]); // return jsonSuccess([]);
//返回修改数据 20260119 start
$update = empty($update) ? [] : array_merge(['ami_id' => empty($data['ami_id']) ? 0 : $data['ami_id']],$update);
$iId = empty($data['ami_id']) ? 0 : $data['ami_id'];
$aResult = $this->_getImageInfo($iId);
$aResult = empty($aResult) ? $update : $aResult;
if(!empty($aResult['main'])){
$aResultInfo = $this->_getMainRow(0,$aResult['main']);
$aResult = empty($aResultInfo) ? $aResult : $aResultInfo;
}
return jsonSuccess($aResult);
//返回新增数据 20260119 end
} }
public function addMainTable(){ public function addMainTable(){
@@ -1144,9 +1251,15 @@ class Preaccept extends Base
$insert['note'] = $data['note']; $insert['note'] = $data['note'];
} }
$insert['ctime'] = time(); $insert['ctime'] = time();
$this->article_main_table_obj->insert($insert); // $this->article_main_table_obj->insert($insert);
return jsonSuccess([]); // return jsonSuccess([]);
//返回新增数据 20260119 start
$iId = $this->article_main_table_obj->insertGetId($insert);
$insert = empty($iId) ? $insert : array_merge(['amt_id' => $iId],$insert);
$aResult = $this->_getTableInfo($iId);
$aResult = empty($aResult) ? $insert : $aResult;
return jsonSuccess($aResult);
//返回新增数据 20260119 end
} }
@@ -1168,7 +1281,18 @@ class Preaccept extends Base
$update['note'] = $data['note']; $update['note'] = $data['note'];
} }
$this->article_main_table_obj->where("amt_id",$data['amt_id'])->update($update); $this->article_main_table_obj->where("amt_id",$data['amt_id'])->update($update);
return jsonSuccess([]); // return jsonSuccess([]);
//返回修改数据 20260119 start
$update = empty($update) ? [] : array_merge(['amt_id' => empty($data['amt_id']) ? 0 : $data['amt_id']],$update);
$iId = empty($data['amt_id']) ? 0 : $data['amt_id'];
$aResult = $this->_getTableInfo($iId);
$aResult = empty($aResult) ? $update : $aResult;
if(!empty($aResult['main'])){
$aResultInfo = $this->_getMainRow(0,$aResult['main']);
$aResult = empty($aResultInfo) ? $aResult : $aResultInfo;
}
return jsonSuccess($aResult);
//返回新增数据 20260119 end
} }
@@ -1549,12 +1673,14 @@ return null;
} }
foreach ($item as $k => $main) { foreach ($item as $k => $main) {
if($main['is_h1']==1){ //取消一级/二级/三级 标题样式 20260119 start
$main['content'] = "<b><i>".$main['content']."</i></b>"; // if($main['is_h1']==1){
} // $main['content'] = "<b><i>".$main['content']."</i></b>";
if($main['is_h2']==1||$main['is_h3']==1){ // }
$main['content'] = "<b>".$main['content']."</b>"; // if($main['is_h2']==1||$main['is_h3']==1){
} // $main['content'] = "<b>".$main['content']."</b>";
// }
//取消一级/二级/三级 标题样式 20260119 end
$main['checks'] = empty($aMainCheckData[$main['am_id']]) ? [] : $aMainCheckData[$main['am_id']]; $main['checks'] = empty($aMainCheckData[$main['am_id']]) ? [] : $aMainCheckData[$main['am_id']];
if($main['type'] == 1){ if($main['type'] == 1){
$main['image'] = empty($aArticleMainImage[$main['ami_id']]) ? [] : $aArticleMainImage[$main['ami_id']]; $main['image'] = empty($aArticleMainImage[$main['ami_id']]) ? [] : $aArticleMainImage[$main['ami_id']];
@@ -1743,4 +1869,175 @@ return null;
return jsonSuccess([]); return jsonSuccess([]);
} }
//获取多条信息
private function _getRowInfo($aId = []){
if(empty($aId)){
return [];
}
//获取信息
$aWhere = ['am_id' => ['in',$aId],'state' => 0];
$aArticleMain = Db::name("article_main")->where($aWhere)->order("sort asc")->select();
if(empty($aArticleMain)){
return [];
}
//获取主键ID
$aMId = array_column($aArticleMain, 'am_id');
//查询article_main_check
$aWhere = ['am_id' => ['in',$aMId],'state' => 0];
$aMainCheck = Db::name("article_main_check")->where($aWhere)->select();
$aMainCheckData = [];
if(!empty($aMainCheck)){
foreach ($aMainCheck as $value) {
if(empty($value['am_id'])){
continue;
}
$aMainCheckData[$value['am_id']][] = $value;
}
}
//获取图片信息
$aMiId = array_unique(array_column($aArticleMain, 'ami_id'));
$aWhere = ['ami_id' => ['in',$aMiId],'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->select();
$aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id');
//获取表格信息
$aMiId = array_unique(array_column($aArticleMain, 'amt_id'));
$aWhere = ['amt_id' => ['in',$aMiId],'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->select();
$aArticleMainTable = empty($aArticleMainTable) ? [] : array_column($aArticleMainTable, null,'amt_id');
//查询校对数量 t_article_proofread
$aWhere = ['am_id' => ['in',$aMId],'state' => ['between',[1,2]],'is_delete' => 2];
$aArticleProofread = Db::name("article_proofread")->field('am_id,count(id) as num,state')->where($aWhere)->group('am_id,state')->select();
$aArticleProofreadData = [];
if(!empty($aArticleProofread)){
foreach ($aArticleProofread as $key => $value) {
$aArticleProofreadData[$value['am_id']][$value['state']] = $value['num'];
}
}
//数据处理
foreach ($aArticleMain as $k => $main) {
$aArticleMain[$k]['checks'] = empty($aMainCheckData[$main['am_id']]) ? [] : $aMainCheckData[$main['am_id']];
if($main['type'] == 1){
$aArticleMain[$k]['image'] = empty($aArticleMainImage[$main['ami_id']]) ? [] : $aArticleMainImage[$main['ami_id']];
}
if($main['type'] == 2){
$aArticleMain[$k]['table'] = empty($aArticleMainTable[$main['amt_id']]) ? [] : $aArticleMainTable[$main['amt_id']];
}
if($main['type'] == 0){
$aDataInfo = empty($aArticleProofreadData[$main['am_id']]) ? [] : $aArticleProofreadData[$main['am_id']];
$main['proof_read_num'] = -1;
if(!empty($aDataInfo)){
$main['proof_read_num'] = empty($aDataInfo[2]) ? 0 : $aDataInfo[2];
}
}
}
return $aArticleMain;
}
//获取图片信息
private function _getImageInfo($iAmiId = 0){
if(empty($iAmiId)){
return [];
}
//获取图片信息
$aWhere = ['ami_id' => $iAmiId,'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->find();
if(empty($aArticleMainImage)){
return [];
}
$iArticleId = empty($aArticleMainImage['article_id']) ? 0 : $aArticleMainImage['article_id'];
//获取表信息
$aWhere = ['ami_id' => $iAmiId,'state' => 0,'type' => 1,'article_id' => $iArticleId];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
//数据处理
$aArticleMainImage['has_selected'] = empty($aArticleMain) ? 0 : 1;
if(!empty($aArticleMain)){
$aArticleMainImage['main'] = $aArticleMain;
}
return $aArticleMainImage;
}
//获取表格信息
private function _getTableInfo($iAmtId = 0){
if(empty($iAmtId)){
return [];
}
//获取图片信息
$aWhere = ['amt_id' => $iAmtId,'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->find();
if(empty($aArticleMainTable)){
return [];
}
$iArticleId = empty($aArticleMainTable['article_id']) ? 0 : $aArticleMainTable['article_id'];
//获取表信息
$aWhere = ['amt_id' => $iAmtId,'state' => 0,'type' => 2,'article_id' => $iArticleId];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
//数据处理
$aArticleMainTable['has_selected'] = empty($aArticleMain) ? 0 : 1;
if(!empty($aArticleMain)){
$aArticleMainTable['main'] = $aArticleMain;
}
return $aArticleMainTable;
}
//获取单独的一条信息
private function _getMainRow($iId = 0,$aArticleMain = []){
if(empty($iId) && empty($aArticleMain)){
return [];
}
//获取基本信息
if(empty($aArticleMain)){
$aWhere = ['am_id' => $iId,'state' => 0];
$aArticleMain = Db::name("article_main")->where($aWhere)->find();
}
if(empty($aArticleMain)){
return [];
}
//获取主键ID
$iId = empty($aArticleMain['am_id']) ? 0 : $aArticleMain['am_id'];
//查询article_main_check
$aWhere = ['am_id' => $iId,'state' => 0];
$aMainCheck = Db::name("article_main_check")->where($aWhere)->select();
//获取主体信息
$iType = isset($aArticleMain['type']) ? $aArticleMain['type'] : -1;
if($iType == 1){//获取图片
$iAmiId = empty($aArticleMain['ami_id']) ? 0 : $aArticleMain['ami_id'];
$aWhere = ['ami_id' => $iAmiId,'state' => 0];
$aArticleMainImage = Db::name("article_main_image")->where($aWhere)->find();
}
//获取表格信息
if($iType == 2){
$iAmtId = empty($aArticleMain['amt_id']) ? 0 : $aArticleMain['amt_id'];
$aWhere = ['amt_id' => $iAmtId,'state' => 0];
$aArticleMainTable = Db::name("article_main_table")->where($aWhere)->find();
}
//查询校对数量 t_article_proofread
$aWhere = ['am_id' => $iId,'state' => ['between',[1,2]],'is_delete' => 2];
$aArticleProofread = Db::name("article_proofread")->field('am_id,count(id) as num,state')->where($aWhere)->group('state')->select();
$aArticleProofreadData = [];
if(!empty($aArticleProofread)){
foreach ($aArticleProofread as $key => $value) {
$aArticleProofreadData[$value['state']] = $value['num'];
}
}
//数据处理
$aArticleMain['checks'] = empty($aMainCheckData) ? [] : $aMainCheckData;
if($iType == 1){
$aArticleMain['image'] = empty($aArticleMainImage) ? [] : $aArticleMainImage;
}
if($iType == 2){
$aArticleMain['table'] = empty($aArticleMainTable) ? [] : $aArticleMainTable;
}
if($iType == 0){
$aDataInfo = empty($aArticleProofreadData) ? [] : $aArticleProofreadData;
$aArticleMain['proof_read_num'] = -1;
if(!empty($aDataInfo)){
$aArticleMain['proof_read_num'] = empty($aDataInfo[2]) ? 0 : $aDataInfo[2];
}
}
return $aArticleMain;
}
} }

View File

@@ -18,7 +18,7 @@ use think\log;
class Production extends Base class Production extends Base
{ {
private $supportedTags = ['sup', 'sub', 'blue', 'b', 'i', 't', 'r', 'wmath']; private $supportedTags = ['sup', 'sub', 'blue', 'b', 'i', 't', 'r', 'wmath','myh3'];
// 颜色映射自定义标签颜色对应LaTeX的HTML十六进制颜色 // 颜色映射自定义标签颜色对应LaTeX的HTML十六进制颜色
private $colorMap = [ private $colorMap = [
'blue' => '0082AA', 'blue' => '0082AA',
@@ -50,57 +50,57 @@ class Production extends Base
} }
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
$files = $this->article_file_obj // $files = $this->article_file_obj
->where('article_id', $article_info['article_id']) // ->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt') // ->where('type_name', 'manuscirpt')
->order('ctime desc') // ->order('ctime desc')
->limit(1) // ->limit(1)
->select(); // ->select();
if (count($files) == 0) { // if (count($files) == 0) {
return jsonError('No Manuscript'); // return jsonError('No Manuscript');
} // }
$url = $this->ts_base_url . "api/typeset/webReaddoc"; // $url = $this->ts_base_url . "api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url']; // $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program))); // $res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data']; // $file_runs = $res['data'];
// return jsonSuccess($file_runs); // return jsonSuccess($file_runs);
//整理信息 //整理信息
$frag = []; // $frag = [];
$aa = []; // $aa = [];
$frag['title'] = $article_info['title']; // $frag['title'] = $article_info['title'];
$start_refer = false; // $start_refer = false;
foreach ($file_runs as $k => $v) { // foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') { // if ($start_refer && $v != '') {
if (strlen($v) > 500) { // if (strlen($v) > 500) {
$start_refer = false; // $start_refer = false;
$frag['main'][] = $v; // $frag['main'][] = $v;
continue; // continue;
} // }
$frag['references'][] = $v; // $frag['references'][] = $v;
continue; // continue;
} // }
$g_val = trim(preg_replace('/\<.*?\>/', '', $v)); // $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val; // $aa[] = $g_val;
//
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) { // if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v; // $frag['keywords'] = $v;
continue; // continue;
} // }
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') { // if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true; // $start_refer = true;
continue; // continue;
} // }
$frag['main'][] = $v; // $frag['main'][] = $v;
} // }
if (!isset($frag['main'])) { // if (!isset($frag['main'])) {
return jsonError("manuscript file error!"); // return jsonError("manuscript file error!");
} // }
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : ''; $insert['main'] = '';//isset($frag['main']) ? json_encode($frag['main']) : '';
$insert['article_id'] = $data['article_id']; $insert['article_id'] = $data['article_id'];
$insert['journal_id'] = $article_info['journal_id']; $insert['journal_id'] = $article_info['journal_id'];
$insert['ctime'] = time(); $insert['ctime'] = time();
@@ -108,13 +108,13 @@ class Production extends Base
//将主体内容写入数据库 //将主体内容写入数据库
foreach ($frag['main'] as $v) { // foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id; // $ca['p_article_id'] = $p_article_id;
$ca['content'] = $v; // $ca['content'] = $v;
$ca['content_g'] = ''; // $ca['content_g'] = '';
$ca['ctime'] = time(); // $ca['ctime'] = time();
$this->production_article_main_obj->insert($ca); // $this->production_article_main_obj->insert($ca);
} // }
return jsonSuccess([]); return jsonSuccess([]);
} }
@@ -260,6 +260,7 @@ class Production extends Base
*/ */
public function getProductionMains() public function getProductionMains()
{ {
// die("stop service!");
$data = $this->request->post(); $data = $this->request->post();
$rule = new Validate([ $rule = new Validate([
"p_article_id" => "require" "p_article_id" => "require"
@@ -268,10 +269,12 @@ class Production extends Base
return jsonError($rule->getError()); return jsonError($rule->getError());
} }
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
$frag = $this->getProductionMainImgs($data['p_article_id']); $frag = getArticleMains($p_info['article_id']);
if (count($frag) == 0) {
return jsonError("create error"); // $frag = $this->getProductionMainImgs($data['p_article_id']);
} // if (count($frag) == 0) {
// return jsonError("create error");
// }
$re['mains'] = $frag; $re['mains'] = $frag;
$re['production'] = $p_info; $re['production'] = $p_info;
return jsonSuccess($re); return jsonSuccess($re);
@@ -282,30 +285,31 @@ class Production extends Base
*/ */
public function getProductionMainsByDoi() public function getProductionMainsByDoi()
{ {
$data = $this->request->post(); die("stop service");
$rule = new Validate([ // $data = $this->request->post();
'doi' => 'require' // $rule = new Validate([
]); // 'doi' => 'require'
if (!$rule->check($data)) { // ]);
return jsonError($rule->getError()); // if (!$rule->check($data)) {
} // return jsonError($rule->getError());
$a = explode('/', $data['doi']); // }
$pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find(); // $a = explode('/', $data['doi']);
if (!$pro_info) { // $pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find();
return jsonError("production error"); // if (!$pro_info) {
} // return jsonError("production error");
// }
if (isset($data['file']) && $data['file'] != "") { //
$frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']); // if (isset($data['file']) && $data['file'] != "") {
} else { // $frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']);
$frag = $this->getProductionMainImgs($pro_info['p_article_id']); // } else {
} // $frag = $this->getProductionMainImgs($pro_info['p_article_id']);
if (count($frag) == 0) { // }
return jsonError("create error"); // if (count($frag) == 0) {
} // return jsonError("create error");
$re['mains'] = $frag; // }
$re['production'] = $pro_info; // $re['mains'] = $frag;
return jsonSuccess($re); // $re['production'] = $pro_info;
// return jsonSuccess($re);
} }
@@ -314,117 +318,117 @@ class Production extends Base
* @return void * @return void
* *
*/ */
public function delProductionMain() // public function delProductionMain()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_main_id' => 'require' // 'p_main_id' => 'require'
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]); // $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]);
return jsonSuccess([]); // return jsonSuccess([]);
} // }
/**添加主体文章图片 /**添加主体文章图片
* @return void * @return void
*/ */
public function addProductionMainImg() // public function addProductionMainImg()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_article_id' => 'require', // 'p_article_id' => 'require',
"pre_type" => "require", // "pre_type" => "require",
"body" => "require", // "body" => "require",
"content" => "require", // "content" => "require",
"width" => "require", // "width" => "require",
"note" => "require" // "note" => "require"
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$insert['p_article_id'] = $data['p_article_id']; // $insert['p_article_id'] = $data['p_article_id'];
if ($data['pre_type'] == "main") { // if ($data['pre_type'] == "main") {
$insert['p_main_id'] = $data['body']; // $insert['p_main_id'] = $data['body'];
} else { // } else {
$insert['pre_id'] = $data['body']; // $insert['pre_id'] = $data['body'];
} // }
$insert['content'] = $data['content']; // $insert['content'] = $data['content'];
$insert['width'] = $data['width']; // $insert['width'] = $data['width'];
$insert['title'] = $data['title']; // $insert['title'] = $data['title'];
$insert['note'] = $data['note']; // $insert['note'] = $data['note'];
$this->production_article_main_img_obj->insert($insert); // $this->production_article_main_img_obj->insert($insert);
return jsonSuccess([]); // return jsonSuccess([]);
} // }
/**删除mainimg /**删除mainimg
* @return void * @return void
*/ */
public function delProductionMainImg() // public function delProductionMainImg()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_main_img_id' => 'require' // 'p_main_img_id' => 'require'
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find(); // $p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find();
$next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find(); // $next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find();
if ($next_info) { // if ($next_info) {
if ($p_img_info['p_main_id'] == 0) { // if ($p_img_info['p_main_id'] == 0) {
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]); // $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]);
} else { // } else {
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]); // $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]);
} // }
} // }
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]); // $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]);
return jsonSuccess([]); // return jsonSuccess([]);
} // }
/**编辑mainimg /**编辑mainimg
* @return void * @return void
*/ */
public function editProductionMainImg() // public function editProductionMainImg()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_main_img_id' => 'require', // 'p_main_img_id' => 'require',
"width" => "require", // "width" => "require",
"content" => "require", // "content" => "require",
"note" => "require" // "note" => "require"
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$update['width'] = $data['width']; // $update['width'] = $data['width'];
$update['content'] = $data['content']; // $update['content'] = $data['content'];
$update['title'] = $data['title']; // $update['title'] = $data['title'];
$update['note'] = $data['note']; // $update['note'] = $data['note'];
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update); // $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update);
return jsonSuccess([]); // return jsonSuccess([]);
} // }
/** /**
* 编辑main内容 * 编辑main内容
* @return \think\response\Json|void * @return \think\response\Json|void
* *
*/ */
public function editProductionMain() // public function editProductionMain()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_main_id' => 'require', // 'p_main_id' => 'require',
'content' => 'require' // 'content' => 'require'
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$update['content'] = trim($data['content']); // $update['content'] = trim($data['content']);
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update); // $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update);
return jsonSuccess([]); // return jsonSuccess([]);
} // }
public function pushMainToWeb() public function pushMainToWeb()
@@ -451,24 +455,24 @@ class Production extends Base
* @return void * @return void
* *
*/ */
public function mainGptcheck() // public function mainGptcheck()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_main_id' => 'require' // 'p_main_id' => 'require'
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find(); // $main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find();
if (mb_strlen($main_info['content']) < 20) { // if (mb_strlen($main_info['content']) < 20) {
return trim($main_info['content']); // return trim($main_info['content']);
} // }
$res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 ' . trim($main_info['content'])))); // $res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 ' . trim($main_info['content']))));
$r = $res['choices'][0]['message']['content']; // $r = $res['choices'][0]['message']['content'];
$re['content'] = $r; // $re['content'] = $r;
return jsonSuccess($re); // return jsonSuccess($re);
} // }
public function getPublicMains() public function getPublicMains()
{ {
@@ -514,6 +518,12 @@ class Production extends Base
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find(); $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find(); $journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
//是否显示图文摘要图片1是2否3默认 20260206 start
$is_graphical_abstract = empty($data['is_graphical_abstract']) ? 3 : $data['is_graphical_abstract'];
if(!in_array($is_graphical_abstract, [1,2])){
return jsonError('Please select whether the uploaded picture should be shown as graphic abstract on the PDF title page');
}
//是否显示图文摘要图片1是2否3默认 20260206 end
$update['title'] = trim($data['title']); $update['title'] = trim($data['title']);
$update['journal_stage_id'] = $data['journal_stage_id']; $update['journal_stage_id'] = $data['journal_stage_id'];
@@ -533,6 +543,9 @@ class Production extends Base
// $update['pub_date'] = trim($data['pub_date']); // $update['pub_date'] = trim($data['pub_date']);
$update['npp'] = isset($data['npp']) ? $data['npp'] : ''; $update['npp'] = isset($data['npp']) ? $data['npp'] : '';
//是否显示图文摘要图片1是2否3默认 20260206 start
$update['is_graphical_abstract'] = $is_graphical_abstract;
//是否显示图文摘要图片1是2否3默认 20260206 end
//生成doi号 //生成doi号
// $doi = ''; // $doi = '';
// if ($p_info['doi'] == '') { // if ($p_info['doi'] == '') {
@@ -628,6 +641,11 @@ class Production extends Base
} else { } else {
$list[$k]['is_repeat'] = 0; $list[$k]['is_repeat'] = 0;
} }
if(strpos($v['refer_content'],'retraction')!==false||strpos($v['refer_content'],'retracted')!==false){
$list[$k]['retract'] = 1;
}else{
$list[$k]['retract'] = 0;
}
} }
$re['refers'] = $list; $re['refers'] = $list;
$re['repeat'] = empty($aRepeat) ? [] : $aRepeat; $re['repeat'] = empty($aRepeat) ? [] : $aRepeat;
@@ -813,6 +831,7 @@ class Production extends Base
$pra['authors'] = json_encode($authors); $pra['authors'] = json_encode($authors);
$pra['organs'] = json_encode($organs); $pra['organs'] = json_encode($organs);
$res = object_to_array(json_decode(myPost($url, $pra))); $res = object_to_array(json_decode(myPost($url, $pra)));
if ($res['code'] == 0) { if ($res['code'] == 0) {
$r_update['state'] = 2; $r_update['state'] = 2;
$r_update['w_article_id'] = isset($res['data']['article_id']) ? $res['data']['article_id'] : 0; $r_update['w_article_id'] = isset($res['data']['article_id']) ? $res['data']['article_id'] : 0;
@@ -1699,6 +1718,12 @@ class Production extends Base
} }
//判断邮箱是否重复 chengxiaoling 20250926 end //判断邮箱是否重复 chengxiaoling 20250926 end
//判断是否是通讯作者 通讯地址必填 20260206 start
if(isset($data['is_report']) && $data['is_report'] == 1 && empty($data['mailing_address'])){
return jsonError("Please enter your mailing address");
}
//判断是否是通讯作者 通讯地址必填 20260206 end
$article_info = $this->article_obj->where('article_id', $old_article_author_info['article_id'])->find(); $article_info = $this->article_obj->where('article_id', $old_article_author_info['article_id'])->find();
$updata['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']); $updata['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']);
$updata['first_name'] = trim($data['first_name']); $updata['first_name'] = trim($data['first_name']);
@@ -1708,6 +1733,11 @@ class Production extends Base
$updata['is_first'] = $data['is_first']; $updata['is_first'] = $data['is_first'];
$updata['is_report'] = $data['is_report']; $updata['is_report'] = $data['is_report'];
$updata['email'] = isset($data['email']) ? trim($data['email']) : ''; $updata['email'] = isset($data['email']) ? trim($data['email']) : '';
//通信地址 20260206 start
$updata['mailing_address'] = isset($data['mailing_address']) ? trim($data['mailing_address']) : '';
//通信地址 20260206 end
$this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->update($updata); $this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->update($updata);
if (is_array($data['organs'])) { if (is_array($data['organs'])) {
$has_ids = []; $has_ids = [];
@@ -1801,6 +1831,12 @@ class Production extends Base
} }
//判断邮箱是否重复 chengxiaoling 20250926 end //判断邮箱是否重复 chengxiaoling 20250926 end
//判断是否是通讯作者 通讯地址必填 20260206 start
if(isset($data['is_report']) && $data['is_report'] == 1 && empty($data['mailing_address'])){
return jsonError("Please enter your mailing address");
}
//判断是否是通讯作者 通讯地址必填 20260206 end
$insert['p_article_id'] = $data['p_article_id']; $insert['p_article_id'] = $data['p_article_id'];
$insert['article_id'] = $p_info['article_id']; $insert['article_id'] = $p_info['article_id'];
$insert['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']); $insert['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']);
@@ -1812,6 +1848,10 @@ class Production extends Base
$insert['is_report'] = $data['is_report']; $insert['is_report'] = $data['is_report'];
$insert['email'] = isset($data['email']) ? trim($data['email']) : ''; $insert['email'] = isset($data['email']) ? trim($data['email']) : '';
//通信地址 20260206 start
$insert['mailing_address'] = isset($data['mailing_address']) ? trim($data['mailing_address']) : '';
//通信地址 20260206 end
Db::startTrans(); Db::startTrans();
$pa_id = $this->production_article_author_obj->insertGetId($insert); $pa_id = $this->production_article_author_obj->insertGetId($insert);
$or_res = true; $or_res = true;
@@ -1835,26 +1875,26 @@ class Production extends Base
/** /**
* gpt校对main内容 * gpt校对main内容
*/ */
public function freshMain() // public function freshMain()
{ // {
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'p_article_id' => 'require' // 'p_article_id' => 'require'
]); // ]);
if (!$rule->check($data)) { // if (!$rule->check($data)) {
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select(); // $list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
foreach ($list as $v) { // foreach ($list as $v) {
if ($v['content'] == '' || strlen($v['content']) < 60) { // if ($v['content'] == '' || strlen($v['content']) < 60) {
$this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]); // $this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]);
} else { // } else {
Queue::push('app\api\job\gpt@fresh', $v, 'gpt'); // Queue::push('app\api\job\gpt@fresh', $v, 'gpt');
} // }
} // }
//
return jsonSuccess([]); // return jsonSuccess([]);
} // }
@@ -2238,9 +2278,15 @@ class Production extends Base
return jsonError($rule->getError()); return jsonError($rule->getError());
} }
$info = $this->article_main_obj->where("am_id",$data['id'])->find(); $info = $this->article_main_obj->where("am_id",$data['id'])->find();
if(isset($data["code"])){
$content = $data['code'];
}else{
$content = $info['content'];
}
$production_info = $this->production_article_obj->where("article_id",$info['article_id'])->find(); $production_info = $this->production_article_obj->where("article_id",$info['article_id'])->find();
$refers = $this->production_article_refer_obj->where("p_article_id",$production_info['p_article_id'])->where('state',0)->order("index")->select(); $refers = $this->production_article_refer_obj->where("p_article_id",$production_info['p_article_id'])->where('state',0)->order("index")->select();
$res = $this->convertToLatex($info['content'],$refers); $res = $this->convertToLatex($content,$refers);
echo $res; echo $res;
// return jsonSuccess([$res]); // return jsonSuccess([$res]);
} }
@@ -2254,9 +2300,9 @@ class Production extends Base
return ''; return '';
} }
//单行处理公式内容 //单行处理公式内容
$pattern = '/^<wmath\s+data-latex="([^"]*)">.*<\/wmath>$/'; $pattern = '/^<wmath[^>]*?\s+data-latex="([^"]*)"[^>]*?>.*?<\/wmath>$/';
if(preg_match($pattern, $content) === 1){ if(preg_match($pattern, $content) === 1){
$pattern1 = '/<wmath\s+data-latex="([^"]*)">/'; $pattern1 = '/<wmath[^>]*?\s+data-latex="([^"]*)">/';
if (preg_match($pattern1, $content, $matches)) { if (preg_match($pattern1, $content, $matches)) {
$latexContent = $matches[1]; $latexContent = $matches[1];
// 将 $$ 转换为 $因为equation环境不需要$$ // 将 $$ 转换为 $因为equation环境不需要$$
@@ -2621,6 +2667,9 @@ class Production extends Base
$style['color'] = $this->colorMap['r']; $style['color'] = $this->colorMap['r'];
break; break;
// tr标签已被移除无需处理 // tr标签已被移除无需处理
case 'myh3':
$style['h3'] = true;
break;
} }
} }
@@ -2662,6 +2711,10 @@ class Production extends Base
$content = '$_{{'.$content.'}}$'; $content = '$_{{'.$content.'}}$';
} }
// 处理h3标签
if (isset($style['h3']) && $style['h3']) {
$content = "\\textbf{{$content}}";
}
return $content; return $content;
} }
@@ -3254,6 +3307,16 @@ class Production extends Base
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find(); $article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find(); $journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
$user_info = $this->user_obj->where('user_id', $article_info['user_id'])->find(); $user_info = $this->user_obj->where('user_id', $article_info['user_id'])->find();
//查询文章是否有Accept记录 20260210 start
$article_info_id = empty($article_info['article_id']) ? 0 : $article_info['article_id'];
$aMsgWhere = ['article_id' => $article_info_id,'state_to' => 5];
$aArticleMsg = Db::name('article_msg')->field('msg_id')->where($aMsgWhere)->find();
if(empty($aArticleMsg)){
return jsonError("Please set the paper as Accept before asking the author to confirm");
}
//查询文章是否有Accept记录 20260210 end
$this->pdfAddProof($p_info['article_id']); $this->pdfAddProof($p_info['article_id']);
if ($p_info['file_pdf'] == '') { if ($p_info['file_pdf'] == '') {
return jsonError('To the editor: PROOF is the final form before the article goes online. The PROOF link step not be opened if you have not completed the previous steps.'); return jsonError('To the editor: PROOF is the final form before the article goes online. The PROOF link step not be opened if you have not completed the previous steps.');
@@ -3413,11 +3476,11 @@ class Production extends Base
$tex_content .= "\\usepackage{textcomp} \n"; $tex_content .= "\\usepackage{textcomp} \n";
$tex_content .= "\\usepackage[english]{babel} \n"; $tex_content .= "\\usepackage[english]{babel} \n";
$tex_content .= "\\geometry{ $tex_content .= "\\geometry{
a4paper, % A4纸张 a4paper, % A4纸张
left=1.5cm, % 左页边距 left=1.5cm, % 左页边距
right=1.5cm, % 右页边距 right=1.5cm, % 右页边距
top=2cm, % 上页边距 top=2cm, % 上页边距
bottom=2cm, % 下页边距 bottom=2cm, % 下页边距
}"; }";
$tex_content .= "\\linespread{1.05}"; $tex_content .= "\\linespread{1.05}";
$tex_content .= "\\definecolor{tablegray}{RGB}{250,231,232}\n\n"; $tex_content .= "\\definecolor{tablegray}{RGB}{250,231,232}\n\n";
@@ -3651,7 +3714,14 @@ class Production extends Base
// 方法1: 使用pdflatex命令推荐 // 方法1: 使用pdflatex命令推荐
// $command = "{$sLatexDir}pdflatex -include-directory=" . dirname($texFilePath) . // $command = "{$sLatexDir}pdflatex -include-directory=" . dirname($texFilePath) .
// " -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath); // " -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath);
$command = "pdflatex -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath); // $command = "pdflatex -output-directory=" . $pdfDir . " " . escapeshellarg($texFilePath);
$sLatexDir = '/usr/bin/';//latex执行目录
$command = sprintf(
'%slualatex -interaction=nonstopmode -output-directory=%s %s 2>&1',
rtrim($sLatexDir, '/') . '/', // /usr/bin/lualatex
escapeshellarg($pdfDir), // 转义输出目录(含空格/特殊字符)
escapeshellarg($texFilePath) // 转义tex文件路径
);
$output = []; $output = [];
$returnVar = 0; $returnVar = 0;
@@ -4322,10 +4392,8 @@ class Production extends Base
$queue = Queue::push('app\api\job\ArticleCreatePdf@fire', ['p_article_id' => $iPArticleId], 'ArticleCreatePdf'); $queue = Queue::push('app\api\job\ArticleCreatePdf@fire', ['p_article_id' => $iPArticleId], 'ArticleCreatePdf');
//生成长表格PDF //生成长表格PDF
$aLongTableId = empty($aResult['long_table_id']) ? [] : $aResult['long_table_id']; $aLongTableId = empty($aResult['long_table_id']) ? [] : $aResult['long_table_id'];
var_dump($aLongTableId);
if(!empty($aLongTableId)){ //调用生成长表格队列 if(!empty($aLongTableId)){ //调用生成长表格队列
$longtablequeue = Queue::push('app\api\job\ArticleCreateLongTable@fire', ['p_article_id' => $iPArticleId,'long_table_id' => $aLongTableId], 'ArticleCreateLongTable'); $longtablequeue = Queue::push('app\api\job\ArticleCreateLongTable@fire', ['p_article_id' => $iPArticleId,'long_table_id' => $aLongTableId], 'ArticleCreateLongTable');
var_dump($longtablequeue);
} }
return json_encode(array('status' => 1,'msg' => 'tex file generated successfully')); return json_encode(array('status' => 1,'msg' => 'tex file generated successfully'));
} }
@@ -4436,4 +4504,54 @@ class Production extends Base
Db::commit(); Db::commit();
return json_encode(array('status' => 1,'msg' => 'PDF generated successfully')); return json_encode(array('status' => 1,'msg' => 'PDF generated successfully'));
} }
/**
* 获取排版生成PDF历史版本
* @param p_article_id 文章ID
*/
public function getProductionArticlePdf($aParam = []){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//必填值验证
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
if(empty($iPArticleId)){
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
}
//查询文章
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
$aProductionArticle = Db::name('production_article')->field('article_id,pdf_id')->where($aWhere)->find();
if(empty($aProductionArticle)){
return json_encode(array('status' => 3,'msg' => 'No articles found' ));
}
$iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id'];
if(empty($iArticleId)){
return json_encode(array('status' => 4,'msg' => 'Unbound article' ));
}
//日志查询
$aWhere = ['article_id' => $iArticleId,'p_article_id' => $iPArticleId,'state' => 2];
$aPdf = Db::name('production_article_pdf')->field('pdf_id,url,create_time')->where($aWhere)->select();
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
}
/**
* 获取生产文章信息
* @param p_article_id 文章ID
*/
public function getProductionArticle($aParam = []){
//获取参数
$aParam = empty($aParam) ? $this->request->post() : $aParam;
//必填值验证
$iPArticleId = empty($aParam['p_article_id']) ? '' : $aParam['p_article_id'];
if(empty($iPArticleId)){
return json_encode(array('status' => 2,'msg' => 'Please select an article' ));
}
//查询文章
$aWhere = ['p_article_id' => $iPArticleId,'state' => ['in',[0,2]]];
$aProductionArticle = Db::name('production_article')->field('pdf_id,file_sub_table')->where($aWhere)->find();
return json_encode(array('status' => 1,'msg' => 'success','data' => $aPdf));
}
} }

View File

@@ -2242,7 +2242,7 @@ class Reviewer extends Base
$aReviewerCompany = []; $aReviewerCompany = [];
if(!empty($aUserId)){ if(!empty($aUserId)){
//作者同机构的审稿人 //作者同机构的审稿人
$aReviewerCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0])->column('reviewer_id,company'); $aReviewerCompany = Db::name('user_reviewer_info')->where(['reviewer_id' => ['in',$aUserId],'state' => 0,'company' => ['<>','']])->column('reviewer_id,company');
} }
//文章作者机构信息 //文章作者机构信息
@@ -2277,7 +2277,12 @@ class Reviewer extends Base
//过滤审稿人机构 //过滤审稿人机构
if(!empty($aAuthorCompany)){ if(!empty($aAuthorCompany)){
$where['t_user_reviewer_info.company'] = ['not in', $aAuthorCompany]; $aAuthorCompany = array_filter($aAuthorCompany, function($v) {
return trim((string)$v) !== '';
});
if(!empty($aAuthorCompany)){
$where['t_user_reviewer_info.company'] = ['not in', $aAuthorCompany];
}
} }
// 计算10天之后的时间戳10天 = 10 * 24 * 60 * 60秒 // 计算10天之后的时间戳10天 = 10 * 24 * 60 * 60秒
$iTeenDaysLater = strtotime('-10 days'); $iTeenDaysLater = strtotime('-10 days');
@@ -2292,6 +2297,7 @@ class Reviewer extends Base
->whereOr('t_user_reviewer_info.last_invite_time', '=', 0); ->whereOr('t_user_reviewer_info.last_invite_time', '=', 0);
}) })
->count(); ->count();
if(empty($count)){ if(empty($count)){
return jsonSuccess(['reviewers' => [],'count' => 0]); return jsonSuccess(['reviewers' => [],'count' => 0]);
} }

View File

@@ -23,7 +23,7 @@ class Supplementary extends Base
public function getJournalBoard(){ public function getJournalBoard(){
//获取参数 //获取参数
$aParam = $this->request->post(); $aParam = $this->request->post();
//参数验证 //参数验证
@@ -38,17 +38,17 @@ class Supplementary extends Base
$aWhere = ['state' => 0,'issn' => ['in',$sIssn]]; $aWhere = ['state' => 0,'issn' => ['in',$sIssn]];
$aJournal = Db::name('journal')->where($aWhere)->column('journal_id,issn'); $aJournal = Db::name('journal')->where($aWhere)->column('journal_id,issn');
if(empty($aJournal)){ if(empty($aJournal)){
return json_encode(['status' => 3,'msg' => 'No journal information found']); return json_encode(['status' => 3,'msg' => 'No journal information found']);
} }
//查询期刊编辑信息 //查询期刊编辑信息
$aWhere = ['state' => 0,'journal_id' => ['in',array_keys($aJournal)]]; $aWhere = ['state' => 0,'journal_id' => ['in',array_keys($aJournal)]];
if(isset($aParam['type'])){//编辑类型 if(isset($aParam['type'])){//编辑类型
$aWhere['type'] = $aParam['type']; $aWhere['type'] = $aParam['type'];
} }
$aJournalBoard = Db::name('board_to_journal')->field('journal_id,user_id')->where($aWhere)->select(); $aJournalBoard = Db::name('board_to_journal')->field('journal_id,user_id')->where($aWhere)->select();
if(empty($aJournalBoard)){ if(empty($aJournalBoard)){
return json_encode(['status' => 4,'msg' => 'No editorial information was found for the journal']); return json_encode(['status' => 4,'msg' => 'No editorial information was found for the journal']);
} }
//查询编辑详情 //查询编辑详情
@@ -62,10 +62,73 @@ class Supplementary extends Base
continue; continue;
} }
$sRealName = empty($aUser[$value['user_id']]) ? '' : $aUser[$value['user_id']]; $sRealName = empty($aUser[$value['user_id']]) ? '' : $aUser[$value['user_id']];
if(!empty($sRealName) && strlen($sRealName) >= 3 && substr($sRealName, 0, 3) === "\xEF\xBB\xBF") {
$sRealName = substr($sRealName, 3);
}
$aUserData[$sIssn][] = $sRealName; $aUserData[$sIssn][] = $sRealName;
} }
return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]); return json_encode(['status' => 1,'msg' => 'success','data' => $aUserData]);
} }
/**
* @title 获取文章底部信息
* @description 获取期刊编辑接口
*/
public function getProductiArticleFooter(){
$aParam = $this->request->post();
//官网文章ID
$iWarticleId = empty($aParam['w_article_id']) ? 0 : $aParam['w_article_id'];
if(empty($iWarticleId)){
return json_encode(['status' => 2,'msg' => 'Please select an article']);
}
//获取子刊信息
$aJournalStage = empty($aParam['journal_stage']) ? [] : $aParam['journal_stage'];
//查询文章生产信息
$aWhere = ['w_article_id' => $iWarticleId,'state' => ['in',[0,2]]];
$aProductionArticle = Db::name('production_article')->field('p_article_id,article_id,journal_stage_id,journal_id,title,type,acknowledgment,abbreviation,author_contribution,abbr,npp,doi,executive_editor')->where($aWhere)->find();
if(empty($aProductionArticle)){
return json_encode(['status' => 3,'msg' => 'No production article information found']);
}
//查询期刊信息
$iJournalId = empty($aProductionArticle['journal_id']) ? 0 : $aProductionArticle['journal_id'];
$aJournal = [];
if(!empty($iJournalId)){
$aWhere = ['journal_id' => $iJournalId,'state' => 0];
$aJournal = Db::name('journal')->field('jabbr,title')->where($aWhere)->find();
}
//获取文章时间/编委信息
$iArticleId = empty($aProductionArticle['article_id']) ? 0 : $aProductionArticle['article_id'];
if(empty($iArticleId)){
return json_encode(['status' => 3,'msg' => 'No article information found']);
}
$oLatexContent = new \app\common\LatexContent;
$aTime = $oLatexContent->getArticleTime(['article_id' => $iArticleId]);
$aProductionArticle = empty($aTime['data']) ? $aProductionArticle : array_merge($aTime['data'],$aProductionArticle);
//获取期刊引用信息
$sCite = $this->_cite($aProductionArticle,$aJournal,$aJournalStage);
$aProductionArticle['article_cite'] = empty($sCite) ? '' : $sCite;
$aProductionArticle['journal_title'] = empty($aJournal['title']) ? '' : $aJournal['title'];
return json_encode(['status' => 1,'data' => $aProductionArticle]);
}
//处理期刊引用信息
private function _cite($aArticle = [],$aJournal = [],$aJournalStage = []){
$no = empty($aJournalStage['stage_no']) ? ':' : '(' . $aJournalStage['stage_no'] . '):';
$jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr'];
$stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year'];
$stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol'];
$sCite = '';
if ($aArticle['journal_id'] == 22) {
$sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
} else {
$sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '. <i>' . choiseJabbr($aArticle['article_id'], $jabbr) . '</i>. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
}
return $sCite;
}
} }
?> ?>

View File

@@ -199,48 +199,48 @@ class Typeset extends Base
/** /**
* 推送文章到官网系统 * 推送文章到官网系统
*/ */
public function pushArticleToSystem(){ // public function pushArticleToSystem(){
die('Service suspension!'); // die('Service suspension!');
$data = $this->request->post(); // $data = $this->request->post();
$rule = new Validate([ // $rule = new Validate([
'on_id'=>'require' // 'on_id'=>'require'
]); // ]);
if(!$rule->check($data)){ // if(!$rule->check($data)){
return jsonError($rule->getError()); // return jsonError($rule->getError());
} // }
$on_info = $this->online_obj->where('on_id',$data['on_id'])->find(); // $on_info = $this->online_obj->where('on_id',$data['on_id'])->find();
$ts_info = $this->ts_obj->where('article_id',$on_info['article_id'])->where('ts_state',0)->find(); // $ts_info = $this->ts_obj->where('article_id',$on_info['article_id'])->where('ts_state',0)->find();
$article_info = $this->article_obj->where('article_id',$on_info['article_id'])->find(); // $article_info = $this->article_obj->where('article_id',$on_info['article_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find(); // $journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
$authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select(); // $authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select();
//check信息是否完整 // //check信息是否完整
if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){ // if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){
return jsonError('信息不全!'); // return jsonError('信息不全!');
} // }
//发送推送请求 // //发送推送请求
// $url = "http://www.journal.com/master/Article/addArticleForSubmission"; // // $url = "http://www.journal.com/master/Article/addArticleForSubmission";
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission'; // $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
$pra = []; // $pra = [];
$pra['title'] = $ts_info['ts_title']; // $pra['title'] = $ts_info['ts_title'];
$pra['journal_stage_id'] = $on_info['journal_stage_id']; // $pra['journal_stage_id'] = $on_info['journal_stage_id'];
$pra['issn'] = $journal_info['issn']; // $pra['issn'] = $journal_info['issn'];
$pra['type'] = translateType($article_info['type']); // $pra['type'] = translateType($article_info['type']);
$pra['doi'] = $on_info['on_doi']; // $pra['doi'] = $on_info['on_doi'];
$pra['abstract'] = $on_info['abstract']; // $pra['abstract'] = $on_info['abstract'];
$pra['pub_date'] = $ts_info['online_date']; // $pra['pub_date'] = $ts_info['online_date'];
$pra['file_pdf'] = $article_info['pdf_url']; // $pra['file_pdf'] = $article_info['pdf_url'];
$pra['keywords'] = $ts_info['keywords']; // $pra['keywords'] = $ts_info['keywords'];
$pra['npp'] = $on_info['npp']; // $pra['npp'] = $on_info['npp'];
$pra['authors'] = json_encode($authors); // $pra['authors'] = json_encode($authors);
//
$res = object_to_array(json_decode(myPost($url, $pra))); // $res = object_to_array(json_decode(myPost($url, $pra)));
if($res['code']==0){ // if($res['code']==0){
$this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]); // $this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]);
return jsonSuccess([]); // return jsonSuccess([]);
}else{ // }else{
return jsonError('system error:'.$res['msg']); // return jsonError('system error:'.$res['msg']);
} // }
} // }
/** /**
* 编辑online信息 * 编辑online信息

View File

@@ -36,7 +36,7 @@ class Workbench extends Base
//获取状态 //获取状态
$iState = isset($aParam['state']) ? $aParam['state'] : -2; $iState = isset($aParam['state']) ? $aParam['state'] : -2;
//空的查询条件 //空的查询条件
$aWhere = []; $aWhere = ['accept_sn' => ['not like','Draft%']];
//SN //SN
$sAcceptSn = empty($aParam['accept_sn']) ? '': $aParam['accept_sn']; $sAcceptSn = empty($aParam['accept_sn']) ? '': $aParam['accept_sn'];
if(!empty($sAcceptSn)){ if(!empty($sAcceptSn)){
@@ -181,6 +181,10 @@ class Workbench extends Base
$aArticle[$key]['report'] = $aAuthorInfo; $aArticle[$key]['report'] = $aAuthorInfo;
$aArticle[$key]['country'] = empty($aAuthorInfo) ? [] : array_unique(array_column($aAuthorInfo, 'country')); $aArticle[$key]['country'] = empty($aAuthorInfo) ? [] : array_unique(array_column($aAuthorInfo, 'country'));
$aArticle[$key]['type_name'] = translateType($value['type']); $aArticle[$key]['type_name'] = translateType($value['type']);
$aArticle[$key]['is_draft'] = 2;
if(!empty($value['accept_sn']) && substr($value['accept_sn'], 0, 5) === 'Draft'){
$aArticle[$key]['is_draft'] = 1;
}
// //付款信息 // //付款信息
// $iPsId = empty($aOrder[$value['article_id']]) ? 0 : $aOrder[$value['article_id']]; // $iPsId = empty($aOrder[$value['article_id']]) ? 0 : $aOrder[$value['article_id']];
@@ -452,6 +456,12 @@ class Workbench extends Base
$aArticleReviewer['realname'] = empty($aUser['realname']) ? '' : $aUser['realname']; $aArticleReviewer['realname'] = empty($aUser['realname']) ? '' : $aUser['realname'];
$aArticleReviewer['email'] = empty($aUser['email']) ? '' : $aUser['email']; $aArticleReviewer['email'] = empty($aUser['email']) ? '' : $aUser['email'];
} }
//查询审稿人机构
if(!empty($aUser)){
$aWhere = ['reviewer_id' => $iUserId,'state' => 0];
$aReviewerInfo = Db::name('user_reviewer_info')->field('company')->where($aWhere)->find();
$aArticleReviewer['company'] = empty($aReviewerInfo['company']) ? '' : $aReviewerInfo['company'];
}
//组装信息 //组装信息
$aData = ['article' => $aArticle,'article_reviewer' => $aArticleReviewer]; $aData = ['article' => $aArticle,'article_reviewer' => $aArticleReviewer];
@@ -641,13 +651,31 @@ class Workbench extends Base
//查询审稿记录 //查询审稿记录
$aWhere = ['art_rev_id' => $iArtRevId]; $aWhere = ['art_rev_id' => $iArtRevId];
$aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state')->where($aWhere)->find(); $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state,agree_review_time,ctime')->where($aWhere)->find();
if(empty($aArticleReviewer)){ if(empty($aArticleReviewer)){
return json_encode(['status' => 4,'msg' => 'Review record does not exist']); return json_encode(['status' => 4,'msg' => 'Review record does not exist']);
} }
if($aArticleReviewer['state'] != 4){ if($aArticleReviewer['state'] != 4 && $aArticleReviewer['state'] != 0){
return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']); return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']);
} }
if($aArticleReviewer['state'] == 0){
$iCtime = empty($aArticleReviewer['ctime']) ? 0 : $aArticleReviewer['ctime'];
$iTime = empty($aArticleReviewer['agree_review_time']) ? 0 : $aArticleReviewer['agree_review_time'];
$iTime = empty($iTime) ? intval($iCtime) : intval($iTime);
if (!is_numeric($iTime) || (int)$iTime <= 0) {
return json_encode(['status' => 12,'msg' => 'Invalid record time, the review period has expired']);
}
//判断是否超过14天
// 14天 = 14*24*3600 秒 = 1209600 秒
$iNowTime = strtotime(date('Y-m-d', time()));
$iFourteenDays = 14 * 24 * 3600;
$iTime = date('Y-m-d', $iTime);
$iTime = strtotime($iTime);//同意审稿时间戳
$timeDiff = $iTime+$iFourteenDays;
if($timeDiff >= $iNowTime){
return json_encode(['status' => 13,'msg' => 'The review link has not expired and no application is required']);
}
}
//获取文章信息 //获取文章信息
$aWhere = ['article_id' => $aArticleReviewer['article_id']]; $aWhere = ['article_id' => $aArticleReviewer['article_id']];
@@ -685,7 +713,7 @@ class Workbench extends Base
$aUser = array_column($aUser, null,'user_id'); $aUser = array_column($aUser, null,'user_id');
//更新审稿人重新申请状态为 //更新审稿人重新申请状态为
$aWhere = ['art_rev_id' => $iArtRevId,'state' => 4]; $aWhere = ['art_rev_id' => $iArtRevId];
$result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update(['is_reapply' => 1,'reapply_time' => time(),'reviewer_act' => 1]); $result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update(['is_reapply' => 1,'reapply_time' => time(),'reviewer_act' => 1]);
if($result === false){ if($result === false){
return json_encode(array('status' => 11,'msg' => 'Application to reopen link failed' )); return json_encode(array('status' => 11,'msg' => 'Application to reopen link failed' ));
@@ -773,14 +801,34 @@ class Workbench extends Base
//查询审稿记录 //查询审稿记录
$aWhere = ['art_rev_id' => $iArtRevId]; $aWhere = ['art_rev_id' => $iArtRevId];
$aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state')->where($aWhere)->find(); $aArticleReviewer = Db::name('article_reviewer')->field('art_rev_id,reviewer_id,article_id,state,ctime,agree_review_time')->where($aWhere)->find();
if(empty($aArticleReviewer)){ if(empty($aArticleReviewer)){
return json_encode(['status' => 4,'msg' => 'Review record does not exist']); return json_encode(['status' => 4,'msg' => 'Review record does not exist']);
} }
if($aArticleReviewer['state'] != 4){ // if($aArticleReviewer['state'] != 4){
// return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']);
// }
if($aArticleReviewer['state'] != 4 && $aArticleReviewer['state'] != 0){
return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']); return json_encode(['status' => 5,'msg' => 'The review link has not expired and no application is required']);
} }
if($aArticleReviewer['state'] == 0){
$iCtime = empty($aArticleReviewer['ctime']) ? 0 : $aArticleReviewer['ctime'];
$iTime = empty($aArticleReviewer['agree_review_time']) ? 0 : $aArticleReviewer['agree_review_time'];
$iTime = empty($iTime) ? intval($iCtime) : intval($iTime);
if (!is_numeric($iTime) || (int)$iTime <= 0) {
return json_encode(['status' => 12,'msg' => 'Invalid record time, the review period has expired']);
}
//判断是否超过14天
$iNowTime = strtotime(date('Y-m-d', time()));
// 14天 = 14*24*3600 秒 = 1209600 秒
$iFourteenDays = 14 * 24 * 3600;
$iTime = date('Y-m-d', $iTime);
$iTime = strtotime($iTime);//同意审稿时间戳
$timeDiff = $iTime+$iFourteenDays;
if($timeDiff >= $iNowTime){
return json_encode(['status' => 13,'msg' => 'The review link has not expired and no application is required']);
}
}
//获取文章信息 //获取文章信息
$aWhere = ['article_id' => $aArticleReviewer['article_id']]; $aWhere = ['article_id' => $aArticleReviewer['article_id']];
$aArticle = Db::name('article')->field('article_id,abstrart,title,type,accept_sn,journal_id,state')->where($aWhere)->find(); $aArticle = Db::name('article')->field('article_id,abstrart,title,type,accept_sn,journal_id,state')->where($aWhere)->find();
@@ -808,12 +856,24 @@ class Workbench extends Base
// } // }
//更新文章状态为邀请 //更新文章状态为邀请
$aWhere = ['art_rev_id' => $iArtRevId,'state' => 4]; $aWhere = ['art_rev_id' => $iArtRevId];
$result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update(['state' => 5,'ctime' => time(),'editor_act' => 1,'is_reapply' => 2,'update_time' => time(),'reviewer_act' => 0]); $aUpdate = [];
if($aArticleReviewer['state'] == 4){
$aUpdate['state'] = 5;
$aUpdate['ctime'] = time();
}
if($aArticleReviewer['state'] == 0){
$aUpdate['agree_review_time'] = time();
}
if(empty($aUpdate)){
return json_encode(array('status' => 15,'msg' => 'Update data to empty' ));
}
$aUpdate += ['editor_act' => 1,'is_reapply' => 2,'update_time' => time(),'reviewer_act' => 0];
$result = Db::name('article_reviewer')->where($aWhere)->limit(1)->update($aUpdate);
if($result === false){ if($result === false){
return json_encode(array('status' => 11,'msg' => 'Status update failed' )); return json_encode(array('status' => 11,'msg' => 'Status update failed' ));
} }
//查询审稿人的邮箱 //查询审稿人的邮箱
$aWhere = ['user_id' => $aArticleReviewer['reviewer_id'],'state' => 0,'email' => ['<>','']]; $aWhere = ['user_id' => $aArticleReviewer['reviewer_id'],'state' => 0,'email' => ['<>','']];
$aUser = Db::name('user')->field('user_id,email,realname,account')->where($aWhere)->find(); $aUser = Db::name('user')->field('user_id,email,realname,account')->where($aWhere)->find();

View File

@@ -53,11 +53,9 @@ class ArticleCreateLongTable
if (!$this->oQueueJob->acquireLock($sRedisKey, $sRedisValue, $job)) { if (!$this->oQueueJob->acquireLock($sRedisKey, $sRedisValue, $job)) {
return; // 未获取到锁,已处理 return; // 未获取到锁,已处理
} }
var_dump($aLongTableId);
//生成内容 //生成内容
$oProduction = new \app\api\controller\Production; $oProduction = new \app\api\controller\Production;
$response = $oProduction->longTablePdfCreate($aLongTableId); $response = $oProduction->longTablePdfCreate($aLongTableId);
var_dump($response);
// 验证API响应 // 验证API响应
if (empty($response)) { if (empty($response)) {
throw new \RuntimeException("返回空结果"); throw new \RuntimeException("返回空结果");

View File

@@ -35,6 +35,7 @@ journalname={{{{journal_title}}}},
layout=largetwo, layout=largetwo,
year={{stage_year}},%年 year={{stage_year}},%年
volume={{stage_vol}},%卷 volume={{stage_vol}},%卷
articletype={{{{article_type}}}},
no={{stage_no}},%期 no={{stage_no}},%期
page={{stage_page}},%号 page={{stage_page}},%号
]{../tmr-tex} ]{../tmr-tex}
@@ -43,6 +44,7 @@ page={{stage_page}},%号
\journalweb{{{website}}} \journalweb{{{website}}}
\usepackage{amsmath} \usepackage{amsmath}
\usepackage{balance}
\usepackage[nopatch]{microtype} \usepackage[nopatch]{microtype}
\usepackage{booktabs} \usepackage{booktabs}
\usepackage[backend=biber]{biblatex} \usepackage[backend=biber]{biblatex}
@@ -50,27 +52,28 @@ page={{stage_page}},%号
\usepackage{tabularray} \usepackage{tabularray}
\addbibresource{references_{{article_id}}.bib} \addbibresource{references_{{article_id}}.bib}
\definecolor{evenRowColor}{RGB}{250,231,232} \definecolor{evenRowColor}{RGB}{250,231,232}
\setlength{\parindent}{1em}
\title{{{article_title}}} \title{{{article_title}}}
{{author_info}} {{author_info}}
{{correspondence_info}} \Correspondence{{{correspondence_info}}}
\keywords{keyword entry 1, keyword entry 2, keyword entry 3} %% First letter not capped \keywords{keyword entry 1, keyword entry 2, keyword entry 3} %% First letter not capped
{{author_contribution}} \authorcontributions{{{author_contribution}}}
\competinginterests{The authors declare no conflicts of interest.} \competinginterests{The authors declare no conflicts of interest.}
{{article_acknowledgment}} \Acknowledgments{{{article_acknowledgment}}}
\Peerreviewinformation{{{journal_title}} thanks all anonymous reviewers for their contribution to the peer review of this paper} \Peerreviewinformation{\textit{{{journal_title}}} thanks all anonymous reviewers for their contribution to the peer review of this paper}
{{article_abbreviation}} \Abbreviations{{{article_abbreviation}}}
{{article_cite}} \Citation{{{article_cite}}}
\received{{{received_date}}} \received{{{received_date}}}
\revised{{{revision_date}}} \revised{{{revision_date}}}
\accepted{{{accepted_date}}} \accepted{{{accepted_date}}}
\Availableonline{{{pub_date}}} \Availableonline{{{pub_date}}}
{{executive_editor}} \EditorialAdvisoryBoard{{{editorial_advisory_board}}}
\Executiveeditor{{{executive_editor}}}
{{abstract}} {{abstract}}
{{keywords}} {{keywords}}
@@ -83,6 +86,7 @@ page={{stage_page}},%号
{{article_main}} {{article_main}}
\nocite{*} \nocite{*}
\printbibliography[title={References}] \printbibliography[title={References}]
\balance
\end{document}'; \end{document}';
/** /**
* 生成初稿-基本内容 * 生成初稿-基本内容
@@ -105,6 +109,7 @@ page={{stage_page}},%号
} }
} }
//子刊信息 //子刊信息
$aJournalStage = [];
$iJournalStageId = empty($aProductionArticle['journal_stage_id']) ? 0 : $aProductionArticle['journal_stage_id']; $iJournalStageId = empty($aProductionArticle['journal_stage_id']) ? 0 : $aProductionArticle['journal_stage_id'];
if(!empty($iJournalStageId)){ if(!empty($iJournalStageId)){
$aJournalStage = $this->getJournalStage(['journal_stage_id' => $iJournalStageId]); $aJournalStage = $this->getJournalStage(['journal_stage_id' => $iJournalStageId]);
@@ -118,9 +123,9 @@ page={{stage_page}},%号
//年 //年
$iYear = empty($aJournalStage['stage_year']) ? date('Y') : $aJournalStage['stage_year']; $iYear = empty($aJournalStage['stage_year']) ? date('Y') : $aJournalStage['stage_year'];
//卷 //卷
$iVolume = empty($aJournalStage['stage_vol']) ? 0 : $aJournalStage['stage_vol']; $iVolume = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol'];
//期 //期
$iPeriod = empty($aJournalStage['stage_no']) ? 0 : $aJournalStage['stage_no']; $iPeriod = empty($aJournalStage['stage_no']) ? '' : $aJournalStage['stage_no'];
//页 //页
$sPage = empty($aProductionArticle['npp']) ? '' : $aProductionArticle['npp']; $sPage = empty($aProductionArticle['npp']) ? '' : $aProductionArticle['npp'];
@@ -138,7 +143,7 @@ page={{stage_page}},%号
$aAuthoInfo = $this->dealAuthor(['p_article_id' => $aProductionArticle['p_article_id']]); $aAuthoInfo = $this->dealAuthor(['p_article_id' => $aProductionArticle['p_article_id']]);
$aSearch['{{author_info}}'] = empty($aAuthoInfo['author']) ? '' : $aAuthoInfo['author']; $aSearch['{{author_info}}'] = empty($aAuthoInfo['author']) ? '' : $aAuthoInfo['author'];
//通讯作者信息 //通讯作者信息
$aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : '\Correspondence{'.$aAuthoInfo['correspondence'].'}'; $aSearch['{{correspondence_info}}'] = empty($aAuthoInfo['correspondence']) ? '' : $aAuthoInfo['correspondence'];
//文章基本信息处理 //文章基本信息处理
//标题 //标题
@@ -156,34 +161,41 @@ page={{stage_page}},%号
} }
$aSearch['{{article_title}}'] = $sTitle; $aSearch['{{article_title}}'] = $sTitle;
//author_contribution //author_contribution
$aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : '\authorcontributions{'.$this->dealContent($aProductionArticle['author_contribution']).'}'; $aSearch['{{author_contribution}}'] = empty($aProductionArticle['author_contribution']) ? '' : $this->dealContent($aProductionArticle['author_contribution']);
//acknowledgment //acknowledgment
$aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : '\Acknowledgments{'.$this->dealContent($aProductionArticle['acknowledgment']).'}'; $aSearch['{{article_acknowledgment}}'] = empty($aProductionArticle['acknowledgment']) ? '' : $this->dealContent($aProductionArticle['acknowledgment']);
//abbreviation //abbreviation
$aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : '\Abbreviations{'.$this->dealContent($aProductionArticle['abbreviation']).'}'; $aSearch['{{article_abbreviation}}'] = empty($aProductionArticle['abbreviation']) ? '' : $this->dealContent($aProductionArticle['abbreviation']);
//文章引用信息 //文章引用信息
$sCite = $this->getArticleCite($aProductionArticle,$aJournal,$aJournalStage); $sCite = $this->getArticleCite($aProductionArticle,$aJournal,$aJournalStage);
$aSearch['{{article_cite}}'] = empty($sCite) ? '' : '\Citation{'.$sCite.'}'; $aSearch['{{article_cite}}'] = empty($sCite) ? '' : $sCite;
//文章类型
$aSearch['{{article_type}}'] = empty($aProductionArticle['type']) ? 'ARTICLE' : strtoupper($aProductionArticle['type']);
//获取文章时间 //获取文章时间
$aTime = $this->getArticleTime(['article_id' => $aProductionArticle['article_id']]); $aTime = $this->getArticleTime(['article_id' => $aProductionArticle['article_id']]);
$aTime = empty($aTime['data']) ? [] : $aTime['data']; $aTime = empty($aTime['data']) ? [] : $aTime['data'];
$aSearch['{{received_date}}'] = empty($aTime['received_date']) ? '' : $aTime['received_date']; $aSearch['{{received_date}}'] = empty($aTime['received_date']) ? '' : $aTime['received_date'];
$aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : $aTime['revision_date']; $aSearch['{{revision_date}}'] = '';
if(in_array( $aSearch['{{article_type}}'], ['ARTICLE','REVIEW','MINI REVIEW'])){
$aSearch['{{revision_date}}'] = empty($aTime['revision_date']) ? '' : $aTime['revision_date'];
}
$aSearch['{{accepted_date}}'] = empty($aTime['accepted_date']) ? '' : $aTime['accepted_date']; $aSearch['{{accepted_date}}'] = empty($aTime['accepted_date']) ? '' : $aTime['accepted_date'];
$aSearch['{{pub_date}}'] = empty($aProductionArticle['pub_date']) ? '' : $aProductionArticle['pub_date']; $aSearch['{{pub_date}}'] = empty($aProductionArticle['pub_date']) ? '' : $aProductionArticle['pub_date'];
//终审编委名字
$aSearch['{{editorial_advisory_board}}'] = empty($aTime['editorial_advisory_board']) ? '' : $aTime['editorial_advisory_board'];
//获取编辑信息 //获取编辑信息
$executive_editor = empty($aProductionArticle['executive_editor']) ? '' : '\Executiveeditor{'.$this->dealContent($aProductionArticle['executive_editor']).'}'; $executive_editor = empty($aProductionArticle['executive_editor']) ? '' : $this->dealContent($aProductionArticle['executive_editor']);
$executive_editor_realname = empty($aUser['realname']) ? '' : '\Executiveeditor{'.$this->dealContent($aUser['realname']).'}'; $executive_editor_realname = empty($aUser['realname']) ? '' : $this->dealContent($aUser['realname']);
$executive_editor = empty($executive_editor) ? $executive_editor_realname : $executive_editor; $executive_editor = empty($executive_editor) ? $executive_editor_realname : $executive_editor;
$aSearch['{{executive_editor}}'] = $executive_editor; $aSearch['{{executive_editor}}'] = $executive_editor;
//摘要替换 //摘要替换
$sAbstract = empty($aProductionArticle['abstract']) ? '' : $this->dealContent($aProductionArticle['abstract']); $sAbstract = empty($aProductionArticle['abstract']) ? '' : $this->dealContent($aProductionArticle['abstract']);
if(!empty($sAbstract)){ if(!empty($sAbstract)){
$aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\textcolor[HTML]{0070C0}{\textbf{Conclusion:}}']; $aRelace = ['Background:' => '\textcolor[HTML]{0070C0}{\textbf{Background:}}','Methods:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Methods:}}','Results:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Results:}}','Conclusion:' => '\\ \textcolor[HTML]{0070C0}{\textbf{Conclusion:}}'];
$sAbstract = str_replace(array_keys($aRelace), array_values($aRelace), $sAbstract); $sAbstract = str_replace(array_keys($aRelace), array_values($aRelace), $sAbstract);
$sAbstract = '\tmrabstract{'.$sAbstract.'}'; $sAbstract = '\tmrabstract{'.$sAbstract.'}';
} }
@@ -194,24 +206,27 @@ page={{stage_page}},%号
//文章图片地址 //文章图片地址
$sIcon = empty($aProductionArticle['icon']) ? '' : $aProductionArticle['icon']; $sIcon = empty($aProductionArticle['icon']) ? '' : $aProductionArticle['icon'];
$is_graphical_abstract = empty($aProductionArticle['is_graphical_abstract']) ? 3 : $aProductionArticle['is_graphical_abstract'];//是否显示图文摘要1是2否3未选择
if(!empty($sIcon)){ if(!empty($sIcon)){
// $sIconUrl = rtrim(ROOT_PATH).$this->sArticleIcon.'/'.$sIcon; $sIconUrl = ROOT_PATH.trim($this->sArticleIcon,'/').'/'.$sIcon;
// if(file_exists($sIconUrl)){ if(file_exists($sIconUrl) && $is_graphical_abstract == 1){
// $sIcon = '\KeywordImage{'.$sIconUrl.'}'; $sIconUrl = str_replace(ROOT_PATH.'public/', '', $sIconUrl);
// }else{ $sIconUrl = '../../'.$sIconUrl;
// $sIcon = ''; $sIcon = $sIconUrl;
// }
//下载图片
$sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleIcon.'/'.$sIcon;
$aImageInfo = $this->getImage($sImagePath,$aProductionArticle['article_id']);
if(!empty($aImageInfo['data'])){
$aImageInfo['data'] = './image/'.basename($aImageInfo['data']);
$sIcon = '\KeywordImage{'.$aImageInfo['data'].'}';
}else{ }else{
$sIcon = ''; $sIcon = '';
} }
// //下载图片
// $sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleIcon.'/'.$sIcon;
// $aImageInfo = $this->getImage($sImagePath,$aProductionArticle['article_id']);
// if(!empty($aImageInfo['data'])){
// $aImageInfo['data'] = './image/'.basename($aImageInfo['data']);
// $sIcon = '\KeywordImage{'.$aImageInfo['data'].'}';
// }else{
// $sIcon = '';
// }
} }
$aSearch['{{article_icon}}'] = $sIcon; $aSearch['{{article_icon}}'] = '\KeywordImage{'.$sIcon.'}';
$aSearch['{{keywords}}'] = $sKeywords; $aSearch['{{keywords}}'] = $sKeywords;
// $aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls'; // $aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls';
$aSearch['{{article_id}}'] = $aProductionArticle['article_id']; $aSearch['{{article_id}}'] = $aProductionArticle['article_id'];
@@ -255,12 +270,13 @@ page={{stage_page}},%号
//查询正文信息 //查询正文信息
$aWhere = ['article_id' => $aProductionArticle['article_id'],'state' => 0]; $aWhere = ['article_id' => $aProductionArticle['article_id'],'state' => 0];
$aArticleMain = Db::name('article_main')->field('am_id,article_id,type,content,ami_id,amt_id,is_h1,is_h2,is_h3,sort')->where($aWhere)->order('sort')->select(); $aArticleMain = Db::name('article_main')->field('am_id,article_id,type,content,ami_id,amt_id,is_h1,is_h2,is_h3,sort')->where($aWhere)->order('sort')->select();
if(!empty($aArticleMain)){ if(!empty($aArticleMain)){
//查询图片 //查询图片
$aAmiId = array_unique(array_column($aArticleMain, 'ami_id')); $aAmiId = array_unique(array_column($aArticleMain, 'ami_id'));
$aWhere = ['ami_id' => ['in',$aAmiId],'state' => 0]; $aWhere = ['ami_id' => ['in',$aAmiId],'state' => 0];
$aArticleMainImage = Db::name('article_main_image')->field('ami_id,url,note')->where($aWhere)->select(); $aArticleMainImage = Db::name('article_main_image')->field('ami_id,url,title,note')->where($aWhere)->select();
$aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id'); $aArticleMainImage = empty($aArticleMainImage) ? [] : array_column($aArticleMainImage, null,'ami_id');
//查询表格 //查询表格
$aAmtId = array_unique(array_column($aArticleMain, 'amt_id')); $aAmtId = array_unique(array_column($aArticleMain, 'amt_id'));
@@ -305,7 +321,13 @@ page={{stage_page}},%号
} }
if($value['is_h1'] == 0 && $value['is_h2'] == 0 && $value['is_h3'] == 0){ if($value['is_h1'] == 0 && $value['is_h2'] == 0 && $value['is_h3'] == 0){
if($value['type'] == 0 ){ if($value['type'] == 0 ){
$sMain .= $this->dealContent($value['content'],$aReferences)."\\par\n"; //处理内容
$sMainContent = $this->dealContent($value['content'],$aReferences);
// //替换myh3标签
// $contentpattern = '/<myh3>(.*?)<\/myh3>/is';
// $contentreplacement = '\\subsubsection{$1}';
// $sMainContent = preg_replace($contentpattern, $contentreplacement, $sMainContent);
$sMain .= $sMainContent."\\par\n";
} }
if($value['type'] == 1 ){//图片 if($value['type'] == 1 ){//图片
$aImageInfo = empty($aArticleMainImage[$value['ami_id']]) ? [] : $aArticleMainImage[$value['ami_id']]; $aImageInfo = empty($aArticleMainImage[$value['ami_id']]) ? [] : $aArticleMainImage[$value['ami_id']];
@@ -313,21 +335,20 @@ page={{stage_page}},%号
continue; continue;
} }
// $sIconUrl = rtrim(ROOT_PATH).$this->sArticleIcon.'/'.$sIcon; $sMainImageUrl = ROOT_PATH.trim($this->sArticleMainImage,'/').'/'.$aImageInfo['url'];
// if(file_exists($sIconUrl)){ if(!file_exists($sMainImageUrl)){
// $sIcon = '\KeywordImage{'.$sIconUrl.'}';
// }else{
// $sIcon = '';
// }
//下载图片
$sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleMainImage.'/'.$aImageInfo['url'];
$aResult = $this->getImage($sImagePath,$aProductionArticle['p_article_id']);
if(empty($aResult['data'])){
continue; continue;
} }
// //下载图片
// $sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleMainImage.'/'.$aImageInfo['url'];
// $aResult = $this->getImage($sImagePath,$aProductionArticle['article_id']);
// if(empty($aResult['data'])){
// continue;
// }
// $aImageSearch = ['{{img_url}}' => $aResult['data'],'{{img_title}}' => $aImageInfo['note'],'{{img_fig_sim}}' => 'img_fig_sim_'.$value['ami_id']]; // $aImageSearch = ['{{img_url}}' => $aResult['data'],'{{img_title}}' => $aImageInfo['note'],'{{img_fig_sim}}' => 'img_fig_sim_'.$value['ami_id']];
// $sImageTempalteInfo = str_replace(array_keys($aImageSearch), array_values($aImageSearch), $sImageTempalte); // $sImageTempalteInfo = str_replace(array_keys($aImageSearch), array_values($aImageSearch), $sImageTempalte);
$aImageInfo['image_url'] = $aResult['data']; // $aImageInfo['image_url'] = $aResult['data'];
$aImageInfo['image_url'] = $sMainImageUrl;
$aDealImage = $this->dealImage($aImageInfo); $aDealImage = $this->dealImage($aImageInfo);
if(empty($aDealImage['data'])){ if(empty($aDealImage['data'])){
continue; continue;
@@ -353,7 +374,6 @@ page={{stage_page}},%号
} }
} }
} }
$aSearch['{{article_main}}'] = empty($sMain) ? '' : $sMain."\n"; $aSearch['{{article_main}}'] = empty($sMain) ? '' : $sMain."\n";
//模版内容替换 //模版内容替换
$sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo); $sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo);
@@ -382,7 +402,7 @@ page={{stage_page}},%号
} }
//查询作者机构 //查询作者机构
$aWhere['p_article_author_id'] = ['in',array_column($aAuthor, 'p_article_author_id')]; $aWhere['p_article_author_id'] = ['in',array_column($aAuthor, 'p_article_author_id')];
$aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->select(); $aAuthorOrgan = Db::name('production_article_author_to_organ')->field('p_article_author_id,p_article_organ_id')->where($aWhere)->order('p_article_author_id asc,p_article_organ_id asc')->select();
//查询机构信息 //查询机构信息
$aAuthorOrganList = []; $aAuthorOrganList = [];
if(!empty($aAuthorOrgan)){ if(!empty($aAuthorOrgan)){
@@ -401,9 +421,10 @@ page={{stage_page}},%号
} }
//处理作者 //处理作者
$sAuthor = $sCorrespondence = ''; $sAuthor = $sCorrespondence = '';
$iFirstNum = 0;
foreach ($aAuthor as $key => $value) { foreach ($aAuthor as $key => $value) {
//作者姓名 //作者姓名
$sName = empty($value['fifirst_name']) ? '' : $value['fifirst_name']; $sName = empty($value['first_name']) ? '' : $value['first_name'];
$sName = empty($sName) ? '' : $sName . ' ' .$value['last_name']; $sName = empty($sName) ? '' : $sName . ' ' .$value['last_name'];
if(empty($sName)){ if(empty($sName)){
$sName = empty($value['author_name']) ? '' : $value['author_name']; $sName = empty($value['author_name']) ? '' : $value['author_name'];
@@ -434,21 +455,32 @@ page={{stage_page}},%号
} }
if($value['is_first'] == 1){ if($value['is_first'] == 1){
$sAuthor .= '\firstauthor'."\n"; $sAuthor .= '\firstauthor'."\n";
$iFirstNum++;
} }
if(!empty($value['orcid'])){ if(!empty($value['orcid'])){
$sAuthor .= '\orcid{'.$this->dealContent($value['orcid']).'}'."\n"; $sAuthor .= '\orcid{'.$this->dealContent($value['orcid']).'}'."\n";
} }
if($value['is_report'] == 1){ if($value['is_report'] == 1){
$sCorrespondence .= $sName; $sCorrespondenceInfo = $sName;
if(!empty($aOrganList[0])){ // if(!empty($aOrganList[0])){
$sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.'); // $sCorrespondence .= ','.trim($this->dealContent($aOrganList[0]),'.');
// }
if(!empty($value['mailing_address'])){//通讯地址
$value['mailing_address'] = trim($value['mailing_address']);
$sCorrespondenceInfo .= ','.trim($this->dealContent($value['mailing_address']),'.');
} }
if(!empty($value['email'])){ if(!empty($value['email'])){
$sCorrespondence .= '.E-mail: '.trim($this->dealContent($value['email']),'.').'.'; $sCorrespondenceInfo .= '. E-mail:'.trim($this->dealContent($value['email']),'.').'.';
}else{
$sCorrespondenceInfo .= trim($sCorrespondenceInfo,'.').'.';
} }
$sCorrespondence .= $sCorrespondenceInfo .' ';
} }
} }
return ['author' => $sAuthor,'correspondence' => $sCorrespondence]; if($iFirstNum == 1 && !empty($sAuthor)){
$sAuthor = str_replace('\firstauthor'."\n", '', $sAuthor);
}
return ['author' => $sAuthor,'correspondence' => trim($sCorrespondence)];
} }
/** /**
@@ -476,28 +508,29 @@ page={{stage_page}},%号
$jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr']; $jabbr = empty($aJournal['jabbr']) ? '' : $aJournal['jabbr'];
$stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year']; $stage_year = empty($aJournalStage['stage_year']) ? '' : $aJournalStage['stage_year'];
$stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol']; $stage_vol = empty($aJournalStage['stage_vol']) ? '' : $aJournalStage['stage_vol'];
$sAbbr = empty($aArticle['abbr']) ? '' : trim(trim($aArticle['abbr'],'.'));
$aAbbr = empty($aArticle['abbr']) ? '' : explode(',', trim($aArticle['abbr'])); // $aAbbr = empty( $sAbbr ) ? [] : explode(',', trim( $sAbbr ));
if(!empty($aAbbr)){ // if(!empty($aAbbr)){
$sEnd = end($aAbbr); // $sEnd = end($aAbbr);
if($sEnd != 'et al'){ // if($sEnd != 'et al'){
$aArticle['abbr'] = implode(',', array_slice($aAbbr, 0,3)); // $aThree = array_slice($aAbbr, 0,3);
if(!empty($aArticle['abbr'])){ // $sAbbr = implode(',', $aThree);
$aArticle['abbr'] .= ', et al'; // if(!empty( $sAbbr ) && count($aThree) > 3){
} // $sAbbr .= ', et al';
} // }
} // }
// }
$sCite = ''; $sCite = '';
if ($aArticle['journal_id'] == 22) { if ($aArticle['journal_id'] == 22) {
$sCite = $aArticle['abbr'] . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; $sCite = $sAbbr . '. ' . $aArticle['title'] . '[J]. ' . choiseJabbr($aArticle['article_id'],$jabbr) . ',' . $stage_year . ',' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
$sCite = $this->dealContent($sCite); $sCite = $this->dealContent($sCite);
} else { } else {
$sCite = $this->dealContent($aArticle['abbr']) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi']; $sCite = $this->dealContent($sAbbr) . '. ' . $this->dealContent($aArticle['title']) . '. \textit{' . $this->dealContent(choiseJabbr($aArticle['article_id'], $jabbr)) . '}. ' . $stage_year . ';' . $stage_vol . $no . $aArticle['npp'] . '. doi:' . $aArticle['doi'];
} }
return $sCite; return $sCite;
} }
private function getArticleTime($aParam = []){ public function getArticleTime($aParam = []){
//必填值验证 //必填值验证
$iArticleId = empty($aParam['article_id']) ? '' : $aParam['article_id']; $iArticleId = empty($aParam['article_id']) ? '' : $aParam['article_id'];
if(empty($iArticleId)){ if(empty($iArticleId)){
@@ -509,6 +542,15 @@ page={{stage_page}},%号
if(empty($aArticle)){ if(empty($aArticle)){
return array('status' => 2,'msg' => 'The article does not exist' ); return array('status' => 2,'msg' => 'The article does not exist' );
} }
//查询终审-审稿记录
$aWhere = ['article_id' => $iArticleId,'state' => ['in',[1,2,3]]];
$aFinalReviewerId = Db::name('article_reviewer_final')->order('review_time desc')->where($aWhere)->column('reviewer_id');
//查询审稿人姓名
$aUserName = [];
if(!empty($aFinalReviewerId)){
$aWhere = ['user_id' => ['in',array_unique($aFinalReviewerId)],'state' => 0,'realname' => ['<>','']];
$aUserName = Db::name('user')->where($aWhere)->column('realname');
}
//获取文章记录 //获取文章记录
$aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,1,5]]]; $aWhere = ['article_id' => $iArticleId,'state' => 0,'state_to' => ['in',[0,1,5]]];
$aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select(); $aArticleMsg = Db::name('article_msg')->field('state_from,state_to,ctime')->where($aWhere)->order('ctime deac')->select();
@@ -532,6 +574,7 @@ page={{stage_page}},%号
$aTime['received_date'] = empty($iReceivedTime) ? '' : $this->timestampToEnglishDate($iReceivedTime); $aTime['received_date'] = empty($iReceivedTime) ? '' : $this->timestampToEnglishDate($iReceivedTime);
$aTime['revision_date'] = empty($iRevisionTime) ? '' : $this->timestampToEnglishDate($iRevisionTime); $aTime['revision_date'] = empty($iRevisionTime) ? '' : $this->timestampToEnglishDate($iRevisionTime);
$aTime['accepted_date'] = empty($iAcceptedTime) ? '' : $this->timestampToEnglishDate($iAcceptedTime); $aTime['accepted_date'] = empty($iAcceptedTime) ? '' : $this->timestampToEnglishDate($iAcceptedTime);
$aTime['editorial_advisory_board'] = empty($aUserName) ? '' : implode(',', $aUserName);
return ['status' => 1,'msg' => 'success','data' => $aTime]; return ['status' => 1,'msg' => 'success','data' => $aTime];
} }
/** /**
@@ -641,7 +684,8 @@ page={{stage_page}},%号
$isWideImage = $imageWidth > $wideImageThreshold; $isWideImage = $imageWidth > $wideImageThreshold;
// 生成LaTeX图片代码 // 生成LaTeX图片代码
$sImageUrl = './image/'.basename($sImageUrl); $sImageUrl = str_replace(ROOT_PATH.'public/', '', $sImageUrl);
$sImageUrl = '../../'.$sImageUrl;
if ($isWideImage) { if ($isWideImage) {
$latexLines[] = "\\begin{figure*}[htbp]"; // 使用figure*环境实现两栏 $latexLines[] = "\\begin{figure*}[htbp]"; // 使用figure*环境实现两栏
$latexLines[] = " \\centering"; $latexLines[] = " \\centering";

View File

@@ -210,11 +210,19 @@ class Reviewer
$sMajorQuery = Db::name('major_to_user')->field('user_id')->where($aWhere)->buildSql(); $sMajorQuery = Db::name('major_to_user')->field('user_id')->where($aWhere)->buildSql();
// 查询符合公司条件的审稿人ID确保去重 // 查询符合公司条件的审稿人ID确保去重
$aWhere = ['state' => 0, 'company' => ['<>', $sCompany]]; $aWhere = ['state' => 0];
if(!empty($sCompany)){
$aWhere['company'] = ['<>',$sCompany];
}
if(!empty($aAuthorCompany)){ if(!empty($aAuthorCompany)){
array_push($aAuthorCompany, $sCompany); array_push($aAuthorCompany, $sCompany);
$aAuthorCompany = array_unique($aAuthorCompany); $aAuthorCompany = array_unique($aAuthorCompany);
$aWhere['company'] = ['not in', $aAuthorCompany]; $aAuthorCompany = array_filter($aAuthorCompany, function($v) {
return trim((string)$v) !== '';
});
if(!empty($aAuthorCompany)){
$aWhere['company'] = ['not in', $aAuthorCompany];
}
} }
if(!empty($aBlack) && !empty($aParam['not_choose_id'])){ if(!empty($aBlack) && !empty($aParam['not_choose_id'])){
$aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id'])); $aBlack = array_unique(array_merge($aBlack, $aParam['not_choose_id']));