1
This commit is contained in:
135
application/api/controller/Typeset.php
Normal file
135
application/api/controller/Typeset.php
Normal file
@@ -0,0 +1,135 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
use think\Queue;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* @title 公共管理相关
|
||||
* @description 公共管理相关
|
||||
*/
|
||||
class Typeset extends Controller {
|
||||
protected $article_obj = '';
|
||||
protected $user_obj = '';
|
||||
protected $user_act_obj = '';
|
||||
protected $journal_obj = '';
|
||||
protected $user_log_obj = '';
|
||||
protected $user_reviewer_info_obj = '';
|
||||
protected $reviewer_major_obj = '';
|
||||
protected $reviewer_to_journal_obj = '';
|
||||
protected $article_reviewer_question_obj = '';
|
||||
protected $article_msg_obj = '';
|
||||
protected $article_file_obj = '';
|
||||
protected $article_reviewer_obj = '';
|
||||
protected $article_author_obj = '';
|
||||
protected $article_transfer_obj = '';
|
||||
protected $chief_to_journal_obj = '';
|
||||
protected $login_auto_obj = '';
|
||||
protected $major_obj = "";
|
||||
protected $major_to_journal_obj = '';
|
||||
protected $reviewer_from_author_obj = '';
|
||||
protected $article_dialog_obj = '';
|
||||
protected $article_proposal_obj = '';
|
||||
protected $user_black_obj = '';
|
||||
protected $user_reviewer_recommend_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null) {
|
||||
parent::__construct($request);
|
||||
$this->user_obj = Db::name('user');
|
||||
$this->user_act_obj = Db::name('user_act');
|
||||
$this->article_obj = Db::name('article');
|
||||
$this->journal_obj = Db::name('journal');
|
||||
$this->user_log_obj = Db::name('user_log');
|
||||
$this->user_reviewer_info_obj = Db::name("user_reviewer_info");
|
||||
$this->reviewer_major_obj = Db::name('reviewer_major');
|
||||
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
|
||||
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
|
||||
$this->article_msg_obj = Db::name('article_msg');
|
||||
$this->article_file_obj = Db::name('article_file');
|
||||
$this->article_reviewer_obj = Db::name('article_reviewer');
|
||||
$this->article_author_obj = Db::name('article_author');
|
||||
$this->article_transfer_obj = Db::name('article_transfer');
|
||||
$this->chief_to_journal_obj = Db::name('chief_to_journal');
|
||||
$this->login_auto_obj = Db::name('login_auto');
|
||||
$this->major_obj = Db::name("major");
|
||||
$this->major_to_journal_obj = Db::name('major_to_journal');
|
||||
$this->reviewer_from_author_obj = Db::name("reviewer_from_author");
|
||||
$this->article_dialog_obj = Db::name('article_dialog');
|
||||
$this->article_proposal_obj = Db::name('article_proposal');
|
||||
$this->user_black_obj = Db::name('user_black');
|
||||
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
|
||||
}
|
||||
|
||||
|
||||
public function createTypeSet(){
|
||||
$data = $this->request->post();
|
||||
// 验证规则
|
||||
$rule = new Validate([
|
||||
'article_id'=>'require|number'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$article_info = $this->article_obj->where('article_id',$data['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');
|
||||
}
|
||||
//调用接口分解word,
|
||||
$url = "http://localhost:8080/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!=''){
|
||||
$frag['references'][] = $v;
|
||||
continue;
|
||||
}
|
||||
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
|
||||
$aa[] = $g_val;
|
||||
if($g_val == $article_info['title']){
|
||||
continue;
|
||||
}
|
||||
|
||||
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) == "abstract"){
|
||||
$i = $k+1;
|
||||
while($file_runs[$i]==''){
|
||||
$i++;
|
||||
}
|
||||
$frag['abstract'] = $file_runs[$i];
|
||||
continue;
|
||||
}
|
||||
if(isset($frag['abstract'])&&$frag['abstract']==$v){
|
||||
continue;
|
||||
}
|
||||
if(strtolower($g_val) == 'references'||strtolower($g_val)=='reference'){
|
||||
$start_refer = true;
|
||||
continue;
|
||||
}
|
||||
$frag['main'][] = $v;
|
||||
}
|
||||
|
||||
var_dump($frag);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user