Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -3680,7 +3680,7 @@ class Article extends Base
|
|||||||
//领域
|
//领域
|
||||||
$ly_fen = 0;
|
$ly_fen = 0;
|
||||||
$m = $this->major_obj->where('major_id', $article_info['major_id'])->find();
|
$m = $this->major_obj->where('major_id', $article_info['major_id'])->find();
|
||||||
if ($m['is_hot'] == 1) {
|
if (!empty($m['is_hot']) && $m['is_hot'] == 1) {
|
||||||
$ly_fen = 1;
|
$ly_fen = 1;
|
||||||
$fen += 1;
|
$fen += 1;
|
||||||
}
|
}
|
||||||
@@ -4338,7 +4338,7 @@ class Article extends Base
|
|||||||
//获取该文章审核人的信息
|
//获取该文章审核人的信息
|
||||||
$aWhere = [
|
$aWhere = [
|
||||||
'article_id'=>$aArticle['article_id'],
|
'article_id'=>$aArticle['article_id'],
|
||||||
'state'=>['in',[2,3]]
|
'state'=>['in',[1,2,3]]
|
||||||
];
|
];
|
||||||
$aReviewer = Db::name('article_reviewer')->where($aWhere)->column('reviewer_id,state');
|
$aReviewer = Db::name('article_reviewer')->where($aWhere)->column('reviewer_id,state');
|
||||||
if(empty($aReviewer)){
|
if(empty($aReviewer)){
|
||||||
@@ -4347,12 +4347,12 @@ class Article extends Base
|
|||||||
|
|
||||||
//查询审核人信息
|
//查询审核人信息
|
||||||
$aUserId = array_keys($aReviewer);
|
$aUserId = array_keys($aReviewer);
|
||||||
$aUser = Db::name('user')->field('user_id,rs_num,rigxht_times,error_times')->whereIn('user_id',$aUserId)->select();
|
$aUser = Db::name('user')->field('user_id,rs_num,right_times,error_times,major_times')->whereIn('user_id',$aUserId)->select();
|
||||||
if(empty($aUser)){
|
if(empty($aUser)){
|
||||||
return json(['status' => 1,'msg' => '未查询到审核人信息']);
|
return json(['status' => 1,'msg' => '未查询到审核人信息']);
|
||||||
}
|
}
|
||||||
//处理数据并组装数据
|
//处理数据并组装数据
|
||||||
$aCase = ['right_times' => '', 'right_rate' => '','error_times' => '', 'error_rate' => ''];
|
$aCase = ['right_times' => '', 'right_rate' => '','error_times' => '', 'error_rate' => '','major_times' => '', 'major_rate' => ''];
|
||||||
$aToState = [2 => 3,3 => 5];//文章3拒稿5录用 审稿人2拒稿3通过
|
$aToState = [2 => 3,3 => 5];//文章3拒稿5录用 审稿人2拒稿3通过
|
||||||
foreach ($aUser as $key => $value) {
|
foreach ($aUser as $key => $value) {
|
||||||
$iState = empty($aReviewer[$value['user_id']]) ? 0 : $aReviewer[$value['user_id']];
|
$iState = empty($aReviewer[$value['user_id']]) ? 0 : $aReviewer[$value['user_id']];
|
||||||
@@ -4360,23 +4360,32 @@ class Article extends Base
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(empty($aToState[$iState])){
|
if(empty($aToState[$iState])){
|
||||||
|
if($iState == 1){
|
||||||
|
$iMajorTimes = $value['major_times']+1;
|
||||||
|
$iMajorRate = empty($value['rs_num']) ? 0 : round($iMajorTimes/$value['rs_num'],2);
|
||||||
|
$aCase['major_times'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
|
$aCase['major_times'] .= "'{$iMajorTimes}' ";
|
||||||
|
$aCase['major_rate'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
|
$aCase['major_rate'] .= "'{$iMajorRate}' ";
|
||||||
|
$aId[] = $value['user_id'];
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if($aArticle['state'] == $aToState[$iState]){
|
if($aArticle['state'] == $aToState[$iState]){
|
||||||
$iTimes = $value['right_times']+1;
|
$iTimes = $value['right_times']+1;
|
||||||
$iRightNum = empty($value['rs_num']) ? 0 : round($iTimes/$value['rs_num'],2);
|
$iRightRate = empty($value['rs_num']) ? 0 : round($iTimes/$value['rs_num'],2);
|
||||||
$aCase['right_times'] .= "WHEN {$value['user_id']} THEN ";
|
$aCase['right_times'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
$aCase['right_times'] .= "'{$iTimes}' ";
|
$aCase['right_times'] .= "'{$iTimes}' ";
|
||||||
$aCase['right_rate'] .= "WHEN {$value['user_id']} THEN ";
|
$aCase['right_rate'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
$aCase['right_rate'] .= "'{$iRightNum}' ";
|
$aCase['right_rate'] .= "'{$iRightRate}' ";
|
||||||
}
|
}
|
||||||
if($aArticle['state'] != $aToState[$iState]){
|
if($aArticle['state'] != $aToState[$iState]){
|
||||||
$iErrorTimes = $value['error_times']+1;
|
$iErrorTimes = $value['error_times']+1;
|
||||||
$iErrorNum = empty($value['rs_num']) ? 0 : round($iErrorTimes/$value['rs_num'],2);
|
$iErrorRate = empty($value['rs_num']) ? 0 : round($iErrorTimes/$value['rs_num'],2);
|
||||||
$aCase['error_times'] .= "WHEN {$value['user_id']} THEN ";
|
$aCase['error_times'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
$aCase['error_times'] .= "'{$iErrorTimes}' ";
|
$aCase['error_times'] .= "'{$iErrorTimes}' ";
|
||||||
$aCase['error_rate'] .= "WHEN {$value['user_id']} THEN ";
|
$aCase['error_rate'] .= "WHEN {$value['user_id']} THEN ";
|
||||||
$aCase['error_rate'] .= "'{$iErrorNum}' ";
|
$aCase['error_rate'] .= "'{$iErrorRate}' ";
|
||||||
}
|
}
|
||||||
$aId[] = $value['user_id'];
|
$aId[] = $value['user_id'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class Crontask extends Controller
|
|||||||
//数据处理
|
//数据处理
|
||||||
$aUpdate = [];
|
$aUpdate = [];
|
||||||
for ($iPage=1; $iPage <= $iDealNum; $iPage++) {
|
for ($iPage=1; $iPage <= $iDealNum; $iPage++) {
|
||||||
|
|
||||||
$iStart = ($iPage - 1) * $iSize;
|
$iStart = ($iPage - 1) * $iSize;
|
||||||
$aArticleState = Db::name('article')->where($aParam)->limit($iStart,$iSize)->column('article_id,state');
|
$aArticleState = Db::name('article')->where($aParam)->limit($iStart,$iSize)->column('article_id,state');
|
||||||
if(empty($aArticleState)){
|
if(empty($aArticleState)){
|
||||||
@@ -34,24 +35,17 @@ class Crontask extends Controller
|
|||||||
//获取该文章审核人的信息
|
//获取该文章审核人的信息
|
||||||
$aWhere = [
|
$aWhere = [
|
||||||
'article_id'=>['in',array_keys($aArticleState)],
|
'article_id'=>['in',array_keys($aArticleState)],
|
||||||
'state'=>['in',[1,2,3]]
|
'state'=>['in',[1,2,3]],
|
||||||
];
|
];
|
||||||
$aReviewer = Db::name('article_reviewer')->field('article_id,reviewer_id,state')->where($aWhere)->order('article_id asc,reviewer_id asc')->select();
|
$aReviewer = Db::name('article_reviewer')->field('article_id,reviewer_id,state')->where($aWhere)->order('article_id asc,reviewer_id asc')->select();
|
||||||
if(empty($aReviewer)){
|
if(empty($aReviewer)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//查询审核人信息
|
|
||||||
$aUserId = array_column($aReviewer,'reviewer_id');
|
|
||||||
$aUser = Db::name('user')->field('user_id,rs_num,right_times,error_times')->whereIn('user_id',$aUserId)->order('user_id asc')->select();
|
|
||||||
if(empty($aUser)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$aUser = array_column($aUser, null,'user_id');
|
|
||||||
|
|
||||||
//处理数据并组装数据
|
//处理数据并组装数据
|
||||||
$aCase = ['right_times' => '', 'right_rate' => '','error_times' => '', 'error_rate' => ''];
|
|
||||||
$aToState = [2 => 3,3 => 5];//文章3拒稿5录用 审稿人2拒稿3通过
|
$aToState = [2 => 3,3 => 5];//文章3拒稿5录用 审稿人2拒稿3通过
|
||||||
$aId = [];
|
$aId = [];
|
||||||
|
// echo '<pre>';var_dump($aReviewer);
|
||||||
foreach ($aReviewer as $key => $item) {
|
foreach ($aReviewer as $key => $item) {
|
||||||
//审核次数+1;
|
//审核次数+1;
|
||||||
$aUpdate[$item['reviewer_id']]['reviewer_id'] = $item['reviewer_id'] ;
|
$aUpdate[$item['reviewer_id']]['reviewer_id'] = $item['reviewer_id'] ;
|
||||||
@@ -61,15 +55,20 @@ class Crontask extends Controller
|
|||||||
if(empty($iArticleState)){
|
if(empty($iArticleState)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if($item['state'] == 1){
|
||||||
|
$aUpdate[$item['reviewer_id']]['major_times'] = empty($aUpdate[$item['reviewer_id']]['major_times']) ? 1 : $aUpdate[$item['reviewer_id']]['major_times']+1 ;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(empty($aToState[$item['state']])){
|
if(empty($aToState[$item['state']])){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($iArticleState == $aToState[$item['state']]){
|
if($iArticleState == $aToState[$item['state']]){
|
||||||
|
|
||||||
$aUpdate[$item['reviewer_id']]['right_times'] = empty($aUpdate[$item['reviewer_id']]['right_times']) ? 1 : $aUpdate[$item['reviewer_id']]['right_times']+1 ;
|
$aUpdate[$item['reviewer_id']]['right_times'] = empty($aUpdate[$item['reviewer_id']]['right_times']) ? 1 : $aUpdate[$item['reviewer_id']]['right_times']+1 ;
|
||||||
|
|
||||||
}
|
}
|
||||||
if($iArticleState != $item['state']){
|
if($iArticleState != $aToState[$item['state']]){
|
||||||
$aUpdate[$item['reviewer_id']]['error_times'] = empty($aUpdate[$item['reviewer_id']]['error_times']) ? 1 : $aUpdate[$item['reviewer_id']]['error_times']+1 ;
|
$aUpdate[$item['reviewer_id']]['error_times'] = empty($aUpdate[$item['reviewer_id']]['error_times']) ? 1 : $aUpdate[$item['reviewer_id']]['error_times']+1 ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -79,7 +78,7 @@ class Crontask extends Controller
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
foreach ($aChunk as $key => $value) {
|
foreach ($aChunk as $key => $value) {
|
||||||
|
|
||||||
$aCase = ['right_times' => '', 'right_rate' => '','error_times' => '', 'error_rate' => '','rs_num' => ''];
|
$aCase = ['right_times' => '', 'right_rate' => '','error_times' => '', 'error_rate' => '','major_times' => '','major_rate' => '','rs_num' => ''];
|
||||||
foreach ($value as $item) {
|
foreach ($value as $item) {
|
||||||
|
|
||||||
//正确数
|
//正确数
|
||||||
@@ -98,6 +97,14 @@ class Crontask extends Controller
|
|||||||
$aCase['error_rate'] .= "WHEN {$item['reviewer_id']} THEN ";
|
$aCase['error_rate'] .= "WHEN {$item['reviewer_id']} THEN ";
|
||||||
$aCase['error_rate'] .= "'{$iErrorRate}' ";
|
$aCase['error_rate'] .= "'{$iErrorRate}' ";
|
||||||
|
|
||||||
|
//大修次数
|
||||||
|
$iMajorTimes = empty($item['major_times']) ? 0 : $item['major_times'];
|
||||||
|
$iMajorRate = empty($iMajorTimes) ? 0 : round($iMajorTimes/$iRsNum,2);
|
||||||
|
$aCase['major_times'] .= "WHEN {$item['reviewer_id']} THEN ";
|
||||||
|
$aCase['major_times'] .= "'{$iMajorTimes}' ";
|
||||||
|
$aCase['major_rate'] .= "WHEN {$item['reviewer_id']} THEN ";
|
||||||
|
$aCase['major_rate'] .= "'{$iMajorRate}' ";
|
||||||
|
|
||||||
//审核数量
|
//审核数量
|
||||||
$aCase['rs_num'] .= "WHEN {$item['reviewer_id']} THEN ";
|
$aCase['rs_num'] .= "WHEN {$item['reviewer_id']} THEN ";
|
||||||
$aCase['rs_num'] .= "'{$iRsNum}' ";
|
$aCase['rs_num'] .= "'{$iRsNum}' ";
|
||||||
@@ -293,6 +300,62 @@ class Crontask extends Controller
|
|||||||
|
|
||||||
$this->showMessage('批量更新超过七日未审稿的状态成功',2);
|
$this->showMessage('批量更新超过七日未审稿的状态成功',2);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @title 审稿人拒绝审稿统计
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function refuseReviewNum(){
|
||||||
|
//获取该文章审核人的信息
|
||||||
|
$aWhere = [
|
||||||
|
'state'=> 4
|
||||||
|
];
|
||||||
|
|
||||||
|
//统计每个审稿人未审稿的数量
|
||||||
|
$aReviewerNum = Db::name('article_reviewer')->field('reviewer_id,count(art_rev_id) as num')->where($aWhere)->group('reviewer_id')->order('reviewer_id asc')->select();
|
||||||
|
if(empty($aReviewerNum)){
|
||||||
|
$this->showMessage('未查询到用户拒绝审稿数量',2);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
//更新超过七日未审核的数据
|
||||||
|
Db::startTrans();
|
||||||
|
//更新审稿人未审稿的数量
|
||||||
|
$aChunkReviewerNum = array_chunk($aReviewerNum, 1000);
|
||||||
|
foreach ($aChunkReviewerNum as $key => $value) {
|
||||||
|
$aId = array_column($value, 'reviewer_id');
|
||||||
|
if(empty($aId)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$aCase = $aUpdateId = [];
|
||||||
|
$sRdNum = '';
|
||||||
|
foreach ($value as $item) {
|
||||||
|
if($item['reviewer_id'] <=0){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//审核数量有,变化更新数量
|
||||||
|
$sRdNum .= "WHEN {$item['reviewer_id']} THEN ";
|
||||||
|
$sRdNum .= "{$item['num']} ";
|
||||||
|
$aUpdateId[] = $item['reviewer_id'];
|
||||||
|
}
|
||||||
|
//SQL拼接最后结尾
|
||||||
|
$aCase['rd_num'] ='CASE user_id '.$sRdNum.'END';
|
||||||
|
//执行更新
|
||||||
|
$result = Db::name('user')
|
||||||
|
->where(['user_id' => ['in',$aUpdateId]])
|
||||||
|
->limit(count($aUpdateId))
|
||||||
|
->update([
|
||||||
|
'rd_num' => Db::raw($aCase['rd_num']),
|
||||||
|
]);
|
||||||
|
if ($result === false) {
|
||||||
|
$this->showMessage('更新用户拒绝审稿数量失败['.$key.']执行SQL:'.Db::getLastSql()."\n",2);
|
||||||
|
}else{
|
||||||
|
$this->showMessage('更新用户拒绝审稿数量成功['.$key.']执行SQL条数:'.$result."\n",1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
|
|
||||||
|
$this->showMessage('批量更新超过七日未审稿的状态成功',2);
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -38,38 +38,25 @@ class Recommend extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查询文章
|
//查询文章
|
||||||
$aArticle = Db::table('t_major_to_article')->field('article_id')->where('article_id',$aParam['article_id'])->find();
|
$aArticle = Db::table('t_article')->field('article_id,user_id')->where('article_id',$aParam['article_id'])->find();
|
||||||
if(empty($aArticle)){
|
if(empty($aArticle)){
|
||||||
exit(json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' )));
|
exit(json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' )));
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询文章领域
|
//查询文章领域
|
||||||
$aMajorId = Db::table('t_major_to_article')->where('article_id',$aArticle['article_id'])->column('major_id');
|
$aMajorId = Db::table('t_major_to_article')->where('article_id',$aArticle['article_id'])->column('major_id');
|
||||||
if(empty($aMajorId)){
|
if(empty($aMajorId)){
|
||||||
exit(json_encode(array('status' => 4,'msg' => 'No field found for the article' )));
|
exit(json_encode(array('status' => 1,'msg' => 'No field found for the article','data' => [])));
|
||||||
}
|
}
|
||||||
|
|
||||||
// //根据文章领域获取满足该领域父类
|
//查询文章领域下的审稿人
|
||||||
// $aMajorId = Db::table('t_major')->field('major_id,major_title,pid')->whereIn('major_id', $aMajorArticle)->where('pid != 1')->select();
|
|
||||||
$aParentId = Db::table('t_major')->where(['major_id' => ['in',$aMajorId]])->column('major_id,pid');
|
|
||||||
$aMajorId = $this->getChildIds(array_values($aParentId));
|
|
||||||
|
|
||||||
//数据处理拼接父类ID为1的领域
|
|
||||||
foreach ($aParentId as $key => $value) {
|
|
||||||
if(in_array($value, [0,1])){
|
|
||||||
array_push($aMajorId,$key);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//查询所属该领域的审稿人
|
|
||||||
if(empty($aMajorId)){
|
|
||||||
exit(json_encode(array('status' => 5,'msg' => 'No reviewers in the field of the article were found' )));
|
|
||||||
}
|
|
||||||
$aMajorUser = Db::name('major_to_user')->whereIn('major_id', $aMajorId)->where('state',0)->order('major_id asc')->column('user_id');
|
$aMajorUser = Db::name('major_to_user')->whereIn('major_id', $aMajorId)->where('state',0)->order('major_id asc')->column('user_id');
|
||||||
if(empty($aMajorUser)){
|
if(empty($aMajorUser)){
|
||||||
exit(json_encode(array('status' => 6,'msg' => 'No reviewers in the field of the article were found' )));
|
exit(json_encode(array('status' => 1,'msg' => 'No reviewers in the field of the article were found','data' => [])));
|
||||||
}
|
}
|
||||||
$aMajorUser = array_unique($aMajorUser);
|
$aMajorUser = array_unique($aMajorUser);
|
||||||
|
|
||||||
|
|
||||||
//查询审稿人是否为劣迹审稿人
|
//查询审稿人是否为劣迹审稿人
|
||||||
$aBlack = Db::name('user_reviewer_black')->whereIn('reviewer_id', $aMajorUser)->where('state',1)->column('reviewer_id');
|
$aBlack = Db::name('user_reviewer_black')->whereIn('reviewer_id', $aMajorUser)->where('state',1)->column('reviewer_id');
|
||||||
if(!empty($aBlack)){
|
if(!empty($aBlack)){
|
||||||
@@ -78,41 +65,220 @@ class Recommend extends Base
|
|||||||
|
|
||||||
//条件拼接
|
//条件拼接
|
||||||
$aWhere = ['state' => 0,'is_reviewer' => 1];
|
$aWhere = ['state' => 0,'is_reviewer' => 1];
|
||||||
if(!empty($aParam['email'])){//根据邮箱搜索
|
|
||||||
$aWhere['email'] = ['like',"%" . $aParam["email"] . "%"];
|
//查询文章作者详情 作者和审稿人的机构不一致
|
||||||
|
$aUserInfo = Db::name('user')->field('email')->where('user_id',$aArticle['user_id'])->find();
|
||||||
|
$sEmail = empty($aUserInfo['email']) ? '' : $aUserInfo['email'];
|
||||||
|
if(!empty($sEmail)){
|
||||||
|
$aAuthor = Db::name('article_author')->field('company')->where(['article_id'=>$aArticle['article_id'],'email' => $sEmail,'state' => 0])->find();
|
||||||
|
if(empty($aAuthor)){
|
||||||
|
exit(json_encode(array('status' => 1,'msg' => 'No detailed information about the author of the article was found','data' => [])));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
//查询审稿人的补充信息表拼接参数
|
||||||
|
$aReviewerWhere = [];
|
||||||
if(!empty($aParam['field'])){//根据领域搜索
|
if(!empty($aParam['field'])){//根据领域搜索
|
||||||
$aReviewerWhere['reviewer_id'] = ['in',$aMajorUser];
|
|
||||||
$aReviewerWhere['field'] = ['like',"%" . $aParam["field"] . "%"];
|
$aReviewerWhere['field'] = ['like',"%" . $aParam["field"] . "%"];
|
||||||
|
}
|
||||||
|
if(!empty($aAuthor['company'])){//作者单位
|
||||||
|
$aReviewerWhere['company'] = ['<>',$aAuthor['company']];
|
||||||
|
}
|
||||||
|
if(!empty($aReviewerWhere)){
|
||||||
|
$aReviewerWhere['reviewer_id'] = ['in',$aMajorUser];
|
||||||
$aReviewerInfo = Db::name('user_reviewer_info')->where($aReviewerWhere)->column('reviewer_id');
|
$aReviewerInfo = Db::name('user_reviewer_info')->where($aReviewerWhere)->column('reviewer_id');
|
||||||
if(empty($aReviewerInfo)){
|
if(empty($aReviewerInfo)){
|
||||||
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
||||||
}
|
}
|
||||||
$aMajorUser = array_intersect($aMajorUser,$aReviewerInfo);
|
$aMajorUser = array_intersect($aMajorUser,$aReviewerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
//查用户信息
|
//查用户信息
|
||||||
$aWhere['user_id'] = ['in',$aMajorUser];
|
$aWhere['user_id'] = ['in',$aMajorUser];
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($sEmail)){
|
||||||
|
|
||||||
|
//查询该用户关联的文章ID
|
||||||
|
$aArticleId = Db::name('article_author')->where('email', $sEmail)->column('article_id');
|
||||||
|
if(!empty($aArticleId)){
|
||||||
|
//查询审稿人的邮箱
|
||||||
|
$aUserEmail = Db::table('t_user')->where($aWhere)->column('email');
|
||||||
|
|
||||||
|
//查询作者不为同一篇文章的审稿人
|
||||||
|
$aArticleId = array_unique($aArticleId);
|
||||||
|
$aAuthorEmail = Db::name('article_author')->where(['article_id'=>['not in',$aArticleId],'email' => ['in',$aUserEmail]])->column('email');
|
||||||
|
if(!empty($aAuthorEmail)){
|
||||||
|
unset($aWhere['user_id']);
|
||||||
|
$aWhere['email'] = ['in',array_unique($aAuthorEmail)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据邮箱搜索
|
||||||
|
$aEmailWhere = [];
|
||||||
|
if(!empty($aParam['email'])){
|
||||||
|
$aEmailWhere['email'] = ['like',"%" . $aParam["email"] . "%"];
|
||||||
|
}
|
||||||
|
|
||||||
//统计数量
|
//统计数量
|
||||||
$iCount = Db::table('t_user')->where($aWhere)->count();
|
$iCount = Db::table('t_user')->where($aWhere)->where($aEmailWhere)->count();
|
||||||
if(empty($iCount)){
|
if(empty($iCount)){
|
||||||
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
||||||
}
|
}
|
||||||
$sOrder = 'review_num asc,right_rate desc';
|
|
||||||
$aUser = Db::table('t_user')->field('user_id,account,email,realname,rs_num,right_times,error_times,right_rate,error_rate,review_num')->where($aWhere)->order($sOrder)->limit($limit_start, $iSize)->select();
|
//判断页数是否超过最大分页限制
|
||||||
|
$iPageNum = ceil($iCount/$iSize);
|
||||||
|
if($iPage > $iPageNum){
|
||||||
|
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询数据
|
||||||
|
$sOrder = 'major_times desc,right_rate desc,review_num asc';//排序字段
|
||||||
|
$aUser = Db::table('t_user')->field('user_id,account,email,realname,rs_num,rd_num,right_times,error_times,right_rate,error_rate,review_num,major_times,major_rate')->where($aWhere)->where($aEmailWhere)->order($sOrder)->paginate([
|
||||||
|
'list_rows' => $iSize,
|
||||||
|
'page' => $iPage,
|
||||||
|
'simple' => true, // 简单分页模式
|
||||||
|
'path' => 'javascript:;' // 禁用URL生成
|
||||||
|
]);
|
||||||
//查询审稿人详细信息
|
//查询审稿人详细信息
|
||||||
|
$aUser = empty($aUser->items()) ? [] : $aUser->items();
|
||||||
$aUserId = array_column($aUser, 'user_id');
|
$aUserId = array_column($aUser, 'user_id');
|
||||||
$aInfo = Db::name('user_reviewer_info')->field('reviewer_id,technical,country,introduction,company,field')->whereIn('reviewer_id',$aUserId)->select();
|
$aInfo = Db::name('user_reviewer_info')->field('reviewer_id,technical,country,introduction,company,field')->whereIn('reviewer_id',$aUserId)->select();
|
||||||
$aInfo = empty($aInfo) ? [] : array_column($aInfo, null,'reviewer_id');
|
$aInfo = empty($aInfo) ? [] : array_column($aInfo, null,'reviewer_id');
|
||||||
|
|
||||||
foreach ($aUser as $key => $value) {
|
foreach ($aUser as $key => $value) {
|
||||||
$value += empty($aInfo[$value['user_id']]) ? [] : $aInfo[$value['user_id']];
|
$value += empty($aInfo[$value['user_id']]) ? [] : $aInfo[$value['user_id']];
|
||||||
|
$value['right_rate'] = intval($value['right_rate']*100);
|
||||||
|
$value['error_rate'] = intval($value['error_rate']*100);
|
||||||
|
$value['major_rate'] = intval($value['major_rate']*100);
|
||||||
$aUser[$key] = $value;
|
$aUser[$key] = $value;
|
||||||
}
|
}
|
||||||
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => $iCount,'lists' => $aUser])));
|
exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => $iCount,'lists' => $aUser])));
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// public function lists(){
|
||||||
|
// //获取参数
|
||||||
|
// $aParam = $this->request->post();
|
||||||
|
// //分页
|
||||||
|
// $iSize = empty($aParam['size']) ? 10 : $aParam['size'];
|
||||||
|
// $iPage = empty($aParam['page']) ? 1 : $aParam['page'];
|
||||||
|
// $aParam['article_id'] = 5972;
|
||||||
|
// if(empty($aParam['article_id'])){
|
||||||
|
// exit(json_encode(array('status' => 2,'msg' => 'Please select an article' )));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //查询文章
|
||||||
|
// $aArticle = Db::table('t_article')->field('article_id,user_id')->where('article_id',$aParam['article_id'])->find();
|
||||||
|
// if(empty($aArticle)){
|
||||||
|
// exit(json_encode(array('status' => 3,'msg' => 'No articles requiring review were found' )));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //查询文章作者详情 作者和审稿人的机构不一致
|
||||||
|
// $aAuthor = Db::name('article_author')->field('company')->where('article_id',$aArticle['article_id'])->find();
|
||||||
|
// if(empty($aAuthor)){
|
||||||
|
// exit(json_encode(array('status' => 4,'msg' => 'No detailed information about the author of the article was found' )));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //查询文章领域
|
||||||
|
// $aMajorId = Db::table('t_major_to_article')->where('article_id',$aArticle['article_id'])->column('major_id');
|
||||||
|
// if(empty($aMajorId)){
|
||||||
|
// exit(json_encode(array('status' => 5,'msg' => 'No field found for the article' )));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //查询该领域下的审稿人
|
||||||
|
// $aMajorUser = Db::name('major_to_user')->whereIn('major_id', $aMajorId)->where('state',0)->order('major_id asc')->column('user_id');
|
||||||
|
// if(empty($aMajorUser)){
|
||||||
|
// exit(json_encode(array('status' => 6,'msg' => 'No reviewers in the field of the article were found' )));
|
||||||
|
// }
|
||||||
|
// $aMajorUser = array_unique($aMajorUser);
|
||||||
|
|
||||||
|
// //查询审稿人是否为劣迹审稿人
|
||||||
|
// $aBlack = Db::name('user_reviewer_black')->whereIn('reviewer_id', $aMajorUser)->where('state',1)->column('reviewer_id');
|
||||||
|
// if(!empty($aBlack)){
|
||||||
|
// $aMajorUser = array_diff($aMajorUser, $aBlack);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //条件拼接
|
||||||
|
// $aWhere = ['user.state' => 0,'user.is_reviewer' => 1,'user_id' => ['in',$aMajorUser]];
|
||||||
|
// if(!empty($aParam['email'])){//根据邮箱搜索
|
||||||
|
// $aWhere['user.email'] = ['like',"%" . $aParam["email"] . "%"];
|
||||||
|
// }
|
||||||
|
// if(!empty($aParam['field'])){//根据领域搜索
|
||||||
|
// $aWhere['reviewer.field'] = ['like',"%" . $aParam["field"] . "%"];
|
||||||
|
// }
|
||||||
|
// if(!empty($aAuthor['company'])){
|
||||||
|
// $aWhere['reviewer.company'] = ['<>',$aAuthor['company']];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //统计数量
|
||||||
|
// $iCount = Db::table('t_user')
|
||||||
|
// ->alias('user')->join('t_user_reviewer_info reviewer','user.user_id = reviewer.reviewer_id')
|
||||||
|
// ->where($aWhere)->count();
|
||||||
|
// if(empty($iCount)){
|
||||||
|
// exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //判断页数是否超过最大分页限制
|
||||||
|
// $iPageNum = ceil($iCount/$iSize);
|
||||||
|
// if($iPage > $iPageNum){
|
||||||
|
// exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => 0,'lists' => []])));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //查询数据
|
||||||
|
// $sOrder = 'major_times desc,right_rate desc,review_num asc';//排序字段
|
||||||
|
// $aUser = Db::table('t_user')
|
||||||
|
// ->alias('user')
|
||||||
|
// ->field('user.user_id,user.account,user.email,user.realname,user.rs_num,user.rd_num,user.right_times,user.error_times,user.right_rate,user.error_rate,user.review_num,user.major_rate,user.major_times,reviewer.reviewer_id,reviewer.technical,reviewer.country,reviewer.introduction,reviewer.company,reviewer.field')
|
||||||
|
// ->join('t_user_reviewer_info reviewer','user.user_id = reviewer.reviewer_id')
|
||||||
|
// ->where($aWhere)->order($sOrder)
|
||||||
|
// ->paginate([
|
||||||
|
// 'list_rows' => $iSize,
|
||||||
|
// 'page' => $iPage,
|
||||||
|
// 'simple' => true, // 简单分页模式
|
||||||
|
// 'path' => 'javascript:;' // 禁用URL生成
|
||||||
|
// ])->each(function($item) { // 数据格式化
|
||||||
|
// $item['right_rate'] = intval($item['right_rate']*100);
|
||||||
|
// $item['error_rate'] = intval($item['error_rate']*100);
|
||||||
|
// $item['major_rate'] = intval($item['major_rate']*100);
|
||||||
|
// return $item;
|
||||||
|
// });
|
||||||
|
// // echo Db::getLastSql();exit;
|
||||||
|
// $aUser = empty($aUser->items()) ? [] : $aUser->items();
|
||||||
|
// exit(json_encode(array('status' => 1,'msg' => '','data' => ['total' => $iCount ?? 0,'lists' => $aUser,'last_use_id' => $iLastUserId ?? 0])));
|
||||||
|
// //
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 游标分页查询
|
||||||
|
* @param array $ids whereIn的ID列表
|
||||||
|
* @param mixed $lastValue 上一页最后一条的排序字段值
|
||||||
|
* @param int $lastId 上一页最后一条的ID(防重复)
|
||||||
|
* @param int $pageSize 每页数量
|
||||||
|
*/
|
||||||
|
// public static function cursorPaginate($aWhere = [], $lastCursor = [], $pageSize = 30) {
|
||||||
|
// $query = Db::name('user')->field('user_id,account,email,realname,rs_num,rd_num,right_times,error_times,right_rate,error_rate,review_num,major_rate,major_times')
|
||||||
|
// ->where($aWhere)
|
||||||
|
// ->order('major_times DESC, right_rate DESC, review_num ASC, user_id DESC');
|
||||||
|
// // 游标处理逻辑
|
||||||
|
// if (!empty($lastCursor)) {
|
||||||
|
// $query->where(function($q) use ($lastCursor) {
|
||||||
|
// $q->where('major_times', '<', $lastCursor['major_times'])
|
||||||
|
// ->whereOr(function($subQ) use ($lastCursor) {
|
||||||
|
// $subQ->where('major_times', '=', $lastCursor['major_times'])
|
||||||
|
// ->where('right_rate', '<', $lastCursor['right_rate'])
|
||||||
|
// ->whereOr(function($sQ) use ($lastCursor) {
|
||||||
|
// $sQ->where('right_rate', '=', $lastCursor['right_rate'])
|
||||||
|
// ->where('review_num', '>', $lastCursor['review_num'])
|
||||||
|
// ->whereOr(function($ssQ) use ($lastCursor) {
|
||||||
|
// $ssQ->where('review_num', '=', $lastCursor['review_num'])
|
||||||
|
// ->where('user_id', '<', $lastCursor['user_id']);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// $result = $query->limit($pageSize)->select();
|
||||||
|
// return $result;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归获取某个分类下的所有子分类ID
|
* 递归获取某个分类下的所有子分类ID
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ class Reviewer extends Base
|
|||||||
foreach ($res as $k => $v) {
|
foreach ($res as $k => $v) {
|
||||||
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
||||||
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
||||||
$res[$k]['major'] = $major['title'];
|
$res[$k]['major'] = empty($major['title']) ? '' : $major['title'];
|
||||||
$res[$k]['cmajor'] = $cmajor['title'];
|
$res[$k]['cmajor'] = empty($cmajor['title']) ? '' : $cmajor['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
//复审的稿件列表
|
//复审的稿件列表
|
||||||
@@ -194,8 +194,8 @@ class Reviewer extends Base
|
|||||||
foreach ($res as $k => $v) {
|
foreach ($res as $k => $v) {
|
||||||
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
||||||
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
||||||
$res[$k]['major'] = $major['title'];
|
$res[$k]['major'] = empty($major['title']) ? '' : $major['title'];
|
||||||
$res[$k]['cmajor'] = $cmajor['title'];
|
$res[$k]['cmajor'] = empty($cmajor['title']) ? '' : $cmajor['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = $this->article_reviewer_obj
|
$count = $this->article_reviewer_obj
|
||||||
@@ -1166,8 +1166,8 @@ class Reviewer extends Base
|
|||||||
foreach ($arts as $k => $v) {
|
foreach ($arts as $k => $v) {
|
||||||
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
||||||
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
||||||
$arts[$k]['major'] = $major['title'];
|
$arts[$k]['major'] = empty($major['title']) ? '' : $major['title'];
|
||||||
$arts[$k]['cmajor'] = $cmajor['title'];
|
$arts[$k]['cmajor'] = empty($cmajor['title']) ? '' : $cmajor['title'];
|
||||||
}
|
}
|
||||||
$re['articles'] = $arts;
|
$re['articles'] = $arts;
|
||||||
$re['count'] = $count;
|
$re['count'] = $count;
|
||||||
@@ -1414,8 +1414,8 @@ class Reviewer extends Base
|
|||||||
foreach ($res as $k => $v) {
|
foreach ($res as $k => $v) {
|
||||||
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
$major = $this->reviewer_major_obj->where('major_id', $v['major_id'])->find();
|
||||||
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
$cmajor = $this->reviewer_major_obj->where('major_id', $v['cmajor_id'])->find();
|
||||||
$res[$k]['major'] = $major['title'];
|
$res[$k]['major'] = empty($major['title']) ? '' : $major['title'];
|
||||||
$res[$k]['cmajor'] = $cmajor['title'];
|
$res[$k]['cmajor'] = empty($cmajor['title']) ? '' : $cmajor['title'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$re['articles'] = $res;
|
$re['articles'] = $res;
|
||||||
|
|||||||
Reference in New Issue
Block a user