DashboardController.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: leo
  5. * Date: 2018/2/24
  6. * Time: 下午12:48
  7. */
  8. namespace backendApi\modules\v1\controllers;
  9. use common\helpers\Bonus;
  10. use common\helpers\ChartData;
  11. use common\helpers\Date;
  12. use common\helpers\Form;
  13. use common\models\FlowBonus;
  14. use common\models\Period;
  15. use common\models\UserInfo;
  16. class DashboardController extends BaseController
  17. {
  18. public $modelClass = FlowBonus::class;
  19. public function behaviors() {
  20. $behaviors = parent::behaviors();
  21. //$behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON;
  22. return $behaviors;
  23. }
  24. /**
  25. * 控制台首页
  26. * @return mixed
  27. * @throws \yii\web\HttpException
  28. */
  29. public function actionIndex(){
  30. // print_r(\Yii::$app->user->validateAdminAction($this->id, $this->action->id));
  31. $nowTime = Date::nowTime();
  32. $period = Period::instance();
  33. $periodNum = $period->getNowPeriodNum();
  34. return static::notice([
  35. 'nowTime' => $nowTime,
  36. 'periodNum' => $periodNum,
  37. ]);
  38. }
  39. /**
  40. * 总累计的项目
  41. * @return array
  42. */
  43. public function actionTotalItem(){
  44. $chart = ChartData::instance();
  45. return [
  46. 'totalBonus' => $chart->totalBonus(),
  47. 'totalPerf' => $chart->totalPerf(),
  48. 'totalWithdraw' => $chart->totalWithdraw(),
  49. 'totalUser' => $chart->totalUser(),
  50. ];
  51. }
  52. /**
  53. * 会员注册量
  54. * @return mixed
  55. * @throws \yii\web\HttpException
  56. */
  57. public function actionRegNum(){
  58. $chartData = ChartData::instance();
  59. return static::notice($chartData->getUserData());
  60. }
  61. /**
  62. * 奖金量
  63. * @return mixed
  64. * @throws \yii\web\HttpException
  65. */
  66. public function actionBonusNum(){
  67. $chartData = ChartData::instance();
  68. return static::notice($chartData->getBonusData());
  69. }
  70. /**
  71. * 提现量
  72. * @return mixed
  73. * @throws \yii\web\HttpException
  74. */
  75. public function actionWithdrawNum(){
  76. $chartData = ChartData::instance();
  77. return static::notice($chartData->getWithdrawData());
  78. }
  79. }