This commit is contained in:
王金磊
2023-03-30 11:44:37 +08:00
parent 34494929a6
commit e4be850ba1
14 changed files with 625 additions and 910 deletions

View File

@@ -2,49 +2,17 @@
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use app\api\controller\Base;
/**
* @title 公共管理相关
* @description 公共管理相关
*/
class Admin extends Controller {
class Admin extends Base {
protected $user_obj = '';
protected $captcha_obj = '';
protected $journal_obj = '';
protected $user_act_obj = '';
protected $reviewer_major_obj = '';
protected $article_obj = '';
protected $article_msg_obj = '';
protected $article_author_obj = '';
protected $admin_obj = '';
protected $country_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_reviewer_obj = '';
protected $user_msg_obj = '';
protected $article_reviewer_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->journal_obj = Db::name('journal');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_obj = Db::name('article');
$this->user_msg_obj = Db::name('user_msg');
$this->article_msg_obj = Db::name('article_msg');
$this->article_author_obj = Db::name('article_author');
$this->country_obj = Db::name('country');
$this->article_reviewer_obj = Db::name('article_reviewer');
}
@@ -257,6 +225,7 @@ class Admin extends Controller {
*
*/
public function reviewer() {
die("service stop!!");
//接受参数
$data = $this->request->post();
$journal_info = $this->journal_obj->where('journal_id', $data['journal'])->find();
@@ -307,6 +276,7 @@ class Admin extends Controller {
* 作者申请成为审稿人
*/
public function becameReviewer() {
die("service stop!!");
//接受参数,查询参数
$data = $this->request->post();

View File

@@ -2,7 +2,7 @@
namespace app\api\controller;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\Queue;
use think\Validate;
@@ -11,73 +11,13 @@ use think\Validate;
* @title 文章接口
* @description 文章接口
*/
class Article extends Controller
class Article extends Base
{
protected $article_obj = '';
protected $country_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 $article_response_to_reviewer_obj = '';
protected $user_black_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $email_log_obj = '';
protected $email_template_obj = '';
protected $production_article_obj = '';
protected $company_top_obj = '';
protected $user_score_log_obj = '';
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->country_obj = Db::name('country');
$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->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer');
$this->user_black_obj = Db::name('user_black');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->email_log_obj = Db::name('email_log');
$this->email_template_obj = Db::name('email_template');
$this->production_article_obj = Db::name('production_article');
$this->company_top_obj = Db::name('company_top');
$this->user_score_log_obj = Db::name('user_score_log');
}
/**
@@ -415,20 +355,6 @@ class Article extends Controller
return json(['article' => $article_res, 'msg' => $article_msg, 'authors' => $author_res, 'suggest' => $suggest, 'transfer' => $transfer_res, 'transinfo' => $transfer_info, 'major' => $major]);
}
private function getMajorStr($major_id)
{
$frag = '';
$major_info = $this->major_obj->where('major_id', $major_id)->find();
if ($major_info == null) {
return '';
}
if ($major_info['major_level'] == 1) {
return '';
} else {
$frag = $this->getMajorStr($major_info['pid']) . ' > ' . $major_info['major_title'];
}
return $frag;
}
/**
@@ -1117,8 +1043,8 @@ class Article extends Controller
return json(['code' => 1, 'msg' => "More than two available reviewer-comments are necessary before going next step."]);
}
}
//接收必须查重小于30%
if ($data['state'] == 5 && $article_info['repetition'] > 30) {
//接收必须查重小于20%
if ($data['state'] == 5 && $article_info['repetition'] > 20) {
return jsonError("Submissions with a repetition rate greater than thirty percent will not be accepted");
}
@@ -1406,6 +1332,16 @@ class Article extends Controller
//接受参数
$data = $this->request->post();
$this->article_obj->where('article_id', $data['articleId'])->update(['repetition' => $data['repefen'], 'repeurl' => $data['zipurl']]);
//当文章重复率大于50%时,拒稿,拉作者进黑名单
if($data['repefen']>=50){
$article_info = $this->article_obj->where('article_id',$data['articleId'])->find();
$user_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
$insert['user_id'] = $data['user_id'];
$insert['reason'] = "The author was blacklisted due to the check rate exceeded 50%";
$insert['black_ctime'] = time();
$this->user_black_obj->insert($insert);
$this->article_obj->where('article_id',$data['articleId'])->update(['state'=>3]);
}
return json(['code' => 0]);
}
@@ -2840,47 +2776,6 @@ class Article extends Controller
return jsonSuccess($re);
}
/**
* 存储article文件历史信息
*/
private function save_article_file($article_id, $user_id, $username, $url, $type_name)
{
//首先确定数据库里面是否存在此数据
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) { //编辑的时候不能重复存储
return true;
} else if ($type_name == 'picturesAndTables' && trim($url) == '') {
return true;
} else if ($type_name == 'coverLetter' && trim($url) == '') {
return true;
} else if ($type_name == 'totalpage' && trim($url) == '') {
return true;
}
$insert_data['article_id'] = $article_id;
$insert_data['user_id'] = $user_id;
$insert_data['username'] = $username;
$insert_data['file_url'] = $url;
$insert_data['type_name'] = $type_name;
$insert_data['ctime'] = time();
return $this->article_file_obj->insertGetId($insert_data);
}
/**
* 获取文章作者字符串
* @param type $article_id
*/
public function getArticleAuthors($article_id)
{
$res = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
$frag = '';
foreach ($res as $v) {
$frag .= $v['firstname'] . $v['lastname'] . ',';
}
return substr($frag, 0, -1);
}
// 给审稿人发送邮件- 稿件的基本情况
public function sendEmailToReviewer($articleId, $state)
{
@@ -2974,7 +2869,7 @@ class Article extends Controller
$this->article_obj->where('article_id', $article_id)->update(['editor_act' => 1]);
$author = $this->user_obj->where('user_id', $article['user_id'])->find();
// 发邮件
$content = 'Dear ' . $res['realname'] . ',<br>';
$content = 'Dear ' . $author['realname'] . ',<br>';
$content .= 'Thank you for contacting our editor. <br>ID: ' . $article['accept_sn'] . '.<br><br>';
$content .= ' Your manuscript: ' . $article['accept_sn'] . ' has received a new reply; please login https://submission.tmrjournals.com/login to check. <br>';
$content .= 'Sincerely,<br>' . $article['title'];

View File

@@ -261,6 +261,21 @@ class Auto extends Controller
return jsonSuccess($re);
}
/**
* 补充doi缺失的全文内容
*/
// public function pushCrossrefForDoiB(){
// $url = "https://doi.crossref.org/servlet/deposit";
// $file = "D://cr396e3d57186c1f28fcb-6cc5.xml";
// $program['operation'] = "doDOICitUpload";
// $program['login_id'] = "books@tmrjournals.com";
// $program['login_passwd'] = "849192806pnX";
// $program['fname'] = $file;
// $res = myPost($url,$program);
// echo $res;
// // return jsonSuccess($res);
// }
public function qqqq()
{

View File

@@ -0,0 +1,253 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Base extends Controller
{
protected $user_obj = '';
protected $captcha_obj = '';
protected $article_obj = '';
protected $user_act_obj = '';
protected $admin_obj = '';
protected $user_reviewer_obj = '';
protected $journal_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_msg_obj = '';
protected $chief_to_journal_obj = '';
protected $board_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_author_obj = '';
protected $user_black_obj = '';
protected $user_to_special_obj = '';
protected $user_register_check_obj = '';
protected $user_cert_obj = '';
protected $apply_board_obj = '';
protected $apply_yboard_obj = '';
protected $user_score_log_obj = '';
protected $user_index_log_obj = '';
protected $article_reviewer_obj = '';
protected $user_ash_obj = '';
protected $major_obj = '';
protected $user_to_yboard_obj = '';
protected $user_author_obj = '';
protected $country_obj = '';
protected $user_log_obj = '';
protected $article_reviewer_question_obj = '';
protected $article_msg_obj = '';
protected $article_file_obj = '';
protected $article_transfer_obj = '';
protected $login_auto_obj = '';
protected $major_to_journal_obj = '';
protected $article_dialog_obj = '';
protected $article_proposal_obj = '';
protected $article_response_to_reviewer_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $email_log_obj = '';
protected $email_template_obj = '';
protected $production_article_obj = '';
protected $company_top_obj = '';
protected $user_cv_obj = '';
protected $ts_obj = '';
protected $ts_refer_obj = '';
protected $ts_frag_obj = '';
protected $online_obj = '';
protected $article_reviewer_file_obj = '';
protected $production_article_author_obj = '';
protected $production_article_organ_obj = '';
protected $production_article_refer_obj = '';
protected $production_article_author_to_organ_obj = '';
protected $production_article_frag_obj = '';
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->article_obj = Db::name('article');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->journal_obj = Db::name('journal');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->user_msg_obj = Db::name('user_msg');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
$this->article_author_obj = Db::name('article_author');
$this->user_black_obj = Db::name('user_black');
$this->user_to_special_obj = Db::name('user_to_special');
$this->user_register_check_obj = Db::name('user_register_check');
$this->user_cert_obj = Db::name('user_cert');
$this->apply_board_obj = Db::name('apply_board');
$this->apply_yboard_obj = Db::name('apply_yboard');
$this->user_score_log_obj = Db::name('user_score_log');
$this->user_index_log_obj = Db::name('user_index_log');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_ash_obj = Db::name('user_ash');
$this->major_obj = Db::name('major');
$this->user_to_yboard_obj = Db::name('user_to_yboard');
$this->country_obj = Db::name('country');
$this->user_log_obj = Db::name('user_log');
$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_transfer_obj = Db::name('article_transfer');
$this->login_auto_obj = Db::name('login_auto');
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->article_dialog_obj = Db::name('article_dialog');
$this->article_proposal_obj = Db::name('article_proposal');
$this->article_response_to_reviewer_obj = Db::name('article_response_to_reviewer');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->email_log_obj = Db::name('email_log');
$this->email_template_obj = Db::name('email_template');
$this->production_article_obj = Db::name('production_article');
$this->company_top_obj = Db::name('company_top');
$this->user_cv_obj = Db::name('user_cv');
$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->article_reviewer_file_obj = Db::name('article_reviewer_file');
$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');
$this->production_article_frag_obj = Db::name('production_article_frag');
}
public function pdfAddProof($article_id)
{
$p_info = $this->production_article_obj->where('article_id', $article_id)->where('state', 0)->find();
vendor('fpdf.fpdf');
vendor('fpdi/fpdi');
$pdf = new \FPDI();
$pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS . $p_info['file_pdf']);
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
$templateId = $pdf->importPage($pageNo);
$size = $pdf->getTemplateSize($templateId);
if ($size['w'] > $size['h']) $pdf->AddPage('L', array($size['w'], $size['h']));
else $pdf->AddPage('P', array($size['w'], $size['h']));
$pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80);
$pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80);
$pdf->useTemplate($templateId);
}
$pdf->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . '.pdf');
if ($p_info['file_sub'] != '' && substr($p_info['file_sub'], strripos($p_info['file_sub'], '.') + 1) == 'pdf') {
$pdf1 = new \FPDI();
$pageCount1 = $pdf1->setSourceFile(ROOT_PATH . 'public' . DS . "articleSUB" . DS . $p_info['file_sub']);
for ($pageNo = 1; $pageNo <= $pageCount1; $pageNo++) {
$templateId1 = $pdf1->importPage($pageNo);
$size = $pdf1->getTemplateSize($templateId1);
if ($size['w'] > $size['h']) $pdf1->AddPage('L', array($size['w'], $size['h']));
else $pdf1->AddPage('P', array($size['w'], $size['h']));
$pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80);
$pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80);
$pdf1->useTemplate($templateId1);
}
$pdf1->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . 'SUB.pdf');
}
}
public function createYboardCert($user_info,$journal_info,$start_time,$year){
if(!is_dir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'])){
mkdir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id']);
}
$sj_num = rand(1000,9999);
$template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'yboard_template.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$ziti1 = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'Georgia0.ttf';
$image = \think\Image::open($template);
$ys = date("F Y",$start_time)." to ".date("F Y",strtotime("+ ".$year." year",$start_time));
$image->text($user_info['realname'], $ziti, 45, '#000000', [1060, 750])
->text($ys, $ziti1, 32, '#C49A6C', [1370, 1015])
->text(date("Y.m.d",$start_time), $ziti, 25, '#000000', [500, 1280])
->text($journal_info['title'], $ziti1, 36, '#C49A6C', [860, 930])
->save(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'].DS. $user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png');
return $journal_info['journal_id'].DS.$user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png';
}
public function majorids($major_id){
$frag[]=$major_id;
$list = $this->major_obj->where('pid',$major_id)->select();
foreach($list as $v){
$cache = self::majorids($v['major_id']);
$frag = array_merge($frag,$cache);
}
return $frag;
}
public function getMajorShu($major){
if($major==0){
return '';
}
$res = $this->major_obj->where('major_id',$major)->find();
if($res['pid']==1){
return $res['major_id'];
}
$p = self::getMajorShu($res['pid']);
return $p.','.$res['major_id'];
}
public function getMajorStr($major_id)
{
$frag = '';
$major_info = $this->major_obj->where('major_id', $major_id)->find();
if ($major_info == null) {
return '';
}
if ($major_info['major_level'] == 1) {
return 'Medicine';
} else {
$frag = $this->getMajorStr($major_info['pid']) . ' > ' . $major_info['major_title'];
}
return $frag;
}
public function save_article_file($article_id, $user_id, $username, $url, $type_name)
{
//首先确定数据库里面是否存在此数据
$res = $this->article_file_obj->where(['file_url' => $url])->find();
if ($res) { //编辑的时候不能重复存储
return true;
} else if ($type_name == 'picturesAndTables' && trim($url) == '') {
return true;
} else if ($type_name == 'coverLetter' && trim($url) == '') {
return true;
} else if ($type_name == 'totalpage' && trim($url) == '') {
return true;
}
$insert_data['article_id'] = $article_id;
$insert_data['user_id'] = $user_id;
$insert_data['username'] = $username;
$insert_data['file_url'] = $url;
$insert_data['type_name'] = $type_name;
$insert_data['ctime'] = time();
return $this->article_file_obj->insertGetId($insert_data);
}
public function getArticleAuthors($article_id)
{
$res = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
$frag = '';
foreach ($res as $v) {
$frag .= $v['firstname'] . $v['lastname'] . ',';
}
return substr($frag, 0, -1);
}
}
?>

