<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "zhongji_fanxian_t".
 *
 * @property int $id
 * @property int $celuo_id
 * @property double $fanxian_rate 返现金额比例
 * @property double $max_cashback 最高返现
 * @property string $created_at
 * @property string $updated_at
 */
class ZhongjiFanxianT extends \common\models\Base
{
    /**
     * {@inheritdoc}
     */

    public static function tableName()
    {
        return 'zhongji_fanxian_t';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['celuo_id', 'tiaojian_id'], 'integer'],
            [['fanxian_rate', 'max_cashback'], 'number'],
            [['created_at', 'updated_at'], 'safe'],

        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'celuo_id' => 'Celuo ID',
            'fanxian_rate' => 'Fanxian Rate',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }

    public function getTiaojian() {
        return $this->hasOne(ZhongjiTiaojian::className(),['id'=>'tiaojian_id']);
    }

    public function getCeluo() {
        return $this->hasOne(ZhongjiYingxiao::className(), ['id'=>'celuo_id']);
    }
}