This commit is contained in:
wangjinlei
2021-04-15 09:34:47 +08:00
parent 5f7f50fe82
commit 90077baf99
3 changed files with 306 additions and 40 deletions

View File

@@ -15,6 +15,7 @@ class Publish extends Controller{
const JURL = 'http://api.tmrjournals.com/public/index.php/api/Article/getArticleForJournal';
const TJ_URL = 'http://api.tmrjournals.com/public/index.php/api/Super/main';
const AL_URL = 'http://api.tmrjournals.com/public/index.php/api/Super/getAllArticle';
const CCA_URL = 'http://api.tmrjournals.com/public/index.php/api/Super/getCCArticles';
protected $admin_obj = '';
protected $journal_obj = '';
@@ -59,8 +60,8 @@ class Publish extends Controller{
}
/**
* @title 获取期刊列表
* @description 获取期刊列表
* @title 获取期刊列表(出刊时间)
* @description 获取期刊列表(出刊时间)
* @author wangjinlei
* @url /super/Publish/getMain
* @method POST
@@ -85,10 +86,11 @@ class Publish extends Controller{
$cs['ctime'] = $ctime;
$journals[$k]['last_time'] = $ctime;
$cache_arts = $this->object_to_array(json_decode(myPost(self::JURL,$cs)));
// $journals[$k]['arts'] = $cache_arts['data'];
$count = is_array($cache_arts['data']['articles'])?count($cache_arts['data']['articles']):0;
$journals[$k]['artCount'] = $count;
}
//按照危险值排序
for($i=0;$i<count($journals);$i++){
for($j=$i+1;$j<count($journals);$j++){
if($journals[$i]['mark']['mk']<$journals[$j]['mark']['mk']){
@@ -117,6 +119,26 @@ class Publish extends Controller{
}
}
/**
* @title 验证登录
* @description 验证登录
* @author wangjinlei
* @url /super/Publish/check_login
* @method POST
*
* @param name:account type:string require:1 desc:账户密码
* @param name:password type:string require:1 desc:密码
*
*/
public function check_login(){
$data = $this->request->post();
if($data['account'] == 'supervise'&&$data['password']=='wu751019'){
return jsonSuccess([]);
} else {
return jsonError('check error!');
}
}
/**
* @title 获取合规检测
* @description 获取合规检测
@@ -124,6 +146,9 @@ class Publish extends Controller{
* @url /super/Publish/getTjJournal
* @method POST
*
* @param name:start type:string require:1 desc:开始时间
* @param name:end type:string require:1 desc:结束时间
*
* @return dates:数据@
* @dates LYL:录用率
* @dates CC:查重
@@ -131,7 +156,33 @@ class Publish extends Controller{
* @dates SJ:时间
*/
public function getTjJournal(){
$res = myPost(self::TJ_URL);
$data = $this->request->post();
$pa['start'] = $data['start'];
$pa['end'] = $data['end'];
$res = myPost(self::TJ_URL,$pa);
return $res;
}
/**
* @title 获取查重文章
* @description 获取查重文章
* @author wangjinlei
* @url /super/Publish/getCCArticle
* @method POST
*
* @param name:issn type:int require:1 desc:期刊id
* @param name:type type:string require:1 desc:重复类型
* @param name:start type:string require:1 desc:开始时间
* @param name:end type:string require:1 desc:结束时间
*
*/
public function getCCArticle(){
$data = $this->request->post();
$pa['issn'] = $data['issn'];
$pa['type'] = $data['type'];
$pa['start'] = $data['start'];
$pa['end'] = $data['end'];
$res = myPost(self::CCA_URL,$pa);
return $res;
}
@@ -183,7 +234,12 @@ class Publish extends Controller{
$frag = [];
$frag['all'] = 0;
for($i=2016;$i<= intval(date('Y'));$i++){
$cstages = $this->journal_stage_obj->where('journal_id',$journal_id)->where('stage_year',$i)->where('state',0)->column('journal_stage_id');
$cstages = $this->journal_stage_obj
->where('journal_id',$journal_id)
->where('stage_year',$i)
->where('is_publish',1)
->where('state',0)
->column('journal_stage_id');
$frag[$i] = $this->article_obj->where('journal_stage_id','in',$cstages)->where('state',0)->count();
$frag['all'] += $frag[$i];
}
@@ -192,7 +248,12 @@ class Publish extends Controller{
private function getLX($journal_id){
$arts = $this->article_obj->where('journal_id',$journal_id)->where('state',0)->select();
$stages = $this->journal_stage_obj
->where('journal_id',$journal_id)
->where('is_publish',1)
->where('state',0)
->column('journal_stage_id');
$arts = $this->article_obj->where('journal_id',$journal_id)->where('journal_stage_id','in',$stages)->where('state',0)->select();
$frag = [];
foreach ($arts as $v){
if(isset($frag[$v['type']])){
@@ -207,7 +268,12 @@ class Publish extends Controller{
}
private function getGJH($journal_id){
$arts = $this->article_obj->where('journal_id',$journal_id)->where('state',0)->column('article_id');
$stages = $this->journal_stage_obj
->where('journal_id',$journal_id)
->where('is_publish',1)
->where('state',0)
->column('journal_stage_id');
$arts = $this->article_obj->where('journal_id',$journal_id)->where('journal_stage_id','in',$stages)->where('state',0)->column('article_id');
$auts = $this->article_author_obj->where('article_id','in',$arts)->where('state',0)->select();
$frag = [];
$frag['list'] = [];
@@ -260,30 +326,6 @@ class Publish extends Controller{
return jsonSuccess($re);
}
public function test(){
echo strtotime('2021-02-24');
}
public function index()
{
echo THINK_VERSION;
}
public function mymy(){
$last_stage = $this->journal_stage_obj
->where('journal_id',22)
->where('is_publish',1)
->where('state',0)
->order('journal_stage_id desc')
->limit(1)
->select();
echo '<pre>';
var_dump($last_stage);
echo '</pre>';
die;
}
/**
* 计算危险指数
*/
@@ -301,20 +343,24 @@ class Publish extends Controller{
->limit(1)
->select();
$stage_now = $last_stage?$last_stage[0]:['issue_date'=>'2020-05-15'];
$cday = intval((time()-strtotime($stage_now['issue_date']))/(3600*24));
$cycle = $journal_info['cycle']==0?2:$journal_info['cycle'];
$art_num = $journal_info['art_num']==0?5:$journal_info['art_num'];
$cday = intval((time()-strtotime($stage_now['issue_date']))/(3600*24));//过去了多少天
$cycle = $journal_info['cycle']==0?2:$journal_info['cycle'];//出刊期限
$art_num = $journal_info['art_num']==0?5:$journal_info['art_num'];//期刊文章数量
$next_time = strtotime("+$cycle month",strtotime($stage_now['issue_date']));//下次出刊时间
$all_days = intval(($next_time-strtotime($stage_now['issue_date']))/(3600*24));//这两次出刊时间差,天数
$frag = [];
$frag['count'] = $count;
$frag['sy'] = $cycle*30 - $cday;
$frag['ntime'] = strtotime($stage_now['issue_date'])+($cycle*30*3600*24);
$frag['sy'] = intval(($next_time- time())/(3600*24));//$cycle*30 - $cday;
$frag['ntime'] = $next_time;//strtotime($stage_now['issue_date'])+($cycle*30*3600*24);
if($cday>($cycle*30)){
if(time()>$next_time){
$frag['mk'] = 100;
return $frag;
}
$lart = intval($cday*$art_num/($cycle*30));
$lart = intval($cday*$art_num/$all_days);
if($count>=$lart){
$frag['mk'] = 0;
}else{