Index.php 761 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\admin\controller;
  3. use app\admin\attr\Permission;
  4. use app\common\model\Io;
  5. use app\common\model\Repo;
  6. use app\common\model\Stock;
  7. use app\common\model\Allocation;
  8. #[Permission('index')]
  9. class Index extends BaseAuthorized
  10. {
  11. public function statistics()
  12. {
  13. $ioCount = Io::count();
  14. $checkCount = Io::where('change_type', '=', Io::CHANGE_TYPE_CHECK)->count();
  15. $allcationCount = Allocation::count();
  16. $goodTotal = Stock::sum('num');
  17. $repoCount = Repo::count();
  18. return [
  19. 'ioCount' => $ioCount,
  20. 'checkCount' => $checkCount,
  21. 'allcationCount' => $allcationCount,
  22. 'goodTotal' => $goodTotal,
  23. 'repoCount' => $repoCount
  24. ];
  25. }
  26. }