From b82c70ab1493b355d9da8e00dca1e1345d55e2e7 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 3 Dec 2019 11:44:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=A1=A8=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E5=9C=B0=E5=9D=80=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/models/ars/Order.php | 6 +- common/models/ars/TakingSite.php | 92 ------------------- ..._add_column_address_in_table_ats_order.php | 20 ++++ 3 files changed, 24 insertions(+), 94 deletions(-) delete mode 100644 common/models/ars/TakingSite.php create mode 100644 console/migrations/m191203_034004_add_column_address_in_table_ats_order.php diff --git a/common/models/ars/Order.php b/common/models/ars/Order.php index 6f03a52..1ddcebd 100644 --- a/common/models/ars/Order.php +++ b/common/models/ars/Order.php @@ -34,6 +34,7 @@ use yii\behaviors\TimestampBehavior; * @property string $discount_decription 折扣说明 * @property int $updated_at 更新时间 * @property int $created_at 创建时间 + * @property string $address 详细地址 */ class Order extends \yii\db\ActiveRecord { @@ -51,9 +52,9 @@ class Order extends \yii\db\ActiveRecord public function rules() { return [ - [['user_id'], 'required'], + [['user_id', 'address'], 'required'], [['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'], - [['discount_decription'], 'string'], + [['discount_decription', 'address'], 'string'], [['order_sn', 'invoice_id'], 'string', 'max' => 64], [['consignee', 'phone'], 'string', 'max' => 20], [['province', 'city', 'area'], 'string', 'max' => 10], @@ -94,6 +95,7 @@ class Order extends \yii\db\ActiveRecord 'discount_decription' => '折扣说明', 'updated_at' => '更新时间', 'created_at' => '创建时间', + 'address' => '详细地址', ]; } diff --git a/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php deleted file mode 100644 index 85364ea..0000000 --- a/common/models/ars/TakingSite.php +++ /dev/null @@ -1,92 +0,0 @@ - '否', - self::IS_DEFAULT_YES => '是' - ]; - /** - * {@inheritdoc} - */ - public static function tableName() - { - return 'ats_taking_site'; - } - - /** - * {@inheritdoc} - */ - public function rules() - { - return [ - [['name', 'province', 'city', 'area', 'address'], 'required'], - [['address'], 'string'], - [['is_default'], 'integer'], - [['name'], 'string', 'max' => 120], - [['province', 'city', 'area'], 'string', 'max' => 10], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'name' => '名称', - 'province' => '省份', - 'city' => '城市', - 'area' => '区域', - 'address' => '详细地址', - 'is_default' => '是否为默认', - 'updated_at' => '更新时间', - 'created_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(); - }, - ], - ]; - } -} diff --git a/console/migrations/m191203_034004_add_column_address_in_table_ats_order.php b/console/migrations/m191203_034004_add_column_address_in_table_ats_order.php new file mode 100644 index 0000000..0e99b7b --- /dev/null +++ b/console/migrations/m191203_034004_add_column_address_in_table_ats_order.php @@ -0,0 +1,20 @@ +addColumn('ats_order', 'address', $this->text()->defaultValue('')->notNull()->comment('详细地址')); + } + + public function down() + { + $this->dropColumn('ats_order', 'address'); + return true; + } +}