Mall.php 602 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace console\models;
  3. use yii\db\ActiveRecord;
  4. /**
  5. * Class Mall
  6. * @package console\models
  7. */
  8. class Mall extends ActiveRecord
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public static function tableName()
  14. {
  15. return '{{%mall}}';
  16. }
  17. /**
  18. * 获取有期限的商城
  19. *
  20. * @return array|static[]
  21. */
  22. public static function getTimeLimitMall()
  23. {
  24. $condition = [
  25. 'and',
  26. ['>', 'expired_at', time()],
  27. ['=', 'status', '1'],
  28. ];
  29. return static::find()->where($condition)->asArray()->all();
  30. }
  31. }