where(['title'=>'次卡列表','addons_name'=>'SecondaryCard'])->orderBy('id asc')->one(); $pid = $model['id']; $sql = "INSERT INTO `qimall_addons_store_menu` ( `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ( '使用记录', '0', '{$pid}', 'store/secondary-card/default/use-log', '', '2', '0', '999', NULL, '', '1', '0', '0', 'SecondaryCard', '1');"; $model = StoreMenu::find()->where(['url'=>'store/secondary-card/default/use-log','addons_name'=>'SecondaryCard'])->orderBy('id asc')->one(); if(empty($model)){ $this->execute($sql); } } /** * {@inheritdoc} */ public function safeDown() { echo "M240412073442SecondaryCard cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M240412073442SecondaryCard cannot be reverted.\n"; return false; } */ }