|
|
@ -11,11 +11,11 @@ use Illuminate\Http\Request; |
|
|
class OrderData extends Card |
|
|
class OrderData extends Card |
|
|
{ |
|
|
{ |
|
|
protected $title; |
|
|
protected $title; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function __construct($title = null, $icon = null) |
|
|
|
|
|
|
|
|
protected $data_type; |
|
|
|
|
|
public function __construct($data_type=null,$title = null, $icon = null) |
|
|
{ |
|
|
{ |
|
|
$this->title = $title; |
|
|
$this->title = $title; |
|
|
|
|
|
$this->data_type = $data_type; |
|
|
parent::__construct($title, $icon); |
|
|
parent::__construct($title, $icon); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -34,11 +34,12 @@ class OrderData extends Card |
|
|
|
|
|
|
|
|
public function handle(Request $request) |
|
|
public function handle(Request $request) |
|
|
{ |
|
|
{ |
|
|
$type = $request->get('option'); |
|
|
|
|
|
$this->content($this->orderNum('',$type)); |
|
|
|
|
|
|
|
|
$type = $request->get('option');//数据选项
|
|
|
|
|
|
$data_type = $request->get('data_type');//数据类型
|
|
|
|
|
|
$this->content($this->orderNum($data_type,$type)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function orderNum($marketId=null,$type=null) |
|
|
|
|
|
|
|
|
public function orderNumBuild($marketId=null,$type=null) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
$where = []; |
|
|
$where = []; |
|
|
@ -73,16 +74,36 @@ class OrderData extends Card |
|
|
$endTime=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1; |
|
|
$endTime=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
$count = ImsCjdcOrderMain |
|
|
|
|
|
|
|
|
$build = ImsCjdcOrderMain |
|
|
::whereBetween('created_at',[$beginTime,$endTime]) |
|
|
::whereBetween('created_at',[$beginTime,$endTime]) |
|
|
->whereIn('state',[3,4,5,10]) |
|
|
->whereIn('state',[3,4,5,10]) |
|
|
->where($where) |
|
|
|
|
|
->count(); |
|
|
|
|
|
|
|
|
->where($where); |
|
|
|
|
|
return $build; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function orderNum($data_type,$type) |
|
|
|
|
|
{ |
|
|
|
|
|
$build = $this->orderNumBuild($marketId=null,$type); |
|
|
|
|
|
if ($data_type=='number'){ |
|
|
|
|
|
$result = $build->count(); |
|
|
|
|
|
}elseif ($data_type=='amount'){ |
|
|
|
|
|
$result = $build->sum('money'); |
|
|
|
|
|
}else{ |
|
|
|
|
|
$result = 0; |
|
|
|
|
|
} |
|
|
|
|
|
return $result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 传递自定义参数到 handle 方法
|
|
|
|
|
|
public function parameters() : array |
|
|
|
|
|
{ |
|
|
|
|
|
return [ |
|
|
|
|
|
'data_type'=>$this->data_type |
|
|
|
|
|
]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 渲染卡片内容 |
|
|
* 渲染卡片内容 |
|
|
* @return string |
|
|
* @return string |
|
|
|