latex update
This commit is contained in:
@@ -50,57 +50,57 @@ class Production extends Base
|
||||
}
|
||||
|
||||
$article_info = $this->article_obj->where('article_id', $data['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');
|
||||
}
|
||||
// $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');
|
||||
// }
|
||||
|
||||
$url = $this->ts_base_url . "api/typeset/webReaddoc";
|
||||
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||
$res = object_to_array(json_decode(myPost($url, $program)));
|
||||
$file_runs = $res['data'];
|
||||
// $url = $this->ts_base_url . "api/typeset/webReaddoc";
|
||||
// $program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
|
||||
// $res = object_to_array(json_decode(myPost($url, $program)));
|
||||
// $file_runs = $res['data'];
|
||||
|
||||
// return jsonSuccess($file_runs);
|
||||
//整理信息
|
||||
$frag = [];
|
||||
$aa = [];
|
||||
$frag['title'] = $article_info['title'];
|
||||
$start_refer = false;
|
||||
foreach ($file_runs as $k => $v) {
|
||||
if ($start_refer && $v != '') {
|
||||
if (strlen($v) > 500) {
|
||||
$start_refer = false;
|
||||
$frag['main'][] = $v;
|
||||
continue;
|
||||
}
|
||||
$frag['references'][] = $v;
|
||||
continue;
|
||||
}
|
||||
$g_val = trim(preg_replace('/\<.*?\>/', '', $v));
|
||||
$aa[] = $g_val;
|
||||
|
||||
if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
|
||||
$frag['keywords'] = $v;
|
||||
continue;
|
||||
}
|
||||
if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
|
||||
$start_refer = true;
|
||||
continue;
|
||||
}
|
||||
$frag['main'][] = $v;
|
||||
}
|
||||
// $frag = [];
|
||||
// $aa = [];
|
||||
// $frag['title'] = $article_info['title'];
|
||||
// $start_refer = false;
|
||||
// foreach ($file_runs as $k => $v) {
|
||||
// if ($start_refer && $v != '') {
|
||||
// if (strlen($v) > 500) {
|
||||
// $start_refer = false;
|
||||
// $frag['main'][] = $v;
|
||||
// continue;
|
||||
// }
|
||||
// $frag['references'][] = $v;
|
||||
// continue;
|
||||
// }
|
||||
// $g_val = trim(preg_replace('/\<.*?\>/', '', $v));
|
||||
// $aa[] = $g_val;
|
||||
//
|
||||
// if ((strpos(strtolower(trim($g_val)), "keyword") == 0 || strpos(strtolower(trim($g_val)), "keyword") == 1) && !isset($frag['keywords'])) {
|
||||
// $frag['keywords'] = $v;
|
||||
// continue;
|
||||
// }
|
||||
// if (strtolower($g_val) == 'reference:' || strtolower($g_val) == 'references:' || strtolower($g_val) == 'references' || strtolower($g_val) == 'reference') {
|
||||
// $start_refer = true;
|
||||
// continue;
|
||||
// }
|
||||
// $frag['main'][] = $v;
|
||||
// }
|
||||
|
||||
|
||||
if (!isset($frag['main'])) {
|
||||
return jsonError("manuscript file error!");
|
||||
}
|
||||
// if (!isset($frag['main'])) {
|
||||
// return jsonError("manuscript file error!");
|
||||
// }
|
||||
|
||||
$insert['main'] = isset($frag['main']) ? json_encode($frag['main']) : '';
|
||||
$insert['main'] = '';//isset($frag['main']) ? json_encode($frag['main']) : '';
|
||||
$insert['article_id'] = $data['article_id'];
|
||||
$insert['journal_id'] = $article_info['journal_id'];
|
||||
$insert['ctime'] = time();
|
||||
@@ -108,13 +108,13 @@ class Production extends Base
|
||||
|
||||
|
||||
//将主体内容写入数据库
|
||||
foreach ($frag['main'] as $v) {
|
||||
$ca['p_article_id'] = $p_article_id;
|
||||
$ca['content'] = $v;
|
||||
$ca['content_g'] = '';
|
||||
$ca['ctime'] = time();
|
||||
$this->production_article_main_obj->insert($ca);
|
||||
}
|
||||
// foreach ($frag['main'] as $v) {
|
||||
// $ca['p_article_id'] = $p_article_id;
|
||||
// $ca['content'] = $v;
|
||||
// $ca['content_g'] = '';
|
||||
// $ca['ctime'] = time();
|
||||
// $this->production_article_main_obj->insert($ca);
|
||||
// }
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
@@ -260,21 +260,22 @@ class Production extends Base
|
||||
*/
|
||||
public function getProductionMains()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
"p_article_id" => "require"
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||
$frag = $this->getProductionMainImgs($data['p_article_id']);
|
||||
if (count($frag) == 0) {
|
||||
return jsonError("create error");
|
||||
}
|
||||
$re['mains'] = $frag;
|
||||
$re['production'] = $p_info;
|
||||
return jsonSuccess($re);
|
||||
die("stop service!");
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// "p_article_id" => "require"
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $p_info = $this->production_article_obj->where('p_article_id', $data['p_article_id'])->find();
|
||||
// $frag = $this->getProductionMainImgs($data['p_article_id']);
|
||||
// if (count($frag) == 0) {
|
||||
// return jsonError("create error");
|
||||
// }
|
||||
// $re['mains'] = $frag;
|
||||
// $re['production'] = $p_info;
|
||||
// return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,30 +283,31 @@ class Production extends Base
|
||||
*/
|
||||
public function getProductionMainsByDoi()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'doi' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$a = explode('/', $data['doi']);
|
||||
$pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find();
|
||||
if (!$pro_info) {
|
||||
return jsonError("production error");
|
||||
}
|
||||
|
||||
if (isset($data['file']) && $data['file'] != "") {
|
||||
$frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']);
|
||||
} else {
|
||||
$frag = $this->getProductionMainImgs($pro_info['p_article_id']);
|
||||
}
|
||||
if (count($frag) == 0) {
|
||||
return jsonError("create error");
|
||||
}
|
||||
$re['mains'] = $frag;
|
||||
$re['production'] = $pro_info;
|
||||
return jsonSuccess($re);
|
||||
die("stop service");
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'doi' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $a = explode('/', $data['doi']);
|
||||
// $pro_info = $this->production_article_obj->where('doi', $a[1])->where('state', 2)->find();
|
||||
// if (!$pro_info) {
|
||||
// return jsonError("production error");
|
||||
// }
|
||||
//
|
||||
// if (isset($data['file']) && $data['file'] != "") {
|
||||
// $frag = $this->getProductionMainImgsByNew($pro_info['p_article_id'], $data['file']);
|
||||
// } else {
|
||||
// $frag = $this->getProductionMainImgs($pro_info['p_article_id']);
|
||||
// }
|
||||
// if (count($frag) == 0) {
|
||||
// return jsonError("create error");
|
||||
// }
|
||||
// $re['mains'] = $frag;
|
||||
// $re['production'] = $pro_info;
|
||||
// return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
@@ -314,117 +316,117 @@ class Production extends Base
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function delProductionMain()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_main_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function delProductionMain()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_main_id' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update(['state' => 1]);
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
/**添加主体文章图片
|
||||
* @return void
|
||||
*/
|
||||
public function addProductionMainImg()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require',
|
||||
"pre_type" => "require",
|
||||
"body" => "require",
|
||||
"content" => "require",
|
||||
"width" => "require",
|
||||
"note" => "require"
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$insert['p_article_id'] = $data['p_article_id'];
|
||||
if ($data['pre_type'] == "main") {
|
||||
$insert['p_main_id'] = $data['body'];
|
||||
} else {
|
||||
$insert['pre_id'] = $data['body'];
|
||||
}
|
||||
$insert['content'] = $data['content'];
|
||||
$insert['width'] = $data['width'];
|
||||
$insert['title'] = $data['title'];
|
||||
$insert['note'] = $data['note'];
|
||||
$this->production_article_main_img_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function addProductionMainImg()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_article_id' => 'require',
|
||||
// "pre_type" => "require",
|
||||
// "body" => "require",
|
||||
// "content" => "require",
|
||||
// "width" => "require",
|
||||
// "note" => "require"
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $insert['p_article_id'] = $data['p_article_id'];
|
||||
// if ($data['pre_type'] == "main") {
|
||||
// $insert['p_main_id'] = $data['body'];
|
||||
// } else {
|
||||
// $insert['pre_id'] = $data['body'];
|
||||
// }
|
||||
// $insert['content'] = $data['content'];
|
||||
// $insert['width'] = $data['width'];
|
||||
// $insert['title'] = $data['title'];
|
||||
// $insert['note'] = $data['note'];
|
||||
// $this->production_article_main_img_obj->insert($insert);
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
/**删除mainimg
|
||||
* @return void
|
||||
*/
|
||||
public function delProductionMainImg()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_main_img_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find();
|
||||
$next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find();
|
||||
if ($next_info) {
|
||||
if ($p_img_info['p_main_id'] == 0) {
|
||||
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]);
|
||||
} else {
|
||||
$this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]);
|
||||
}
|
||||
}
|
||||
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function delProductionMainImg()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_main_img_id' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $p_img_info = $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->find();
|
||||
// $next_info = $this->production_article_main_img_obj->where('pre_id', $p_img_info['p_main_img_id'])->find();
|
||||
// if ($next_info) {
|
||||
// if ($p_img_info['p_main_id'] == 0) {
|
||||
// $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['pre_id' => $p_img_info['pre_id']]);
|
||||
// } else {
|
||||
// $this->production_article_main_img_obj->where('p_main_img_id', $next_info['p_main_img_id'])->update(['p_main_id' => $p_img_info['p_main_id']]);
|
||||
// }
|
||||
// }
|
||||
// $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update(['state' => 1]);
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
/**编辑mainimg
|
||||
* @return void
|
||||
*/
|
||||
public function editProductionMainImg()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_main_img_id' => 'require',
|
||||
"width" => "require",
|
||||
"content" => "require",
|
||||
"note" => "require"
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['width'] = $data['width'];
|
||||
$update['content'] = $data['content'];
|
||||
$update['title'] = $data['title'];
|
||||
$update['note'] = $data['note'];
|
||||
$this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function editProductionMainImg()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_main_img_id' => 'require',
|
||||
// "width" => "require",
|
||||
// "content" => "require",
|
||||
// "note" => "require"
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $update['width'] = $data['width'];
|
||||
// $update['content'] = $data['content'];
|
||||
// $update['title'] = $data['title'];
|
||||
// $update['note'] = $data['note'];
|
||||
// $this->production_article_main_img_obj->where('p_main_img_id', $data['p_main_img_id'])->update($update);
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 编辑main内容
|
||||
* @return \think\response\Json|void
|
||||
*
|
||||
*/
|
||||
public function editProductionMain()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_main_id' => 'require',
|
||||
'content' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$update['content'] = trim($data['content']);
|
||||
$this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function editProductionMain()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_main_id' => 'require',
|
||||
// 'content' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $update['content'] = trim($data['content']);
|
||||
// $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->update($update);
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
|
||||
public function pushMainToWeb()
|
||||
@@ -451,24 +453,24 @@ class Production extends Base
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
public function mainGptcheck()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_main_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find();
|
||||
if (mb_strlen($main_info['content']) < 20) {
|
||||
return trim($main_info['content']);
|
||||
}
|
||||
$res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 :' . trim($main_info['content']))));
|
||||
$r = $res['choices'][0]['message']['content'];
|
||||
$re['content'] = $r;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
// public function mainGptcheck()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_main_id' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $main_info = $this->production_article_main_obj->where('p_main_id', $data['p_main_id'])->find();
|
||||
// if (mb_strlen($main_info['content']) < 20) {
|
||||
// return trim($main_info['content']);
|
||||
// }
|
||||
// $res = object_to_array(json_decode(pushGpt('请将以下内容按照医学期刊的标准校对,不要改变原意,主要是对格式和拼写的校对,将<b></b><i></i>这四个标签保留,将校对好的内容返回 :' . trim($main_info['content']))));
|
||||
// $r = $res['choices'][0]['message']['content'];
|
||||
// $re['content'] = $r;
|
||||
// return jsonSuccess($re);
|
||||
// }
|
||||
|
||||
public function getPublicMains()
|
||||
{
|
||||
@@ -1835,26 +1837,26 @@ class Production extends Base
|
||||
/**
|
||||
* gpt校对main内容
|
||||
*/
|
||||
public function freshMain()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
$rule = new Validate([
|
||||
'p_article_id' => 'require'
|
||||
]);
|
||||
if (!$rule->check($data)) {
|
||||
return jsonError($rule->getError());
|
||||
}
|
||||
$list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||
foreach ($list as $v) {
|
||||
if ($v['content'] == '' || strlen($v['content']) < 60) {
|
||||
$this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]);
|
||||
} else {
|
||||
Queue::push('app\api\job\gpt@fresh', $v, 'gpt');
|
||||
}
|
||||
}
|
||||
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
// public function freshMain()
|
||||
// {
|
||||
// $data = $this->request->post();
|
||||
// $rule = new Validate([
|
||||
// 'p_article_id' => 'require'
|
||||
// ]);
|
||||
// if (!$rule->check($data)) {
|
||||
// return jsonError($rule->getError());
|
||||
// }
|
||||
// $list = $this->production_article_main_obj->where('p_article_id', $data['p_article_id'])->where('state', 0)->select();
|
||||
// foreach ($list as $v) {
|
||||
// if ($v['content'] == '' || strlen($v['content']) < 60) {
|
||||
// $this->production_article_main_obj->where('p_main_id', $v['p_main_id'])->update(['content_g' => $v['content']]);
|
||||
// } else {
|
||||
// Queue::push('app\api\job\gpt@fresh', $v, 'gpt');
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return jsonSuccess([]);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user