This commit is contained in:
wangjinlei
2022-09-19 18:06:19 +08:00
parent 8490380169
commit db0a74a0fc
6 changed files with 524 additions and 10 deletions

View File

@@ -827,6 +827,11 @@ class Article extends Controller {
$user_info = $this->user_obj->where(['user_id' => $article_info['user_id']])->find();
$user_rev_info = $this->user_reviewer_info_obj->where("reviewer_id",$user_info['user_id'])->find();
if($article_info['state']==5||$article_info['state']==3){
return jsonError("Status cannot be changed");
}
// 发送邮件内容
$sendUser=[
'title'=> $journal_info['title'], // 邮件标题
@@ -883,11 +888,6 @@ class Article extends Controller {
$tt1 .= 'Please check the new transfer manuscript in the submission system.';
sendEmail($trans_editor_info['email'],$journal_info['title'], $journal_info['title'], $tt1, $journal_info['email'], $journal_info['epassword']);
// $sendUser['user_id'] = $trans_editor_info['user_id'];
// $sendUser['email'] = $trans_editor_info['email'];
// $sendUser['content'] = 'Dear editor,Please check the new transfer manuscript in the submission system.';
// Queue::push('app\api\job\domail@fire',$sendUser,'domail');
//增加usermsg
add_usermsg($tran_journal['editor_id'], 'New transfer manuscript ', '/articleDetailEditor?id=' . $article_info['article_id']);
@@ -897,7 +897,7 @@ class Article extends Controller {
if($data['state']==5&&$article_info['type']!="N"&&$article_info['type']!="T"&&$article_info['type']!="LTE"&&$article_info['journal_id']!=21){
//定义符合条件的数量
$rev_real_num = 0;
//获取通过的审稿意见数
//获取通过的审稿意见数,必须大于两个
$rev_list = $this->article_reviewer_obj
->field('t_article_reviewer_question.*')
->join("t_article_reviewer_question",'t_article_reviewer_question.art_rev_id = t_article_reviewer.art_rev_id','left')
@@ -1949,6 +1949,7 @@ class Article extends Controller {
->where('t_user.user_id','not in',$noids)
->where('t_user.state',0)
->select();
// if ($noids != null) {
// $where['t_user.user_id'] = [['in', $revids], ['not in', $noids]];

View File

@@ -0,0 +1,358 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Validate;
/**
* @title 公共管理相关
* @description 公共管理相关
*/
class Production 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 = '';
protected $ts_obj = '';
protected $ts_refer_obj = '';
protected $ts_frag_obj = '';
protected $online_obj = '';
protected $production_article_obj = '';
protected $production_article_author_obj = '';
protected $production_article_organ_obj = '';
protected $production_article_refer_obj = '';
protected $production_article_author_to_organ_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');
$this->ts_obj = Db::name('ts');
$this->ts_refer_obj = Db::name('ts_refer');
$this->ts_frag_obj = Db::name('ts_frag');
$this->online_obj = Db::name('online');
$this->production_article_obj = Db::name('production_article');
$this->production_article_author_obj = Db::name('production_article_author');
$this->production_article_organ_obj = Db::name('production_article_organ');
$this->production_article_refer_obj = Db::name('production_article_refer');
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
}
/**
* 添加生产实例
*/
public function addProduction(){
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require|number'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$check = $this->production_article_obj->where('article_id',$data['article_id'])->where('state',0)->find();
if($check){
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
$insert['article_id'] = $data['article_id'];
$insert['journal_id'] = $article_info['journal_id'];
$insert['ctime'] = time();
$this->production_article_obj->insert($insert);
return jsonSuccess([]);
}
/**
* 删除生产实例
*/
public function delProduction(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require|number'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* 编辑生产实例
*/
public function editProduction(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require|number',
'title'=>'require',
'subtitle'=>'require',
'type'=>'require',
'icon'=>'require',
'tradition_tag'=>'require',
'tradition'=>'require',
'doi'=>'require',
'abstract'=>'require',
'keywords'=>'require',
'fund'=>'require',
'abbr'=>'require',
'pub_date'=>'require',
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$update['title'] = trim($data['title']);
$update['subtitle'] = trim($data['subtitle']);
$update['type'] = trim($data['type']);
$update['icon'] = trim($data['icon']);
$update['tradition_tag'] = trim($data['tradition_tag']);
$update['tradition'] = trim($data['tradition']);
$update['mhoo'] = isset($data['mhoo'])?trim($data['mhoo']):'';
$update['doi'] = trim($data['doi']);
$update['abstract'] = trim($data['abstract']);
$update['keywords'] = trim($data['keywords']);
$update['fund'] = trim($data['fund']);
$update['abbr'] = trim($data['abbr']);
$update['pub_date'] = trim($data['pub_date']);
$update['npp'] = $data['npp'];
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
return jsonSuccess([]);
}
/**
* 获取生产实例列表
*/
public function getProductionList(){
$data = $this->request->post();
$rule = new Validate([
'editor_id'=>'require|number',
'journal_id'=>'require',
'pageIndex' => 'require',
'pageSize' => 'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$journalids = [];
if($data['journal_id']==0){
$journalids = $this->journal_obj->where('editor_id',$data['editor_id'])->column('journal_id');
}
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = $this->production_article_obj->where('journal_id','in',$journalids)->where('state',0)->limit($limit_start,$data['pageSize'])->select();
$count = $this->production_article_obj->where('journal_id','in',$journalids)->where('state',0)->count();
$re['productions'] = $list;
$re['count'] = $count;
return jsonSuccess($re);
}
/**
* 添加作者机构
*/
public function addAuthorOrgan(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require|number',
'argan_name'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
$insert['p_article_id'] = $data['p_article_id'];
$insert['article_id'] = $p_info['article_id'];
$insert['organ_name'] = trim($data['organ_name']);
$this->production_article_organ_obj->insert($insert);
return jsonSuccess([]);
}
/**
* 删除作者机构
*/
public function delAuthorOrgan(){
$data = $this->request->post();
$rule = new Validate([
'p_article_organ_id'=>'require|number'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->production_article_organ_obj->where('p_article_organ_id',$data['p_article_organ_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* 编辑作者机构信息
*/
public function editAuthorOrgan(){
$data = $this->request->post();
$rule = new Validate([
'p_article_organ_id'=>'require|number',
'organ_name'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->production_article_organ_obj->where('p_article_organ_id',$data['p_article_organ_id'])->update(['organ_name'=>$data['organ_name']]);
return jsonSuccess([]);
}
/**
* 获取机构列表
*/
public function getOrganList(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require|number'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->production_article_organ_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
$re['organs'] = $list;
return jsonSuccess($re);
}
/**
* 添加作者
*/
public function addAuthor(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require|number',
'first_name'=>'require',
'last_name'=>'require',
'author_country'=>'require',
'is_first'=>'require',
'is_report'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
$insert['p_article_id'] = $data['p_article_id'];
$insert['article_id'] = $p_info['article_id'];
$insert['author_name'] = $data['first_name'].' '.$data['last_name'];
$insert['first_name'] = $data['first_name'];
$insert['last_name'] = $data['las_name'];
$insert['orcid'] = isset($data['orcid'])?$data['orcid']:'';
$insert['author_country'] = $data['author_country'];
$insert['is_first'] = $data['is_first'];
$insert['is_report'] = $data['is_report'];
$insert['email'] = isset($data['email'])?trim($data['email']):'';
Db::startTrans();
$pa_id = $this->production_article_author_obj->insertGetId($insert);
$or_res = true;
if (isset($data['organs']) && is_array($data['organs'])) {
foreach ($data['organs'] as $v) {
$cache_ins['p_article_id'] = $data['p_article_id'];
$cache_ins['p_article_author_id'] = $pa_id;
$cache_ins['p_article_organ_id'] = $v;
$or_res = $this->production_article_author_to_organ_obj->insert($cache_ins) ? true : false;
}
}
if ($pa_id && $or_res) {
Db::commit();
return jsonSuccess([]);
} else {
Db::rollback();
return jsonError("system error");
}
}
/**
* 删除作者
*/
public function delAuthor(){
$data = $this->request->post();
$rule = new Validate([
'p_article_author_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$this->production_article_author_obj->where('p_article_author_id',$data['p_artice_author_id'])->update(['state'=>1]);
return jsonSuccess([]);
}
/**
* 获取作者列表
*/
public function getAuthorlist(){
$data = $this->request->post();
$rule = new Validate([
'p_article_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$list = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
foreach($list as $k => $v){
$list[$k]['organs'] = $this->production_article_author_to_organ_obj
->field("t_production_article_organ.*")
->join("t_production_article_organ",'t_production_article_organ.p_article_organ_id = t_production_article_author_to_organ.p_article_organ_id','left')
->where('p_article_author_id',$v['p_article_author_id'])
->select();
}
$re['authors'] = $list;
return jsonSuccess($re);
}
/**
* 上传文件
*/
public function up_file(){
}
}

View File

@@ -0,0 +1,77 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use think\Validate;
/**
* @title 公共管理相关
* @description 公共管理相关
*/
class Publish 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 = '';
protected $ts_obj = '';
protected $ts_refer_obj = '';
protected $ts_frag_obj = '';
protected $online_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');
$this->ts_obj = Db::name('ts');
$this->ts_refer_obj = Db::name('ts_refer');
$this->ts_frag_obj = Db::name('ts_frag');
$this->online_obj = Db::name('online');
}
}

View File

@@ -105,11 +105,13 @@ class Reviewer extends Controller
$data = $this->request->post();
//获取审稿人基本信息
$reviewer_info = $this->user_obj->where('user_id', $data['user_id'])->find();
$res = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article.title article_title,t_article.abstrart,t_article.major_id,t_article.cmajor_id,t_article.type,t_journal.title journal_title,t_article.accept_sn accept_sn')
->join('t_article', 't_article_reviewer.article_id = t_article.article_id', 'LEFT')
->join('t_journal', 't_article.journal_id = t_journal.journal_id', 'LEFT')
->where('t_article_reviewer.reviewer_id', $reviewer_info['user_id'])
->where("t_article.state", 2)
->where('t_article.user_id','!=',$reviewer_info['user_id'])
->where('t_article_reviewer.state', 0)
->select();
foreach ($res as $k => $v) {

View File

@@ -118,7 +118,7 @@ class Typeset extends Controller
$insert['article_id'] = $data['article_id'];
$insert['journal_id'] = $journal_info['journal_id'];
$insert['on_title'] = $article_info['title'];
$insert['on_title'] = $ts_info['ts_title'];
$insert['on_doi'] = $ts_info['ts_doi'];
$insert['abstract'] = $ts_info['ts_abstract'];
$insert['keywords'] = $ts_info['keywords'];
@@ -130,6 +130,75 @@ class Typeset extends Controller
}
/**
* 创建和推送至online
*/
public function createAndPushOnline(){
$data = $this->request->post();
// 验证规则
$rule = new Validate([
'article_id' => 'require|number',
'journal_stage_id' => 'require',
'npp'=>'require'
]);
if (!$rule->check($data)) {
return jsonError($rule->getError());
}
$check = $this->online_obj->where('article_id',$data['article_id'])->where('on_state',0)->find();
if($check){
return jsonError('不能重复生成');
}
$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();
$ts_info = $this->ts_obj->where('article_id',$data['article_id'])->where('ts_state',0)->find();
$insert['article_id'] = $data['article_id'];
$insert['journal_id'] = $journal_info['journal_id'];
$insert['on_title'] = $ts_info['ts_title'];
$insert['on_doi'] = $ts_info['ts_doi'];
$insert['npp'] = $data['npp'];
$insert['abstract'] = $ts_info['ts_abstract'];
$insert['keywords'] = $ts_info['keywords'];
$insert['on_ctime'] = time();
$on_id = $this->online_obj->insertGetId($insert);
$on_info = $this->online_obj->where('on_id',$on_id)->find();
$authors = $this->article_author_obj->where('article_id',$article_info['article_id'])->where('state',0)->select();
//check信息是否完整
if($on_info['journal_stage_id']==''||$on_info['on_doi']==''||$on_info['abstract']==''||$on_info['npp']==''){
return jsonError('信息不全!');
}
//发送推送请求
// $url = "http://www.journal.com/master/Article/addArticleForSubmission";
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
$pra = [];
$pra['title'] = $ts_info['ts_title'];
$pra['journal_stage_id'] = $on_info['journal_stage_id'];
$pra['issn'] = $journal_info['issn'];
$pra['type'] = translateType($article_info['type']);
$pra['doi'] = $on_info['on_doi'];
$pra['abstract'] = $on_info['abstract'];
$pra['pub_date'] = $ts_info['online_date'];
$pra['file_pdf'] = $article_info['pdf_url'];
$pra['keywords'] = $ts_info['keywords'];
$pra['npp'] = $on_info['npp'];
$pra['authors'] = json_encode($authors);
$res = object_to_array(json_decode(myPost($url, $pra)));
if($res['code']==0){
$this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]);
return jsonSuccess([]);
}else{
return jsonError('system error:'.$res['msg']);
}
}
/**
* 编辑online信息
*/
@@ -185,6 +254,7 @@ class Typeset extends Controller
* 推送文章到官网系统
*/
public function pushArticleToSystem(){
die('Service suspension!');
$data = $this->request->post();
$rule = new Validate([
'on_id'=>'require'
@@ -205,7 +275,7 @@ class Typeset extends Controller
// $url = "http://www.journal.com/master/Article/addArticleForSubmission";
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
$pra = [];
$pra['title'] = $article_info['title'];
$pra['title'] = $ts_info['ts_title'];
$pra['journal_stage_id'] = $on_info['journal_stage_id'];
$pra['issn'] = $journal_info['issn'];
$pra['type'] = translateType($article_info['type']);
@@ -213,7 +283,7 @@ class Typeset extends Controller
$pra['abstract'] = $on_info['abstract'];
$pra['pub_date'] = $ts_info['online_date'];
$pra['file_pdf'] = $article_info['pdf_url'];
$pra['keywords'] = $article_info['keywords'];
$pra['keywords'] = $ts_info['keywords'];
$pra['npp'] = $on_info['npp'];
$pra['authors'] = json_encode($authors);
@@ -222,7 +292,7 @@ class Typeset extends Controller
$this->online_obj->where('on_id',$data['on_id'])->update(['has_push'=>1]);
return jsonSuccess([]);
}else{
return jsonError('system error!');
return jsonError('system error:'.$res['msg']);
}
}
@@ -694,6 +764,7 @@ class Typeset extends Controller
*/
public function doTypeSetting()
{
die('Temporarily Out of Service');
$data = $this->request->post();
// 验证规则
$rule = new Validate([
@@ -860,6 +931,7 @@ class Typeset extends Controller
*/
public function createTypeSet()
{
die('Temporarily Out of Service');
$data = $this->request->post();
// 验证规则
$rule = new Validate([

View File

@@ -55,6 +55,10 @@ class User extends Controller
$this->user_to_special_obj = Db::name('user_to_special');
}
public function pstest(){
echo md5('TMR893533');
}
/**
* @title 登录功能
* @description 登录功能