Files
tougao/application/api/controller/Super.php
wangjinlei e31c67e77c 20201112
2021-03-30 14:55:44 +08:00

129 lines
4.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
class Super extends Controller{
protected $article_obj = '';
protected $user_obj = '';
protected $user_act_obj = '';
protected $journal_obj = '';
protected $user_log_obj = '';
protected $reviewer_major_obj = '';
protected $reviewer_to_journal_obj = '';
protected $article_msg_obj = '';
protected $article_file_obj = '';
protected $article_reviewer_obj = '';
protected $article_author_obj = '';
protected $article_transfer_obj = '';
protected $staff_obj = '';
protected $staff_level_obj = '';
protected $staff_log_obj = '';
protected $staff_to_journal_obj = '';
public function __construct(\think\Request $request = null) {
parent::__construct($request);
$this->user_obj = Db::name('user');
$this->user_act_obj = Db::name('user_act');
$this->article_obj = Db::name('article');
$this->journal_obj = Db::name('journal');
$this->user_log_obj = Db::name('user_log');
$this->reviewer_major_obj = Db::name('reviewer_major');
$this->reviewer_to_journal_obj = Db::name('reviewer_to_journal');
$this->article_msg_obj = Db::name('article_msg');
$this->article_file_obj = Db::name('article_file');
$this->article_reviewer_obj = Db::name('article_reviewer');
$this->article_author_obj = Db::name('article_author');
$this->article_transfer_obj = Db::name('article_transfer');
$this->staff_obj = Db::name('staff');
$this->staff_level_obj = Db::name('staff_level');
$this->staff_log_obj = Db::name('staff_log');
$this->staff_to_journal_obj = Db::name('staff_to_journal');
}
public function index() {
$res = $this->getLYL(1);
echo ($res*100).'%';
}
/**
* 获取录用率
*/
private function getLYL($journalId){
$res = $this->article_obj->field('state,count(state) as num')->where('journal_id',$journalId)->where('state','in','3,5')->group('state')->select();
foreach ( $res as $v){
if($v['state']==3){
$jj = $v['num'];
} else {
$js = $v['num'];
}
}
return $js/($js+$jj);
}
/**
* 获取查重异常
*/
private function getCC($journalId){
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
$low = 0;
$mid = 0;
$high = 0;
foreach ($res as $v){
if($v['repetition']<20){
$low++;
}elseif($v['repetition']>=20 && $v['repetition']<50){
$mid++;
}else{
$high++;
}
}
$re['low'] = $low;
$re['mid'] = $mid;
$re['high'] = $high;
return $re;
}
/**
* 获取外审异常
*/
private function getWS($journalId){
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
$np =0;
foreach ( $res as $v){
$ca = $this->article_reviewer_obj->where('article_id',$v['article_id'])->count();
if($ca<2){
$np++;
}
}
$re['all'] = count($res);
$re['np'] = $np;
return $re;
}
/**
* 获取时间异常
*/
private function getSJ($journalId){
$res = $this->article_obj->where('journal_id',$journalId)->where('state',5)->select();
foreach ($res as $v){
//文章提交至接收超过48小时
$t48 = $this->article_obj->where('journal_id',$v['journal_id'])->where('state',0)->count();
//文章接受时间小于15天
//文章接收时间大于120天
//with editor时间超过三天预留
$cache_list = $this->article_obj->where('journal_id',$v['journal_id'])->where('state',5)->select();
}
}
}