1
This commit is contained in:
@@ -45,6 +45,7 @@ class Production extends Controller
|
|||||||
protected $production_article_organ_obj = '';
|
protected $production_article_organ_obj = '';
|
||||||
protected $production_article_refer_obj = '';
|
protected $production_article_refer_obj = '';
|
||||||
protected $production_article_author_to_organ_obj = '';
|
protected $production_article_author_to_organ_obj = '';
|
||||||
|
protected $production_article_frag_obj = '';
|
||||||
|
|
||||||
public function __construct(\think\Request $request = null)
|
public function __construct(\think\Request $request = null)
|
||||||
{
|
{
|
||||||
@@ -81,25 +82,27 @@ class Production extends Controller
|
|||||||
$this->production_article_organ_obj = Db::name('production_article_organ');
|
$this->production_article_organ_obj = Db::name('production_article_organ');
|
||||||
$this->production_article_refer_obj = Db::name('production_article_refer');
|
$this->production_article_refer_obj = Db::name('production_article_refer');
|
||||||
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
|
$this->production_article_author_to_organ_obj = Db::name('production_article_author_to_organ');
|
||||||
|
$this->production_article_frag_obj = Db::name('production_article_frag');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加生产实例
|
* 添加生产实例
|
||||||
*/
|
*/
|
||||||
public function addProduction(){
|
public function addProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'article_id'=>'require|number'
|
'article_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$check = $this->production_article_obj->where('article_id',$data['article_id'])->where('state',0)->find();
|
$check = $this->production_article_obj->where('article_id', $data['article_id'])->where('state', 0)->find();
|
||||||
if($check){
|
if ($check) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
$article_info = $this->article_obj->where('article_id',$data['article_id'])->find();
|
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find();
|
||||||
$files = $this->article_file_obj
|
$files = $this->article_file_obj
|
||||||
->where('article_id', $article_info['article_id'])
|
->where('article_id', $article_info['article_id'])
|
||||||
->where('type_name', 'manuscirpt')
|
->where('type_name', 'manuscirpt')
|
||||||
@@ -144,9 +147,7 @@ class Production extends Controller
|
|||||||
$frag['main'][] = $v;
|
$frag['main'][] = $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
|
||||||
|
|
||||||
|
|
||||||
$insert['article_id'] = $data['article_id'];
|
$insert['article_id'] = $data['article_id'];
|
||||||
$insert['journal_id'] = $article_info['journal_id'];
|
$insert['journal_id'] = $article_info['journal_id'];
|
||||||
$insert['ctime'] = time();
|
$insert['ctime'] = time();
|
||||||
@@ -157,104 +158,316 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除生产实例
|
* 删除生产实例
|
||||||
*/
|
*/
|
||||||
public function delProduction(){
|
public function delProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number'
|
'p_article_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update(['state'=>1]);
|
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update(['state' => 1]);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑生产实例
|
* 编辑生产实例
|
||||||
*/
|
*/
|
||||||
public function editProduction(){
|
public function editProduction()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number',
|
'p_article_id' => 'require|number',
|
||||||
'title'=>'require',
|
'journal_stage_id' => 'require',
|
||||||
'type'=>'require',
|
'title' => 'require',
|
||||||
'icon'=>'require',
|
'type' => 'require',
|
||||||
'tradition_tag'=>'require',
|
'icon' => 'require',
|
||||||
'tradition'=>'require',
|
'tradition_tag' => 'require',
|
||||||
'doi'=>'require',
|
'tradition' => 'require',
|
||||||
'abstract'=>'require',
|
'abstract' => 'require',
|
||||||
'keywords'=>'require',
|
'acknowledgment' => 'require',
|
||||||
'fund'=>'require',
|
'abbreviation' =>'require',
|
||||||
'abbr'=>'require',
|
'keywords' => 'require',
|
||||||
'pub_date'=>'require',
|
'author_contribution'=>'require',
|
||||||
|
'fund' => 'require',
|
||||||
|
'abbr' => 'require',
|
||||||
|
'pub_date' => 'require',
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
|
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||||
|
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
|
||||||
|
|
||||||
|
|
||||||
$update['title'] = trim($data['title']);
|
$update['title'] = trim($data['title']);
|
||||||
|
$update['journal_stage_id'] = $data['journal_stage_id'];
|
||||||
$update['type'] = trim($data['type']);
|
$update['type'] = trim($data['type']);
|
||||||
$update['icon'] = trim($data['icon']);
|
$update['icon'] = trim($data['icon']);
|
||||||
$update['tradition_tag'] = trim($data['tradition_tag']);
|
$update['tradition_tag'] = trim($data['tradition_tag']);
|
||||||
$update['tradition'] = trim($data['tradition']);
|
$update['tradition'] = trim($data['tradition']);
|
||||||
$update['mhoo'] = isset($data['mhoo'])?trim($data['mhoo']):'';
|
$update['author_contribution'] = trim($data['author_contribution']);
|
||||||
$update['doi'] = trim($data['doi']);
|
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : '';
|
||||||
$update['ltai'] = isset($data['ltai'])?trim($data['ltai']):'';
|
$update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : '';
|
||||||
$update['abstract'] = trim($data['abstract']);
|
$update['abstract'] = trim($data['abstract']);
|
||||||
$update['keywords'] = trim($data['keywords']);
|
$update['keywords'] = trim($data['keywords']);
|
||||||
|
$update['abbreviation'] = trim($data['abbreviation']);
|
||||||
|
$update['acknowledgment'] = trim($data['acknowledgment']);
|
||||||
$update['fund'] = trim($data['fund']);
|
$update['fund'] = trim($data['fund']);
|
||||||
$update['abbr'] = trim($data['abbr']);
|
$update['abbr'] = trim($data['abbr']);
|
||||||
$update['pub_date'] = trim($data['pub_date']);
|
$update['pub_date'] = trim($data['pub_date']);
|
||||||
$update['npp'] = $data['npp'];
|
$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;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($update);
|
||||||
|
return jsonSuccess($update);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文章排版结果列表
|
||||||
|
*/
|
||||||
|
public function getArticleFrags(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$list = $this->production_article_frag_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||||
|
|
||||||
|
$re['frags'] = $list;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑文章主要内容
|
||||||
|
*/
|
||||||
|
public function editMainContent(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number',
|
||||||
|
'main'=>'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$update['main'] = json_encode($data['main']);
|
||||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
|
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function createdoi($year, $vol, $abbr)
|
||||||
|
{
|
||||||
|
$frag = '';
|
||||||
|
$doi = $abbr . $year . $vol . rand(1000, 9999);
|
||||||
|
$frag = $doi;
|
||||||
|
$check = $this->production_article_obj->where('doi', $doi)->find();
|
||||||
|
if ($check) {
|
||||||
|
$frag = $this->createdoi($year, $vol, $abbr);
|
||||||
|
}
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取引用文献列表
|
||||||
|
*/
|
||||||
|
public function getReferList(){
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$list = $this->production_article_refer_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
||||||
|
$re['refers'] = $list;
|
||||||
|
return jsonSuccess($re);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参考文献的最终结果
|
||||||
|
*/
|
||||||
|
public function editReferFrag()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_refer_id' => 'require',
|
||||||
|
'refer_frag' => 'require'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$update['refer_frag'] = trim($data['refer_frag']);
|
||||||
|
$updata['cs'] = 1;
|
||||||
|
$this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->update($updata);
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取生产实例列表
|
* 获取生产实例列表
|
||||||
*/
|
*/
|
||||||
public function getProductionList(){
|
public function getProductionList()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'editor_id'=>'require|number',
|
'editor_id' => 'require|number',
|
||||||
'journal_id'=>'require',
|
'journal_id' => 'require',
|
||||||
'pageIndex' => 'require',
|
'pageIndex' => 'require',
|
||||||
'pageSize' => 'require'
|
'pageSize' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$journalids = [];
|
$journalids = [];
|
||||||
if($data['journal_id']==0){
|
if ($data['journal_id'] == 0) {
|
||||||
$journalids = $this->journal_obj->where('editor_id',$data['editor_id'])->column('journal_id');
|
$journalids = $this->journal_obj->where('editor_id', $data['editor_id'])->column('journal_id');
|
||||||
}
|
}
|
||||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
$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->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();
|
$count = $this->production_article_obj->where('journal_id', 'in', $journalids)->where('state', 0)->count();
|
||||||
$re['productions'] = $list;
|
$re['productions'] = $list;
|
||||||
$re['count'] = $count;
|
$re['count'] = $count;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取生产实例详情
|
* 排版主方法入口
|
||||||
*/
|
*/
|
||||||
public function getProductionDetail(){
|
public function doTypeSetting()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
|
// 验证规则
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number'
|
'p_article_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
||||||
$list = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
|
||||||
foreach($list as $k => $v){
|
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
|
||||||
$list[$k]['organs'] = $this->production_article_author_to_organ_obj
|
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||||
->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')
|
$typesetInfo = [];
|
||||||
->where('p_article_author_id',$v['p_article_author_id'])
|
$typesetInfo['info_title'] = $p_info['title'];
|
||||||
|
$typesetInfo['info_type'] = $p_info['type'];
|
||||||
|
$typesetInfo['doi'] = $p_info['doi'];
|
||||||
|
$typesetInfo['topic'] = '';
|
||||||
|
$typesetInfo['mainText'] = $p_info['main'];
|
||||||
|
|
||||||
|
$au_res = $this->authorFormate($data['p_article_id']);
|
||||||
|
|
||||||
|
$typesetInfo['author'] = $au_res['author'];
|
||||||
|
$typesetInfo['authorAddress'] = $au_res['address'];
|
||||||
|
$typesetInfo['authorContribution'] = $p_info['author_contribution'];
|
||||||
|
|
||||||
|
//查询通讯作者
|
||||||
|
$corr_authors = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('is_report',1)->where('state',0)->select();
|
||||||
|
$corrauthor = '';
|
||||||
|
$corremail = '';
|
||||||
|
foreach($corr_authors as $v){
|
||||||
|
$corrauthor .= $v['first_name']. ' '.$v['last_name'].'. ';
|
||||||
|
$corremail .= $v['email'].'. ';
|
||||||
|
}
|
||||||
|
$typesetInfo['authorCorresponding'] = substr(trim($corrauthor),0,-1);
|
||||||
|
$typesetInfo['authorCorrespondingEmail'] = substr(trim($corremail),0,-1);
|
||||||
|
$typesetInfo['traditon'] = $p_info['tradition'];
|
||||||
|
$typesetInfo['journal'] = $journal_info['title'];
|
||||||
|
$typesetInfo['jabbr'] = $journal_info['jabbr'];
|
||||||
|
|
||||||
|
//查询分期
|
||||||
|
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
|
||||||
|
$cs['journal_stage_id'] = $p_info['journal_stage_id'];
|
||||||
|
$list = object_to_array(json_decode(myPost($url, $cs)));
|
||||||
|
$stage_re = $list['data']['stage'];
|
||||||
|
|
||||||
|
$typesetInfo['stage'] = $stage_re['stage_year'].';'.$stage_re['stage_vol'].'('.$stage_re['stage_no'].'):'.$p_info['npp'];//2022;6(1):17
|
||||||
|
$typesetInfo['little_author'] = $p_info['abbr'];
|
||||||
|
$typesetInfo['website'] = $journal_info['website'];
|
||||||
|
$typesetInfo['acknowledgment'] = $p_info['acknowledgment'];
|
||||||
|
$typesetInfo['received_date'] = date("d F Y", $article_info['ctime']);;
|
||||||
|
$typesetInfo['accepted_date'] = date("d F Y", $article_info['rtime']);
|
||||||
|
$typesetInfo['online_date'] = $p_info['pub_date'];//这里可能会有问题
|
||||||
|
$typesetInfo['abbreviation'] = $p_info['abbreviation'];
|
||||||
|
$typesetInfo['abstractText'] = $p_info['abstract'];
|
||||||
|
$typesetInfo['keywords'] = $p_info['keywords'];
|
||||||
|
$typesetInfo['userAccount'] = $editor_info['nickname'];
|
||||||
|
|
||||||
|
//获取文件
|
||||||
|
$files = $this->article_file_obj
|
||||||
|
->where('article_id', $article_info['article_id'])
|
||||||
|
->where('type_name', 'manuscirpt')
|
||||||
|
->order('ctime desc')
|
||||||
|
->limit(1)
|
||||||
->select();
|
->select();
|
||||||
|
if (count($files) == 0) {
|
||||||
|
return jsonError('No Manuscript');
|
||||||
|
}
|
||||||
|
$typesetInfo['filename'] = "http://api.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||||
|
|
||||||
|
$rs = $this->production_article_refer_obj->where('p_article_id',$p_info['p_article_id'])->where('state',0)->select();
|
||||||
|
$refers = [];
|
||||||
|
foreach ($rs as $v) {
|
||||||
|
$refers[] = $v['refer_frag'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$typesetInfo['refers'] = json_encode($refers);
|
||||||
|
|
||||||
|
$url = "http://ts.tmrjournals.com/api/typeset/webGetDocx";
|
||||||
|
$res = object_to_array(json_decode(myPost1($url, $typesetInfo)));
|
||||||
|
|
||||||
|
if (!isset($res['data']['file']) || $res['data']['file'] == '') {
|
||||||
|
return jsonError('create error');
|
||||||
|
}
|
||||||
|
$file_res = $res['data']['file'];
|
||||||
|
$tf_insert['p_article_id'] = $p_info['p_article_id'];
|
||||||
|
$tf_insert['url'] = $file_res;
|
||||||
|
$tf_insert['ctime'] = time();
|
||||||
|
$this->production_article_frag_obj->insert($tf_insert);
|
||||||
|
|
||||||
|
return jsonSuccess([]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取生产实例详情
|
||||||
|
*/
|
||||||
|
public function getProductionDetail()
|
||||||
|
{
|
||||||
|
$data = $this->request->post();
|
||||||
|
$rule = new Validate([
|
||||||
|
'p_article_id' => 'require|number'
|
||||||
|
]);
|
||||||
|
if (!$rule->check($data)) {
|
||||||
|
return jsonError($rule->getError());
|
||||||
|
}
|
||||||
|
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||||
|
$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['production'] = $p_info;
|
$re['production'] = $p_info;
|
||||||
$re['author'] = $list;
|
$re['author'] = $list;
|
||||||
@@ -265,16 +478,17 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 添加作者机构
|
* 添加作者机构
|
||||||
*/
|
*/
|
||||||
public function addAuthorOrgan(){
|
public function addAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number',
|
'p_article_id' => 'require|number',
|
||||||
'organ_name'=>'require'
|
'organ_name' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||||
$insert['p_article_id'] = $data['p_article_id'];
|
$insert['p_article_id'] = $data['p_article_id'];
|
||||||
$insert['article_id'] = $p_info['article_id'];
|
$insert['article_id'] = $p_info['article_id'];
|
||||||
$insert['organ_name'] = trim($data['organ_name']);
|
$insert['organ_name'] = trim($data['organ_name']);
|
||||||
@@ -286,48 +500,51 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除作者机构
|
* 删除作者机构
|
||||||
*/
|
*/
|
||||||
public function delAuthorOrgan(){
|
public function delAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_organ_id'=>'require|number'
|
'p_article_organ_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->production_article_organ_obj->where('p_article_organ_id',$data['p_article_organ_id'])->update(['state'=>1]);
|
$this->production_article_organ_obj->where('p_article_organ_id', $data['p_article_organ_id'])->update(['state' => 1]);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑作者机构信息
|
* 编辑作者机构信息
|
||||||
*/
|
*/
|
||||||
public function editAuthorOrgan(){
|
public function editAuthorOrgan()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_organ_id'=>'require|number',
|
'p_article_organ_id' => 'require|number',
|
||||||
'organ_name'=>'require'
|
'organ_name' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
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']]);
|
$this->production_article_organ_obj->where('p_article_organ_id', $data['p_article_organ_id'])->update(['organ_name' => $data['organ_name']]);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取机构列表
|
* 获取机构列表
|
||||||
*/
|
*/
|
||||||
public function getOrganList(){
|
public function getOrganList()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number'
|
'p_article_id' => 'require|number'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
$list = $this->production_article_organ_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
$list = $this->production_article_organ_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||||
$re['organs'] = $list;
|
$re['organs'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
}
|
}
|
||||||
@@ -335,30 +552,31 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 添加作者
|
* 添加作者
|
||||||
*/
|
*/
|
||||||
public function addAuthor(){
|
public function addAuthor()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require|number',
|
'p_article_id' => 'require|number',
|
||||||
'first_name'=>'require',
|
'first_name' => 'require',
|
||||||
'last_name'=>'require',
|
'last_name' => 'require',
|
||||||
'author_country'=>'require',
|
'author_country' => 'require',
|
||||||
'is_first'=>'require',
|
'is_first' => 'require',
|
||||||
'is_report'=>'require'
|
'is_report' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$p_info = $this->production_article_obj->where('p_article_id',$data['p_article_id'])->find();
|
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||||
$insert['p_article_id'] = $data['p_article_id'];
|
$insert['p_article_id'] = $data['p_article_id'];
|
||||||
$insert['article_id'] = $p_info['article_id'];
|
$insert['article_id'] = $p_info['article_id'];
|
||||||
$insert['author_name'] = $data['first_name'].' '.$data['last_name'];
|
$insert['author_name'] = $data['first_name'] . ' ' . $data['last_name'];
|
||||||
$insert['first_name'] = $data['first_name'];
|
$insert['first_name'] = $data['first_name'];
|
||||||
$insert['last_name'] = $data['last_name'];
|
$insert['last_name'] = $data['last_name'];
|
||||||
$insert['orcid'] = isset($data['orcid'])?$data['orcid']:'';
|
$insert['orcid'] = isset($data['orcid']) ? $data['orcid'] : '';
|
||||||
$insert['author_country'] = $data['author_country'];
|
$insert['author_country'] = $data['author_country'];
|
||||||
$insert['is_first'] = $data['is_first'];
|
$insert['is_first'] = $data['is_first'];
|
||||||
$insert['is_report'] = $data['is_report'];
|
$insert['is_report'] = $data['is_report'];
|
||||||
$insert['email'] = isset($data['email'])?trim($data['email']):'';
|
$insert['email'] = isset($data['email']) ? trim($data['email']) : '';
|
||||||
|
|
||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
$pa_id = $this->production_article_author_obj->insertGetId($insert);
|
$pa_id = $this->production_article_author_obj->insertGetId($insert);
|
||||||
@@ -378,7 +596,6 @@ class Production extends Controller
|
|||||||
Db::rollback();
|
Db::rollback();
|
||||||
return jsonError("system error");
|
return jsonError("system error");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -416,7 +633,7 @@ class Production extends Controller
|
|||||||
*/
|
*/
|
||||||
public function referToDoi($p_article_id)
|
public function referToDoi($p_article_id)
|
||||||
{
|
{
|
||||||
$p_info = $this->production_article_obj->where('p_article_id',$p_article_id)->find();
|
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
|
||||||
$refers = $this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where('state', 0)->select();
|
$refers = $this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where('state', 0)->select();
|
||||||
foreach ($refers as $v) { //处理doi
|
foreach ($refers as $v) { //处理doi
|
||||||
if (strripos($v['refer_content'], 'doi:') == false && strripos($v['refer_content'], 'doi.org/') == false) {
|
if (strripos($v['refer_content'], 'doi:') == false && strripos($v['refer_content'], 'doi.org/') == false) {
|
||||||
@@ -445,7 +662,7 @@ class Production extends Controller
|
|||||||
|
|
||||||
public function doiTofrag($p_article_id)
|
public function doiTofrag($p_article_id)
|
||||||
{
|
{
|
||||||
$p_info = $this->production_article_obj->where('p_article_id',$p_article_id)->find();
|
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
|
||||||
$refers = $this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where('state', 0)->select();
|
$refers = $this->production_article_refer_obj->where('p_article_id', $p_info['p_article_id'])->where('state', 0)->select();
|
||||||
foreach ($refers as $v) {
|
foreach ($refers as $v) {
|
||||||
if ($v['refer_doi'] == '') {
|
if ($v['refer_doi'] == '') {
|
||||||
@@ -469,7 +686,7 @@ class Production extends Controller
|
|||||||
if (!$rule->check($data)) {
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$list = $this->production_article_refer_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
$list = $this->production_article_refer_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||||
if (!$list) {
|
if (!$list) {
|
||||||
return jsonError('references error');
|
return jsonError('references error');
|
||||||
}
|
}
|
||||||
@@ -498,7 +715,7 @@ class Production extends Controller
|
|||||||
if (!$rule->check($data)) {
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$list = $this->production_article_refer_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
$list = $this->production_article_refer_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||||
$z = count($list);
|
$z = count($list);
|
||||||
$m = 0;
|
$m = 0;
|
||||||
foreach ($list as $v) {
|
foreach ($list as $v) {
|
||||||
@@ -520,36 +737,38 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 删除作者
|
* 删除作者
|
||||||
*/
|
*/
|
||||||
public function delAuthor(){
|
public function delAuthor()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_author_id'=>'require'
|
'p_article_author_id' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$this->production_article_author_obj->where('p_article_author_id',$data['p_article_author_id'])->update(['state'=>1]);
|
$this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->update(['state' => 1]);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作者列表
|
* 获取作者列表
|
||||||
*/
|
*/
|
||||||
public function getAuthorlist(){
|
public function getAuthorlist()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require'
|
'p_article_id' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
$list = $this->production_article_author_obj->where('p_article_id',$data['p_article_id'])->where('state',0)->select();
|
$list = $this->production_article_author_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||||
foreach($list as $k => $v){
|
foreach ($list as $k => $v) {
|
||||||
$list[$k]['organs'] = $this->production_article_author_to_organ_obj
|
$list[$k]['organs'] = $this->production_article_author_to_organ_obj
|
||||||
->field("t_production_article_organ.*")
|
->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')
|
->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'])
|
->where('p_article_author_id', $v['p_article_author_id'])
|
||||||
->select();
|
->select();
|
||||||
}
|
}
|
||||||
$re['authors'] = $list;
|
$re['authors'] = $list;
|
||||||
return jsonSuccess($re);
|
return jsonSuccess($re);
|
||||||
@@ -558,13 +777,14 @@ class Production extends Controller
|
|||||||
/**
|
/**
|
||||||
* 更改附加文件
|
* 更改附加文件
|
||||||
*/
|
*/
|
||||||
public function editArticleFile() {
|
public function editArticleFile()
|
||||||
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
$rule = new Validate([
|
$rule = new Validate([
|
||||||
'p_article_id'=>'require',
|
'p_article_id' => 'require',
|
||||||
'filetype'=>'require'
|
'filetype' => 'require'
|
||||||
]);
|
]);
|
||||||
if(!$rule->check($data)){
|
if (!$rule->check($data)) {
|
||||||
return jsonError($rule->getError());
|
return jsonError($rule->getError());
|
||||||
}
|
}
|
||||||
if ($data['filetype'] == 'PDF') {
|
if ($data['filetype'] == 'PDF') {
|
||||||
@@ -579,17 +799,18 @@ class Production extends Controller
|
|||||||
$updata['endnote'] = $data['fileURL'];
|
$updata['endnote'] = $data['fileURL'];
|
||||||
} elseif ($data['filetype'] == 'bibTex') {
|
} elseif ($data['filetype'] == 'bibTex') {
|
||||||
$updata['bibtex'] = $data['fileURL'];
|
$updata['bibtex'] = $data['fileURL'];
|
||||||
}elseif($data['filetype'] == 'CDF'){
|
} elseif ($data['filetype'] == 'CDF') {
|
||||||
$updata['file_cdf'] = $data['fileURL'];
|
$updata['file_cdf'] = $data['fileURL'];
|
||||||
}
|
}
|
||||||
$this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($updata);
|
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($updata);
|
||||||
return jsonSuccess([]);
|
return jsonSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文章图片文件
|
* 上传文章图片文件
|
||||||
*/
|
*/
|
||||||
public function up_articlepic_file(){
|
public function up_articlepic_file()
|
||||||
|
{
|
||||||
$file = request()->file('articleicon');
|
$file = request()->file('articleicon');
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$info = $file->move(ROOT_PATH . 'public' . DS . 'articleicon');
|
$info = $file->move(ROOT_PATH . 'public' . DS . 'articleicon');
|
||||||
@@ -609,7 +830,8 @@ class Production extends Controller
|
|||||||
*
|
*
|
||||||
* @return upurl:图片地址
|
* @return upurl:图片地址
|
||||||
*/
|
*/
|
||||||
public function up_article_file($type) {
|
public function up_article_file($type)
|
||||||
|
{
|
||||||
$file = request()->file($type);
|
$file = request()->file($type);
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
|
$info = $file->move(ROOT_PATH . 'public' . DS . $type);
|
||||||
@@ -621,5 +843,58 @@ class Production extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function authorFormate($p_article_id)
|
||||||
|
{
|
||||||
|
// $authors = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
|
||||||
|
|
||||||
|
$authors = $this->production_article_author_obj->where('p_article_id',$p_article_id)->where('state',0)->select();
|
||||||
|
//组装地址数组
|
||||||
|
$address = [];
|
||||||
|
foreach ($authors as $v) {
|
||||||
|
$cac = $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('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();
|
||||||
|
foreach($cac as $val){
|
||||||
|
if(!in_array($val['organ_name'],$address)){
|
||||||
|
$address[] = $val['organ_name'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//构建数组字符串
|
||||||
|
$author = '';
|
||||||
|
foreach ($authors as $v) {
|
||||||
|
$cache_str = $v['first_name'] . ' ' . $v['last_name'] . '<q>';
|
||||||
|
$cac = $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('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();
|
||||||
|
foreach ($cac as $val) {
|
||||||
|
$cache_str .= (intval(search_array_val($address, $val['organ_name'])) + 1) . " ";
|
||||||
|
}
|
||||||
|
if ($v['is_first'] == 1) {
|
||||||
|
$cache_str .= '*';
|
||||||
|
}
|
||||||
|
if ($v['is_report'] == 1) {
|
||||||
|
$cache_str .= '#';
|
||||||
|
}
|
||||||
|
$cache_str = trim($cache_str);
|
||||||
|
$cache_str .= '</q>';
|
||||||
|
$author .= $cache_str;
|
||||||
|
}
|
||||||
|
//组装address
|
||||||
|
$address_str = '';
|
||||||
|
foreach ($address as $k => $v) {
|
||||||
|
$address_str .= ($k + 1) . ' ' . $v . ' ';
|
||||||
|
}
|
||||||
|
$frag['author'] = $author;
|
||||||
|
$frag['address'] = $address_str;
|
||||||
|
return $frag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user