1
This commit is contained in:
@@ -97,9 +97,11 @@ class Production extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
|
||||
// $data['article_id'] = 1144;
|
||||
$check = $this->production_article_obj->where('article_id', $data['article_id'])->where('state', 0)->find();
|
||||
if ($check) {
|
||||
return jsonError($rule->getError());
|
||||
return jsonError('实例已存在!');
|
||||
}
|
||||
|
||||
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||
@@ -151,6 +153,7 @@ class Production extends Controller
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['journal_id'] = $article_info['journal_id'];
|
||||
$insert['ctime'] = time();
|
||||
|
||||
$this->production_article_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -171,6 +174,13 @@ class Production extends Controller
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
|
||||
public function mytest(){
|
||||
$p_info = $this->production_article_obj->where('p_article_id',10)->find();
|
||||
dump(json_decode($p_info['main']));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑生产实例
|
||||
*/
|
||||
@@ -185,14 +195,11 @@ class Production extends Controller
|
||||
'icon' => 'require',
|
||||
'tradition_tag' => 'require',
|
||||
'tradition' => 'require',
|
||||
'abstract' => 'require',
|
||||
'acknowledgment' => 'require',
|
||||
'abbreviation' =>'require',
|
||||
'keywords' => 'require',
|
||||
'author_contribution'=>'require',
|
||||
'fund' => 'require',
|
||||
'abbr' => 'require',
|
||||
'pub_date' => 'require',
|
||||
'abbr' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
@@ -210,27 +217,26 @@ class Production extends Controller
|
||||
$update['author_contribution'] = trim($data['author_contribution']);
|
||||
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : '';
|
||||
$update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : '';
|
||||
$update['abstract'] = trim($data['abstract']);
|
||||
// $update['abstract'] = trim($data['abstract']);
|
||||
$update['keywords'] = trim($data['keywords']);
|
||||
$update['abbreviation'] = trim($data['abbreviation']);
|
||||
$update['acknowledgment'] = trim($data['acknowledgment']);
|
||||
$update['fund'] = trim($data['fund']);
|
||||
$update['abbr'] = trim($data['abbr']);
|
||||
$update['pub_date'] = trim($data['pub_date']);
|
||||
// $update['pub_date'] = trim($data['pub_date']);
|
||||
$update['npp'] = isset($data['npp'])?$data['npp']:'';
|
||||
|
||||
//生成doi号
|
||||
$doi = '';
|
||||
if ($p_info['doi'] == '') {
|
||||
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
|
||||
$cs['journal_stage_id'] = $data['journal_stage_id'];
|
||||
$list = object_to_array(json_decode(myPost($url, $cs)));
|
||||
$re = $list['data']['stage'];
|
||||
$doi = $this->createdoi($re['stage_year'], $re['stage_vol'], $journal_info['abbr']);
|
||||
}else{
|
||||
$doi = $p_info['doi'];
|
||||
}
|
||||
$update['doi'] = $doi;
|
||||
// $doi = '';
|
||||
// if ($p_info['doi'] == '') {
|
||||
// $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
|
||||
// $cs['journal_stage_id'] = $data['journal_stage_id'];
|
||||
// $list = object_to_array(json_decode(myPost($url, $cs)));
|
||||
// $re = $list['data']['stage'];
|
||||
// $doi = $this->createdoi($re['stage_year'], $re['stage_vol'], $journal_info['abbr']);
|
||||
// }else{
|
||||
// $doi = $p_info['doi'];
|
||||
// }
|
||||
// $update['doi'] = $doi;
|
||||
|
||||
|
||||
|
||||
@@ -268,7 +274,7 @@ class Production extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['main'] = json_encode($data['main']);
|
||||
$update['main'] = $data['main'];
|
||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -342,13 +348,96 @@ class Production extends Controller
|
||||
$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();
|
||||
$list = $this->production_article_obj
|
||||
->field('t_production_article.*,t_article.accept_sn')
|
||||
->join('t_article','t_article.article_id = t_production_article.article_id','left')
|
||||
->where('t_production_article.journal_id', 'in', $journalids)
|
||||
->where('t_production_article.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 editArticleLast(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number',
|
||||
'abstract' => 'require',
|
||||
'doi' => 'require',
|
||||
'pub_date' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['abstract'] = trim($data['abstract']);
|
||||
$updata['doi'] = $data['doi'];
|
||||
$updata['pub_date'] = $data['pub_date'];
|
||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($updata);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送文章到官网系统
|
||||
*/
|
||||
public function pushArticleToSystem(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id'=>'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
// $data['p_article_id'] = 7;
|
||||
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
||||
$article_info = $this->article_obj->where('article_id',$p_info['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id',$article_info['journal_id'])->find();
|
||||
$authors = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||
foreach($authors as $k => $v){
|
||||
$cache = $this->production_article_author_to_organ_obj
|
||||
->field('t_production_article_organ.organ_name')
|
||||
->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('t_production_article_author_to_organ.p_article_author_id',$v['p_article_author_id'])
|
||||
->where('t_production_article_author_to_organ.state',0)
|
||||
->select();
|
||||
$authors[$k]['organs'] = $cache;
|
||||
}
|
||||
$organs = $this->production_article_organ_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||
//check信息是否完整
|
||||
if(count($authors)==0||$p_info['journal_stage_id']==''||$p_info['doi']==''||$p_info['abstract']==''||$p_info['npp']==''){
|
||||
return jsonError('Incomplete information');
|
||||
}
|
||||
//发送推送请求
|
||||
// $url = "http://www.journal.com/master/Article/addArticleForSubmission";
|
||||
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/addArticleForSubmission';
|
||||
$pra = [];
|
||||
$pra['title'] = $p_info['title'];
|
||||
$pra['journal_stage_id'] = $p_info['journal_stage_id'];
|
||||
$pra['issn'] = $journal_info['issn'];
|
||||
$pra['type'] = translateType($article_info['type']);
|
||||
$pra['doi'] = $p_info['doi'];
|
||||
$pra['abstract'] = $p_info['abstract'];
|
||||
$pra['pub_date'] = $p_info['pub_date'];
|
||||
$pra['file_pdf'] = $p_info['file_pdf'];
|
||||
$pra['keywords'] = $p_info['keywords'];
|
||||
$pra['npp'] = $p_info['npp'];
|
||||
$pra['authors'] = json_encode($authors);
|
||||
$pra['organs'] = json_encode($organs);
|
||||
|
||||
$res = object_to_array(json_decode(myPost($url, $pra)));
|
||||
if($res['code']==0){
|
||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update(['state'=>2]);
|
||||
return jsonSuccess([]);
|
||||
}else{
|
||||
return jsonError('system error:'.$res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 排版主方法入口
|
||||
@@ -439,7 +528,7 @@ class Production extends Controller
|
||||
if (!isset($res['data']['file']) || $res['data']['file'] == '') {
|
||||
return jsonError('create error');
|
||||
}
|
||||
$file_res = $res['data']['file'];
|
||||
$file_res = date('Ymd').DS.$res['data']['file'];
|
||||
$tf_insert['p_article_id'] = $p_info['p_article_id'];
|
||||
$tf_insert['url'] = $file_res;
|
||||
$tf_insert['ctime'] = time();
|
||||
@@ -897,4 +986,38 @@ class Production extends Controller
|
||||
$frag['address'] = $address_str;
|
||||
return $frag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改文章pdf文件
|
||||
*/
|
||||
public function updateArticlePDF(){
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require',
|
||||
'pdf' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['file_pdf'] = $data['pdf'];
|
||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传pdf文件
|
||||
*/
|
||||
public function up_pdf_file()
|
||||
{
|
||||
$file = request()->file('pdf');
|
||||
if ($file) {
|
||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'pdf');
|
||||
if ($info) {
|
||||
return json(['code' => 0, 'upurl' => str_replace("\\", "/", $info->getSaveName())]);
|
||||
} else {
|
||||
return json(['code' => 1, 'msg' => $file->getError()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user