1
This commit is contained in:
@@ -6,6 +6,7 @@ use app\api\controller\Base;
|
|||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Queue;
|
use think\Queue;
|
||||||
use think\Validate;
|
use think\Validate;
|
||||||
|
use PhpOffice\PhpWord\IOFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 文章接口
|
* @title 文章接口
|
||||||
@@ -1905,6 +1906,38 @@ class Article extends Base
|
|||||||
return json(['code' => 0]);
|
return json(['code' => 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**分解文章的图片和表格
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function markArticleImgTab(){
|
||||||
|
$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();
|
||||||
|
$files = $this->article_file_obj->where("article_id",$data['article_id'])->where("type_name","manuscirpt")->where("state",0)->order("ctme desc")->limit(1)->select();
|
||||||
|
if(isset($files[0])){
|
||||||
|
$file = $files[0]['file_url'];
|
||||||
|
}
|
||||||
|
$dir = ROOT_PATH."public/articleImage/".$article_info['accept_sn'];
|
||||||
|
if (!is_dir($dir)) {
|
||||||
|
mkdir($dir, 0777, true);
|
||||||
|
}
|
||||||
|
$url = $this->ts_base_url."api/typeset/markImages";
|
||||||
|
$program['url'] = "https://submission.tmrjournals.com/public/".$files;
|
||||||
|
$program['sn'] = $article_info['accept_sn'];
|
||||||
|
$res = object_to_array(json_decode(myPost($url, $program)));
|
||||||
|
$file_runs = $res['list'];
|
||||||
|
return jsonSuccess($file_runs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑添加审稿实例(临时开启,为了补充审稿实例不够)
|
* 编辑添加审稿实例(临时开启,为了补充审稿实例不够)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use hashids\hashids;
|
|||||||
class Base extends Controller
|
class Base extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $ts_base_url = "http://ts.tmrjournals.cn/";
|
protected $ts_base_url = "http://ts.tmrjournals.com/";
|
||||||
|
|
||||||
protected $user_obj = '';
|
protected $user_obj = '';
|
||||||
protected $captcha_obj = '';
|
protected $captcha_obj = '';
|
||||||
|
|||||||
@@ -849,7 +849,7 @@ class Reviewer extends Base
|
|||||||
if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $content)>0){//含有中文
|
if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $content)>0){//含有中文
|
||||||
if($journal_info['journal_id']==1){
|
if($journal_info['journal_id']==1){
|
||||||
if(mb_strlen($content, 'UTF8')<150){
|
if(mb_strlen($content, 'UTF8')<150){
|
||||||
return jsonError("We encourage you to enrich your comment further to help improve the peer paper (at least 100 words).");
|
return jsonError("We encourage you to enrich your comment further to help improve the peer paper (at least 150 words).");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(mb_strlen($content, 'UTF8')<100){
|
if(mb_strlen($content, 'UTF8')<100){
|
||||||
@@ -860,7 +860,7 @@ class Reviewer extends Base
|
|||||||
if($journal_info['journal_id']==1){
|
if($journal_info['journal_id']==1){
|
||||||
$carray = explode(" ", $content);
|
$carray = explode(" ", $content);
|
||||||
if(count($carray)<150){
|
if(count($carray)<150){
|
||||||
return jsonError("We encourage you to enrich your comment further to help improve the peer paper (at least 100 words).");
|
return jsonError("We encourage you to enrich your comment further to help improve the peer paper (at least 150 words).");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$carray = explode(" ", $content);
|
$carray = explode(" ", $content);
|
||||||
|
|||||||
@@ -1898,7 +1898,7 @@ class User extends Base
|
|||||||
$user_info = $this->user_obj->where('account', $account)->find();
|
$user_info = $this->user_obj->where('account', $account)->find();
|
||||||
if ($user_info['type'] == 2) {
|
if ($user_info['type'] == 2) {
|
||||||
$ros[] = 'editor';
|
$ros[] = 'editor';
|
||||||
if($account=="liuna"){
|
if($account=="liuna"||$account=="zhuwenjing"){
|
||||||
$ros[] = "superadmin";
|
$ros[] = "superadmin";
|
||||||
}
|
}
|
||||||
return $ros;
|
return $ros;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use PHPMailer\PHPMailer\PHPMailer;
|
|||||||
use think\Db;
|
use think\Db;
|
||||||
use think\Env;
|
use think\Env;
|
||||||
use think\Cache;
|
use think\Cache;
|
||||||
|
use PhpOffice\PhpWord\IOFactory;
|
||||||
|
|
||||||
|
|
||||||
//use TCPDF;
|
//use TCPDF;
|
||||||
@@ -172,6 +173,61 @@ function proofState($article_id)
|
|||||||
$p_article_obj->where('article_id', $article_id)->where('state', '<>', 1)->where('proof_etime', '<', time())->where('proof_state', 1)->update(['proof_state' => 2]);
|
$p_article_obj->where('article_id', $article_id)->where('state', '<>', 1)->where('proof_etime', '<', time())->where('proof_state', 1)->update(['proof_state' => 2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function readWordImg($article_id,$file){
|
||||||
|
$phpWord = IOFactory::load($file);
|
||||||
|
|
||||||
|
// 获取文档中的所有图像
|
||||||
|
$images = [];
|
||||||
|
foreach ($phpWord->getSections() as $section) {
|
||||||
|
foreach ($section->getElements() as $element) {
|
||||||
|
var_dump(get_class($element)); // 输出每个元素的类名
|
||||||
|
|
||||||
|
// 如果是列表项元素,检查其中是否包含图片
|
||||||
|
if ($element instanceof \PhpOffice\PhpWord\Element\ListItemRun) {
|
||||||
|
foreach ($element->getElements() as $itemElement) {
|
||||||
|
if (method_exists($itemElement, 'getImage')) {
|
||||||
|
$image = $itemElement->getImage();
|
||||||
|
if ($image) {
|
||||||
|
$imageContent = $image->getImageString();
|
||||||
|
$imageName = 'image_' . uniqid() . '.' . $image->getExtension();
|
||||||
|
file_put_contents(ROOT_PATH.'/public/articleImage/'.$article_id."/" . $imageName, $imageContent);
|
||||||
|
$images[] = $imageName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($element instanceof \PhpOffice\PhpWord\Element\Table) {
|
||||||
|
// 检查表格中是否包含图片
|
||||||
|
foreach ($element->getRows() as $row) {
|
||||||
|
foreach ($row->getCells() as $cell) {
|
||||||
|
foreach ($cell->getElements() as $cellElement) {
|
||||||
|
if (method_exists($cellElement, 'getImage')) {
|
||||||
|
$image = $cellElement->getImage();
|
||||||
|
if ($image) {
|
||||||
|
$imageContent = $image->getImageString();
|
||||||
|
$imageName = 'image_' . uniqid() . '.' . $image->getExtension();
|
||||||
|
file_put_contents(ROOT_PATH.'/public/articleImage/'.$article_id."/" . $imageName, $imageContent);
|
||||||
|
$images[] = $imageName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 检查是否是图片元素
|
||||||
|
elseif (method_exists($element, 'getImage')) {
|
||||||
|
$image = $element->getImage();
|
||||||
|
if ($image) {
|
||||||
|
$imageContent = $image->getImageString();
|
||||||
|
$imageName = 'image_' . uniqid() . '.' . $image->getExtension();
|
||||||
|
file_put_contents(ROOT_PATH.'/public/articleImage/'.$article_id."/" . $imageName, $imageContent);
|
||||||
|
$images[] = $imageName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $images;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成文章sn号
|
* 生成文章sn号
|
||||||
* @return type
|
* @return type
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"tecnickcom/tcpdf": "^6.3",
|
"tecnickcom/tcpdf": "^6.3",
|
||||||
"weiwei/api-doc": "^1.6",
|
"weiwei/api-doc": "^1.6",
|
||||||
"topthink/think-queue": "1.1.4",
|
"topthink/think-queue": "1.1.4",
|
||||||
"phpoffice/phpword": "^1.0",
|
"phpoffice/phpword": "^1.2",
|
||||||
"topthink/think-image": "^1.0",
|
"topthink/think-image": "^1.0",
|
||||||
"mpdf/mpdf": "^8.1",
|
"mpdf/mpdf": "^8.1",
|
||||||
"phpoffice/phpexcel": "^1.8",
|
"phpoffice/phpexcel": "^1.8",
|
||||||
|
|||||||
4
vendor/composer/installed.php
vendored
4
vendor/composer/installed.php
vendored
@@ -3,7 +3,7 @@
|
|||||||
'name' => 'topthink/think',
|
'name' => 'topthink/think',
|
||||||
'pretty_version' => 'dev-master',
|
'pretty_version' => 'dev-master',
|
||||||
'version' => 'dev-master',
|
'version' => 'dev-master',
|
||||||
'reference' => '1f7220f36e66f33fb9d3867ecb1856a4d2fb0ae5',
|
'reference' => '79de1c784a0e081dfa16d0bcd35779967aa0fd0a',
|
||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
'topthink/think' => array(
|
'topthink/think' => array(
|
||||||
'pretty_version' => 'dev-master',
|
'pretty_version' => 'dev-master',
|
||||||
'version' => 'dev-master',
|
'version' => 'dev-master',
|
||||||
'reference' => '1f7220f36e66f33fb9d3867ecb1856a4d2fb0ae5',
|
'reference' => '79de1c784a0e081dfa16d0bcd35779967aa0fd0a',
|
||||||
'type' => 'project',
|
'type' => 'project',
|
||||||
'install_path' => __DIR__ . '/../../',
|
'install_path' => __DIR__ . '/../../',
|
||||||
'aliases' => array(),
|
'aliases' => array(),
|
||||||
|
|||||||
Reference in New Issue
Block a user