Browse Source

修改商品表单

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
667865d423
  1. 43
      vendor/antgoods/goods/src/migrations/m191202_025843_update_column_sort_order_in_antgoods_attribute.php
  2. 43
      vendor/antgoods/goods/src/migrations/m191202_032835_update_column_sort_order_in_antgoods_category.php
  3. 16
      vendor/antgoods/goods/src/models/ars/Attribute.php
  4. 16
      vendor/antgoods/goods/src/models/ars/Category.php
  5. 6
      vendor/antgoods/goods/src/views/goods/goods.php

43
vendor/antgoods/goods/src/migrations/m191202_025843_update_column_sort_order_in_antgoods_attribute.php

@ -1,43 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191202_025843_update_column_sort_order_in_antgoods_attribute
*/
class m191202_025843_update_column_sort_order_in_antgoods_attribute extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->dropColumn('antgoods_attribute', 'sort_order');
$this->addColumn('antgoods_attribute', 'sort_order', $this->smallInteger(3)->defaultValue(null)->unsigned()->comment('排序'));
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('antgoods_attribute', 'sort_order');
$this->addColumn('antgoods_attribute', 'sort_order', $this->smallInteger(3)->defaultValue(null)->comment('排序'));
return true;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m191202_025843_update_column_sort_order_in_antgoods_attribute cannot be reverted.\n";
return false;
}
*/
}

43
vendor/antgoods/goods/src/migrations/m191202_032835_update_column_sort_order_in_antgoods_category.php

@ -1,43 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191202_032835_update_column_sort_order_in_antgoods_category
*/
class m191202_032835_update_column_sort_order_in_antgoods_category extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->dropColumn('antgoods_category', 'sort_order');
$this->addColumn('antgoods_category', 'sort_order', $this->smallInteger(3)->defaultValue(0)->comment('排序'));
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('antgoods_category', 'sort_order');
$this->addColumn('antgoods_category', 'sort_order', $this->smallInteger(3)->unsigned()->defaultValue(0)->comment('排序'));
return true;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m191202_032835_update_column_sort_order_in_antgoods_category cannot be reverted.\n";
return false;
}
*/
}

16
vendor/antgoods/goods/src/models/ars/Attribute.php

@ -44,25 +44,9 @@ class Attribute extends \yii\db\ActiveRecord
[['value'], 'string'], [['value'], 'string'],
[['type', 'sort_order', 'is_delete', 'cat_id'], 'integer'], [['type', 'sort_order', 'is_delete', 'cat_id'], 'integer'],
[['name'], 'string', 'max' => 50], [['name'], 'string', 'max' => 50],
[['sort_order'], 'checkNegative'],
]; ];
} }
/**
* @param $attribute
* @param $params
* 验证是否为负数
*/
public function checkNegative($attribute, $params)
{
if ($this->$attribute < 0) {
$this->addError($attribute, "不得为负数");
}
if ($this->$attribute > 65535) {
$this->addError($attribute, "不得大于65535");
}
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

16
vendor/antgoods/goods/src/models/ars/Category.php

@ -54,25 +54,9 @@ class Category extends \yii\db\ActiveRecord
[['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'], [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'],
[['name'], 'string', 'max' => 60], [['name'], 'string', 'max' => 60],
[['iconImageId'], 'string'], [['iconImageId'], 'string'],
[['sort_order'], 'checkNegative'],
]; ];
} }
/**
* @param $attribute
* @param $params
* 验证是否为负数
*/
public function checkNegative($attribute, $params)
{
if ($this->$attribute < 0) {
$this->addError($attribute, "不得为负数");
}
if ($this->$attribute > 65535) {
$this->addError($attribute, "不得大于65535");
}
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

6
vendor/antgoods/goods/src/views/goods/goods.php

@ -5,6 +5,7 @@ use antgoods\goods\models\ars\Brand;
use antgoods\goods\models\ars\ShopCategory; use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\ars\Supplier; use antgoods\goods\models\ars\Supplier;
use linyao\widgets\Select2; use linyao\widgets\Select2;
use yii\bootstrap4\Html;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */ /* @var $model antgoods\goods\models\ars\Goods */
@ -55,3 +56,8 @@ use linyao\widgets\Select2;
<?= $form->field($model, 'bouns_points')->textInput() ?> <?= $form->field($model, 'bouns_points')->textInput() ?>
<?= $form->field($model, 'experience_points')->textInput() ?> <?= $form->field($model, 'experience_points')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
Loading…
Cancel
Save