| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace app\models;
- use yii\behaviors\TimestampBehavior;
- use yii\db\ActiveRecord;
- /**
- * This is the model class for table "{{%pond}}".
- *
- * @property integer $id
- * @property integer $store_id
- * @property integer $type
- * @property string $name
- * @property string $image_url
- * @property integer $winning_rate
- * @property integer $stock
- * @property integer $gift_id
- * @property integer $create_time
- * @property integer $update_time
- * @property integer $user_id
- */
- class Pond extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%pond}}';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['store_id', 'name'], 'required'],
- [['store_id', 'type', 'stock', 'gift_id', 'create_time', 'update_time', 'user_id', 'winning_rate'], 'integer'],
- [['image_url'], 'string', 'max' => 255],
- ];
- }
- public function behaviors()
- {
- return [
- [
- 'class' => TimestampBehavior::class,
- 'attributes' => [
- ActiveRecord::EVENT_BEFORE_INSERT => ['update_time', 'create_time'],
- ActiveRecord::EVENT_BEFORE_UPDATE => 'update_time'
- ]
- ]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'store_id' => 'Store ID',
- 'type' => '1.谢谢惠顾 2.商品',
- 'name' => '奖品名称',
- 'image_url' => '图片',
- 'winning_rate' => '中奖率',
- 'stock' => '库存',
- 'gift_id' => '赠品',
- 'create_time' => 'Create Time',
- 'update_time' => 'Update Time',
- 'user_id' => '指定中奖用户id',
- ];
- }
- public function getGift()
- {
- return $this->hasOne(Goods::className(), ['id' => 'gift_id']);
- }
- }
|