StatController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace shop\controllers;
  3. use common\components\dateUtil;
  4. use Yii;
  5. use common\components\util;
  6. class StatController extends BaseController
  7. {
  8. //统计列表 shish 2020.1.5
  9. public function actionList()
  10. {
  11. $type = Yii::$app->request->get('type', 1);
  12. $incomeStat = [
  13. 'total' => (185 + 381 + 662 + 443),
  14. 'list' => [
  15. ['name' => '2.6', 'num' => 185],
  16. ['name' => '2.7', 'num' => 381],
  17. ['name' => '2.8', 'num' => 662],
  18. ['name' => '2.9', 'num' => 443],
  19. ],
  20. ];
  21. $visitStat = [
  22. 'total' => (115 + 341 + 622 + 423),
  23. 'list' => [
  24. ['name' => '2.6', 'num' => 115],
  25. ['name' => '2.7', 'num' => 341],
  26. ['name' => '2.8', 'num' => 622],
  27. ['name' => '2.9', 'num' => 423],
  28. ],
  29. ];
  30. $userStat = [
  31. 'total' => (185 + 341 + 622 + 423),
  32. 'list' => [
  33. ['name' => '2.6', 'num' => 185],
  34. ['name' => '2.7', 'num' => 341],
  35. ['name' => '2.8', 'num' => 622],
  36. ['name' => '2.9', 'num' => 423],
  37. ],
  38. ];
  39. $fansStat = [
  40. 'total' => (185 + 241 + 322 + 553),
  41. 'list' => [
  42. ['name' => '2.6', 'num' => 185],
  43. ['name' => '2.7', 'num' => 241],
  44. ['name' => '2.8', 'num' => 322],
  45. ['name' => '2.9', 'num' => 553],
  46. ],
  47. ];
  48. $incomeSourceStat = [
  49. 'total' => (299 + 366 + 2995),
  50. 'list' => [
  51. ['name' => '门店', 'num' => 299],
  52. ['name' => '微信朋友圈', 'num' => 366],
  53. ['name' => '美团', 'num' => 2995],
  54. ],
  55. ];
  56. $categoryStat = [
  57. 'total' => (552 + 155 + 295 + 365 + 600 + 504),
  58. 'list' => [
  59. ['name' => '花束', 'num' => 552],
  60. ['name' => '花篮', 'num' => 155],
  61. ['name' => '蝴蝶兰', 'num' => 295],
  62. ['name' => '绿植', 'num' => 365],
  63. ['name' => '永生花', 'num' => 600],
  64. ['name' => '散花', 'num' => 504],
  65. ],
  66. ];
  67. $useStat = [
  68. 'total' => (552 + 155 + 295 + 365 + 600 + 504),
  69. 'list' => [
  70. ['name' => '年销花', 'num' => 552],
  71. ['name' => '送爱人', 'num' => 155],
  72. ['name' => '婚庆', 'num' => 295],
  73. ['name' => '开业', 'num' => 365],
  74. ['name' => '送母亲', 'num' => 600],
  75. ['name' => '生日', 'num' => 504],
  76. ]
  77. ];
  78. $data = ['incomeStat' => $incomeStat,
  79. 'visitStat' => $visitStat,
  80. 'userStat' => $userStat,
  81. 'fansStat' => $fansStat,
  82. 'incomeSourceStat' => $incomeSourceStat,
  83. 'categoryStat' => $categoryStat,
  84. 'useStat' => $useStat,
  85. ];
  86. util::success($data);
  87. }
  88. }