You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.7 KiB
75 lines
1.7 KiB
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use Yii;
|
|
|
|
/**
|
|
* This is the model class for table "strategy_t".
|
|
*
|
|
* @property integer $id
|
|
* @property string $name
|
|
* @property string $remark
|
|
* @property string $min_money
|
|
* @property string $max_money
|
|
* @property integer $sel_count
|
|
* @property integer $group_id
|
|
* @property integer $user_id
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
*/
|
|
class StrategyT extends \common\models\Base
|
|
{
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function tableName()
|
|
{
|
|
return 'strategy_t';
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['name', 'user_id'], 'required'],
|
|
[['min_money', 'max_money'], 'number'],
|
|
[['sel_count', 'group_id', 'user_id'], 'integer'],
|
|
[['created_at', 'updated_at'], 'safe'],
|
|
[['name'], 'string', 'max' => 100],
|
|
[['remark'], 'string', 'max' => 200],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'id' => 'ID',
|
|
'name' => 'Name',
|
|
'remark' => 'Remark',
|
|
'min_money' => 'Min Money',
|
|
'max_money' => 'Max Money',
|
|
'sel_count' => 'Sel Count',
|
|
'group_id' => 'Group ID',
|
|
'user_id' => 'User ID',
|
|
'created_at' => 'Created At',
|
|
'updated_at' => 'Updated At',
|
|
];
|
|
}
|
|
|
|
public function getUser()
|
|
{
|
|
return $this->hasOne(UserT::className(),['id'=>'user_id']);
|
|
}
|
|
|
|
public function getGifts()
|
|
{
|
|
return $this->hasMany(GiftT::className(),['id'=>'gift_id'])
|
|
->viaTable('gift_strategy_t',['strategy_id'=>'id']);
|
|
}
|
|
}
|
|
|