88 lines
1.3 KiB
PHP
88 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\statistics;
|
|
|
|
|
|
use app\admin\model\Admin;
|
|
use app\admin\model\Order;
|
|
use app\common\controller\Backend;
|
|
use think\Model;
|
|
use function Symfony\Component\Clock\now;
|
|
|
|
/**
|
|
* 服务项目统计
|
|
*
|
|
* @icon fa fa-circle-o
|
|
*/
|
|
class Aftersale extends Backend
|
|
{
|
|
|
|
protected $relationSearch = true;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
return $this->fetch('index');
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
$build = new Order();
|
|
|
|
}
|
|
|
|
public function dispatch()
|
|
{
|
|
$build = new Admin();
|
|
$build->alias('a')
|
|
->join('order b','a.id = b.admin_id','right')
|
|
->join('aftersale c','b.id = c.admin_id','left')
|
|
->where('b.status',Order::STATUS_FINISHED);
|
|
|
|
$build->group('a.id');
|
|
$build->field(
|
|
[
|
|
'a.id',
|
|
'a.nickname',
|
|
'count(b.id) order_total',
|
|
'count(c.id) after_total',
|
|
]
|
|
);
|
|
|
|
$res = $build->paginate();
|
|
$total = $res->total();
|
|
$ress = $res->items();
|
|
// dd(Admin::getLastSql());
|
|
return [
|
|
'rows' => $ress,
|
|
'total' => $total
|
|
];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|