1
This commit is contained in:
@@ -1193,13 +1193,15 @@ class Article extends Controller {
|
||||
//修改文章状态->审稿中
|
||||
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>2]);
|
||||
|
||||
// //添加article_msg信息
|
||||
// $insmsg_data['article_id'] = $data['articleId'];
|
||||
// $insmsg_data['content'] = '';
|
||||
// $insmsg_data['state_from'] = $article_info['state'];
|
||||
// $insmsg_data['state_to'] = 2;
|
||||
// $insmsg_data['ctime'] = time();
|
||||
// $this->article_msg_obj->insert($insmsg_data);
|
||||
//添加article_msg信息
|
||||
if($article_info['state']!=2){
|
||||
$insmsg_data['article_id'] = $data['articleId'];
|
||||
$insmsg_data['content'] = '';
|
||||
$insmsg_data['state_from'] = $article_info['state'];
|
||||
$insmsg_data['state_to'] = 2;
|
||||
$insmsg_data['ctime'] = time();
|
||||
$this->article_msg_obj->insert($insmsg_data);
|
||||
}
|
||||
|
||||
//发送email提醒审稿员
|
||||
$tt = $article_info['accept_sn'] . '<br>';
|
||||
|
||||
@@ -38,6 +38,7 @@ class Typeset extends Controller
|
||||
protected $user_reviewer_recommend_obj = '';
|
||||
protected $ts_obj = '';
|
||||
protected $ts_refer_obj = '';
|
||||
protected $ts_frag_obj = '';
|
||||
|
||||
public function __construct(\think\Request $request = null)
|
||||
{
|
||||
@@ -67,6 +68,7 @@ class Typeset extends Controller
|
||||
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
|
||||
$this->ts_obj = Db::name('ts');
|
||||
$this->ts_refer_obj = Db::name('ts_refer');
|
||||
$this->ts_frag_obj = Db::name('ts_frag');
|
||||
}
|
||||
|
||||
public function getTypeSet()
|
||||
@@ -100,7 +102,6 @@ class Typeset extends Controller
|
||||
$rule = new Validate([
|
||||
'editor_id' => 'require|number',
|
||||
'journal_id' => 'require',
|
||||
'ts_state' => 'require',
|
||||
'pageIndex' => 'require',
|
||||
'pageSize' => 'require'
|
||||
]);
|
||||
@@ -115,16 +116,37 @@ class Typeset extends Controller
|
||||
}
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$ts_list = $this->ts_obj->join('t_article', 't_article.article_id = t_ts.article_id', 'left')
|
||||
->where('t_ts.ts_state', $data['ts_state'])
|
||||
->where('t_ts.ts_state', 0)
|
||||
->where('t_article.journal_id', 'in', $journals)
|
||||
->limit($limit_start, $data['pageSize'])
|
||||
->select();
|
||||
$count = $this->ts_obj->join('t_article', 't_article.article_id = t_ts.article_id', 'left')->where('t_ts.ts_state', $data['ts_state'])->where('t_article.journal_id', 'in', $journals)->count();
|
||||
$count = $this->ts_obj->join('t_article', 't_article.article_id = t_ts.article_id', 'left')->where('t_ts.ts_state', 0)->where('t_article.journal_id', 'in', $journals)->count();
|
||||
foreach($ts_list as $k => $v){
|
||||
$cache = $this->ts_frag_obj->where('ts_id',$v['ts_id'])->where('tf_state',0)->order('ts_id desc')->limit(1)->find();
|
||||
$ts_list[$k]['frag_url'] = $cache['url'];
|
||||
}
|
||||
$re['ts_list'] = $ts_list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取排版实例最终文件列表
|
||||
*/
|
||||
public function getFragList(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'ts_id'=>'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->ts_frag_obj->where('ts_id',$data['ts_id'])->where('tf_state',0)->select();
|
||||
|
||||
$re['frags'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑参考文献
|
||||
*/
|
||||
@@ -150,6 +172,22 @@ class Typeset extends Controller
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参考文献的最终结果
|
||||
*/
|
||||
public function editReferFrag(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'ts_refer_id'=>'require',
|
||||
'refer_frag'=>'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->ts_refer_obj->where('ts_refer_id',$data['ts_refer_id'])->update(['refer_frag'=>$data['refer_frag']]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参考文献
|
||||
*/
|
||||
@@ -181,7 +219,7 @@ class Typeset extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->find();
|
||||
$refers = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||
foreach ($refers as $v) { //处理doi
|
||||
if (strpos($v['refer_content'], 'doi:') == false && strpos($v['refer_content'], 'doi.org/') == false) {
|
||||
@@ -221,13 +259,17 @@ class Typeset extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->find();
|
||||
$refers = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||
//清空frag,百分比用
|
||||
//清空frag,百分比用,重新生成
|
||||
$this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_doi', '<>', '')->update(['refer_frag' => '']);
|
||||
foreach ($refers as $v) {
|
||||
if($v['refer_doi']==''){
|
||||
$this->ts_refer_obj->where('ts_refer_id',$v['ts_refer_id'])->update(['refer_frag'=>$v['refer_content']]);
|
||||
}else{
|
||||
Queue::push('app\api\job\ts@fire', $v, 'ts');
|
||||
}
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -242,8 +284,8 @@ class Typeset extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||
$list = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_doi', '<>', '')->where('refer_state', 0)->select();
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->find();
|
||||
$list = $this->ts_refer_obj->where('ts_id', $ts_info['ts_id'])->where('refer_state', 0)->select();
|
||||
$z = count($list);
|
||||
$m = 0;
|
||||
foreach ($list as $v) {
|
||||
@@ -293,7 +335,7 @@ class Typeset extends Controller
|
||||
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id', $article_info['journal_id'])->find();
|
||||
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||
$ts_info = $this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->find();
|
||||
|
||||
$typesetInfo = [];
|
||||
$typesetInfo['info_title'] = $ts_info['ts_title'];
|
||||
@@ -321,8 +363,6 @@ class Typeset extends Controller
|
||||
$typesetInfo['keywords'] = $ts_info['keywords'];
|
||||
$typesetInfo['userAccount'] = $editor_info['nickname'];
|
||||
|
||||
|
||||
|
||||
//获取文件
|
||||
$files = $this->article_file_obj
|
||||
->where('article_id', $article_info['article_id'])
|
||||
@@ -343,14 +383,24 @@ class Typeset extends Controller
|
||||
|
||||
$typesetInfo['refers'] = json_encode($refers);
|
||||
|
||||
|
||||
$url = "http://localhost:8081/typeset/webGetDocx";
|
||||
// $url = "http://192.168.110.100:8080/typeset/webGetDocx";
|
||||
// $url = "http://ts.tmrjournals.com/api/typeset/webGetDocx";
|
||||
// var_dump($typesetInfo);die;
|
||||
$res = object_to_array(json_decode(myPost1($url, $typesetInfo)));
|
||||
|
||||
|
||||
var_dump($res);die;
|
||||
if(!isset($res['data']['file'])||$res['data']['file']==''){
|
||||
return jsonError('create error');
|
||||
}
|
||||
$file_res = $res['data']['file'];
|
||||
$this->ts_obj->where('ts_id', $ts_info['ts_id'])->update(['ts_url' => $file_res]);
|
||||
// $this->ts_obj->where('ts_id', $ts_info['ts_id'])->update(['ts_url' => $file_res]);
|
||||
$tf_insert['ts_id'] = $ts_info['ts_id'];
|
||||
$tf_insert['url'] = $file_res;
|
||||
$tf_insert['tf_ctime'] = time();
|
||||
$this->ts_frag_obj->insert($tf_insert);
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -382,6 +432,7 @@ class Typeset extends Controller
|
||||
'ts_doi' => 'require',
|
||||
'trdition' => 'require',
|
||||
'ts_topic' => 'require',
|
||||
'ts_main' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
@@ -406,7 +457,8 @@ class Typeset extends Controller
|
||||
$insert_ts['ts_doi'] = $data['ts_doi'];
|
||||
$insert_ts['trdition'] = $data['trdition'];
|
||||
$insert_ts['ts_topic'] = $data['ts_topic'];
|
||||
$this->ts_obj->where('article_id', $data['article_id'])->update($insert_ts);
|
||||
$insert_ts['ts_main'] = $data['ts_main'];
|
||||
$this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->update($insert_ts);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -426,7 +478,7 @@ class Typeset extends Controller
|
||||
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||
|
||||
//存在实例不可重复创建
|
||||
$check_ts = $this->ts_obj->where('article_id', $data['article_id'])->find();
|
||||
$check_ts = $this->ts_obj->where('article_id', $data['article_id'])->where('ts_state',0)->find();
|
||||
if ($check_ts) {
|
||||
return jsonError("has created");
|
||||
}
|
||||
@@ -533,7 +585,76 @@ class Typeset extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function getAllRuns()
|
||||
{
|
||||
$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://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'];
|
||||
$re['data'] = $file_runs;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除排版实例
|
||||
*/
|
||||
public function delTypeSet(){
|
||||
$data = $this->require->post();
|
||||
$rule = new Validate([
|
||||
'ts_id'=>'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->ts_obj->where('ts_id',$data['ts_id'])->update(['ts_state'=>1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新引用条目
|
||||
*/
|
||||
public function freshRefers(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id'=>'require',
|
||||
'refers'=>'require|array'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
$ts_info = $this->ts_obj->where('article_id',$data['article_id'])->where('ts_state',0)->find();
|
||||
//清空之前的引用条目
|
||||
$this->ts_refer_obj->where('ts_id',$ts_info['ts_id'])->update(['refer_state'=>1]);
|
||||
|
||||
foreach($data['refers'] as $k => $v){
|
||||
$cache_insert['ts_id'] = $ts_info['ts_id'];
|
||||
$cache_insert['refer_content'] = $v;
|
||||
$cache_insert['refer_ctime'] = time();
|
||||
$this->ts_refer_obj->insert($cache_insert);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function authorFormate($article_id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user