1
This commit is contained in:
@@ -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 文章文件上传
|
||||
|
||||
Reference in New Issue
Block a user