This commit is contained in:
wangjinlei
2023-06-29 11:07:41 +08:00
parent e4c4096f5b
commit 504b1b9e06
2 changed files with 406 additions and 282 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -231,7 +231,8 @@ class Base extends Controller
return $frag;
}
public function getMajorOne($major_id){
public function getMajorOne($major_id)
{
$major_info = $this->major_obj->where('major_id', $major_id)->find();
return $major_info['major_title'];
}
@@ -272,6 +273,81 @@ class Base extends Controller
return substr($frag, 0, -1);
}
public function addProductionEx($article_id)
{
$check = $this->production_article_obj->where('article_id', $article_id)->where('state', 0)->find();
if ($check) {
return 'Instance already exists';
}
$article_info = $this->article_obj->where('article_id', $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 = "http://ts.tmrjournals.com/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!");
}
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
$insert['article_id'] = $article_id;
$insert['journal_id'] = $article_info['journal_id'];
$insert['ctime'] = time();
$p_article_id = $this->production_article_obj->insertGetId($insert);
//将主体内容写入数据库
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);
}
return jsonSuccess([]);
}
public function getCvs($user_id)
{
@@ -293,10 +369,10 @@ class Base extends Controller
} else {
$where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"];
}
if($china_type==1){
if ($china_type == 1) {
$where['t_user_reviewer_info.country'] = "China";
}elseif ($china_type==2){
$where['t_user_reviewer_info.country'] = ["<>","China"];
} elseif ($china_type == 2) {
$where['t_user_reviewer_info.country'] = ["<>", "China"];
}
$list = $this->user_obj
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left')
@@ -321,10 +397,10 @@ class Base extends Controller
} else {
$where['t_user_reviewer_info.field'] = ["like", "%" . $body . "%"];
}
if($china_type==1){
if ($china_type == 1) {
$where['t_user_reviewer_info.country'] = "China";
}elseif ($china_type==2){
$where['t_user_reviewer_info.country'] = ["<>","China"];
} elseif ($china_type == 2) {
$where['t_user_reviewer_info.country'] = ["<>", "China"];
}
$list = $this->user_obj
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_user.user_id", 'left')
@@ -350,10 +426,10 @@ class Base extends Controller
} else {
$where['field'] = ["like", "%" . $body . "%"];
}
if($china_type==1){
if ($china_type == 1) {
$where['country'] = "China";
}elseif ($china_type==2){
$where['country'] = ["<>","China"];
} elseif ($china_type == 2) {
$where['country'] = ["<>", "China"];
}
$list = $this->user_ash_obj
->where($where)
@@ -388,8 +464,9 @@ class Base extends Controller
return $frag;
}
public function creatUserCode($str){
$hashids = hashids::instance(8,"tmrjournals");
public function creatUserCode($str)
{
$hashids = hashids::instance(8, "tmrjournals");
return $hashids->encode($str);
}