校对状态数量统计
This commit is contained in:
@@ -502,6 +502,7 @@ class Proofread extends Base
|
|||||||
return json_encode(['status' => 1,'msg' => "Update successful"]);
|
return json_encode(['status' => 1,'msg' => "Update successful"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @title 根据状态统计数量
|
* @title 根据状态统计数量
|
||||||
* @param article_id 文章ID
|
* @param article_id 文章ID
|
||||||
@@ -531,16 +532,26 @@ class Proofread extends Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
//查询校对内容
|
//查询校对内容
|
||||||
$iState = empty($aParam['state']) ? 2 : explode(',', $aParam['state']);
|
$aState = empty($aParam['state']) ? [1,2] : explode(',', $aParam['state']);
|
||||||
if(!empty($iState)){
|
$aWhere['state'] = ['in',$aState];
|
||||||
$aWhere['state'] = ['in',$iState];
|
|
||||||
}
|
|
||||||
$aWhere['is_delete'] = 2;
|
$aWhere['is_delete'] = 2;
|
||||||
$aCount = Db::name('article_proofread')->field('am_id,count(id) as num')->where($aWhere)->group('am_id')->select();
|
$aCount = Db::name('article_proofread')->field('am_id,count(id) as num,state')->where($aWhere)->group('am_id,state')->order('am_id')->select();
|
||||||
$aCount = empty($aCount) ? [] : array_column($aCount, 'num','am_id');
|
$aCountData = [];
|
||||||
|
$iCount = -1;
|
||||||
|
if(!empty($aCount)){
|
||||||
|
$iCount = 0;
|
||||||
|
foreach ($aCount as $key => $value) {
|
||||||
|
$aCountData[$value['am_id']][$value['state']] = $value['num'];
|
||||||
|
if($value['state'] == 2){
|
||||||
|
$iCount += $value['num'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//总数量
|
//总数量
|
||||||
$iCount = empty($aCount) ? 0 : array_sum(array_values($aCount));
|
$am_id_count = -1;
|
||||||
$am_id_count = empty($aCount[$iAmId]) ? 0 : $aCount[$iAmId];
|
if(!empty($aCountData[$iAmId])){
|
||||||
|
$am_id_count = empty($aCountData[$iAmId][2]) ? 0 : $aCountData[$iAmId][2];
|
||||||
|
}
|
||||||
return json_encode(['status' => 1,'msg' => 'success','data' => ['sum_count' => $iCount,'am_id_count' => $am_id_count]]);
|
return json_encode(['status' => 1,'msg' => 'success','data' => ['sum_count' => $iCount,'am_id_count' => $am_id_count]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user