db->createCommand($check_table_sql)->execute(); // if(!empty($res)) return ''; //查询数据是否存在 $sql = "select * from qimall_crontab_task where command = 'hi-go/merchant-crontab/order-finish-mode' or command = 'hi-go/merchant-crontab/order-to-mode'"; $res = $this->db->createCommand($sql)->execute(); if($res) return ''; // 插入表数据 $sql = "INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '嗨购-打赏完成后订单模式结束处理', 'hi-go/merchant-crontab/order-finish-mode', 2, '0 */5 * * * *', 0, 1, 1669253273, 1669253273);"; $this->execute($sql); $sql = "INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '嗨购-打赏完成后订单模式开始处理', 'hi-go/merchant-crontab/order-to-mode', 2, '0 */5 * * * *', 0, 1, 1669253273, 1669253273);"; $this->execute($sql); }catch (\Exception $e){ } } /** * {@inheritdoc} */ public function safeDown() { echo "M221124013130InsertQimallCrontabTask cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M221124013130InsertQimallCrontabTask cannot be reverted.\n"; return false; } */ }