This commit is contained in:
wangjinlei
2022-11-23 14:48:15 +08:00
parent 0a92e69b83
commit ec59e99a8b
636 changed files with 59164 additions and 46329 deletions

View File

@@ -14,6 +14,7 @@ use think\Validate;
class Article extends Controller {
protected $article_obj = '';
protected $country_obj = '';
protected $user_obj = '';
protected $user_act_obj = '';
protected $journal_obj = '';
@@ -44,6 +45,7 @@ class Article extends Controller {
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->country_obj = Db::name('country');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
@@ -313,14 +315,14 @@ class Article extends Controller {
// $suggest = $lastbean['content'];
// }
//查询审稿人审稿建议
if($article_res['state']==4){
// if($article_res['state']==4){
$suggest = $this->article_reviewer_obj->field('t_article_reviewer.*,t_article_reviewer_question.qu9_contents,t_article_reviewer_question.qu10_contents,t_article_reviewer_question.qu11_contents,t_article_reviewer_question.qu12_contents,t_article_reviewer_question.qu13_contents,t_article_reviewer_question.qu14_contents,t_article_reviewer_question.qu15_contents,t_article_reviewer_question.comments comments')
->join('t_article_reviewer_question','t_article_reviewer.art_rev_id=t_article_reviewer_question.art_rev_id','left')
->where('t_article_reviewer.state','<',4)
->where('t_article_reviewer.state','>',0)
->where('t_article_reviewer.article_id',$article_res['article_id'])
->select();
}
// }
//查询major信息
// $major_data = [];
@@ -1352,9 +1354,9 @@ class Article extends Controller {
. ' in the journal '.$journal_info['title'].'. <br>';
$tt .= 'Please bring into our knowledge if there is any potential Conflict of Interest. If you agree to review this manuscript, we ask you to complete your review and submit it by submission system within 14 days of receipt of the manuscript.<br><br>';
$tt .= 'Thank you for your consideration.<br> Look forward for your reply.<br>';
$tt .= '<a href="'.$this->creatLoginUrlForreviewer($reviewer_info,$res).'">Click here to review the article</a><br>';
$tt .= '<a href="'.$this->creatLoginUrlForreviewer($reviewer_info,$res).'">Click here to accept the invitation to review</a><br>';
// $tt .= '<a href="https://submission.tmrjournals.com/">Click here to review the article</a><br>';
$tt .= '<a href="'.$this->creatRejectUrlForReviewer($reviewer_info, $res).'">Click on the link to reject the review of this manuscript</a><br>';
$tt .= '<a href="'.$this->creatRejectUrlForReviewer($reviewer_info, $res).'">Click here to decline the invitation to review</a><br>';
$tt .= 'Your username:'.$reviewer_info['account'].'<br><br>';
$tt .= 'Your original password:123456qwe, if you have reset the password, please login with the new one or click the "<a href="https://submission.tmrjournals.com/retrieve">forgot password</a>".<br>';
$tt .= 'Sincerely,<br>Editorial Office<br>';
@@ -1627,6 +1629,7 @@ class Article extends Controller {
if ($res && $res_author && $transr && $res_file1 && $res_file2 && $res_file3 && $res_file4 && $res_log && $res_msg && $recommend_res) {
Db::commit();
$this->ai_scor($res);
return json(['code' => 0]);
} else {
Db::rollback();
@@ -1634,8 +1637,114 @@ class Article extends Controller {
}
}
public function ffff(){
$data = $this->request->post();
$this->ai_scor($data['article_id']);
}
/**
* 人工智能打分
*/
public function ai_scor($article_id){
$article_info = $this->article_obj->where('article_id',$article_id)->find();
$files = $this->article_file_obj->where('article_id',$article_id)->where('type_name','manuscirpt')
->order('ctime desc')
->limit(1)
->select();
$user_info = $this->user_obj->where('user_id',$article_info['user_id'])->find();
$fen = 0;
//h指数分数
$h_fen = 0;
if($user_info['google_index']>=20){
$h_fen = 4;
}elseif($user_info['google_index']>=6){
$h_fen = 3;
}elseif($user_info['google_index']>=2){
$h_fen = 1;
}else{
$h_fen = 0;
}
$fen += $h_fen;
//图表
$b_fen = 0;
$p_num = 0;
$url = "http://ts.tmrjournals.com/api/typeset/readPic";
$program['fileRoute'] = "https://submission.tmrjournals.com/public/" . $files[0]['file_url'];
$res = object_to_array(json_decode(myPost($url, $program)));
$wp = $res['data'];
$pics = $this->article_file_obj->where('article_id',$article_id)->where('type_name','picturesAndTables')->select();
$np = 0;
foreach($pics as $v){
$ext = substr(strrchr($v['file_url'],'.'),1);
if($ext=='zip'){
$cn = $this->readZip(ROOT_PATH . "public".DS.$v['file_url']);
$np += $cn;
}else{
$np++;
}
}
$p_num = $wp>$np?$wp:$np;
if($p_num>3){
$b_fen = 2;
}elseif($p_num>=1){
$b_fen = 1;
}else{
$b_fen = 0;
}
$fen += $b_fen;
//国家
$c_fen = 0;
$author = $this->article_author_obj->where('article_id',$article_id)->where('is_report',1)->find();
if($author['country']!=""){
$coun = $this->country_obj->where('en_name',$author['country'])->find();
if($coun&&$coun['is_hot']==1){
$c_fen = 1;
$fen+=1;
}
}
//单位
$dw_fen = 0;
//领域
$ly_fen = 0;
$m = $this->major_obj->where('major_id',$article_info['major_id'])->find();
if($m['is_hot']==1){
$ly_fen = 1;
$fen += 1;
}
//基金
$jj_fen = 0;
if(strlen($article_info['fund'])>15){
$jj_fen = 0.5;
$fen += 0.5;
}
// return $fen;
$updata['scoring'] = $fen;
$updata['h_fen'] = $h_fen;
$updata['b_fen'] = $b_fen;
$updata['c_fen'] = $c_fen;
$updata['dw_fen'] = $dw_fen;
$updata['ly_fen'] = $ly_fen;
$updata['jj_fen'] = $jj_fen;
$this->article_obj->where('article_id',$article_id)->update($updata);
}
private function readZip($file){
$zip = new \ZipArchive();
if($zip->open($file)===true){
return $zip->numFiles;
}else{
return 0;
}
}
/**
* 添加推荐审稿人
*/
public function addRecommentReviewer($reivewe,$journal_id,$user_id,$article_id){

View File

@@ -660,7 +660,9 @@ class Production extends Controller
return jsonError($rule->getError());
}
$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]);
return jsonSuccess([]);
}
@@ -1071,8 +1073,8 @@ class Production extends Controller
//发送邮件
$tt = "Dear Author,<br/><br/>";
$tt .= "Please confirm proof of your manuscript on the submission website within 48 hours. (https://submission.tmrjournals.com)<br/><br/>";
$tt .= "<a href='https://submission.tmrjournals.com/api/Production/editProofFromEmail/articleId/".$p_info['article_id']."'>Click here to confirm the proof.</a><br/>";
$tt .= "<a href='https://submission.tmrjournals.com'>Click here to make changes based on this version.</a><br/><br/>";
// $tt .= "<a href='https://submission.tmrjournals.com/api/Production/editProofFromEmail/articleId/".$p_info['article_id']."'>Click here to confirm the proof.</a><br/>";
$tt .= "<a href='https://submission.tmrjournals.com'>Click here to view and confirm the proof.</a><br/><br/>";
$tt .= "If your response is not received, we will regard the author's consent to the version if the time exceeds.<br/><br/>";
$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.";

View File

@@ -1758,6 +1758,13 @@ class Reviewer extends Controller
->count();
}
}
foreach($list as $k => $v){
$list[$k]['now'] = $this->article_reviewer_obj->where('reviewer_id',$v['user_id'])->where('state',0)->count();
}
$re['reviewers'] = $list;
$re['count'] = $count;
return jsonSuccess($re);

