This commit is contained in:
wangjinlei
2022-10-10 19:04:50 +08:00
parent c1070744c9
commit 96171d9f79
3 changed files with 158 additions and 25 deletions

View File

@@ -53,6 +53,16 @@ class Admin extends Controller {
return jsonSuccess(['mycode'=>md5($data['mmm'])]); return jsonSuccess(['mycode'=>md5($data['mmm'])]);
} }
public function emailTest(){
$email = '751475802@qq.com';
$title = 'testemail';
$tt = 'content';
$journal_info = $this->journal_obj->where('journal_id',12)->find();
$res = sendEmail($email, $title, $title, $tt, $journal_info['email'],$journal_info['epassword']);
dump($res);
}
/** /**

View File

@@ -66,6 +66,9 @@ class Email extends Controller{
$this->email_template_obj = Db::name('email_template'); $this->email_template_obj = Db::name('email_template');
} }
/** /**
* 添加邮件模板 * 添加邮件模板
*/ */
@@ -182,9 +185,6 @@ class Email extends Controller{
} }
public function tttt(){
echo md5('zhengzuguo0614');
}
/** /**
* 获取邮件发送记录通过文章 * 获取邮件发送记录通过文章

View File

@@ -97,9 +97,11 @@ class Production extends Controller
if (!$rule->check($data)) { if (!$rule->check($data)) {
return jsonError($rule->getError()); return jsonError($rule->getError());
} }
// $data['article_id'] = 1144;
$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('实例已存在!');
} }
$article_info = $this->article_obj->where('article_id', $data['article_id'])->find(); $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['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();
$this->production_article_obj->insert($insert); $this->production_article_obj->insert($insert);
return jsonSuccess([]); return jsonSuccess([]);
} }
@@ -171,6 +174,13 @@ class Production extends Controller
return jsonSuccess([]); 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', 'icon' => 'require',
'tradition_tag' => 'require', 'tradition_tag' => 'require',
'tradition' => 'require', 'tradition' => 'require',
'abstract' => 'require',
'acknowledgment' => 'require', 'acknowledgment' => 'require',
'abbreviation' =>'require', 'abbreviation' =>'require',
'keywords' => 'require', 'keywords' => 'require',
'author_contribution'=>'require', 'author_contribution'=>'require',
'fund' => 'require', 'abbr' => 'require'
'abbr' => 'require',
'pub_date' => 'require',
]); ]);
if (!$rule->check($data)) { if (!$rule->check($data)) {
return jsonError($rule->getError()); return jsonError($rule->getError());
@@ -210,27 +217,26 @@ class Production extends Controller
$update['author_contribution'] = trim($data['author_contribution']); $update['author_contribution'] = trim($data['author_contribution']);
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : ''; $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['abbreviation'] = trim($data['abbreviation']);
$update['acknowledgment'] = trim($data['acknowledgment']); $update['acknowledgment'] = trim($data['acknowledgment']);
$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'] = isset($data['npp'])?$data['npp']:''; $update['npp'] = isset($data['npp'])?$data['npp']:'';
//生成doi号 //生成doi号
$doi = ''; // $doi = '';
if ($p_info['doi'] == '') { // if ($p_info['doi'] == '') {
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail'; // $url = 'http://journalapi.tmrjournals.com/public/index.php/master/Journal/getStageDetail';
$cs['journal_stage_id'] = $data['journal_stage_id']; // $cs['journal_stage_id'] = $data['journal_stage_id'];
$list = object_to_array(json_decode(myPost($url, $cs))); // $list = object_to_array(json_decode(myPost($url, $cs)));
$re = $list['data']['stage']; // $re = $list['data']['stage'];
$doi = $this->createdoi($re['stage_year'], $re['stage_vol'], $journal_info['abbr']); // $doi = $this->createdoi($re['stage_year'], $re['stage_vol'], $journal_info['abbr']);
}else{ // }else{
$doi = $p_info['doi']; // $doi = $p_info['doi'];
} // }
$update['doi'] = $doi; // $update['doi'] = $doi;
@@ -268,7 +274,7 @@ class Production extends Controller
if (!$rule->check($data)) { if (!$rule->check($data)) {
return jsonError($rule->getError()); 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); $this->production_article_obj->where('p_article_id',$data['p_article_id'])->update($update);
return jsonSuccess([]); return jsonSuccess([]);
} }
@@ -342,13 +348,96 @@ class Production extends Controller
$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
->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(); $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 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'] == '') { if (!isset($res['data']['file']) || $res['data']['file'] == '') {
return jsonError('create error'); 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['p_article_id'] = $p_info['p_article_id'];
$tf_insert['url'] = $file_res; $tf_insert['url'] = $file_res;
$tf_insert['ctime'] = time(); $tf_insert['ctime'] = time();
@@ -897,4 +986,38 @@ class Production extends Controller
$frag['address'] = $address_str; $frag['address'] = $address_str;
return $frag; 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()]);
}
}
}
} }