BsBonus103Calc.php 969 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace common\models;
  3. use common\components\ActiveRecord;
  4. /**
  5. * This is the model class for table "{{%BS_BONUS_103_CALC}}".
  6. *
  7. */
  8. class BsBonus103Calc extends ActiveRecord
  9. {
  10. /**
  11. * @inheritdoc
  12. */
  13. public static function tableName()
  14. {
  15. return '{{%BS_BONUS_103_CALC}}';
  16. }
  17. /**
  18. * 查询指定期数最大推荐网层级.
  19. * @param integer $period 期数
  20. * @return bool|mixed|string|null
  21. */
  22. public static function getMaxLayer(int $period)
  23. {
  24. return static::find()->where('CALC_PERIOD_ID=:CALC_PERIOD_ID', [':CALC_PERIOD_ID' => $period])->max('LAYER');
  25. }
  26. /**
  27. * 会员的上级
  28. * @param $userId
  29. * @param $period
  30. * @return array|null
  31. */
  32. public static function getIntroducer($userId, $period)
  33. {
  34. return static::findOneAsArray('USER_ID=:USER_ID AND CALC_PERIOD_ID=:CALC_PERIOD_ID', [':USER_ID' => $userId, ':CALC_PERIOD_ID' => $period]);
  35. }
  36. }