RechargeConfigService.php 652 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace addons\TinyShop\services\marketing;
  3. use common\enums\StatusEnum;
  4. use addons\TinyShop\common\models\marketing\RechargeConfig;
  5. /**
  6. * Class RechargeConfigService
  7. * @package addons\TinyShop\services\marketing
  8. * @author jianyan74 <751393839@qq.com>
  9. */
  10. class RechargeConfigService
  11. {
  12. /**
  13. * @param $money
  14. * @return array|\yii\db\ActiveRecord|null|RechargeConfig
  15. */
  16. public function getGiveMoney($money)
  17. {
  18. return RechargeConfig::find()
  19. ->where(['<=', 'price', $money])
  20. ->andWhere(['status' => StatusEnum::ENABLED])
  21. ->orderBy('price desc')
  22. ->one();
  23. }
  24. }
粤ICP备19079148号