| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace addons\HiGo\console\migrations;
- use yii\db\Migration;
- /**
- * Class M221124013130InsertQimallCrontabTask
- */
- class M221124013130InsertQimallCrontabTask extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- // $table = 'qimall_crontab_task';
- // $check_table_sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- // $res = $this->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;
- }
- */
- }
|