latex update

This commit is contained in:
wangjinlei
2026-01-27 11:22:35 +08:00
parent b37060be8f
commit 1d0581e46e
5 changed files with 581 additions and 920 deletions

View File

@@ -67,7 +67,7 @@ class Base extends Controller
protected $production_article_author_to_organ_obj = '';
protected $production_article_frag_obj = '';
protected $production_article_main_obj = '';
protected $production_article_main_img_obj = '';
// protected $production_article_main_img_obj = '';
protected $apply_reviewer_obj = '';
protected $promotion_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_frag_obj = Db::name('production_article_frag');
$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->promotion_obj = Db::name("promotion");
$this->promotion_email_obj = Db::name("promotion_email");
@@ -843,95 +843,95 @@ class Base extends Controller
}
public function getProductionMainImgs($p_article_id)
{
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
if (count($mains) == 0) {
$this->creatMainData($p_article_id);
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
}
$frag = [];
foreach ($mains as $v) {
$frag[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) {
$frag[] = $ca;
$pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) {
$frag[] = $cac;
$pre_id = $cac['p_main_img_id'];
} else {
$pre_id = 0;
}
}
}
}
return $frag;
}
// public function getProductionMainImgs($p_article_id)
// {
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// if (count($mains) == 0) {
// $this->creatMainData($p_article_id);
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// }
// $frag = [];
// foreach ($mains as $v) {
// $frag[] = $v;
// $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
// if ($ca) {
// $frag[] = $ca;
// $pre_id = $ca['p_main_img_id'];
// while ($pre_id != 0) {
// $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
// if ($cac) {
// $frag[] = $cac;
// $pre_id = $cac['p_main_img_id'];
// } else {
// $pre_id = 0;
// }
// }
// }
// }
// return $frag;
// }
private function creatMainData($p_article_id)
{
$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();
$files = $this->article_file_obj
->where('article_id', $article_info['article_id'])
->where('type_name', 'manuscirpt')
->order('ctime desc')
->limit(1)
->select();
if (count($files) == 0) {
return jsonError('No Manuscript');
}
$url = $this->ts_base_url."api/typeset/webReaddoc";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data'];
//整理信息
$frag = [];
$aa = [];
$frag['title'] = $article_info['title'];
$start_refer = false;
foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') {
if (strlen($v) > 500) {
$start_refer = false;
$frag['main'][] = $v;
continue;
}
$frag['references'][] = $v;
continue;
}
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val;
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v;
continue;
}
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true;
continue;
}
$frag['main'][] = $v;
}
if (!isset($frag['main'])) {
return jsonError("manuscript file error!");
}
//将主体内容写入数据库
foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id;
$ca['content'] = $v;
$ca['content_g'] = '';
$ca['ctime'] = time();
$this->production_article_main_obj->insert($ca);
}
}
// private function creatMainData($p_article_id)
// {
// $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();
// $files = $this->article_file_obj
// ->where('article_id', $article_info['article_id'])
// ->where('type_name', 'manuscirpt')
// ->order('ctime desc')
// ->limit(1)
// ->select();
// if (count($files) == 0) {
// return jsonError('No Manuscript');
// }
// $url = $this->ts_base_url."api/typeset/webReaddoc";
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
// $res = object_to_array(json_decode(myPost($url, $program)));
//
// $file_runs = $res['data'];
//
// //整理信息
// $frag = [];
// $aa = [];
// $frag['title'] = $article_info['title'];
// $start_refer = false;
// foreach ($file_runs as $k => $v) {
// if ($start_refer && $v != '') {
// if (strlen($v) > 500) {
// $start_refer = false;
// $frag['main'][] = $v;
// continue;
// }
// $frag['references'][] = $v;
// continue;
// }
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
// $aa[] = $g_val;
//
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
// $frag['keywords'] = $v;
// continue;
// }
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
// $start_refer = true;
// continue;
// }
// $frag['main'][] = $v;
// }
// if (!isset($frag['main'])) {
// return jsonError("manuscript file error!");
// }
//
//
// //将主体内容写入数据库
// foreach ($frag['main'] as $v) {
// $ca['p_article_id'] = $p_article_id;
// $ca['content'] = $v;
// $ca['content_g'] = '';
// $ca['ctime'] = time();
// $this->production_article_main_obj->insert($ca);
// }
// }
public function refuseReferIndex($p_article_id)
{
@@ -946,83 +946,83 @@ class Base extends Controller
}
public function getProductionMainImgsByNew($p_article_id, $file)
{
$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();
$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/20230706/87628e769c4ee8a8414219b05c72a028.docx" ;
$res = object_to_array(json_decode(myPost($url, $program)));
$file_runs = $res['data'];
if (count($file_runs) == 0) {
return jsonError("File crawl failed");
}
//清空之前的
$this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]);
//整理信息
$frag = [];
$aa = [];
$frag['title'] = $article_info['title'];
$start_refer = false;
foreach ($file_runs as $k => $v) {
if ($start_refer && $v != '') {
if (strlen($v) > 500) {
$start_refer = false;
$frag['main'][] = $v;
continue;
}
$frag['references'][] = $v;
continue;
}
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
$aa[] = $g_val;
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
$frag['keywords'] = $v;
continue;
}
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
$start_refer = true;
continue;
}
$frag['main'][] = $v;
}
if (!isset($frag['main'])) {
return jsonError("manuscript file error!");
}
//将主体内容写入数据库
foreach ($frag['main'] as $v) {
$ca['p_article_id'] = $p_article_id;
$ca['content'] = $v;
$ca['content_g'] = '';
$ca['ctime'] = time();
$this->production_article_main_obj->insert($ca);
}
$mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
$f = [];
foreach ($mains as $v) {
$f[] = $v;
$ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
if ($ca) {
$f[] = $ca;
$pre_id = $ca['p_main_img_id'];
while ($pre_id != 0) {
$cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
if ($cac) {
$f[] = $cac;
$pre_id = $cac['p_main_img_id'];
} else {
$pre_id = 0;
}
}
}
}
return $f;
}
// public function getProductionMainImgsByNew($p_article_id, $file)
// {
// $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();
// $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/20230706/87628e769c4ee8a8414219b05c72a028.docx" ;
// $res = object_to_array(json_decode(myPost($url, $program)));
// $file_runs = $res['data'];
// if (count($file_runs) == 0) {
// return jsonError("File crawl failed");
// }
// //清空之前的
// $this->production_article_main_obj->where('p_article_id', $p_article_id)->update(['state' => 1]);
//
// //整理信息
// $frag = [];
// $aa = [];
// $frag['title'] = $article_info['title'];
// $start_refer = false;
// foreach ($file_runs as $k => $v) {
// if ($start_refer && $v != '') {
// if (strlen($v) > 500) {
// $start_refer = false;
// $frag['main'][] = $v;
// continue;
// }
// $frag['references'][] = $v;
// continue;
// }
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
// $aa[] = $g_val;
//
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
// $frag['keywords'] = $v;
// continue;
// }
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
// $start_refer = true;
// continue;
// }
// $frag['main'][] = $v;
// }
// if (!isset($frag['main'])) {
// return jsonError("manuscript file error!");
// }
//
// //将主体内容写入数据库
// foreach ($frag['main'] as $v) {
// $ca['p_article_id'] = $p_article_id;
// $ca['content'] = $v;
// $ca['content_g'] = '';
// $ca['ctime'] = time();
// $this->production_article_main_obj->insert($ca);
// }
//
// $mains = $this->production_article_main_obj->where('p_article_id', $p_article_id)->where('state', 0)->select();
// $f = [];
// foreach ($mains as $v) {
// $f[] = $v;
// $ca = $this->production_article_main_img_obj->where('p_main_id', $v['p_main_id'])->where("state", 0)->find();
// if ($ca) {
// $f[] = $ca;
// $pre_id = $ca['p_main_img_id'];
// while ($pre_id != 0) {
// $cac = $this->production_article_main_img_obj->where('pre_id', $pre_id)->where('state', 0)->find();
// if ($cac) {
// $f[] = $cac;
// $pre_id = $cac['p_main_img_id'];
// } else {
// $pre_id = 0;
// }
// }
// }
// }
// return $f;
// }
/**创建空production实例应对main和refers