调整地区
This commit is contained in:
@@ -36,8 +36,7 @@ class HomeController extends Controller
|
||||
if ($admin->id == 1) {
|
||||
$this->getUserData();
|
||||
$this->getAreaData();
|
||||
// $this->getUserStockData();
|
||||
// $this->getUserStockOrderData();
|
||||
$this->getScoreData();
|
||||
} else {
|
||||
$this->content->row($this->setDivider('您没有权限查看数据'));
|
||||
}
|
||||
@@ -81,57 +80,6 @@ class HomeController extends Controller
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 用户水数量
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2022/9/1 13:35
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserStockData()
|
||||
{
|
||||
$this->content->row($this->setDivider('会员水库存数'));
|
||||
|
||||
$all = UserStock::query()->sum('stock');
|
||||
$holds = UserStock::query()->sum('hold');
|
||||
$sy = bcsub($all, $holds);
|
||||
|
||||
$users = [
|
||||
'all' => [
|
||||
'name' => '总数',
|
||||
'color' => 'blue',
|
||||
'count' => UserStock::query()->sum('stock')
|
||||
],
|
||||
'stock' => [
|
||||
'name' => '已提货数',
|
||||
'color' => 'green',
|
||||
'count' => UserStock::query()->sum('hold')
|
||||
],
|
||||
'sy' => [
|
||||
'name' => '待提货数',
|
||||
'color' => 'green',
|
||||
'count' => $sy
|
||||
],
|
||||
];
|
||||
|
||||
$this->content->row(function (Row $row) use ($users) {
|
||||
foreach ($users as $user) {
|
||||
$row->column(2, function (Column $column) use ($user) {
|
||||
$column->append(new InfoBox(
|
||||
$user['name'],
|
||||
'goods',
|
||||
$user['color'],
|
||||
'/admin/stocks',
|
||||
$user['count'],
|
||||
));
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 区域数据
|
||||
*
|
||||
@@ -199,119 +147,63 @@ class HomeController extends Controller
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function getUserFreeData()
|
||||
{
|
||||
$this->content->row($this->setDivider('会员水库存数'));
|
||||
|
||||
$all = UserStock::query()->sum('stock');
|
||||
$holds = UserStock::query()->sum('hold');
|
||||
$sy = bcsub($all, $holds);
|
||||
|
||||
$users = [
|
||||
'all' => [
|
||||
'name' => '总数',
|
||||
'color' => 'blue',
|
||||
'count' => UserStock::query()->sum('stock')
|
||||
],
|
||||
'stock' => [
|
||||
'name' => '已提货数',
|
||||
'color' => 'green',
|
||||
'count' => UserStock::query()->sum('hold')
|
||||
],
|
||||
'sy' => [
|
||||
'name' => '待提货数',
|
||||
'color' => 'green',
|
||||
'count' => $sy
|
||||
],
|
||||
];
|
||||
|
||||
$this->content->row(function (Row $row) use ($users) {
|
||||
foreach ($users as $user) {
|
||||
$row->column(2, function (Column $column) use ($user) {
|
||||
$column->append(new InfoBox(
|
||||
$user['name'],
|
||||
'goods',
|
||||
$user['color'],
|
||||
'/admin/stocks',
|
||||
$user['count'],
|
||||
));
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 提货订单数量
|
||||
* Notes: 积分兑换信息
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2022/9/1 13:51
|
||||
* @Date: 2023/1/29 8:50
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserStockOrderData()
|
||||
public function getScoreData()
|
||||
{
|
||||
$this->content->row($this->setDivider('会员提货订单'));
|
||||
|
||||
|
||||
$deliver = OrderItem::query()
|
||||
->whereHas('order', function ($q) {
|
||||
$q->paid();
|
||||
})->sum('qty');
|
||||
|
||||
$deliverd = OrderItem::query()
|
||||
->whereHas('order', function ($q) {
|
||||
$q->whereIn('state', [
|
||||
Order::STATUS_SIGNED,
|
||||
Order::STATUS_DELIVERED,
|
||||
]);
|
||||
})->sum('qty');
|
||||
|
||||
$users = [
|
||||
'all' => [
|
||||
'name' => '订单总数',
|
||||
$this->content->row($this->setDivider('积分兑换订单'));
|
||||
$lists = [
|
||||
'all' => [
|
||||
'name' => '兑换总数',
|
||||
'color' => 'blue',
|
||||
'count' => Order::query()->where('type', Order::TYPE_SAMPLE)->count()
|
||||
'link' => '',
|
||||
'count' => Order::where('type', Order::TYPE_SCORE)->whereIn('state', [
|
||||
Order::STATUS_INIT,
|
||||
Order::STATUS_PAID,
|
||||
Order::STATUS_DELIVERED,
|
||||
Order::STATUS_SIGNED,
|
||||
])->count()
|
||||
],
|
||||
'deliver' => [
|
||||
'init' => [
|
||||
'name' => '待支付',
|
||||
'color' => 'green',
|
||||
'link' => '',
|
||||
'count' => Order::where('type', Order::TYPE_SCORE)->where('state', Order::STATUS_INIT)->count()
|
||||
],
|
||||
'paid' => [
|
||||
'name' => '待发货',
|
||||
'color' => 'green',
|
||||
'count' => Order::query()
|
||||
->where('type', Order::TYPE_SAMPLE)
|
||||
->paid()
|
||||
->count()
|
||||
'link' => '',
|
||||
'count' => Order::where('type', Order::TYPE_SCORE)->where('state', Order::STATUS_PAID)->count()
|
||||
],
|
||||
'deliverd' => [
|
||||
'name' => '已发货',
|
||||
'delivered' => [
|
||||
'name' => '待签收',
|
||||
'color' => 'green',
|
||||
'count' => Order::query()
|
||||
->where('type', Order::TYPE_SAMPLE)
|
||||
->whereIn('state', [
|
||||
Order::STATUS_DELIVERED,
|
||||
])
|
||||
->count(),
|
||||
'link' => '',
|
||||
'count' => Order::where('type', Order::TYPE_SCORE)->where('state', Order::STATUS_DELIVERED)->count()
|
||||
],
|
||||
'signed' => [
|
||||
'sign' => [
|
||||
'name' => '已签收',
|
||||
'color' => 'green',
|
||||
'count' => Order::query()
|
||||
->where('type', Order::TYPE_SAMPLE)
|
||||
->whereIn('state', [
|
||||
Order::STATUS_SIGNED,
|
||||
])
|
||||
->count()
|
||||
'link' => '',
|
||||
'count' => Order::where('type', Order::TYPE_SCORE)->where('state', Order::STATUS_SIGNED)->count()
|
||||
],
|
||||
];
|
||||
|
||||
$this->content->row(function (Row $row) use ($users) {
|
||||
foreach ($users as $user) {
|
||||
$row->column(2, function (Column $column) use ($user) {
|
||||
$this->content->row(function (Row $row) use ($lists) {
|
||||
foreach ($lists as $list) {
|
||||
$row->column(2, function (Column $column) use ($list) {
|
||||
$column->append(new InfoBox(
|
||||
$user['name'],
|
||||
$list['name'],
|
||||
'goods',
|
||||
$user['color'],
|
||||
'/admin/stocks',
|
||||
$user['count'],
|
||||
$list['color'],
|
||||
$list['link'],
|
||||
$list['count'],
|
||||
));
|
||||
|
||||
});
|
||||
@@ -321,6 +213,7 @@ class HomeController extends Controller
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Notes : 清理模型缓存
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user