This commit is contained in:
wangjinlei
2022-12-21 18:41:13 +08:00
parent e05a3d163a
commit 28553a3cd0
3 changed files with 275 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ class Special extends Controller
protected $chief_to_journal_obj = '';
protected $article_reviewer_obj = '';
protected $user_reviewer_recommend_obj = '';
protected $company_top_obj = '';
public function __construct(\think\Request $request = null)
{
@@ -58,6 +59,7 @@ class Special extends Controller
$this->chief_to_journal_obj = Db::name('chief_to_journal');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->user_reviewer_recommend_obj = Db::name('user_reviewer_recommend');
$this->company_top_obj = Db::name('company_top');
}
/**
@@ -565,6 +567,7 @@ class Special extends Controller
if ($res && $res_author && $transr && $res_file1 && $res_file2 && $res_file3 && $res_log && $res_msg) {
Db::commit();
$this->ai_scor($data['article_id']);
return json(['code' => 0]);
} else {
Db::rollback();
@@ -572,6 +575,127 @@ class Special extends Controller
}
}
/**
* 人工智能打分
*/
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();
$authors = $this->article_author_obj->where('article_id',$article_id)->where('is_report',1)->where('state',0)->select();
$user_id = $article_info['user_id'];
$g_index = 0;
foreach($authors as $v){
$c_user = $this->user_obj->where('email',$v['email'])->find();
if($c_user['google_index']>=$g_index){
$user_id = $c_user['user_id'];
$g_index = $c_user['google_index'];
}
}
$user_info = $this->user_obj->where('user_id',$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;
$report_author = $this->article_author_obj->where('email',$user_info['email'])->find();
if($report_author){
$ca_res = $this->company_top_obj->where('title',$report_author['company'])->find();
if($ca_res){
$dw_fen = 1.5;
$fen+=1.5;
}
}
//领域
$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;
}
}
/**
* 客座编辑添加审稿人
*/