View File

@@ -6,6 +6,7 @@ use think\Controller;
use think\Db;
use think\Env;
use think\Queue;
use think\Validate;
/**
* @title 主编相关接口
@@ -240,10 +241,11 @@ class Chief extends Controller {
//加上文章领域
foreach($list as $k => $v){
$major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
$cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
$list[$k]['major'] = $major['title'];
$list[$k]['cmajor'] = $cmajor['title'];
$list[$k]['major_str'] = getMajorStr($v['major_id']);
// $major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
// $cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
// $list[$k]['major'] = $major['title'];
// $list[$k]['cmajor'] = $cmajor['title'];
}
$re['articles'] = $list;
@@ -288,15 +290,17 @@ class Chief extends Controller {
}
//加上文章领域
foreach($list as $k => $v){
$major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
$cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
$list[$k]['major'] = $major['title'];
$list[$k]['cmajor'] = $cmajor['title'];
// $major = $this->reviewer_major_obj->where('major_id',$v['major_id'])->find();
// $cmajor = $this->reviewer_major_obj->where('major_id',$v['cmajor_id'])->find();
$list[$k]['major_str'] = getMajorStr($v['major_id']);
// $list[$k]['major'] = $major['title'];
// $list[$k]['cmajor'] = $cmajor['title'];
}
$re['count'] = $count;
$re['articles'] = $list;
return jsonSuccess($re);
}
/**
* @title 获取主编期刊列表

View File

@@ -2,51 +2,19 @@
namespace app\api\controller;
use think\Controller;
use think\Db;
use app\api\controller\Base;
use think\Validate;
use app\api\controller\User as usercontroller;
use think\Queue;
/**
* @title 期刊相关
* @description 期刊相关
*/
class Journal extends Controller {
class Journal extends Base {
protected $user_obj = '';
protected $captcha_obj = '';
protected $journal_obj = '';
protected $user_act_obj = '';
protected $reviewer_major_obj = '';
protected $article_obj = '';
protected $article_msg_obj = '';
protected $article_author_obj = '';
protected $admin_obj = '';
protected $country_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_reviewer_obj = '';
protected $user_msg_obj = '';
protected $user_to_special_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->journal_obj = Db::name('journal');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_obj = Db::name('article');
$this->user_msg_obj = Db::name('user_msg');
$this->article_msg_obj = Db::name('article_msg');
$this->article_author_obj = Db::name('article_author');
$this->country_obj = Db::name('country');
$this->user_to_special_obj = Db::name('user_to_special');
}
/**

View File

@@ -5,7 +5,7 @@ namespace app\api\controller;
use Mpdf\Config\ConfigVariables;
use Mpdf\Config\FontVariables;
use Mpdf\Mpdf;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\Queue;
use think\Validate;
@@ -14,78 +14,12 @@ use think\Validate;
* @title 公共管理相关
* @description 公共管理相关
*/
class Production extends Controller
class Production extends Base
{
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 = '';
protected $production_article_frag_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');
$this->production_article_frag_obj = Db::name('production_article_frag');
}
/**
@@ -1429,68 +1363,7 @@ class Production extends Controller
self::pdfAddProof($article_id);
}
private function pdfAddProof($article_id)
{
$p_info = $this->production_article_obj->where('article_id', $article_id)->where('state', 0)->find();
vendor('fpdf.fpdf');
vendor('fpdi/fpdi');
$pdf = new \FPDI();
$pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS . $p_info['file_pdf']);
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
$templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) $pdf->AddPage('L', array($size['w'], $size['h']));
else $pdf->AddPage('P', array($size['w'], $size['h']));
// use the imported page
// $pdf->useTemplate($templateId);
$pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80);
$pdf->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80);
$pdf->useTemplate($templateId);
// $pdf->SetFont('Arial', 'B', '12');
// // sign with current date
// $pdf->SetXY(0, 0); // you should keep testing untill you find out correct x,y values
// $pdf->Write(7, date('Y-m-d'));
}
$pdf->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . '.pdf');
if ($p_info['file_sub'] != '' && substr($p_info['file_sub'], strripos($p_info['file_sub'], '.') + 1) == 'pdf') {
$pdf1 = new \FPDI();
$pageCount1 = $pdf1->setSourceFile(ROOT_PATH . 'public' . DS . "articleSUB" . DS . $p_info['file_sub']);
for ($pageNo = 1; $pageNo <= $pageCount1; $pageNo++) {
// import a page
$templateId1 = $pdf1->importPage($pageNo);
// get the size of the imported page
$size = $pdf1->getTemplateSize($templateId1);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) $pdf1->AddPage('L', array($size['w'], $size['h']));
else $pdf1->AddPage('P', array($size['w'], $size['h']));
// use the imported page
// $pdf->useTemplate($templateId);
$pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 25, 80);
$pdf1->image(ROOT_PATH . 'public' . DS . 'pdf' . DS . 'bg2.png', 55, 155, 80);
$pdf1->useTemplate($templateId1);
// $pdf->SetFont('Arial', 'B', '12');
// // sign with current date
// $pdf->SetXY(0, 0); // you should keep testing untill you find out correct x,y values
// $pdf->Write(7, date('Y-m-d'));
}
$pdf1->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . 'SUB.pdf');
}
}
/**
* @title 文章文件上传

View File

@@ -2,75 +2,19 @@
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Queue;
use app\api\controller\Base;
use think\Validate;
/**
* @title 公共管理相关
* @description 公共管理相关
*/
class Publish extends Controller
class Publish extends Base
{
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

@@ -2,60 +2,21 @@
namespace app\api\controller;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\Validate;
use TCPDF;
use think\Queue;
/**
* @title 审稿人接口
* @description 审稿人接口
*/
class Reviewer extends Controller
class Reviewer extends Base
{
protected $user_obj = '';
protected $user_reviewer_obj = '';
protected $journal_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_log_obj = '';
protected $article_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_reviewer_file_obj = '';
protected $article_reviewer_question_obj = '';
protected $chief_to_journal_obj = '';
protected $board_to_journal_obj = '';
protected $login_auto_obj = '';
protected $country_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $article_msg_obj = '';
//put your code here
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->journal_obj = Db::name('journal');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->user_log_obj = Db::name('user_log');
$this->article_obj = Db::name('article');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_reviewer_file_obj = Db::name('article_reviewer_file');
$this->article_reviewer_question_obj = Db::name('article_reviewer_question');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->login_auto_obj = Db::name('login_auto');
$this->country_obj = Db::name('country');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->article_msg_obj = Db::name('article_msg');
}
/**
@@ -250,6 +211,8 @@ class Reviewer extends Controller
->where('t_user.account|t_user.email', 'like', '%' . $data['account'] . '%')
->where('t_user.state', 0)
->find();
$check['majorshu'] = getMajorShu($check['major']);
$check['cvs'] = getReviewerCvs($check['user_id']);
$check['title'] = $check['technical'];
$re['reviewer'] = $check;
return jsonSuccess($re);
@@ -1402,7 +1365,6 @@ class Reviewer extends Controller
$info_insert['introduction'] = isset($data['introduction']) ? trim($data['introduction']) : '';
$info_insert['company'] = isset($data['company']) ? trim($data['company']) : '';
$info_insert['major'] = $data['major'];
$info_insert['cmajor'] = $data['cmajor'];
$info_insert['qualifications'] = isset($data['cv'])?trim($data['cv']):'';
$info_insert['field'] = trim($data['field']);
$res1 = $this->user_reviewer_info_obj->insertGetId($info_insert);
@@ -1469,7 +1431,7 @@ class Reviewer extends Controller
$info_insert['introduction'] = isset($data['introduction']) ? trim($data['introduction']) : '';
$info_insert['company'] = isset($data['company']) ? trim($data['company']) : '';
$info_insert['major'] = $data['major'];
$info_insert['cmajor'] = $data['cmajor'];
// $info_insert['cmajor'] = $data['cmajor'];
$info_insert['field'] = trim($data['field']);
$info_insert['qualifications'] = trim($data['cv']);
if ($reviewer_info == null) {
@@ -1602,10 +1564,11 @@ class Reviewer extends Controller
}
foreach($res as $k => $v){
$major_res = $this->reviewer_major_obj->where('major_id', $v['major'])->column('title');
$res[$k]['major_title'] = $major_res ? $major_res[0] : '';
$cmajor_res = $this->reviewer_major_obj->where('major_id', $v['cmajor'])->column('title');
$res[$k]['cmajor_title'] = $cmajor_res ? $cmajor_res[0] : '';
$res[$k]['major_title'] = getMajorStr($v['major']);
// $major_res = $this->reviewer_major_obj->where('major_id', $v['major'])->column('title');
// $res[$k]['major_title'] = $major_res ? $major_res[0] : '';
// $cmajor_res = $this->reviewer_major_obj->where('major_id', $v['cmajor'])->column('title');
// $res[$k]['cmajor_title'] = $cmajor_res ? $cmajor_res[0] : '';
}
return json(['code' => 0, 'data' => $res, 'total' => $count]);
}
@@ -1693,116 +1656,45 @@ class Reviewer extends Controller
public function searchReviewer()
{
$data = $this->request->post();
$rule = new Validate([
'article_id'=>'require',
'pageIndex'=>'require',
'pageSize'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$article_info = $this->article_obj->where("article_id", $data['article_id'])->find();
$noids = $this->article_reviewer_obj->where('article_id', $data['article_id'])->column('reviewer_id');
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$list = [];
$gradewhere = '';
if(isset($data['grade'])){
$gradewhere = 't_reviewer_to_journal.grade = "'.$data['grade'].'"';
$where['t_reviewer_to_journal.journal_id'] = $article_info['journal_id'];
$where['t_reviewer_to_journal.reviewer_id'] = ['not in',$noids];
$where['t_reviewer_to_journal.state'] = 0;
if(isset($data['keywords'])&&$data['keywords']!=''){
$where['t_user_reviewer_info.introduction|t_user_reviewer_info.field|t_user.account|t_user.email|t_user.realname'] = ['like',"%" . $data["keywords"] . "%"];
}
$count = 0;
if ($data["keywords"] == "") {
if ($data["major_id"] == 0) {
$list = $this->reviewer_to_journal_obj
->field("t_user.user_id,t_user.realname,t_reviewer_major.title cmajor,t_reviewer_to_journal.grade,t_user.account,t_user_reviewer_info.company,t_user_reviewer_info.field,t_user.rs_num,t_user.rd_num")
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_reviewer_major", "t_reviewer_major.major_id = t_user_reviewer_info.cmajor", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where('t_reviewer_to_journal.state', 0)
->order("t_user.rs_num desc")
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where('t_reviewer_to_journal.state', 0)
->count();
} else {
$list = $this->reviewer_to_journal_obj
->field("t_user.user_id,t_user.realname,t_reviewer_major.title cmajor,t_reviewer_to_journal.grade,t_user.account,t_user_reviewer_info.company,t_user_reviewer_info.field,t_user.rs_num,t_user.rd_num")
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_reviewer_major", "t_reviewer_major.major_id = t_user_reviewer_info.cmajor", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.major", $data['major_id'])
->where('t_reviewer_to_journal.state', 0)
->order("t_user.rs_num desc")
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.major", $data['major_id'])
->where('t_reviewer_to_journal.state', 0)
->count();
}
} else {
if ($data["major_id"] == 0) {
$list = $this->reviewer_to_journal_obj
->field("t_user.user_id,t_user.realname,t_reviewer_major.title cmajor,t_reviewer_to_journal.grade,t_user.account,t_user_reviewer_info.company,t_user_reviewer_info.field,t_user.rs_num,t_user.rd_num")
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_reviewer_major", "t_reviewer_major.major_id = t_user_reviewer_info.cmajor", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.introduction|t_user_reviewer_info.field|t_user.account|t_user.email|t_user.realname", "like", "%" . $data["keywords"] . "%")
->where('t_reviewer_to_journal.state', 0)
->order("t_user.rs_num desc")
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.introduction|t_user_reviewer_info.field|t_user.account|t_user.email|t_user.realname", "like", "%" . $data["keywords"] . "%")
->where('t_reviewer_to_journal.state', 0)
->count();
} else {
$list = $this->reviewer_to_journal_obj
->field("t_user.user_id,t_user.realname,t_reviewer_major.title cmajor,t_reviewer_to_journal.grade,t_user.account,t_user_reviewer_info.company,t_user_reviewer_info.field,t_user.rs_num,t_user.rd_num")
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_reviewer_major", "t_reviewer_major.major_id = t_user_reviewer_info.cmajor", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where("t_user_reviewer_info.major", $data['major_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.introduction|t_user_reviewer_info.field|t_user.account|t_user.email|t_user.realname", "like", "%" . $data["keywords"] . "%")
->where('t_reviewer_to_journal.state', 0)
->order("t_user.rs_num desc")
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->where('t_reviewer_to_journal.journal_id', $article_info['journal_id'])
->where("t_user_reviewer_info.major", $data['major_id'])
->where('t_reviewer_to_journal.reviewer_id', 'not in', $noids)
->where($gradewhere)
->where("t_user_reviewer_info.introduction|t_user_reviewer_info.field|t_user.account|t_user.email|t_user.realname", "like", "%" . $data["keywords"] . "%")
->where('t_reviewer_to_journal.state', 0)
->count();
}
if(isset($data['major_id'])&&$data['major_id']!=0){
$where['t_user_reviewer_info.major'] = $data['major_id'];
}
$list = $this->reviewer_to_journal_obj
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->where($where)
->order('t_user.rs_num desc')
->limit($limit_start, $data['pageSize'])
->select();
$count = $this->reviewer_to_journal_obj
->join("t_user", "t_user.user_id = t_reviewer_to_journal.reviewer_id", "left")
->join("t_user_reviewer_info", "t_user_reviewer_info.reviewer_id = t_reviewer_to_journal.reviewer_id", "left")
->where($where)
->count();
foreach($list as $k => $v){
$list[$k]['majorstr'] = getMajorStr($v['major']);
$list[$k]['now'] = $this->article_reviewer_obj->where('reviewer_id',$v['user_id'])->where('state',0)->count();
}
$re['reviewers'] = $list;
$re['count'] = $count;
return jsonSuccess($re);

View File

@@ -749,7 +749,6 @@ class Special extends Controller
'realname' => 'require',
'article_id' => 'require',
'major' => 'require',
'cmajor' => 'require',
'country' => 'require'
]);
if (!$rule->check($data)) {
@@ -784,7 +783,7 @@ class Special extends Controller
if ($uri == null) { //添加审稿人信息
$insert_reviewer_info['reviewer_id'] = $reviewer_info['user_id'];
$insert_reviewer_info['major'] = $data['major'];
$insert_reviewer_info['cmajor'] = $data['cmajor'];
// $insert_reviewer_info['cmajor'] = $data['cmajor'];
$insert_reviewer_info['country'] = $data['country'];
$res2 = $this->user_reviewer_info_obj->insert($insert_reviewer_info);
}

View File

@@ -2,7 +2,7 @@
namespace app\api\controller;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\Queue;
use think\Validate;
@@ -11,66 +11,12 @@ use think\Validate;
* @title 公共管理相关
* @description 公共管理相关
*/
class Typeset extends Controller
class Typeset extends Base
{
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');
}
public function getTypeSet()
@@ -535,41 +481,41 @@ class Typeset extends Controller
return jsonSuccess([]);
}
/**
* pdf文件加水印
*/
public function pdfAddProof()
{
vendor('fpdf.fpdf');
vendor('fpdi/fpdi');
$pdf = new \FPDI();
$pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS.'pdf'.DS.'test.pdf');
// /**
// * pdf文件加水印
// */
// public function pdfAddProof()
// {
// vendor('fpdf.fpdf');
// vendor('fpdi/fpdi');
// $pdf = new \FPDI();
// $pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS.'pdf'.DS.'test.pdf');
// iterate through all pages
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// import a page
$templateId = $pdf->importPage($pageNo);
// // iterate through all pages
// for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
// // import a page
// $templateId = $pdf->importPage($pageNo);
// get the size of the imported page
$size = $pdf->getTemplateSize($templateId);
// // get the size of the imported page
// $size = $pdf->getTemplateSize($templateId);
// create a page (landscape or portrait depending on the imported page size)
if ($size['w'] > $size['h']) $pdf->AddPage('L', array($size['w'], $size['h']));
else $pdf->AddPage('P', array($size['w'], $size['h']));
// // create a page (landscape or portrait depending on the imported page size)
// if ($size['w'] > $size['h']) $pdf->AddPage('L', array($size['w'], $size['h']));
// else $pdf->AddPage('P', array($size['w'], $size['h']));
// use the imported page
// $pdf->useTemplate($templateId);
// // use the imported page
// // $pdf->useTemplate($templateId);
$pdf->image(ROOT_PATH . 'public' . DS.'pdf'.DS.'bg2.png',55, 25, 80);
$pdf->image(ROOT_PATH . 'public' . DS.'pdf'.DS.'bg2.png',55, 155, 80);
$pdf->useTemplate($templateId);
// $pdf->SetFont('Arial', 'B', '12');
// // sign with current date
// $pdf->SetXY(0, 0); // you should keep testing untill you find out correct x,y values
// $pdf->Write(7, date('Y-m-d'));
}
$pdf->Output(ROOT_PATH . 'public' . DS.'pdf'.DS.'word.pdf');
}
// $pdf->image(ROOT_PATH . 'public' . DS.'pdf'.DS.'bg2.png',55, 25, 80);
// $pdf->image(ROOT_PATH . 'public' . DS.'pdf'.DS.'bg2.png',55, 155, 80);
// $pdf->useTemplate($templateId);
// // $pdf->SetFont('Arial', 'B', '12');
// // // sign with current date
// // $pdf->SetXY(0, 0); // you should keep testing untill you find out correct x,y values
// // $pdf->Write(7, date('Y-m-d'));
// }
// $pdf->Output(ROOT_PATH . 'public' . DS.'pdf'.DS.'word.pdf');
// }
/**
* 获取online的分期

View File

@@ -2,49 +2,16 @@
namespace app\api\controller;
use think\Controller;
use think\Db;
use app\api\controller\Base;
use think\Validate;
class Ucenter extends Controller{
class Ucenter extends Base{
protected $user_obj = '';
protected $user_reviewer_info_obj = '';
protected $journal_obj = '';
protected $reviewer_to_journal_obj = '';
protected $article_reviewer_obj = '';
protected $article_obj = '';
protected $chief_to_journal_obj = '';
protected $board_to_journal_obj = '';
protected $major_obj = "";
protected $major_to_journal_obj = '';
protected $user_cv_obj = '';
protected $apply_board_obj = '';
protected $apply_yboard_obj = '';
protected $user_score_log_obj = '';
protected $user_index_log_obj = '';
protected $user_to_yboard_obj = '';
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_reviewer_info_obj = Db::name("user_reviewer_info");
$this->journal_obj = Db::name('journal');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_obj = Db::name('article');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->major_obj = Db::name("major");
$this->major_to_journal_obj = Db::name('major_to_journal');
$this->user_cv_obj = Db::name('user_cv');
$this->apply_board_obj = Db::name('apply_board');
$this->apply_yboard_obj = Db::name('apply_yboard');
$this->user_score_log_obj = Db::name('user_score_log');
$this->user_index_log_obj = Db::name('user_index_log');
$this->user_to_yboard_obj = Db::name('user_to_yboard');
}
@@ -81,6 +48,8 @@ class Ucenter extends Controller{
->where('t_user.user_id',$data['user_id'])
->find();
$userInfo['baseInfo']['majorshu'] = $userInfo['baseInfo']['major']==0?'':getMajorShu($userInfo['baseInfo']['major']);
$userInfo['baseInfo']['majorStr'] = $userInfo['baseInfo']['major']==0?'':getMajorStr($userInfo['baseInfo']['major']);
//cv信息
$cvs = $this->user_cv_obj->where('user_id',$data['user_id'])->where('state',0)->select();
$userInfo['cvs'] = $cvs;
@@ -253,13 +222,14 @@ class Ucenter extends Controller{
if(isset($data['phone'])&&$data['phone']!=''){
$update['phone'] = $data['phone'];
}
$update['localname'] = isset($data['localname'])?trim($data['localname']):'';
$this->user_obj->where(['user_id'=>$data['user_id']])->update($update);
$updata1=[
'technical'=>$data['technical'],
'country'=>$data['country'],
'major'=>$data['major'],
'field'=>$data['field'],
'introduction'=>$data['introduction'],
'introduction'=>isset($data['introduction'])?$data['introduction']:'',
'company'=>$data['company']
];
$this->user_reviewer_info_obj->where(['reviewer_id'=>$data['user_id']])->update($updata1);
@@ -414,7 +384,7 @@ class Ucenter extends Controller{
// 获取审稿人基本信息
$res = $this->user_reviewer_info_obj->where(['reviewer_id'=>$userId])->find();
$res['majors'] = self::getMajorShu($res['major']);
$res['majors'] = getMajorShu($res['major']);
// 获取审稿人期刊
@@ -430,19 +400,6 @@ class Ucenter extends Controller{
return $res;
}
private function getMajorShu($major){
if($major==0){
return ;
}
$res = $this->major_obj->where('major_id',$major)->find();
if($res['pid']==1){
return $res['major_id'];
}
$p = self::getMajorShu($res['pid']);
return $p.','.$res['major_id'];
}
/**
* Notes: 编辑的期刊资料
* User: wangzhaocui

View File

@@ -2,7 +2,7 @@
namespace app\api\controller;
use think\Controller;
use app\api\controller\Base;
use think\Db;
use think\captcha;
use think\Cache;
@@ -15,67 +15,12 @@ use think\Validate;
* @title 用户相关接口
* @description 用户相关接口
*/
class User extends Controller
class User extends Base
{
protected $user_obj = '';
protected $captcha_obj = '';
protected $article_obj = '';
protected $user_act_obj = '';
protected $admin_obj = '';
protected $user_reviewer_obj = '';
protected $journal_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $user_reviewer_info_obj = '';
protected $user_msg_obj = '';
protected $chief_to_journal_obj = '';
protected $board_to_journal_obj = '';
protected $reviewer_from_author_obj = '';
protected $article_author_obj = '';
protected $user_black_obj = '';
protected $user_to_special_obj = '';
protected $user_register_check_obj = '';
protected $user_cert_obj = '';
protected $apply_board_obj = '';
protected $apply_yboard_obj = '';
protected $user_score_log_obj = '';
protected $user_index_log_obj = '';
protected $article_reviewer_obj = '';
protected $user_ash_obj = '';
protected $major_obj = '';
protected $user_to_yboard_obj = '';
public function __construct(\think\Request $request = null)
{
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->captcha_obj = Db::name('captcha');
$this->article_obj = Db::name('article');
$this->user_act_obj = Db::name('user_act');
$this->admin_obj = Db::name('admin');
$this->user_reviewer_obj = Db::name('user_reviewer_apply');
$this->journal_obj = Db::name('journal');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->user_reviewer_info_obj = Db::name('user_reviewer_info');
$this->user_msg_obj = Db::name('user_msg');
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->board_to_journal_obj = Db::name('board_to_journal');
$this->reviewer_from_author_obj = Db::name('reviewer_from_author');
$this->article_author_obj = Db::name('article_author');
$this->user_black_obj = Db::name('user_black');
$this->user_to_special_obj = Db::name('user_to_special');
$this->user_register_check_obj = Db::name('user_register_check');
$this->user_cert_obj = Db::name('user_cert');
$this->apply_board_obj = Db::name('apply_board');
$this->apply_yboard_obj = Db::name('apply_yboard');
$this->user_score_log_obj = Db::name('user_score_log');
$this->user_index_log_obj = Db::name('user_index_log');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_ash_obj = Db::name('user_ash');
$this->major_obj = Db::name('major');
$this->user_to_yboard_obj = Db::name('user_to_yboard');
}
public function pstest(){
@@ -601,27 +546,8 @@ class User extends Controller
return jsonSuccess($re);
}
private function majorids($major_id){
$frag[]=$major_id;
$list = $this->major_obj->where('pid',$major_id)->select();
foreach($list as $v){
$cache = self::majorids($v['major_id']);
$frag = array_merge($frag,$cache);
}
return $frag;
}
private function getMajorShu($major){
if($major==0){
return '';
}
$res = $this->major_obj->where('major_id',$major)->find();
if($res['pid']==1){
return $res['major_id'];
}
$p = self::getMajorShu($res['pid']);
return $p.','.$res['major_id'];
}
/**
* 添加灰库用户单个
@@ -662,20 +588,7 @@ class User extends Controller
}
private function getMajorStr($major_id)
{
$frag = '';
$major_info = $this->major_obj->where('major_id', $major_id)->find();
if ($major_info == null) {
return '';
}
if ($major_info['major_level'] == 1) {
return 'Medicine';
} else {
$frag = $this->getMajorStr($major_info['pid']) . ' > ' . $major_info['major_title'];
}
return $frag;
}
/**
* 灰库导入excel用户
@@ -987,7 +900,7 @@ class User extends Controller
$app_info = $this->apply_yboard_obj->where('ap_yboard_id',$data['ap_yboard_id'])->find();
$user_info = $this->user_obj->where('user_id',$app_info['user_id'])->find();
$journal_info = $this->journal_obj->where('journal_id',$app_info['journal_id'])->find();
$check = $this->user_to_yboard_obj->where('user_id',$app_info['user_id'])->where('journal_id',$app_info['journal_id'])->where('start_date',"<=",$start_time)->where('end_date',"<=",$start_time)->find();
$check = $this->user_to_yboard_obj->where('user_id',$app_info['user_id'])->where('journal_id',$app_info['journal_id'])->where('start_date',"<=",$start_time)->where('end_date',">=",$start_time)->find();
if($check){
return jsonError("Already exists");
}
@@ -1003,6 +916,37 @@ class User extends Controller
return jsonSuccess([]);
}
/**
* 添加作者用户
*/
public function addUserForAuthor(){
$num = $this->request->post('num');
$num =1;
$cs['num'] = $num;
$url = 'http://journalapi.tmrjournals.com/public/index.php/master/Article/getArticleReportAuthors';
$list = object_to_array(json_decode(myPost($url, $cs)));
dump($list);
// foreach($list as $v){
// foreach($v['author'] as $val){
// $check_user = $this->user_obj->where('email',$val['email'])->where('state',0)->find();
// if(!$check_user){
// $ui['account'] = $val['email'];
// $ui['password'] = md5("123456qwe");
// $ui['email'] = $val['email'];
// $ui['realname'] = $val['author_name'];
// $ui['ctime'] = time();
// $uid = $this->user_obj->insertGetId($ui);
// $uir['reviewer_id'] = $uid;
// $uir['country'] = $val['author_country'];
// $this->user_reviewer_info_obj->insert($uir);
// $check_user = $this->user_obj->where('user_id',$uid)->find();
// }
// }
// }
}
/**
* 拒绝青年科学家申请
*/
@@ -1481,9 +1425,13 @@ class User extends Controller
if ($reviewer_res != null) {
$roles[] = 'reviewer';
}
$yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('is_yboard', 1)->where('state', 0)->find();
if ($yboard_res != null) {
$roles[] = 'yboard';
// $yboard_res = $this->reviewer_to_journal_obj->where('reviewer_id', $user_info['user_id'])->where('is_yboard', 1)->where('state', 0)->find();
// if ($yboard_res != null) {
// $roles[] = 'yboard';
// }
$yboard_res = $this->user_to_yboard_obj->where('user_id',$user_info['user_id'])->where('state',0)->find();
if($yboard_res != null){
$roles[] = "yboard";
}
$chief_res = $this->chief_to_journal_obj->where('user_id', $user_info['user_id'])->where('state', 0)->find();
if ($chief_res != null) {
@@ -2119,7 +2067,7 @@ class User extends Controller
$insert_info['company'] = $apply_info['company'];
$insert_info['major'] = $apply_info['major'];
$insert_info['field'] = $apply_info['field'];
$insert_info['qualifications'] = $apply_info['qualifications'];
// $insert_info['qualifications'] = $apply_info['qualifications'];
$addinfo_res = $this->user_reviewer_info_obj->insertGetId($insert_info);
$has_res = $this->user_obj->where('account', $apply_info['name'])->find();
} else {
@@ -2134,8 +2082,18 @@ class User extends Controller
$insert_info['company'] = $apply_info['company'];
$insert_info['major'] = $apply_info['major'];
$insert_info['field'] = $apply_info['field'];
$insert_info['qualifications'] = $apply_info['qualifications'];
// $insert_info['qualifications'] = $apply_info['qualifications'];
$this->user_reviewer_info_obj->insert($insert_info);
}else{
$update_info['gender'] = $apply_info['gender'];
$update_info['technical'] = $apply_info['technical'];
$update_info['country'] = $apply_info['country'];
$update_info['introduction'] = $apply_info['introduction'];
$update_info['company'] = $apply_info['company'];
$update_info['major'] = $apply_info['major'];
$update_info['field'] = $apply_info['field'];
// $update_info['qualifications'] = $apply_info['qualifications'];
$this->user_reviewer_info_obj->where('reviewer_id',$has_res['user_id'])->update($update_info);
}
$add_res = true;
$addinfo_res = true;
@@ -2436,37 +2394,21 @@ class User extends Controller
return jsonSuccess($insert);
}
private function createYboardCert($user_info,$journal_info,$start_time,$year){
if(!is_dir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'])){
mkdir(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id']);
}
$sj_num = rand(1000,9999);
$template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'yboard_template.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$ziti1 = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'Georgia0.ttf';
$image = \think\Image::open($template);
$ys = date("F Y",$start_time)." to ".date("F Y",strtotime("+ ".$year." year",$start_time));
$image->text($user_info['realname'], $ziti, 45, '#000000', [1060, 750])
->text($ys, $ziti1, 32, '#C49A6C', [1370, 1015])
->text(date("Y.m.d",$start_time), $ziti, 25, '#000000', [500, 1280])
->text($journal_info['title'], $ziti1, 36, '#C49A6C', [860, 930])
->save(ROOT_PATH . 'public' . DS . 'cert' . DS .$journal_info['journal_id'].DS. $user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png');
return $journal_info['journal_id'].DS.$user_info['user_id'].'_yboard_'.date('Y',$start_time).$sj_num . '.png';
}
private function createCert($user_info,$journal_info,$year,$type){
//type:1编委2青年科学家
$template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'cert_template.png';
$ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
$image = \think\Image::open($template);
// private function createCert($user_info,$journal_info,$year,$type){
// //type:1编委2青年科学家
// $template = ROOT_PATH . 'public' . DS . 'cert' . DS . 'cert_template.png';
// $ziti = ROOT_PATH . 'public' . DS . 'zhengshu' . DS . 'siyuan.ttf';
// $image = \think\Image::open($template);
$image->text($user_info['realname'], $ziti, 50, '#000000', [1060, 760])
->text($year, $ziti, 50, '#C49A6C', [1850, 505])
->text($year, $ziti, 36, '#C49A6C', [1665, 1052])
->text($journal_info['title'], $ziti, 36, '#C49A6C', [920, 980])
->save(ROOT_PATH . 'public' . DS . 'cert' . DS . $user_info['user_id'].'_'.$type.'_'.$year . '.png');
return $user_info['user_id'].'_'.$type.'_'.$year . '.png';
}
// $image->text($user_info['realname'], $ziti, 50, '#000000', [1060, 760])
// ->text($year, $ziti, 50, '#C49A6C', [1850, 505])
// ->text($year, $ziti, 36, '#C49A6C', [1665, 1052])
// ->text($journal_info['title'], $ziti, 36, '#C49A6C', [920, 980])
// ->save(ROOT_PATH . 'public' . DS . 'cert' . DS . $user_info['user_id'].'_'.$type.'_'.$year . '.png');
// return $user_info['user_id'].'_'.$type.'_'.$year . '.png';
// }
/**
* 注册绑定orcid至我们的账户