| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace addons\Mch\console\migrations;
- use common\models\rbac\AuthItem;
- use yii\db\Migration;
- /**
- * Class M250905150803AddRbacAuthItem
- */
- class M250905150803AddRbacAuthItem extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $check = AuthItem::findOne(['name' => 'mch/diy/index']);
- if (!$check) {
- $sql = "INSERT INTO `qimall_rbac_auth_item`( `name`, `title`, `app_id`, `addons_name`, `pid`, `level`, `is_addon`, `sort`, `tree`, `status`, `created_at`, `updated_at`, `cate_id`) VALUES ('mch/diy/index', '装修', 'backend', 'Mch', 624955, 2, 1, 10, 'tr_0 tr_624955 ', 1, 1757056425, 1757056425, 1);";
- $this->execute($sql);
- }
- $check = AuthItem::findOne(['name' => 'mch/store-audit/index']);
- if (!$check) {
- $sql = "INSERT INTO `qimall_rbac_auth_item`( `name`, `title`, `app_id`, `addons_name`, `pid`, `level`, `is_addon`, `sort`, `tree`, `status`, `created_at`, `updated_at`, `cate_id`) VALUES ('mch/store-audit/index', '商户审核', 'backend', 'Mch', 624955, 2, 1, 30, 'tr_0 tr_624955 ', 1, 1757056425, 1757056425, 1);";
- $this->execute($sql);
- }
- $check = AuthItem::findOne(['name' => 'mch/store-category/index']);
- if (!$check) {
- $sql = "INSERT INTO `qimall_rbac_auth_item`( `name`, `title`, `app_id`, `addons_name`, `pid`, `level`, `is_addon`, `sort`, `tree`, `status`, `created_at`, `updated_at`, `cate_id`) VALUES ('mch/store-category/index', '商户分类', 'backend', 'Mch', 624955, 2, 1, 40, 'tr_0 tr_624955 ', 1, 1757056425, 1757056425, 1);";
- $this->execute($sql);
- }
- $sql = "UPDATE `qimall_rbac_auth_item` SET `sort` = 20 WHERE `name` = 'mch/store/index' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 50 WHERE `name` = 'mch/store-order/index' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 60 WHERE `name` = 'mch/store-order/refund-list' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 70 WHERE `name` = 'mch/store-goods/index' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 80 WHERE `name` = 'mch/store-assets/index' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 90 WHERE `name` = 'mch/store-cashdraw/index' and `addons_name` = 'Mch';
- UPDATE `qimall_rbac_auth_item` SET `sort` = 100 WHERE `name` = 'mch/store-setting/index' and `addons_name` = 'Mch'";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M250905150803AddRbacAuthItem cannot be reverted.\n";
- return false;
- }
- }
|