This commit is contained in:
weiz 2024-06-06 14:04:09 +08:00
parent 427ac7a98f
commit 4686688753
2 changed files with 43 additions and 6 deletions

View File

@ -0,0 +1,33 @@
<?php
namespace app\adminapi\controller\cost_project;
use app\adminapi\controller\BaseAdminController;
use app\common\model\cost_project\CostProject;
use app\common\model\marketing\MarketingContract;
class CostStatisticsController extends BaseAdminController
{
//项目统计
public function project(){
//待立项项目
$pending_project_num = MarketingContract::field('id')->where([
['review_status','=', 1],
['contract_type','=',0],
['business_nature','=',4]
])->count();
//已立项项目
$approved_project_num = CostProject::field('id')->count();
$result['data'] = [
[
'name' => '待立项项目',
'value' => $pending_project_num
],
[
'name' => '已立项项目',
'value' => $approved_project_num
]
];
return $this->success('success',$result);
}
}

View File

@ -63,7 +63,11 @@
public function lists(): array
{
$status = $this->request->get('status', 0);
return MarketingContract::where($this->searchWhere)->where('review_status', 1)->where('contract_type',0)
return MarketingContract::where($this->searchWhere)->where([
['review_status','=', 1],
['contract_type','=',0],
['business_nature','=',4]
])
->where('status', $status)
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
@ -125,11 +129,11 @@
public function count(): int
{
$status = $this->request->get('status', 0);
$where=[
['status', '=', $status],
['contract_type', '=', 0]
];
return MarketingContract::where($this->searchWhere)->where($where)->where('review_status', 1)->count();
return MarketingContract::where($this->searchWhere)->where('status', $status)->where([
['review_status','=', 1],
['contract_type','=',0],
['business_nature','=',4]
])->count();
}
public function setFileName(): string