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.
90 lines
2.1 KiB
90 lines
2.1 KiB
5 years ago
|
<?php
|
||
|
|
||
|
namespace common\models;
|
||
|
|
||
|
use Yii;
|
||
|
|
||
|
/**
|
||
|
* This is the model class for table "gift_ticket_t".
|
||
|
*
|
||
|
* @property integer $id
|
||
|
* @property integer $code
|
||
|
* @property integer $type_id
|
||
|
* @property integer $group_id
|
||
|
* @property string $car_no
|
||
|
* @property string $input_date
|
||
|
* @property string $use_date
|
||
|
* @property integer $status
|
||
|
* @property integer $op_id
|
||
|
* @property string $created_at
|
||
|
* @property string $updated_at
|
||
|
*/
|
||
|
class GiftTicketT extends \common\models\Base
|
||
|
{
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public static function tableName()
|
||
|
{
|
||
|
return 'gift_ticket_t';
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function rules()
|
||
|
{
|
||
|
return [
|
||
|
[['code', 'type_id', 'status', 'op_id','group_id'], 'integer'],
|
||
|
[['type_id'], 'required'],
|
||
|
[['input_date', 'use_date', 'created_at', 'updated_at'], 'safe'],
|
||
|
[['car_no'], 'string', 'max' => 50],
|
||
|
];
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @inheritdoc
|
||
|
*/
|
||
|
public function attributeLabels()
|
||
|
{
|
||
|
return [
|
||
|
'id' => 'ID',
|
||
|
'code' => 'Code',
|
||
|
'type_id' => 'Type ID',
|
||
|
'gorup_id' => 'Group ID',
|
||
|
'car_no' => 'Car No',
|
||
|
'input_date' => 'Input Date',
|
||
|
'use_date' => 'Use Date',
|
||
|
'status' => 'Status',
|
||
|
'op_id' => 'Op ID',
|
||
|
'created_at' => 'Created At',
|
||
|
'updated_at' => 'Updated At',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function getStatus() {
|
||
|
switch($this->status) {
|
||
|
case 1:
|
||
|
return '已出库,未使用';
|
||
|
case 2:
|
||
|
return '已使用';
|
||
|
case 3:
|
||
|
return '已退回';
|
||
|
default:
|
||
|
return '未使用';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function getType() {
|
||
|
return $this->hasOne(GiftType2T::className(),['id'=>'type_id']);
|
||
|
}
|
||
|
|
||
|
public function getUser() {
|
||
|
return $this->hasOne(UserT::className(),['id'=>'op_id']);
|
||
|
}
|
||
|
|
||
|
public function getGroup() {
|
||
|
return $this->hasOne(GiftGroupT::className(),['id'=>'group_id']);
|
||
|
}
|
||
|
}
|