Browse Source

feat:修改商品数据标限购字段,增加默认值0

antshop
linyaostalker 5 years ago
parent
commit
c05936e85e
  1. 1
      backend/modules/goods/controllers/GoodsController.php
  2. 22
      backend/modules/goods/migrations/m191211_060934_update_column_limit_count_in_table_atg_goods.php

1
backend/modules/goods/controllers/GoodsController.php

@ -102,6 +102,7 @@ class GoodsController extends Controller
$model->is_taking = Goods::IS_TAKING_NO; $model->is_taking = Goods::IS_TAKING_NO;
$model->is_express = Goods::IS_EXPRESS_YES; $model->is_express = Goods::IS_EXPRESS_YES;
$model->express_type = Goods::EXPRESS_TYPE_EXPRESS_TEMPLATE; $model->express_type = Goods::EXPRESS_TYPE_EXPRESS_TEMPLATE;
$model->limit_count = 0;
if ($model->load(Yii::$app->request->post()) && $model->validate()) { if ($model->load(Yii::$app->request->post()) && $model->validate()) {
//商品封面图和商品详情图上传保存处理 //商品封面图和商品详情图上传保存处理
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model); $res = GoodsManager::updateGoods(Yii::$app->request->post(), $model);

22
backend/modules/goods/migrations/m191211_060934_update_column_limit_count_in_table_atg_goods.php

@ -0,0 +1,22 @@
<?php
use yii\db\Migration;
/**
* Class m191211_060934_update_column_limit_count_in_table_atg_goods
*/
class m191211_060934_update_column_limit_count_in_table_atg_goods extends Migration
{
public function up()
{
$this->dropColumn('atg_goods', 'limit_count');
$this->addColumn('atg_goods', 'limit_count', $this->integer(11)->defaultValue("0")->comment("限购数量"));
}
public function down()
{
$this->dropColumn('atg_goods', 'limit_count');
$this->addColumn('atg_goods', 'limit_count', $this->integer(11)->defaultValue(null)->comment("限购数量"));
return true;
}
}
Loading…
Cancel
Save