Browse Source

订单商品表增加重量字段

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
8052d0e4d3
  1. 4
      common/models/ars/OrderGoods.php
  2. 20
      console/migrations/m191130_071623_add_column_weight_in_table_ats_order_goods.php

4
common/models/ars/OrderGoods.php

@ -19,6 +19,7 @@ use yii\behaviors\TimestampBehavior;
* @property int $market_price 市场价
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
* @property int $weight 重量
*/
class OrderGoods extends \yii\db\ActiveRecord
{
@ -37,7 +38,7 @@ class OrderGoods extends \yii\db\ActiveRecord
{
return [
[['order_id', 'goods_id'], 'required'],
[['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price'], 'integer'],
[['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price', 'weight'], 'integer'],
[['goods_name', 'sku_value'], 'string', 'max' => 120],
];
}
@ -59,6 +60,7 @@ class OrderGoods extends \yii\db\ActiveRecord
'market_price' => '市场价',
'updated_at' => '更新时间',
'created_at' => '创建时间',
'weight' => '重量',
];
}

20
console/migrations/m191130_071623_add_column_weight_in_table_ats_order_goods.php

@ -0,0 +1,20 @@
<?php
use yii\db\Migration;
/**
* Class m191130_071623_add_column_weight_in_table_ats_order_goods
*/
class m191130_071623_add_column_weight_in_table_ats_order_goods extends Migration
{
public function up()
{
$this->addColumn('ats_order_goods', 'weight', $this->integer(11)->defaultValue(0)->unsigned()->comment('重量'));
}
public function down()
{
$this->dropColumn('ats_order_goods', 'weight');
return true;
}
}
Loading…
Cancel
Save