|
|
|
<?php
|
|
|
|
|
|
|
|
namespace common\models;
|
|
|
|
|
|
|
|
use Yii;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the model class for table "car_gift_t".
|
|
|
|
*
|
|
|
|
* @property integer $id
|
|
|
|
* @property integer $car_id
|
|
|
|
* @property integer $order_id
|
|
|
|
* @property integer $user_id
|
|
|
|
* @property integer $submit_time
|
|
|
|
* @property integer $status
|
|
|
|
* @property integer $type
|
|
|
|
* @property string $created_at
|
|
|
|
* @property string $updated_at
|
|
|
|
*/
|
|
|
|
class CarGiftT extends \common\models\Base
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public static function tableName()
|
|
|
|
{
|
|
|
|
return 'car_gift_t';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[['car_id', 'order_id', 'user_id', 'submit_time', 'status'], 'required'],
|
|
|
|
[['car_id', 'order_id', 'user_id', 'submit_time', 'status','type'], 'integer'],
|
|
|
|
[['created_at', 'updated_at'], 'safe'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
|
|
|
public function attributeLabels()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => 'ID',
|
|
|
|
'car_id' => 'Car ID',
|
|
|
|
'order_id' => 'Order ID',
|
|
|
|
'user_id' => 'User ID',
|
|
|
|
'submit_time' => 'Submit Time',
|
|
|
|
'status' => 'Status',
|
|
|
|
'type' => 'Type',
|
|
|
|
'created_at' => 'Created At',
|
|
|
|
'updated_at' => 'Updated At',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCar()
|
|
|
|
{
|
|
|
|
return $this->hasOne(CarT::className(),['id'=>'car_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getGift()
|
|
|
|
{
|
|
|
|
return $this->hasOne(GiftT::className(),['id'=>'gift_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getUser()
|
|
|
|
{
|
|
|
|
return $this->hasOne(UserT::className(),['id'=>'user_id']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getStatus() {
|
|
|
|
switch($this->status) {
|
|
|
|
case 0:
|
|
|
|
return '未出库';
|
|
|
|
case 1:
|
|
|
|
return '已出库';
|
|
|
|
case 2:
|
|
|
|
return '正在退换';
|
|
|
|
default:
|
|
|
|
return '状态错误';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getOrder()
|
|
|
|
{
|
|
|
|
return $this->hasOne(OrderT::className(),['id'=>'order_id']);
|
|
|
|
}
|
|
|
|
}
|