Browse Source

feat:商品模型增加行为,若limit_count字段为空,则为0

antshop
linyaostalker 5 years ago
parent
commit
acd6c94b30
  1. 1
      backend/modules/goods/controllers/GoodsController.php
  2. 3
      backend/modules/goods/models/ars/Goods.php

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

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

3
backend/modules/goods/models/ars/Goods.php

@ -234,6 +234,9 @@ class Goods extends \yii\db\ActiveRecord
if (!$this->sn) {
$this->sn = time() . rand(1111, 9999);
}
if (!$this->limit_count) {
$this->limit_count = 0;
}
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
}

Loading…
Cancel
Save