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.
simple-yewu/common/models/GiftTicket2T.php

102 lines
2.3 KiB

5 years ago
<?php
namespace common\models;
use Yii;
/**
* This is the model class for table "gift_ticket2_t".
*
* @property integer $id
* @property integer $gift_id
* @property string $car_no
* @property integer $ticket_id
* @property string $use_date
* @property integer $status
* @property integer $op_id
* @property integer $send_type
* @property string $send_no
* @property string $created_at
* @property string $updated_at
*/
class GiftTicket2T extends \common\models\Base
{
/**
* @inheritdoc
*/
public static function tableName()
{
return 'gift_ticket2_t';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['gift_id', 'ticket_id'], 'required'],
[['gift_id', 'ticket_id', 'status', 'op_id', 'send_type'], 'integer'],
[['use_date', 'created_at', 'updated_at'], 'safe'],
[['car_no', 'send_no'], 'string', 'max' => 50],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'gift_id' => 'Gift ID',
'car_no' => 'Car No',
'ticket_id' => 'Ticket ID',
'use_date' => 'Use Date',
'status' => 'Status',
'op_id' => 'Op ID',
'send_type' => 'Send Type',
'send_no' => 'Send No',
'created_at' => 'Created At',
'updated_at' => 'Updated At',
];
}
public function getStatus() {
switch($this->status) {
case 1:
return '已出库';
case 3:
return '已退回';
default:
return '';
}
}
public function getSendType() {
switch($this->status) {
case 1:
return '自上门';
case 2:
return '德邦快递';
default:
return '';
}
}
public function getGift()
{
return $this->hasOne(Gift2T::className(),['id'=>'gift_id']);
}
public function getTicket()
{
return $this->hasOne(GiftTicketT::className(),['id'=>'ticket_id']);
}
public function getUser()
{
return $this->hasOne(UserT::className(),['id'=>'op_id']);
}
}