CouponController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace addons\TinyShop\merchant\modules\statistics\controllers;
  3. use Yii;
  4. use common\helpers\ResultHelper;
  5. use common\enums\UseStateEnum;
  6. use addons\TinyShop\merchant\controllers\BaseController;
  7. /**
  8. * Class CouponController
  9. * @package addons\TinyShop\merchant\modules\statistics\controllers
  10. * @author jianyan74 <751393839@qq.com>
  11. */
  12. class CouponController extends BaseController
  13. {
  14. /**
  15. * @return string
  16. */
  17. public function actionIndex()
  18. {
  19. return $this->render('index', [
  20. 'groupCount' => Yii::$app->tinyShopService->marketingCoupon->findCountByState()
  21. ]);
  22. }
  23. /**
  24. * @param $type
  25. * @return array|mixed
  26. */
  27. public function actionGetCount($type)
  28. {
  29. $data = Yii::$app->tinyShopService->marketingCoupon->getBetweenCountStatToEchant($type, UseStateEnum::GET);
  30. return ResultHelper::json(200, '获取成功', $data);
  31. }
  32. /**
  33. * @param $type
  34. * @return array|mixed
  35. */
  36. public function actionUnsedCount($type)
  37. {
  38. $data = Yii::$app->tinyShopService->marketingCoupon->getBetweenCountStatToEchant($type, UseStateEnum::USE);
  39. return ResultHelper::json(200, '获取成功', $data);
  40. }
  41. /**
  42. * @param $type
  43. * @return array|mixed
  44. */
  45. public function actionPastDueCount($type)
  46. {
  47. $data = Yii::$app->tinyShopService->marketingCoupon->getBetweenCountStatToEchant($type, UseStateEnum::PAST_DUE);
  48. return ResultHelper::json(200, '获取成功', $data);
  49. }
  50. }
粤ICP备19079148号