|
|
@ -49,7 +49,7 @@ class OrderData extends Card |
|
|
$this->content($this->orderNum($data_type, $type, $market_id, $user_ids)); |
|
|
$this->content($this->orderNum($data_type, $type, $market_id, $user_ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function orderDataBuild($type = null, $marketId = null, $user_ids = []) |
|
|
|
|
|
|
|
|
public function orderDataBuild($type = null, $marketId = null) |
|
|
{ |
|
|
{ |
|
|
$where = []; |
|
|
$where = []; |
|
|
$where['type'] = 1; |
|
|
$where['type'] = 1; |
|
|
@ -61,10 +61,6 @@ class OrderData extends Card |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (count($user_ids)) { |
|
|
|
|
|
$where[] = ['in' => ['user_id' => $user_ids]]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch ($type) { |
|
|
switch ($type) { |
|
|
case '1': |
|
|
case '1': |
|
|
$beginTime = mktime(0, 0, 0, date('m'), date('d'), date('Y')); |
|
|
$beginTime = mktime(0, 0, 0, date('m'), date('d'), date('Y')); |
|
|
@ -109,14 +105,23 @@ class OrderData extends Card |
|
|
|
|
|
|
|
|
public function orderNum($data_type, $type, $marketId, $user_ids) |
|
|
public function orderNum($data_type, $type, $marketId, $user_ids) |
|
|
{ |
|
|
{ |
|
|
$build = $this->orderDataBuild($type, $marketId, $user_ids); |
|
|
|
|
|
|
|
|
$build = $this->orderDataBuild($type, $marketId); |
|
|
|
|
|
if ($user_ids){ |
|
|
|
|
|
$build = $build->whereIn('user_id',$user_ids); |
|
|
|
|
|
} |
|
|
if ($data_type == 'number') { |
|
|
if ($data_type == 'number') { |
|
|
$result = $build->count(); |
|
|
$result = $build->count(); |
|
|
} elseif ($data_type == 'amount') { |
|
|
} elseif ($data_type == 'amount') { |
|
|
$result = $build->sum('money'); |
|
|
$result = $build->sum('money'); |
|
|
} elseif ($data_type == 'user') { |
|
|
} elseif ($data_type == 'user') { |
|
|
$result = $build->groupBy('user_id')->pluck('user_id')->toArray(); |
|
|
|
|
|
$result = count($result); |
|
|
|
|
|
|
|
|
if ($user_ids){ |
|
|
|
|
|
$result = $build->groupBy('user_id') |
|
|
|
|
|
->pluck('user_id') |
|
|
|
|
|
->toArray(); |
|
|
|
|
|
$result = count($result); |
|
|
|
|
|
}else{ |
|
|
|
|
|
$result = 0; |
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
$result = 0; |
|
|
$result = 0; |
|
|
} |
|
|
} |
|
|
|