|
|
|
@ -7,15 +7,18 @@ use App\Models\ImsCjdcOrder; |
|
|
|
use App\Models\ImsCjdcOrderMain; |
|
|
|
use Dcat\Admin\Widgets\Metrics\Card; |
|
|
|
use Illuminate\Http\Request; |
|
|
|
use Illuminate\Support\Facades\DB; |
|
|
|
|
|
|
|
class OrderData extends Card |
|
|
|
{ |
|
|
|
protected $title; |
|
|
|
protected $data_type; |
|
|
|
public function __construct($data_type=null,$title = null, $icon = null) |
|
|
|
protected $market_id; |
|
|
|
public function __construct($data_type=null,$market_id=null,$title = null, $icon = null) |
|
|
|
{ |
|
|
|
$this->title = $title; |
|
|
|
$this->data_type = $data_type; |
|
|
|
$this->market_id = $market_id; |
|
|
|
parent::__construct($title, $icon); |
|
|
|
} |
|
|
|
|
|
|
|
@ -36,16 +39,21 @@ class OrderData extends Card |
|
|
|
{ |
|
|
|
$type = $request->get('option');//数据选项
|
|
|
|
$data_type = $request->get('data_type');//数据类型
|
|
|
|
$this->content($this->orderNum($data_type,$type)); |
|
|
|
$market_id = $request->get('market_id');//市场id
|
|
|
|
$this->content($this->orderNum($data_type,$type,$market_id)); |
|
|
|
} |
|
|
|
|
|
|
|
public function orderDataBuild($marketId=null,$type=null) |
|
|
|
public function orderDataBuild($type=null,$marketId=null) |
|
|
|
{ |
|
|
|
|
|
|
|
$where = []; |
|
|
|
$where['type'] = 1; |
|
|
|
if ($marketId){ |
|
|
|
$where['market_id'] = $marketId; |
|
|
|
if (is_array($marketId)){ |
|
|
|
$where[] = ['in'=>['market_id'=>$marketId]]; |
|
|
|
}else{ |
|
|
|
$where['market_id'] = $marketId; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
switch ($type){ |
|
|
|
@ -82,9 +90,9 @@ class OrderData extends Card |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function orderNum($data_type,$type) |
|
|
|
public function orderNum($data_type,$type,$marketId) |
|
|
|
{ |
|
|
|
$build = $this->orderDataBuild($marketId=null,$type); |
|
|
|
$build = $this->orderDataBuild($type,$marketId); |
|
|
|
if ($data_type=='number'){ |
|
|
|
$result = $build->count(); |
|
|
|
}elseif ($data_type=='amount'){ |
|
|
|
@ -100,7 +108,8 @@ class OrderData extends Card |
|
|
|
public function parameters() : array |
|
|
|
{ |
|
|
|
return [ |
|
|
|
'data_type'=>$this->data_type |
|
|
|
'data_type'=>$this->data_type, |
|
|
|
'market_id'=>$this->market_id, |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
|