Yesterdaydata.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\admin\controller\informational;
  3. use app\admin\logic\PaymentLogic;
  4. use app\admin\logic\UserLogic;
  5. use app\admin\logic\WithdrawLogic;
  6. use app\common\model\ShopCategory;
  7. use app\admin\traits\Curd;
  8. use app\common\controller\AdminController;
  9. use EasyAdmin\annotation\ControllerAnnotation;
  10. use EasyAdmin\annotation\NodeAnotation;
  11. use think\App;
  12. use think\facade\Db;
  13. use think\Model;
  14. /**
  15. * Class Admin
  16. * @package app\admin\controller\system
  17. * @ControllerAnnotation(title="昨日数据管理")
  18. */
  19. class Yesterdaydata extends AdminController
  20. {
  21. use Curd;
  22. public function __construct(App $app)
  23. {
  24. parent::__construct($app);
  25. }
  26. /**
  27. * @NodeAnotation(title="后台数据列表")
  28. */
  29. public function index(){
  30. $yesterdayDate = sr_getcurtime(time()-86400, 'Y-m-d');
  31. $day = sr_getcurtime(time(), 'Y-m-d');
  32. $res = [
  33. // 昨日数据
  34. 'yesterday'=>sr_getcurtime(time()-86400, 'Y年-m月-d日'),
  35. 'yesterday_register'=> UserLogic::getCountByTime($yesterdayDate),
  36. 'yesterday_recharge'=> PaymentLogic::getTotal([4,5], $yesterdayDate),
  37. 'yesterday_withdraw'=> WithdrawLogic::getTotal($yesterdayDate),
  38. // 今日数据
  39. 'today'=>sr_getcurtime(time(), 'Y年-m月-d日'),
  40. 'today_register'=> UserLogic::getCountByTime($day),
  41. 'today_recharge'=> PaymentLogic::getTotal([4,5], $day),
  42. 'today_withdraw'=> WithdrawLogic::getTotal($day),
  43. ];
  44. $this->assign('res', $res);
  45. return $this->fetch();
  46. }
  47. }