View File

@@ -7,6 +7,7 @@ use think\Db;
use think\captcha;
use think\Cache;
use think\Env;
use think\Loader;
use think\Queue;
use think\Validate;
@@ -156,6 +157,7 @@ class User extends Controller
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'realname'=>'require',
'wos_index'=>'require',
'google_index'=>'require'
]);
@@ -172,6 +174,8 @@ class User extends Controller
$updata['google_index'] = $data['google_index'];
$updata['google_time'] = time();
}
$updata['realname'] = trim($data['realname']);
$updata['localname'] = trim($data['localname']);
if(count($updata)>0){
$this->user_obj->where('user_id',$data['user_id'])->update($updata);
}
@@ -188,6 +192,7 @@ class User extends Controller
* @param name:pageIndex type:int require:1 desc:当前页码数
* @param name:pageSize type:int require:1 desc:单页数据条数
* @param name:username type:string require:1 desc:用户名或邮箱
* @param name:role type:string require:1 desc:0全部1editor2reviewer3board
*
* @return users:用户列表#
* @return count:总数
@@ -195,17 +200,45 @@ class User extends Controller
public function getAllUser()
{
$data = $this->request->post();
$rule = new Validate([
'pageIndex'=>'require',
'pageSize'=>'require',
'role'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
$black_list = $this->user_black_obj->where('black_state', 0)->column("user_id");
$frag = [];
$count = 0;
if ($data['username'] == "") {
$frag = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->count();
} else {
$frag = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where('state', 0)->where("user_id", "not in", $black_list)->where("account|email", 'like', '%' . trim($data['username'] . '%'))->count();
$where = [];
$where['state'] = 0;
// $where['user_id'] = ['not in',$black_list];
if ($data['username'] != "") {
$where["account|email"] = ['like','%' . trim($data['username'] . '%')];
}
if($data['role']==1){
$where['type'] = 2;
}elseif($data['role']==2){
$c = $this->reviewer_to_journal_obj->where('state',0)->column('reviewer_id');
$where['user_id'] = ['in',$c];
}elseif($data['role']==3){
$cc = $this->board_to_journal_obj->where('state',0)->column('user_id');
$where['user_id'] = ['in',$cc];
}
if(isset($where['user_id'])){
$where['user_id'] = [['not in',$black_list],$where['user_id']];
}else{
$where['user_id'] = ['not in',$black_list];
}
$frag = $this->user_obj->where($where)->limit($limit_start, $data['pageSize'])->select();
$count = $this->user_obj->where($where)->count();
foreach ($frag as $k => $v) {
$frag[$k]['roles'] = $this->getUserRoles($v['account']);
}
@@ -444,6 +477,11 @@ class User extends Controller
$specials[] = $cache_info;
}
//如果是审稿人的,获取期审稿人的附加信息
$reviewer_info = $this->user_reviewer_info_obj->where('reviewer_id',$data['user_id'])->where('state',0)->find();
if($reviewer_info){
$user_info['company'] = $reviewer_info['company'];
}
$user_info['specials'] = $specials;
$re['user'] = $user_info;
return jsonSuccess($re);
@@ -514,6 +552,155 @@ class User extends Controller
}
}
/**
* 谷歌测试
*/
public function googleTest(){
Loader::import("google.google-search-results");
Loader::import("google.restclient");
// require 'path/to/google-search-results.php';
// require 'path/to/restclient.php';
// $query = [
// "engine" => "google_scholar",
// "q" => "biology",
// ];
// $query = [
// "engine" => "google_scholar_author",
// "author_id" => "YrGbzsEAAAAJ",
// ];
$query = [
"engine" => "google_scholar_profiles",
"mauthors" => "biol",
];
$search = new \GoogleSearch('7651ca6caf949b0ac6ce28a95f3d2e9d8ee51b024ba7fad86f0298fb84290765');
$result = $search->get_json($query);
// $organic_results = $result->organic_results;
$organic_results = $result;
dump($organic_results);
}
/**
* 获取google学术人物列表
*/
public function googleGetAuthor(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
if($user_info['g_author']!=''||$user_info['realname']==''){
return jsonError('Google account is tied/Please tied your realname first before proceeding to the next step');
}
Loader::import("google.google-search-results");
Loader::import("google.restclient");
$query = [
"engine" => "google_scholar_profiles",
"mauthors" => $user_info['realname'],
];
$search = new \GoogleSearch('7651ca6caf949b0ac6ce28a95f3d2e9d8ee51b024ba7fad86f0298fb84290765');
$result = $search->get_json($query);
$organic_results = object_to_array($result);
if(isset($organic_results['profiles'])){
$re['authors'] = $organic_results['profiles'];
return jsonSuccess($re);
}else{
return jsonError('no date');
}
}
/**
* 绑定谷歌用户id
*/
public function googleBindAuthor(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require',
'g_author'=>'require',
// 'website'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
// $this->user_obj->where('user_id',$data['user_id'])->update(['g_author'=>trim($data['g_author']),'g_website'=>trim($data['website'])]);
$this->user_obj->where('user_id',$data['user_id'])->update(['g_author'=>trim($data['g_author'])]);
//绑定完成后自动获取指数
Loader::import("google.google-search-results");
Loader::import("google.restclient");
$query = [
"engine" => "google_scholar_author",
"author_id" => $data['g_author']
];
$search = new \GoogleSearch('7651ca6caf949b0ac6ce28a95f3d2e9d8ee51b024ba7fad86f0298fb84290765');
$result = $search->get_json($query);
$organic_results = object_to_array($result);
$h_index= 0;
// if(isset($organic_results['cited_by']['table']['h_index'])){
$h_index = $organic_results['cited_by']['table'][1]['h_index']['all'];
// }else{
// $h_index = $organic_results['cited_by']['table']['indice_h']['all'];
// }
$updata['google_index'] = $h_index;
$updata['google_time'] = time();
$this->user_obj->where('user_id',$data['user_id'])->update($updata);
return jsonSuccess($organic_results);
}
/**
* 获取H指数
*/
public function googleGetIndex(){
$data = $this->request->post();
$rule = new Validate([
'user_id'=>'require'
]);
if(!$rule->check($data)){
return jsonError($rule->getError());
}
$user_info = $this->user_obj->where('user_id',$data['user_id'])->find();
if($user_info['google_time']>strtotime('-1 year')){
return jsonError('The time interval obtained is one year');
}
if($user_info['g_author']==''){
return jsonError('google_id is null , please bind google_id before the request.');
}
Loader::import("google.google-search-results");
Loader::import("google.restclient");
$query = [
"engine" => "google_scholar_author",
"author_id" => $user_info['g_author']
];
$search = new \GoogleSearch('7651ca6caf949b0ac6ce28a95f3d2e9d8ee51b024ba7fad86f0298fb84290765');
$result = $search->get_json($query);
$organic_results = object_to_array($result);
$h_index= 0;
// if(isset($organic_results['cited_by']['table']['h_index'])){
$h_index = $organic_results['cited_by']['table'][1]['h_index']['all'];
// }else{
// $h_index = $organic_results['cited_by']['table']['indice_h']['all'];
// }
$updata['google_index'] = $h_index;
$updata['google_time'] = time();
$this->user_obj->where('user_id',$data['user_id'])->update($updata);
return jsonSuccess($organic_results);
}
/**
* @title 审稿系统登录功能

View File

@@ -78,16 +78,18 @@ function sendEmail($email = '', $title = '', $from_name = '', $content = '', $me
$mail->msgHTML($content);
//Replace the plain text body with one created manually
$mail->AltBody = '';
// if (is_array($attachmentFile)) {
// for ($i = 0; $i < count($attachmentFile); $i++) {
// $mail->addAttachment($attachmentFile[$i], 'thanks' . $i.'.jpg'); //这里可以是多维数组,然后循环附件的文件和名称
// }
// } else {
if (is_array($attachmentFile)) {
for ($i = 0; $i < count($attachmentFile); $i++) {
if($attachmentFile[$i]!=''){
$mail->addAttachment($attachmentFile[$i],substr($attachmentFile[$i],strrpos($attachmentFile[$i],DS)+1)); //这里可以是多维数组,然后循环附件的文件和名称
}
}
} else {
if ($attachmentFile != '') {
//Attach an image file
$mail->addAttachment($attachmentFile, substr($attachmentFile,strrpos($attachmentFile,DS)+1));
}
// }
}
//send the message, check for errors
if (!$mail->send()) {
$status = 0;