<?php namespace common\models; use Yii; /** * This is the model class for table "caiwu_import_t". * * @property integer $id * @property string $title * @property string $submit_date * @property integer $total_all * @property integer $total_right * @property integer $total_error * @property integer $total_none * @property integer $user_id * @property string $user_name * @property string $import_type * @property string $created_at * @property string $updated_at */ class CaiwuImportT extends \common\models\Base { /** * @inheritdoc */ public static function tableName() { return 'caiwu_import_t'; } /** * @inheritdoc */ public function rules() { return [ [['submit_date', 'created_at', 'updated_at'], 'safe'], [['total_all', 'total_right', 'total_error', 'total_none', 'user_id'], 'integer'], [['title', 'user_name'], 'string', 'max' => 100], ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => 'ID', 'title' => 'Title', 'submit_date' => 'Submit Date', 'total_all' => 'Total All', 'total_right' => 'Total Right', 'total_error' => 'Total Error', 'total_none' => 'Total None', 'user_id' => 'User ID', 'user_name' => 'User Name', 'import_type' => 'Import Type', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getUser() { return $this->hasOne(UserT::className(),['id'=>'user_id']); } //返回匹对名称 public function getImportName(){ switch($this->import_type){ case 1: return '手续费'; break; case 2: return '补点一'; break; case 3: return '补点二'; break; default: return ''; } } }