db->createCommand("select * from qimall_rbac_auth_item where name = 'admin/platform-order/index' ")->queryAll(); if(!$platform_order){ $column = ['name', 'title', 'app_id','addons_name', 'pid','level','is_addon','sort','tree','status','created_at','updated_at','cate_id']; $data = [ ['admin/platform-order/index', '订单管理', 'backend', '', '0', '1', '0', '999', 'tr_0 ', '1', time(), time(), '1'], ['admin/finance/index', '财务管理', 'backend', '', '0', '1', '0', '999', 'tr_0 ', '1', time(), time(), '1'], ['admin/upgrade/index', '更新管理', 'backend', '', '0', '1', '0', '999', 'tr_0 ', '1', time(), time(), '1'], ]; $this->batchInsert('qimall_rbac_auth_item', $column, $data); $platform_order = $this->db->createCommand("select * from qimall_rbac_auth_item where name = 'admin/platform-order/index' ")->queryAll(); $pid = $platform_order[0]['id']; $finance = $this->db->createCommand("select * from qimall_rbac_auth_item where name = 'admin/finance/index' ")->queryAll(); $finance_pid = $finance[0]['id']; $upgrade = $this->db->createCommand("select * from qimall_rbac_auth_item where name = 'admin/upgrade/index' ")->queryAll(); $upgrade_pid = $upgrade[0]['id']; $data = [ ['admin/platform-order/index', '订单列表', 'backend' , '',$pid, 2 , 0 , 999 ,'tr_0 tree_'.$pid, 1 , time(),time(),1], ['admin/finance/index', '账单明细', 'backend' , '',$finance_pid, 2 , 0 , 999 ,'tr_0 tree_'.$finance_pid, 1 , time(),time(),1], ['admin/upgrade/index', '更新记录', 'backend' , '',$upgrade_pid, 2 , 0 , 999 ,'tr_0 tree_'.$upgrade_pid, 1 , time(),time(),1], ]; $this->db->createCommand()->batchInsert('qimall_rbac_auth_item', $column, $data)->execute(); } $sql = "UPDATE `qimall_rbac_auth_item` SET `name`='admin/link/cate-index' WHERE (`name`='admin/link/cate') LIMIT 1"; $this->execute($sql); }catch (\Exception $e){ } } /** * {@inheritdoc} */ public function safeDown() { echo "M230202083942UpdateNameToRbacAuthItem cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M230202083942UpdateNameToRbacAuthItem cannot be reverted.\n"; return false; } */ }