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.
 
 
 

86 lines
2.1 KiB

<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_address".
*
* @property int $id
* @property int $user_id 用户id
* @property string $consignee 收件人
* @property string $phone 电话
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property string $address 详细地址
* @property int $status 状态,0-默认值 1-默认地址
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Address extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_address';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'status'], 'integer'],
[['address'], 'string'],
[['consignee', 'phone'], 'string', 'max' => 20],
[['province', 'city', 'area'], 'string', 'max' => 10],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'user_id' => '用户id',
'consignee' => '收件人',
'phone' => '电话',
'province' => '省份',
'city' => '城市',
'area' => '区域',
'address' => '详细地址',
'status' => '状态,0-默认值 1-默认地址',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}