1
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use Mpdf\Config\ConfigVariables;
|
||||
use Mpdf\Config\FontVariables;
|
||||
use Mpdf\Mpdf;
|
||||
use think\Controller;
|
||||
use think\Db;
|
||||
@@ -175,8 +177,9 @@ class Production extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function mytest(){
|
||||
$p_info = $this->production_article_obj->where('p_article_id',10)->find();
|
||||
public function mytest()
|
||||
{
|
||||
$p_info = $this->production_article_obj->where('p_article_id', 10)->find();
|
||||
dump(json_decode($p_info['main']));
|
||||
}
|
||||
|
||||
@@ -194,7 +197,7 @@ class Production extends Controller
|
||||
'type' => 'require',
|
||||
'acknowledgment' => 'require',
|
||||
'keywords' => 'require',
|
||||
'author_contribution'=>'require',
|
||||
'author_contribution' => 'require',
|
||||
'abbr' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
@@ -207,19 +210,19 @@ class Production extends Controller
|
||||
$update['title'] = trim($data['title']);
|
||||
$update['journal_stage_id'] = $data['journal_stage_id'];
|
||||
$update['type'] = trim($data['type']);
|
||||
$update['icon'] = isset($data['icon'])?trim($data['icon']):'';
|
||||
$update['tradition_tag'] = isset($data['tradition_tag'])?trim($data['tradition_tag']):'';
|
||||
$update['tradition'] = isset($data['tradition'])?trim($data['tradition']):'';
|
||||
$update['icon'] = isset($data['icon']) ? trim($data['icon']) : '';
|
||||
$update['tradition_tag'] = isset($data['tradition_tag']) ? trim($data['tradition_tag']) : '';
|
||||
$update['tradition'] = isset($data['tradition']) ? trim($data['tradition']) : '';
|
||||
$update['author_contribution'] = trim($data['author_contribution']);
|
||||
$update['mhoo'] = isset($data['mhoo']) ? trim($data['mhoo']) : '';
|
||||
$update['ltai'] = isset($data['ltai']) ? trim($data['ltai']) : '';
|
||||
// $update['abstract'] = trim($data['abstract']);
|
||||
$update['keywords'] = trim($data['keywords']);
|
||||
$update['abbreviation'] = isset($data['abbreviation'])?trim($data['abbreviation']):'';
|
||||
$update['abbreviation'] = isset($data['abbreviation']) ? trim($data['abbreviation']) : '';
|
||||
$update['acknowledgment'] = trim($data['acknowledgment']);
|
||||
$update['abbr'] = trim($data['abbr']);
|
||||
// $update['pub_date'] = trim($data['pub_date']);
|
||||
$update['npp'] = isset($data['npp'])?$data['npp']:'';
|
||||
$update['npp'] = isset($data['npp']) ? $data['npp'] : '';
|
||||
|
||||
//生成doi号
|
||||
// $doi = '';
|
||||
@@ -243,7 +246,8 @@ class Production extends Controller
|
||||
/**
|
||||
* 获取文章排版结果列表
|
||||
*/
|
||||
public function getArticleFrags(){
|
||||
public function getArticleFrags()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number'
|
||||
@@ -251,27 +255,27 @@ class Production extends Controller
|
||||
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();
|
||||
$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(){
|
||||
public function editMainContent()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number',
|
||||
'main'=>'require'
|
||||
'main' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$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([]);
|
||||
}
|
||||
|
||||
@@ -292,7 +296,8 @@ class Production extends Controller
|
||||
/**
|
||||
* 获取引用文献列表
|
||||
*/
|
||||
public function getReferList(){
|
||||
public function getReferList()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number'
|
||||
@@ -300,7 +305,7 @@ class Production extends Controller
|
||||
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();
|
||||
$list = $this->production_article_refer_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||
$re['refers'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
@@ -320,7 +325,7 @@ class Production extends Controller
|
||||
}
|
||||
$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);
|
||||
$this->production_article_refer_obj->where('p_refer_id', $data['p_refer_id'])->update($updata);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -346,7 +351,7 @@ class Production extends Controller
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$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')
|
||||
->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'])
|
||||
@@ -360,7 +365,8 @@ class Production extends Controller
|
||||
/**
|
||||
* 编辑文章信息在排版之后
|
||||
*/
|
||||
public function editArticleLast(){
|
||||
public function editArticleLast()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number',
|
||||
@@ -374,45 +380,46 @@ class Production extends Controller
|
||||
$updata['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);
|
||||
$this->production_article_obj->where('p_article_id', $data['p_article_id'])->update($updata);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送文章到官网系统
|
||||
*/
|
||||
public function pushArticleToSystem(){
|
||||
public function pushArticleToSystem()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id'=>'require'
|
||||
'p_article_id' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
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();
|
||||
if($p_info['state']!=0){
|
||||
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||
if ($p_info['state'] != 0) {
|
||||
return jsonError("Non repeatable submission");
|
||||
}
|
||||
if($p_info['proof_state']!=2){
|
||||
if ($p_info['proof_state'] != 2) {
|
||||
return jsonError('Warning: It is a violation to publish your article online without completing PROOF.
|
||||
The ONLINE step will only continue if you have completed the PROOF step.');
|
||||
}
|
||||
$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){
|
||||
$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();
|
||||
->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();
|
||||
$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']==''){
|
||||
if (count($authors) == 0 || $p_info['journal_stage_id'] == '' || $p_info['doi'] == '' || $p_info['abstract'] == '' || $p_info['npp'] == '') {
|
||||
return jsonError('Incomplete information');
|
||||
}
|
||||
//发送推送请求
|
||||
@@ -430,19 +437,19 @@ class Production extends Controller
|
||||
$pra['pub_date'] = $p_info['pub_date'];
|
||||
$pra['abbr'] = $p_info['abbr'];
|
||||
$pra['icon'] = $p_info['icon'];
|
||||
if($p_info['file_sub']!=''){
|
||||
if ($p_info['file_sub'] != '') {
|
||||
$pra['file_sub'] = $p_info['file_sub'];
|
||||
}
|
||||
if($p_info['file_sub2']!=''){
|
||||
if ($p_info['file_sub2'] != '') {
|
||||
$pra['file_sub2'] = $p_info['file_sub2'];
|
||||
}
|
||||
if($p_info['file_cdf']!=''){
|
||||
if ($p_info['file_cdf'] != '') {
|
||||
$pra['file_cdf'] = $p_info['file_cdf'];
|
||||
}
|
||||
if($p_info['endnote']!=''){
|
||||
if ($p_info['endnote'] != '') {
|
||||
$pra['endnote'] = $p_info['endnote'];
|
||||
}
|
||||
if($p_info['bibtex']!=''){
|
||||
if ($p_info['bibtex'] != '') {
|
||||
$pra['bibtex'] = $p_info['bibtex'];
|
||||
}
|
||||
$pra['file_pdf'] = $p_info['file_pdf'];
|
||||
@@ -452,49 +459,163 @@ class Production extends Controller
|
||||
$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]);
|
||||
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']);
|
||||
} else {
|
||||
return jsonError('system error:' . $res['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function eeeccc(){
|
||||
public function eeeccc()
|
||||
{
|
||||
// $str = "Critical Care Medicine 2022;50 (6):955-63";
|
||||
// dump($this->bekjournal($str));
|
||||
$str = "Pandey S, Kumar P, Niranjan A, Verma H, Kumar M. Targeting biosignatures of hyperglycemia and oxidative stress in diabetes comorbid depressive rats: effectiveness of hydroethanolic extract of the whole plant of Ludwigia octovalvis. Tradit Med Res 2023;8 (2):9.";
|
||||
$res = explode('.',$str);
|
||||
$res = explode('.', $str);
|
||||
echo $this->prgeAuthor($res[0]);
|
||||
}
|
||||
|
||||
public function creatpdf(){
|
||||
$path = ROOT_PATH . 'public' . DS . 'testpdf'.DS;
|
||||
$mpdf = new Mpdf(['mode'=>'utf-8','format'=>'A4']);
|
||||
|
||||
public function getPdfByHtml(){
|
||||
$data = $this->request->post();
|
||||
$html = $data['html'];
|
||||
$path = ROOT_PATH . 'public' . DS . 'testpdf' . DS;
|
||||
$intFontSize = 10.5;
|
||||
|
||||
// $defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
$defaultConfig = (new ConfigVariables())->getDefaults();
|
||||
$fontDirs = $defaultConfig['fontDir'];
|
||||
|
||||
// $defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults();
|
||||
$defaultFontConfig = (new FontVariables())->getDefaults();
|
||||
$fontData = $defaultFontConfig['fontdata'];
|
||||
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4',
|
||||
'default_font_size' => $intFontSize,
|
||||
'useSubstitutions' => true, //中文支持关键
|
||||
'useAdobeCJK' => true,
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
'fontDir' => array_merge($fontDirs, [
|
||||
__DIR__ . '/custom/font/directory',
|
||||
]),
|
||||
'fontdata' => $fontData + [
|
||||
'宋体' => [
|
||||
'R' => 'Sun-ExtA.ttf',
|
||||
'I' => 'Sun-ExtB.ttf',
|
||||
]
|
||||
],
|
||||
'default_font' => '宋体' //CSS中写的汉字宋体就这么写要是别的自定义的就写自己的 自定义字体关键
|
||||
]);
|
||||
$strContent = $html;
|
||||
$mpdf->WriteHTML($strContent);
|
||||
$strFileName_New = time() . rand(100, 999) . '.pdf';
|
||||
$mpdf->Output($path .$strFileName_New, 'f');
|
||||
return jsonSuccess(['url'=>$strFileName_New]);
|
||||
}
|
||||
|
||||
public function creatpdf()
|
||||
{
|
||||
$path = ROOT_PATH . 'public' . DS . 'testpdf' . DS;
|
||||
$mpdf = new Mpdf(['mode' => 'utf-8', 'format' => 'A4']);
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$mpdf->autoScriptToLang = true;
|
||||
$mpdf->autoLangToFont = true;
|
||||
$fileUrl = $path.'1234.pdf';
|
||||
$mpdf->WriteHTML(file_get_contents($path.'meaut1.html'));
|
||||
$mpdf->Output($fileUrl,"D");
|
||||
$fileUrl = $path . '1234.pdf';
|
||||
$mpdf->WriteHTML(file_get_contents($path . 'meaut1.html'));
|
||||
$mpdf->Output($fileUrl, "D");
|
||||
}
|
||||
|
||||
|
||||
public function bekjournal($str){
|
||||
preg_match("/[0-9]{4}/",$str,$math);
|
||||
public function creatpdf1()
|
||||
{
|
||||
$path = ROOT_PATH . 'public' . DS . 'testpdf' . DS;
|
||||
$intFontSize = 10.5;
|
||||
|
||||
// $defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults();
|
||||
$defaultConfig = (new ConfigVariables())->getDefaults();
|
||||
$fontDirs = $defaultConfig['fontDir'];
|
||||
|
||||
// $defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults();
|
||||
$defaultFontConfig = (new FontVariables())->getDefaults();
|
||||
$fontData = $defaultFontConfig['fontdata'];
|
||||
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'mode' => 'utf-8',
|
||||
'format' => 'A4',
|
||||
'default_font_size' => $intFontSize,
|
||||
'useSubstitutions' => true, //中文支持关键
|
||||
'useAdobeCJK' => true,
|
||||
'margin_left' => 0,
|
||||
'margin_right' => 0,
|
||||
'margin_top' => 0,
|
||||
'margin_bottom' => 0,
|
||||
'margin_header' => 0,
|
||||
'margin_footer' => 0,
|
||||
'fontDir' => array_merge($fontDirs, [
|
||||
__DIR__ . '/custom/font/directory',
|
||||
]),
|
||||
'fontdata' => $fontData + [
|
||||
'宋体' => [
|
||||
'R' => 'Sun-ExtA.ttf',
|
||||
'I' => 'Sun-ExtB.ttf',
|
||||
]
|
||||
],
|
||||
'default_font' => '宋体' //CSS中写的汉字宋体就这么写要是别的自定义的就写自己的 自定义字体关键
|
||||
]);
|
||||
//自定义标签样式设置也可以直接修改DefaultCss.php中的默认设置
|
||||
// $mpdf->defaultCSS["BODY"]['FONT-SIZE'] = '10.5pt';
|
||||
// $mpdf->defaultCSS["BODY"]['LINE-HEIGHT'] = '1.6em';
|
||||
// $mpdf->defaultCSS["P"]['MARGIN'] = '0 0';
|
||||
// $mpdf->defaultCSS["P"]['PADDING'] = '0';
|
||||
// $mpdf->defaultCSS["H1"]['FONT-SIZE'] = '16pt';
|
||||
// $mpdf->defaultCSS["H1"]['MARGIN'] = '0 0';
|
||||
// $mpdf->defaultCSS["H2"]['FONT-SIZE'] = '10.5pt';
|
||||
// $mpdf->defaultCSS["H2"]['MARGIN'] = '0em 0';
|
||||
// $mpdf->defaultCSS["H4"]['FONT-SIZE'] = '14pt';
|
||||
// $mpdf->defaultCSS["H4"]['MARGIN'] = '0 0';
|
||||
// $mpdf->defaultCSS["H5"]['FONT-SIZE'] = '10.5pt';
|
||||
// $mpdf->defaultCSS["H5"]['FONT-WEIGHT'] = 'normal';
|
||||
// $mpdf->defaultCSS["H5"]['MARGIN'] = '-3.4em 0 0 0';
|
||||
// $mpdf->defaultCSS['SPAN'] = [
|
||||
// 'PADDINT-LEFT' => '14px',
|
||||
// 'PADDINT-RIGHT' => '14px',
|
||||
// 'PADDINT-TOP' => '0px',
|
||||
// 'PADDINT-BOTTOM' => '0px'
|
||||
// ];
|
||||
$strContent =file_get_contents($path . 'meaut33.html');
|
||||
$mpdf->WriteHTML($strContent);
|
||||
$strFileName_New = $path .time() . rand(100, 999) . '.pdf';
|
||||
$mpdf->Output($strFileName_New, true); //第二个参数true是直接下载 不设置默认仅保存
|
||||
}
|
||||
|
||||
|
||||
public function bekjournal($str)
|
||||
{
|
||||
preg_match("/[0-9]{4}/", $str, $math);
|
||||
$year = $math[0];
|
||||
$frag[0]=trim(substr($str,0,stripos($str,$year))) ;
|
||||
$frag[1]=substr($str,stripos($str,$year));
|
||||
$frag[0] = trim(substr($str, 0, stripos($str, $year)));
|
||||
$frag[1] = substr($str, stripos($str, $year));
|
||||
return $frag;
|
||||
}
|
||||
|
||||
public function prgeAuthor($author){
|
||||
$a = explode(',',$author);
|
||||
if(count($a)<7){
|
||||
return $author.'.';
|
||||
}else{
|
||||
return trim($a[0]).', '.trim($a[1]).', '.trim($a[2]).', et al.';
|
||||
public function prgeAuthor($author)
|
||||
{
|
||||
$a = explode(',', $author);
|
||||
if (count($a) < 7) {
|
||||
return $author . '.';
|
||||
} else {
|
||||
return trim($a[0]) . ', ' . trim($a[1]) . ', ' . trim($a[2]) . ', et al.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -512,7 +633,7 @@ class Production extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
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();
|
||||
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
|
||||
$journal_info = $this->journal_obj->where('journal_id', $p_info['journal_id'])->find();
|
||||
$editor_info = $this->user_obj->where('user_id', $journal_info['editor_id'])->find();
|
||||
@@ -531,15 +652,15 @@ class Production extends Controller
|
||||
$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();
|
||||
$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 .= trim($v['first_name']). ' '.trim($v['last_name']).'. ';
|
||||
$corremail .= $v['email'].'. ';
|
||||
foreach ($corr_authors as $v) {
|
||||
$corrauthor .= trim($v['first_name']) . ' ' . trim($v['last_name']) . '. ';
|
||||
$corremail .= $v['email'] . '. ';
|
||||
}
|
||||
$typesetInfo['authorCorresponding'] = substr(trim($corrauthor),0,-1);
|
||||
$typesetInfo['authorCorrespondingEmail'] = substr(trim($corremail),0,-1);
|
||||
$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'];
|
||||
@@ -550,13 +671,13 @@ class Production extends Controller
|
||||
$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['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['online_date'] = $p_info['pub_date']; //这里可能会有问题
|
||||
$typesetInfo['abbreviation'] = $p_info['abbreviation'];
|
||||
$typesetInfo['abstractText'] = $p_info['abstract'];
|
||||
$typesetInfo['keywords'] = $p_info['keywords'];
|
||||
@@ -574,7 +695,7 @@ class Production extends Controller
|
||||
}
|
||||
$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();
|
||||
$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'];
|
||||
@@ -588,7 +709,7 @@ class Production extends Controller
|
||||
if (!isset($res['data']['file']) || $res['data']['file'] == '') {
|
||||
return jsonError('create error');
|
||||
}
|
||||
$file_res = date('Ymd').DS.$res['data']['file'];
|
||||
$file_res = date('Ymd') . DS . $res['data']['file'];
|
||||
$tf_insert['p_article_id'] = $p_info['p_article_id'];
|
||||
$tf_insert['url'] = $file_res;
|
||||
$tf_insert['ctime'] = time();
|
||||
@@ -617,7 +738,7 @@ class Production extends Controller
|
||||
->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)
|
||||
->where('t_production_article_author_to_organ.state', 0)
|
||||
->select();
|
||||
}
|
||||
$re['production'] = $p_info;
|
||||
@@ -626,7 +747,8 @@ class Production extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function getProductionPreview(){
|
||||
public function getProductionPreview()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require|number'
|
||||
@@ -635,10 +757,10 @@ class Production extends Controller
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$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();
|
||||
$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();
|
||||
// $list = $this->production_article_author_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||
|
||||
|
||||
$re['production'] = $p_info;
|
||||
$re['author'] = $this->authorFormate($data['p_article_id']);
|
||||
$re['journal'] = $journal_info;
|
||||
@@ -657,9 +779,9 @@ class Production extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$p_info = $this->production_article_obj->where('article_id', $data['article_id'])->where('state',0)->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();
|
||||
$p_info = $this->production_article_obj->where('article_id', $data['article_id'])->where('state', 0)->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();
|
||||
$re['production'] = $p_info;
|
||||
$re['article'] = $article_info;
|
||||
$re['journal'] = $journal_info;
|
||||
@@ -704,14 +826,15 @@ class Production extends Controller
|
||||
|
||||
|
||||
$this->production_article_organ_obj->where('p_article_organ_id', $data['p_article_organ_id'])->update(['state' => 1]);
|
||||
$this->production_article_author_to_organ_obj->where('p_article_organ_id',$data['p_article_organ_id'])->update(['state'=>1]);
|
||||
$this->production_article_author_to_organ_obj->where('p_article_organ_id', $data['p_article_organ_id'])->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑作者信息
|
||||
*/
|
||||
public function editAuthor(){
|
||||
public function editAuthor()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_author_id' => 'require',
|
||||
@@ -720,14 +843,14 @@ class Production extends Controller
|
||||
'author_country' => 'require',
|
||||
'is_first' => 'require',
|
||||
'is_report' => 'require',
|
||||
'organs'=>'require'
|
||||
'organs' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$old_article_author_info = $this->production_article_author_obj->where('p_article_author_id',$data['p_article_author_id'])->find();
|
||||
$article_info = $this->article_obj->where('article_id',$old_article_author_info['article_id'])->find();
|
||||
$updata['author_name'] = $article_info['journal_id']==21?trim($data['last_name']).trim($data['first_name']):trim($data['first_name']) . ' ' . trim($data['last_name']);
|
||||
$old_article_author_info = $this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->find();
|
||||
$article_info = $this->article_obj->where('article_id', $old_article_author_info['article_id'])->find();
|
||||
$updata['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']);
|
||||
$updata['first_name'] = trim($data['first_name']);
|
||||
$updata['last_name'] = trim($data['last_name']);
|
||||
$updata['orcid'] = isset($data['orcid']) ? $data['orcid'] : '';
|
||||
@@ -735,14 +858,14 @@ class Production extends Controller
|
||||
$updata['is_first'] = $data['is_first'];
|
||||
$updata['is_report'] = $data['is_report'];
|
||||
$updata['email'] = isset($data['email']) ? trim($data['email']) : '';
|
||||
$this->production_article_author_obj->where('p_article_author_id',$data['p_article_author_id'])->update($updata);
|
||||
$this->production_article_author_obj->where('p_article_author_id', $data['p_article_author_id'])->update($updata);
|
||||
if (is_array($data['organs'])) {
|
||||
$has_ids = [];
|
||||
foreach ($data['organs'] as $v) {
|
||||
$cache_one = $this->production_article_author_to_organ_obj
|
||||
->where('p_article_author_id',$data['p_article_author_id'])
|
||||
->where('p_article_organ_id',$v)
|
||||
->where('state',0)
|
||||
->where('p_article_author_id', $data['p_article_author_id'])
|
||||
->where('p_article_organ_id', $v)
|
||||
->where('state', 0)
|
||||
->find();
|
||||
if ($cache_one == null) {
|
||||
$insert['p_article_id'] = $old_article_author_info['p_article_id'];
|
||||
@@ -753,7 +876,7 @@ class Production extends Controller
|
||||
$has_ids[] = intval($v);
|
||||
}
|
||||
$this->production_article_author_to_organ_obj->where('p_article_author_id', $data['p_article_author_id'])->where('state', 0)->where('p_article_organ_id', 'not in', $has_ids)->update(['state' => 1]);
|
||||
}else{
|
||||
} else {
|
||||
$this->production_article_author_to_organ_obj->where('p_article_author_id', $data['p_article_author_id'])->where('state', 0)->update(['state' => 1]);
|
||||
}
|
||||
return jsonSuccess([]);
|
||||
@@ -812,11 +935,11 @@ class Production extends Controller
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$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();
|
||||
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
|
||||
|
||||
$insert['p_article_id'] = $data['p_article_id'];
|
||||
$insert['article_id'] = $p_info['article_id'];
|
||||
$insert['author_name'] = $article_info['journal_id']==21?trim($data['last_name']).trim($data['first_name']):trim($data['first_name']) . ' ' . trim($data['last_name']);
|
||||
$insert['author_name'] = $article_info['journal_id'] == 21 ? trim($data['last_name']) . trim($data['first_name']) : trim($data['first_name']) . ' ' . trim($data['last_name']);
|
||||
$insert['first_name'] = trim($data['first_name']);
|
||||
$insert['last_name'] = trim($data['last_name']);
|
||||
$insert['orcid'] = isset($data['orcid']) ? $data['orcid'] : '';
|
||||
@@ -878,7 +1001,8 @@ class Production extends Controller
|
||||
/**
|
||||
* 合并到上个文献中
|
||||
*/
|
||||
public function referHB(){
|
||||
public function referHB()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_refer_id' => 'require'
|
||||
@@ -886,18 +1010,18 @@ class Production extends Controller
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$refer_info = $this->production_article_refer_obj->where('p_refer_id',$data['p_refer_id'])->find();
|
||||
$refer_info = $this->production_article_refer_obj->where('p_refer_id', $data['p_refer_id'])->find();
|
||||
$refer_rev_res = $this->production_article_refer_obj
|
||||
->where('p_article_id',$refer_info['p_article_id'])
|
||||
->where('state',0)
|
||||
->where('p_refer_id','<',$refer_info['p_refer_id'])
|
||||
->where('p_article_id', $refer_info['p_article_id'])
|
||||
->where('state', 0)
|
||||
->where('p_refer_id', '<', $refer_info['p_refer_id'])
|
||||
->order('p_refer_id desc')
|
||||
->limit(1)->select();
|
||||
$refer_rev_info = $refer_rev_res[0];
|
||||
$updata['refer_frag'] = $refer_rev_info['refer_frag'].$refer_info['refer_frag'];
|
||||
$updata['refer_frag'] = $refer_rev_info['refer_frag'] . $refer_info['refer_frag'];
|
||||
$updata['cs'] = 0;
|
||||
$this->production_article_refer_obj->where('p_refer_id',$refer_rev_info['p_refer_id'])->update($updata);
|
||||
$this->production_article_refer_obj->where('p_refer_id',$refer_info['p_refer_id'])->update(['state'=>1]);
|
||||
$this->production_article_refer_obj->where('p_refer_id', $refer_rev_info['p_refer_id'])->update($updata);
|
||||
$this->production_article_refer_obj->where('p_refer_id', $refer_info['p_refer_id'])->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -948,8 +1072,9 @@ class Production extends Controller
|
||||
}
|
||||
|
||||
|
||||
public function mytest11(){
|
||||
$r = $this->production_article_refer_obj->where('p_refer_id',8)->find();
|
||||
public function mytest11()
|
||||
{
|
||||
$r = $this->production_article_refer_obj->where('p_refer_id', 8)->find();
|
||||
my_doiToFrag2($r);
|
||||
}
|
||||
|
||||
@@ -1047,7 +1172,7 @@ class Production extends Controller
|
||||
->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)
|
||||
->where('t_production_article_author_to_organ.state', 0)
|
||||
->select();
|
||||
}
|
||||
$re['authors'] = $list;
|
||||
@@ -1105,20 +1230,21 @@ class Production extends Controller
|
||||
/**
|
||||
* 开始proof
|
||||
*/
|
||||
public function pushProof(){
|
||||
public function pushProof()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id'=>'require'
|
||||
'p_article_id' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$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();
|
||||
$user_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
|
||||
$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();
|
||||
$user_info = $this->user_obj->where('user_id', $article_info['user_id'])->find();
|
||||
$this->pdfAddProof($p_info['article_id']);
|
||||
if($p_info['file_pdf']==''){
|
||||
if ($p_info['file_pdf'] == '') {
|
||||
return jsonError('To the editor: PROOF is the final form before the article goes online. The PROOF link step not be opened if you have not completed the previous steps.');
|
||||
}
|
||||
//发送邮件
|
||||
@@ -1130,31 +1256,30 @@ class Production extends Controller
|
||||
$tt .= "If you have any questions, please feel free to contact us.<br/>";
|
||||
$tt .= "Note: Double-check the authors' information carefully to ensure they are correct.";
|
||||
|
||||
|
||||
|
||||
// $maidata['email'] = '751475802@qq.com';
|
||||
$maidata['email'] = $user_info['email'];
|
||||
$maidata['title'] = "PROOF|".$journal_info['title'];
|
||||
$maidata['title'] = "PROOF|" . $journal_info['title'];
|
||||
$maidata['content'] = $tt;
|
||||
$maidata['tmail'] = $journal_info['email'];
|
||||
$maidata['tpassword'] = $journal_info['epassword'];
|
||||
if($p_info['file_sub']!=''){
|
||||
if ($p_info['file_sub'] != '') {
|
||||
$file = [];
|
||||
$file[] = ROOT_PATH . 'public' . DS.'proofPDF'.DS.$p_info['article_id'].'.pdf';
|
||||
if(substr($p_info['file_sub'],strripos($p_info['file_sub'],'.')+1)=='pdf'){
|
||||
$file[] = ROOT_PATH . 'public' . DS.'proofPDF'.DS.$p_info['article_id'].'SUB.pdf';
|
||||
}else{
|
||||
$file[] = ROOT_PATH . 'public' . DS.'articleSUB'.DS.$p_info['file_sub'];
|
||||
$file[] = ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $p_info['article_id'] . '.pdf';
|
||||
if (substr($p_info['file_sub'], strripos($p_info['file_sub'], '.') + 1) == 'pdf') {
|
||||
$file[] = ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $p_info['article_id'] . 'SUB.pdf';
|
||||
} else {
|
||||
$file[] = ROOT_PATH . 'public' . DS . 'articleSUB' . DS . $p_info['file_sub'];
|
||||
}
|
||||
|
||||
}else{
|
||||
$file = ROOT_PATH . 'public' . DS.'proofPDF'.DS.$p_info['article_id'].'.pdf';
|
||||
} else {
|
||||
$file = ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $p_info['article_id'] . '.pdf';
|
||||
}
|
||||
sendEmail($maidata['email'],$maidata['title'],$journal_info['title'],$maidata['content'],$maidata['tmail'],$maidata['tpassword'],$file);
|
||||
sendEmail($maidata['email'], $maidata['title'], $journal_info['title'], $maidata['content'], $maidata['tmail'], $maidata['tpassword'], $file);
|
||||
//更改数据库
|
||||
$updata['proof_state'] = 1;
|
||||
$updata['proof_stime'] = time();
|
||||
$updata['proof_etime'] = strtotime("+2 day");
|
||||
$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([]);
|
||||
}
|
||||
@@ -1162,36 +1287,38 @@ class Production extends Controller
|
||||
/**
|
||||
* 自动执行
|
||||
*/
|
||||
public function proofState(){
|
||||
$this->production_article_obj->where('proof_state',1)->where('proof_etime','<',time())->update(['proof_state'=>2]);
|
||||
public function proofState()
|
||||
{
|
||||
$this->production_article_obj->where('proof_state', 1)->where('proof_etime', '<', time())->update(['proof_state' => 2]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 作者反馈proof
|
||||
*/
|
||||
public function editProof(){
|
||||
public function editProof()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'article_id'=>'require',
|
||||
'code'=>'require'
|
||||
'article_id' => 'require',
|
||||
'code' => 'require'
|
||||
]);
|
||||
if(!$rule->check($data)){
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$updata = [];
|
||||
$updata['proof_rtime'] = time();
|
||||
if($data['code']==0){//同意
|
||||
if ($data['code'] == 0) { //同意
|
||||
$updata['proof_state'] = 2;
|
||||
}else{//拒绝
|
||||
if(trim($data['content'])==''){
|
||||
} else { //拒绝
|
||||
if (trim($data['content']) == '') {
|
||||
return jsonError('Content is required');
|
||||
}
|
||||
$updata['proof_state'] = 2;
|
||||
$updata['proof_content'] = trim($data['content']);
|
||||
}
|
||||
$this->production_article_obj->where('article_id',$data['article_id'])->where('state',0)->update($updata);
|
||||
$this->production_article_obj->where('article_id', $data['article_id'])->where('state', 0)->update($updata);
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -1199,18 +1326,19 @@ class Production extends Controller
|
||||
/**
|
||||
* 同意proof通过邮件链接
|
||||
*/
|
||||
public function editProofFromEmail($articleId){
|
||||
$this->production_article_obj->where('article_id',$articleId)->where('state',0)->update(['proof_state'=>2,'proof_rtime'=>time()]);
|
||||
public function editProofFromEmail($articleId)
|
||||
{
|
||||
$this->production_article_obj->where('article_id', $articleId)->where('state', 0)->update(['proof_state' => 2, 'proof_rtime' => time()]);
|
||||
echo 'Commit Succeeded';
|
||||
}
|
||||
|
||||
private function pdfAddProof($article_id)
|
||||
{
|
||||
$p_info = $this->production_article_obj->where('article_id',$article_id)->where('state',0)->find();
|
||||
$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']);
|
||||
$pageCount = $pdf->setSourceFile(ROOT_PATH . 'public' . DS . $p_info['file_pdf']);
|
||||
// iterate through all pages
|
||||
for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) {
|
||||
// import a page
|
||||
@@ -1226,44 +1354,44 @@ class Production extends Controller
|
||||
// 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->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');
|
||||
$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'){
|
||||
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']);
|
||||
$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->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');
|
||||
$pdf1->Output(ROOT_PATH . 'public' . DS . 'proofPDF' . DS . $article_id . 'SUB.pdf');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1291,28 +1419,28 @@ class Production extends Controller
|
||||
private function authorFormate($p_article_id)
|
||||
{
|
||||
// $authors = $this->article_author_obj->where('article_id', $article_id)->where('state', 0)->select();
|
||||
$p_info = $this->production_article_obj->where('p_article_id',$p_article_id)->find();
|
||||
$article_info = $this->article_obj->where('article_id',$p_info['article_id'])->find();
|
||||
$authors = $this->production_article_author_obj->where('p_article_id',$p_article_id)->where('state',0)->select();
|
||||
$p_info = $this->production_article_obj->where('p_article_id', $p_article_id)->find();
|
||||
$article_info = $this->article_obj->where('article_id', $p_info['article_id'])->find();
|
||||
$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)){
|
||||
->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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$first_num = 0;//第一作者的总数
|
||||
foreach($authors as $v){
|
||||
if($v['is_first']==1){
|
||||
$first_num = 0; //第一作者的总数
|
||||
foreach ($authors as $v) {
|
||||
if ($v['is_first'] == 1) {
|
||||
$first_num++;
|
||||
}
|
||||
}
|
||||
@@ -1321,19 +1449,19 @@ class Production extends Controller
|
||||
//构建数组字符串
|
||||
$author = '';
|
||||
foreach ($authors as $v) {
|
||||
$cache_str = $article_info['journal_id']==21?trim($v['last_name']).trim($v['first_name'])."<q>":trim($v['first_name']) . ' ' . trim($v['last_name']) . '<q>';
|
||||
$cache_str = $article_info['journal_id'] == 21 ? trim($v['last_name']) . trim($v['first_name']) . "<q>" : trim($v['first_name']) . ' ' . trim($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();
|
||||
->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) . ", ";
|
||||
}
|
||||
$cache_str = trim($cache_str);
|
||||
$cache_str = substr($cache_str,0,-1);
|
||||
if ($first_num>1&&$v['is_first'] == 1) {
|
||||
$cache_str = substr($cache_str, 0, -1);
|
||||
if ($first_num > 1 && $v['is_first'] == 1) {
|
||||
$cache_str .= '#';
|
||||
}
|
||||
if ($v['is_report'] == 1) {
|
||||
@@ -1356,7 +1484,8 @@ class Production extends Controller
|
||||
/**
|
||||
* 更改文章pdf文件
|
||||
*/
|
||||
public function updateArticlePDF(){
|
||||
public function updateArticlePDF()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require',
|
||||
@@ -1366,7 +1495,7 @@ class Production extends Controller
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['file_pdf'] = $data['pdf'];
|
||||
$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([]);
|
||||
}
|
||||
|
||||
@@ -1385,5 +1514,4 @@ class Production extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user