| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace common\models;
- use common\components\ActiveRecord;
- /**
- * This is the model class for table "{{%BS_BONUS_103_CALC}}".
- *
- */
- class BsBonus103Calc extends ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%BS_BONUS_103_CALC}}';
- }
- /**
- * 查询指定期数最大推荐网层级.
- * @param integer $period 期数
- * @return bool|mixed|string|null
- */
- public static function getMaxLayer(int $period)
- {
- return static::find()->where('CALC_PERIOD_ID=:CALC_PERIOD_ID', [':CALC_PERIOD_ID' => $period])->max('LAYER');
- }
- /**
- * 会员的上级
- * @param $userId
- * @param $period
- * @return array|null
- */
- public static function getIntroducer($userId, $period)
- {
- return static::findOneAsArray('USER_ID=:USER_ID AND CALC_PERIOD_ID=:CALC_PERIOD_ID', [':USER_ID' => $userId, ':CALC_PERIOD_ID' => $period]);
- }
- }
|