Browse Source

删除shop_category表的icon_type字段,修改pid和icon字段,修改表单字段

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
931a2d8f47
  1. 20
      vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php
  2. 26
      vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php
  3. 10
      vendor/antgoods/goods/src/models/searchs/CategorySearch.php
  4. 7
      vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php
  5. 4
      vendor/antgoods/goods/src/views/shopcategory/_form.php

20
vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php

@ -0,0 +1,20 @@
<?php
use yii\db\Migration;
/**
* Class m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category
*/
class m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category extends Migration
{
public function up()
{
$this->dropColumn('antgoods_shop_category', 'icon_type');
}
public function down()
{
$this->addColumn('antgoods_shop_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
return true;
}
}

26
vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php

@ -0,0 +1,26 @@
<?php
use yii\db\Migration;
/**
* Class m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category
*/
class m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category extends Migration
{
public function up()
{
$this->dropColumn('antgoods_shop_category', 'icon');
$this->addColumn('antgoods_shop_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标'));
$this->dropColumn('antgoods_shop_category', 'pid');
$this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id'));
}
public function down()
{
$this->dropColumn('antgoods_shop_category', 'icon');
$this->addColumn('antgoods_shop_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标'));
$this->dropColumn('antgoods_shop_category', 'pid');
$this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id'));
return true;
}
}

10
vendor/antgoods/goods/src/models/searchs/CategorySearch.php

@ -26,8 +26,8 @@ class CategorySearch extends Category
public function rules()
{
return [
[['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'],
[['name', 'icon'], 'safe'],
[['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'],
[['name'], 'safe'],
['created_at_range','safe'],
];
}
@ -57,7 +57,6 @@ class CategorySearch extends Category
'pid',
'goods_count',
'sort_order',
//'icon_type',
//'icon',
//'is_show',
//'is_delete',
@ -134,15 +133,14 @@ class CategorySearch extends Category
'pid' => $this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
'icon_type' => $this->icon_type,
'is_show' => $this->is_show,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
'icon' => $this->icon,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'icon', $this->icon]);
$query->andFilterWhere(['like', 'name', $this->name]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);

7
vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php

@ -26,8 +26,8 @@ class ShopCategorySearch extends ShopCategory
public function rules()
{
return [
[['id', 'pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete', 'created_at', 'updated_at'], 'integer'],
[['name', 'keywords', 'desc', 'icon', 'filter_attr'], 'safe'],
[['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'],
[['name', 'keywords', 'desc', 'filter_attr'], 'safe'],
['created_at_range','safe'],
];
}
@ -136,7 +136,7 @@ class ShopCategorySearch extends ShopCategory
'pid' => $this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
'icon_type' => $this->icon_type,
'icon' => $this->icon,
'is_show' => $this->is_show,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
@ -146,7 +146,6 @@ class ShopCategorySearch extends ShopCategory
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'keywords', $this->keywords])
->andFilterWhere(['like', 'desc', $this->desc])
->andFilterWhere(['like', 'icon', $this->icon])
->andFilterWhere(['like', 'filter_attr', $this->filter_attr]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);

4
vendor/antgoods/goods/src/views/shopcategory/_form.php

@ -15,16 +15,12 @@ use blobt\widgets\Icheck;
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'goods_count')->textInput() ?>
<?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'icon_type')->textInput() ?>
<?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'filter_attr')->textarea(['rows' => 6]) ?>

Loading…
Cancel
Save