From 3f03d9357ab2e986a824d4d5cfdf8f9b5a207da4 Mon Sep 17 00:00:00 2001
From: wangjinlei <751475802@qq.com>
Date: Wed, 18 Dec 2024 09:10:10 +0800
Subject: [PATCH] 1
---
application/api/controller/Article.php | 254 +++++++++++++++++++----
application/api/controller/Base.php | 202 ++++++++++++++++++
application/api/controller/Preaccept.php | 113 ++++++++++
application/api/controller/Web.php | 7 +-
4 files changed, 540 insertions(+), 36 deletions(-)
diff --git a/application/api/controller/Article.php b/application/api/controller/Article.php
index 2a5e95d..62715d0 100644
--- a/application/api/controller/Article.php
+++ b/application/api/controller/Article.php
@@ -1420,7 +1420,8 @@ class Article extends Base
//为预接收的文章生成production实例
if($data['state'] == 6){
- $this->addProductionEx($data['articleId']);
+// $this->addProductionEx($data['articleId']);
+ $this->addArticleMainEx($data['articleId']);
}
}
@@ -2001,7 +2002,17 @@ class Article extends Base
return jsonSuccess($re);
}
+ public function myMarkTmage(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $this->markArticleImage($data['article_id']);
+ }
/**分解文章的图片和表格
* @return void
@@ -2020,7 +2031,7 @@ class Article extends Base
}
$this->markWord("https://submission.tmrjournals.com/public/".$file,$article_id);
//处理压缩包等等的内容
- $pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->select();
+ $pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->order("file_id desc")->limit(1)->select();
foreach ($pics as $v){
$extension = pathinfo($v['file_url'], PATHINFO_EXTENSION);
if($extension=="zip"){
@@ -2032,57 +2043,200 @@ class Article extends Base
- private function markZip($file,$article_id){
- $article_info = $this->article_obj->where("article_id",$article_id)->find();
+// private function markZip($file,$article_id){
+// $article_info = $this->article_obj->where("article_id",$article_id)->find();
+// $zip = new \ZipArchive();
+// // 打开 ZIP 文件
+// if ($zip->open($file) === true) {
+// $fileCount = $zip->numFiles;
+// $num_rand = rand(1000,9999);
+// for ($i = 0; $i < $fileCount; $i++) {
+// $stat = $zip->statIndex($i);
+// $fileName = $stat['name'];
+// $fileContent = $zip->getFromIndex($i);
+// $base_url = ROOT_PATH."public/articleImage/".$article_id."/";
+// $extension = pathinfo($fileName, PATHINFO_EXTENSION);
+// if($extension=="jpg"||$extension=="JPG"||$extension=="jpeg"){
+// file_put_contents($base_url."zipimg".$num_rand.$i.".jpg", $fileContent);
+// $insert['article_id'] = $article_id;
+// $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".jpg";
+// $insert['ctime'] = time();
+// $this->article_image_obj->insert($insert);
+// }elseif ($extension=="png"){
+// file_put_contents($base_url."zipimg".$num_rand.$i.".png", $fileContent);
+// $insert['article_id'] = $article_id;
+// $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".png";
+// $insert['ctime'] = time();
+// $this->article_image_obj->insert($insert);
+// }elseif ($extension=="tiff"||$extension=="tif"){
+// file_put_contents($base_url."zipimg".$num_rand.$i.".".$extension, $fileContent);
+// $imagick = new \Imagick();
+// $imagick->readImage($fileContent);
+// $imagick->setImageFormat('jpg');
+// $imagick->writeImage($base_url."zipimg".$num_rand.$i.".jpg");
+// $imagick->clear();
+// $imagick->destroy();
+// $insert['article_id'] = $article_id;
+// $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".".$extension;
+// $insert['jpg_url'] = $article_id."/"."zipimg".$num_rand.$i.".jpg";
+// $insert['ctime'] = time();
+// $this->article_image_obj->insert($insert);
+// }elseif ($extension=="emf"||$extension=="EMF"){
+// file_put_contents($base_url."zipimg".$num_rand.$i.".".$extension, $fileContent);
+// $imagick = new \Imagick();
+// $imagick->readImage($fileContent);
+// $imagick->setImageFormat('jpg');
+// $imagick->writeImage($base_url."zipimg".$num_rand.$i.".jpg");
+// $imagick->clear();
+// $imagick->destroy();
+// $insert['article_id'] = $article_id;
+// $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".".$extension;
+// $insert['jpg_url'] = $article_id."/"."zipimg".$num_rand.$i.".jpg";
+// $insert['ctime'] = time();
+// $this->article_image_obj->insert($insert);
+// }elseif ($extension=="docx"){
+// $word_dir = ROOT_PATH."public/articleCache/".$article_id;
+// if (!is_dir($word_dir)) {
+// mkdir($word_dir, 0777, true);
+// }
+// $word_file = rand(1000,9999).$fileName;
+// file_put_contents($word_dir."/".$word_file, $fileContent);
+// $this->markWord("https://submission.tmrjournals.com/public/articleCache/".$article_id."/".$word_file,$article_id);
+// }
+//
+// }
+//
+// // 关闭 ZIP 文件
+// $zip->close();
+//
+// } else {
+// return json(['error' => 'Unable to open ZIP file.']);
+// }
+// }
+ private function markZip($file, $article_id)
+ {
+ $article_info = $this->article_obj->where("article_id", $article_id)->find();
$zip = new \ZipArchive();
+
// 打开 ZIP 文件
if ($zip->open($file) === true) {
$fileCount = $zip->numFiles;
- $num_rand = rand(1000,9999);
+ $num_rand = uniqid('', true); // 使用 uniqid 来生成更唯一的文件名
+
for ($i = 0; $i < $fileCount; $i++) {
$stat = $zip->statIndex($i);
- $fileName = $stat['name'];
+ $fileName = basename($stat['name']); // 获取文件名并去掉路径
$fileContent = $zip->getFromIndex($i);
- $base_url = ROOT_PATH."public/articleImage/".$article_id."/";
+ $base_url = ROOT_PATH . "public/articleImage/" . $article_id . "/";
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
- if($extension=="jpg"||$extension=="JPG"||$extension=="jpeg"){
- file_put_contents($base_url."zipimg".$num_rand.$i.".jpg", $fileContent);
- $insert['article_id'] = $article_id;
- $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".jpg";
- $insert['ctime'] = time();
- $this->article_image_obj->insert($insert);
- }elseif ($extension=="png"){
- file_put_contents($base_url."zipimg".$num_rand.$i.".png", $fileContent);
- $insert['article_id'] = $article_id;
- $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".png";
- $insert['ctime'] = time();
- $this->article_image_obj->insert($insert);
- }elseif ($extension=="tiff"){
- file_put_contents($base_url."zipimg".$num_rand.$i.".tiff", $fileContent);
- $insert['article_id'] = $article_id;
- $insert['image'] = $article_id."/"."zipimg".$num_rand.$i.".tiff";
- $insert['ctime'] = time();
- $this->article_image_obj->insert($insert);
- }elseif ($extension=="docx"){
- $word_dir = ROOT_PATH."public/articleCache/".$article_id;
- if (!is_dir($word_dir)) {
- mkdir($word_dir, 0777, true);
- }
- $word_file = rand(1000,9999).$fileName;
- file_put_contents($word_dir."/".$word_file, $fileContent);
- $this->markWord("https://submission.tmrjournals.com/public/articleCache/".$article_id."/".$word_file,$article_id);
- }
+ // 创建文件名并确保唯一性
+ $newFileName = "zipimg" . $num_rand . $i . '.' . $extension;
+
+ if (in_array(strtolower($extension), ['jpg', 'jpeg', 'png'])) {
+ // 处理图片文件
+ file_put_contents($base_url . $newFileName, $fileContent);
+ $this->insertImageData($article_id, $newFileName);
+ } elseif (in_array(strtolower($extension), ['tiff', 'tif'])) {
+ // 处理 TIFF 和 EMF 文件并转换为 JPG
+ file_put_contents($base_url . $newFileName, $fileContent);
+ $this->insertImageData($article_id, $newFileName);
+// $this->convertImageToJpg($base_url . $newFileName, $base_url, $num_rand, $i, $extension, $article_id);
+ } elseif ($extension == "docx") {
+ // 处理 DOCX 文件
+ $this->handleDocxFile($fileContent, $article_id, $fileName);
+ }
}
// 关闭 ZIP 文件
$zip->close();
-
} else {
return json(['error' => 'Unable to open ZIP file.']);
}
}
+ private function insertImageData($article_id, $newFileName)
+ {
+ $insert = [
+ 'article_id' => $article_id,
+ 'image' => $article_id . "/" . $newFileName,
+ 'ctime' => time(),
+ ];
+ $this->article_image_obj->insert($insert);
+ }
+
+
+ private function convertImageToJpg($inputPath, $base_url, $num_rand, $index, $extension, $article_id)
+ {
+ try {
+ $imagick = new \Imagick();
+
+ // 确保文件读取成功
+ $imagick->readImage($inputPath);
+ $outputPath = $base_url . "zipimg" . $num_rand . $index . ".jpg";
+ // 确保转换成功并写入文件
+ if ($imagick->setImageFormat('jpg') && $imagick->writeImage($outputPath)) {
+ echo "Image successfully written to: " . $outputPath; // Debugging output
+ $imagick->clear();
+ $imagick->destroy();
+
+ // 插入数据库记录
+ $insert = [
+ 'article_id' => $article_id,
+ 'image' => $article_id . "/zipimg" . $num_rand . $index . '.' . $extension,
+ 'jpg_url' => $article_id . "/zipimg" . $num_rand . $index . ".jpg",
+ 'ctime' => time(),
+ ];
+ $this->article_image_obj->insert($insert);
+ } else {
+ echo "Image writing failed!"; // Debugging output
+ }
+ } catch (\ImagickException $e) {
+ // 错误处理,输出异常信息
+ return json(['error' => 'Image conversion failed: ' . $e->getMessage()]);
+ }
+ }
+
+// private function convertImageToJpg($inputPath, $base_url, $num_rand, $index, $extension, $article_id)
+// {
+// try {
+// $imagick = new \Imagick();
+// $imagick->readImage($inputPath);
+// $imagick->setImageFormat('jpg');
+// $outputPath = $base_url . "zipimg" . $num_rand . $index . ".jpg";
+// $res = $imagick->writeImage($outputPath);
+// var_dump($res);
+//
+// $imagick->clear();
+// $imagick->destroy();
+//
+// // 插入数据库记录
+// $insert = [
+// 'article_id' => $article_id,
+// 'image' => $article_id . "/zipimg" . $num_rand . $index . '.' . $extension,
+// 'jpg_url' => $article_id . "/zipimg" . $num_rand . $index . ".jpg",
+// 'ctime' => time(),
+// ];
+// $this->article_image_obj->insert($insert);
+// } catch (\Exception $e) {
+// // 错误处理,可以记录日志或返回错误信息
+// return json(['error' => 'Image conversion failed: ' . $e->getMessage()]);
+// }
+// }
+
+ private function handleDocxFile($fileContent, $article_id, $fileName)
+ {
+ $word_dir = ROOT_PATH . "public/articleCache/" . $article_id;
+ if (!is_dir($word_dir)) {
+ mkdir($word_dir, 0777, true);
+ }
+
+ $word_file = rand(1000, 9999) . $fileName;
+ file_put_contents($word_dir . "/" . $word_file, $fileContent);
+
+ $this->markWord("https://submission.tmrjournals.com/public/articleCache/" . $article_id . "/" . $word_file, $article_id);
+ }
+
private function markWord($file,$article_id){
$url = $this->ts_base_url."api/typeset/markImages";
$program['file'] = $file;
@@ -2096,12 +2250,42 @@ class Article extends Base
foreach ($file_runs as $v){
$insert['article_id'] = $article_id;
$insert['image'] = $article_id."/".$v;
+// if(strtolower(pathinfo($v,PATHINFO_EXTENSION))=="emf"){
+// $imagick = new \Imagick();
+// $formats = $imagick->queryFormats();
+//// var_dump($formats);die;
+// $inputPath = ROOT_PATH."public/articleImage/".$article_id."/".$v;
+// // 确保文件读取成功
+// $imagick->readImage($inputPath);
+// $outputPath = ROOT_PATH."public/articleImage/".$article_id."/".substr($v,0,-3)."jpg";;
+// // 确保转换成功并写入文件
+// if ($imagick->setImageFormat('jpg') && $imagick->writeImage($outputPath)) {
+// echo "Image successfully written to: " . $outputPath; // Debugging output
+// $imagick->clear();
+// $imagick->destroy();
+// $insert['jpg_url'] = $article_id."/".substr($v,0,-3)."jpg";
+// } else {
+// echo "Image writing failed!"; // Debugging output
+// }
+// }
$insert['ctime'] = time();
$this->article_image_obj->insert($insert);
}
}
+ public function testArticleImageEx(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $this->addArticleMainEx($data['article_id']);
+ return jsonSuccess([]);
+ }
+
public function getArticleImages(){
$data = $this->request->post();
diff --git a/application/api/controller/Base.php b/application/api/controller/Base.php
index f314edc..ed6aba7 100644
--- a/application/api/controller/Base.php
+++ b/application/api/controller/Base.php
@@ -78,6 +78,9 @@ class Base extends Controller
protected $email_account_obj="";
protected $article_image_obj="";
protected $article_table_obj="";
+ protected $article_main_obj="";
+ protected $article_main_image_obj = "";
+ protected $article_main_table_obj = '';
public function __construct(\think\Request $request = null)
@@ -151,6 +154,9 @@ class Base extends Controller
$this->email_account_obj = Db::name("email_account");
$this->article_image_obj = Db::name("article_image");
$this->article_table_obj = Db::name("article_table");
+ $this->article_main_obj = Db::name("article_main");
+ $this->article_main_image_obj = Db::name("article_main_image");
+ $this->article_main_table_obj = Db::name("article_main_table");
}
@@ -382,6 +388,202 @@ class Base extends Controller
return jsonSuccess([]);
}
+
+
+ public function addArticleMainEx($article_id){
+ $article_info = $this->article_obj->where('article_id', $article_id)->find();
+ $files = $this->article_file_obj
+ ->where('article_id', $article_info['article_id'])
+ ->where('type_name', 'manuscirpt')
+ ->order('ctime desc')
+ ->limit(1)
+ ->select();
+ if (count($files) == 0) {
+ return jsonError('No Manuscript');
+ }
+ $dir = ROOT_PATH."public/articleImage/".$article_id;
+ if (!is_dir($dir)) {
+ mkdir($dir, 0777, true);
+ }
+ $url = $this->ts_base_url."api/typeset/readDocx";
+ $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
+ $program['article_id'] = $article_id;
+ $res = object_to_array(json_decode(myPost($url, $program)));
+ $file_runs = $res['data'];
+ //需要处理很多事情
+ if(!isset($file_runs['mains'])){
+ return "system error";
+ }
+ $refer_start = false;
+ foreach ($file_runs['mains'] as $k=>$v){
+ if($this->isImageTag($v)){//img
+ preg_match("/\/public\/articleImage\/(.*?)'/", $v, $matches);
+ if (!isset($matches[1])) {continue;}
+
+ $insert_image['article_id'] = $article_id;
+ $insert_image['url'] = $matches[1];
+ $insert_image['ctime'] = time();
+ $c_id = $this->article_main_image_obj->insertGetId($insert_image);
+
+ $insert1['article_id'] = $article_id;
+ $insert1['type'] = 1;
+ $insert1['ami_id'] = $c_id;
+ $insert1['content'] = $v;
+ $insert1['sort'] = $k+1;
+ $insert1['ctime'] = time();
+ $this->article_main_obj->insert($insert1);
+
+ }else{//文本
+ if($refer_start&&$v!=""){
+ if (strlen($v) > 500) {
+ $refer_start = false;
+ $cc_t = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($v)));
+ $insert['article_id'] = $article_id;
+ $insert['type'] = 0;
+ $insert['content'] = $cc_t;
+ $insert['sort'] = $k+1;
+ $insert['ctime'] = time();
+ $this->article_main_obj->insert($insert);
+ continue;
+ }
+ continue ;
+ }
+ if (strtolower($v) == 'reference:' || strtolower($v)=="references"||strtolower($v) == 'references:' || strtolower($v) == 'references' || strtolower($v) == 'reference') {
+ $refer_start = true;
+ continue;
+ }
+
+ $c_t = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($v)));
+ $insert['article_id'] = $article_id;
+ $insert['type'] = 0;
+ $insert['content'] = $c_t;
+ $insert['sort'] = $k+1;
+ $insert['ctime'] = time();
+ $this->article_main_obj->insert($insert);
+ }
+ }
+
+ //处理表格
+ $tables = $this->article_table_obj->where("article_id",$article_id)->where("state",0)->select();
+ foreach ($tables as $table) {
+ $ins['article_id'] = $article_id;
+ $ins['type'] = 0;
+ $ins['table_data'] = $table['table'];
+ $ins['ctime'] = time();
+ $this->article_main_table_obj->insert($ins);
+ }
+
+
+ $pics = $this->article_file_obj->where("article_id",$article_id)->where("type_name","picturesAndTables")->where("state",0)->order("file_id desc")->limit(1)->select();
+ if(!isset($pics[0])){
+ return ;
+ }
+ $extension = pathinfo($pics[0]['file_url'], PATHINFO_EXTENSION);
+ if($extension=="zip"){
+ $file = ROOT_PATH."public/".$pics[0]['file_url'];
+ $zip = new \ZipArchive();
+
+ // 打开 ZIP 文件
+ if ($zip->open($file) === true) {
+ $fileCount = $zip->numFiles;
+ $num_rand = uniqid('', true); // 使用 uniqid 来生成更唯一的文件名
+
+ for ($i = 0; $i < $fileCount; $i++) {
+ $stat = $zip->statIndex($i);
+ $fileName = basename($stat['name']); // 获取文件名并去掉路径
+ $fileContent = $zip->getFromIndex($i);
+ $base_url = ROOT_PATH . "public/articleImage/" . $article_id . "/";
+ $extension = pathinfo($fileName, PATHINFO_EXTENSION);
+
+ // 创建文件名并确保唯一性
+ $newFileName = "zipimg" . $num_rand . $i . '.' . $extension;
+
+ if (in_array(strtolower($extension), ['jpg', 'jpeg', 'png'])) {
+ // 处理图片文件
+ file_put_contents($base_url . $newFileName, $fileContent);
+ $insert['article_id'] = $article_id;
+ $insert['url'] = $article_id . "/" . $newFileName;
+ $insert['ctime'] = time();
+ $this->article_main_image_obj->insert($insert);
+ } elseif (in_array(strtolower($extension), ['tiff', 'tif'])) {
+ // 处理 TIFF 和 EMF 文件并转换为 JPG
+ file_put_contents($base_url . $newFileName, $fileContent);
+ $insert['article_id'] = $article_id;
+ $insert['url'] = $article_id . "/" . $newFileName;
+ $insert['ctime'] = time();
+ $this->article_main_image_obj->insert($insert);
+ } elseif ($extension == "docx") {
+ $word_dir = ROOT_PATH . "public/articleCache/" . $article_id;
+ if (!is_dir($word_dir)) {
+ mkdir($word_dir, 0777, true);
+ }
+ $word_file = uniqid('', true) . $fileName;
+ file_put_contents($word_dir . "/" . $word_file, $fileContent);
+ $url = $this->ts_base_url . "api/typeset/markImages";
+ $program['file'] = "https://submission.tmrjournals.com/public/articleCache/" . $article_id . "/" . $word_file;
+ $program['article_id'] = $article_id;
+ $res = object_to_array(json_decode(myPost($url, $program)));
+ if (!isset($res['data']['list'])) {
+ return;
+ }
+ $file_runs = $res['data']['list'];
+ foreach ($file_runs as $val) {
+ $insert['article_id'] = $article_id;
+ $insert['url'] = $val;
+ $insert['ctime'] = time();
+ $this->article_main_image_obj->insert($insert);
+ }
+ }
+ }
+ // 关闭 ZIP 文件
+ $zip->close();
+ } else {
+ return json(['error' => 'Unable to open ZIP file.']);
+ }
+ }
+ }
+
+ public function isImageTag($str) {
+ // 正则表达式匹配
标签,忽略大小写
+ $pattern = '/^\s*
]*\s*src=["\'][^"\']+["\'][^>]*>\s*$/i';
+
+ // 使用 preg_match 判断是否符合 img 标签的格式
+ if (preg_match($pattern, $str)) {
+ return true; // 是 img 标签
+ }
+ return false; // 不是 img 标签
+ }
+
+ public function removeExtraSpaces($str) {
+ // 使用正则表达式匹配两个及以上的连续空格,并替换为一个空格
+ return preg_replace('/\s{2,}/', ' ', $str);
+ }
+
+
+ public function replaceChinesePunctuation($str) {
+ // 定义中文标点和对应的英文标点替换
+ $replacements = [
+ ',' => ',', // 中文逗号 -> 英文逗号
+ '。' => '.', // 中文句号 -> 英文句号
+ '!' => '!', // 中文感叹号 -> 英文感叹号
+ '?' => '?', // 中文问号 -> 英文问号
+ ':' => ':', // 中文冒号 -> 英文冒号
+ ';' => ';', // 中文分号 -> 英文分号
+ '(' => '(', // 中文左括号 -> 英文左括号
+ ')' => ')', // 中文右括号 -> 英文右括号
+ '【' => '[', // 中文左方括号 -> 英文左方括号
+ '】' => ']', // 中文右方括号 -> 英文右方括号
+ '《' => '<', // 中文左书名号 -> 英文左书名号
+ '》' => '>', // 中文右书名号 -> 英文右书名号
+ '、' => ',', // 中文顿号 -> 英文逗号
+ '——' => '--', // 中文破折号 -> 英文破折号
+ '·' => '.', // 中文间隔符 -> 英文点
+ ];
+
+ // 替换所有中文标点
+ return str_replace(array_keys($replacements), array_values($replacements), $str);
+ }
+
public function getBoardsForJournal($journal_id, $aar = false)
{
$ca_board = [];
diff --git a/application/api/controller/Preaccept.php b/application/api/controller/Preaccept.php
index 2ceb80b..e31ce41 100644
--- a/application/api/controller/Preaccept.php
+++ b/application/api/controller/Preaccept.php
@@ -368,6 +368,103 @@ class Preaccept extends Base
return jsonSuccess($re);
}
+
+ public function getArticleMains(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select();
+ if(!$mains){
+ $this->addArticleMainEx($data['article_id']);
+ }
+ $mains = $this->article_main_obj->where("article_id",$data['article_id'])->whereIn("state",[0,2])->order("sort asc")->select();
+ if(!$mains){
+ return jsonError("error");
+ }
+ foreach ($mains as $k=>$main) {
+ if($main['type']==0){
+ continue;
+ }elseif($main['type']==1){
+ $c_d = $this->article_main_image_obj->where("ami_id",$main['ami_id'])->find();
+ $mains[$k]['image'] = $c_d;
+ }else{
+ $c_d_t = $this->article_main_table_obj->where("amt_id",$main['amt_id'])->find();
+ $mains[$k]['table'] = $c_d_t;
+ }
+ }
+ $re['list'] = $mains;
+
+ return jsonSuccess($re);
+ }
+
+ public function delArticleMains(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "am_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>1]);
+
+ return jsonSuccess([]);
+ }
+
+ public function editArticleMainsForAuthor(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "am_id"=>"require",
+ "content"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $update['content'] = $this->replaceChinesePunctuation($this->removeExtraSpaces(trim($data['content'])));
+ $update['state'] = 0;
+ $this->article_main_obj->where("am_id",$data['am_id'])->update($update);
+ return jsonSuccess([]);
+ }
+
+ public function getArticleMainsRecycle(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ "article_id"=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $list = $this->article_main_obj->where("article_id",$data['article_id'])->where("state",1)->select();
+ $re['list'] = $list;
+
+ return jsonSuccess($re);
+ }
+
+
+ public function replyArticleRecycle(){
+ $data = $this->request->post();
+ $rule = new Validate([
+ 'am_id'=>"require"
+ ]);
+ if(!$rule->check($data)){
+ return jsonError($rule->getError());
+ }
+ $info = $this->article_main_obj->where("am_id",$data['am_id'])->find();
+ $check = $this->article_main_obj->where("article_id",$info['article_id'])->where("sort",$info['sort'])->whereIn("state",[0,2])->find();
+ if($check){
+ $this->article_main_obj->where("article_id",$data['article_id'])->where("sort",">=",$info['sort'])->inc('sort',1)->update();
+ }
+ $this->article_main_obj->where("am_id",$data['am_id'])->update(['state'=>0]);
+ return jsonSuccess([]);
+ }
+
+
+
+
+
/**调整refer排序
* @return \think\response\Json
* @throws \think\Exception
@@ -405,6 +502,22 @@ class Preaccept extends Base
}
+// public function getArticleMains(){
+// $data = $this->request->post();
+// $rule = new Validate([
+// "article_id"=>"require"
+// ]);
+// if(!$rule->check($data)){
+// return jsonError($rule->getError());
+// }
+// $article_info = $this->article_obj->where("article_id",$data['article_id'])->find();
+// $product_info = $this->production_article_obj->where("article_id".$data['article_id'])->find();
+//
+//
+//
+// }
+
+
public function addRefersByExcel()
{
$data = $this->request->post();
diff --git a/application/api/controller/Web.php b/application/api/controller/Web.php
index fddcd2e..e51197a 100644
--- a/application/api/controller/Web.php
+++ b/application/api/controller/Web.php
@@ -229,7 +229,12 @@ class Web extends Base
];
continue;
}
- if($v['state_to']==4&&!$reciv&&$reviewer_has&&(($article_info['journal_id']==1&&$p_info['journal_stage_id']>=453)||$article_info['journal_id']==23)){
+ if($v['state_to']==4&&!$reciv&&$reviewer_has&&
+ (($article_info['journal_id']==1&&$p_info['journal_stage_id']>=453)
+ ||$article_info['journal_id']==23
+ ||$article_info['journal_id']==2
+ ||$article_info['journal_id']==9
+ )){
$r_files = $this->article_response_to_reviewer_obj->where('article_id',$article_info['article_id'])->select();
$reciv=true;
if($r_files){