| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace addons\SecondaryCard\console\migrations;
- use common\models\common\CrontabTask;
- use yii\db\Migration;
- /**
- * Class M240320021647InsertTask
- */
- class M240320021647InsertTask extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $res = CrontabTask::find()->where(['command'=>'secondary-card/index-crontab/order-refund'])->one();
- if(empty($res)) {
- $sql="INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '次卡过期检查', 'secondary-card/index-crontab/order-refund', 2, '0 */1 * * * *', 0, 1, 1710494060, 1710494060);";
- $this->execute($sql);
- }
- $res = CrontabTask::find()->where(['command'=>'secondary-card/index-crontab/put-down'])->one();
- if(empty($res)) {
- $sql="
- INSERT INTO `qimall_crontab_task` ( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('次卡检查下架', 'secondary-card/index-crontab/put-down', 2, '0 */1 * * * *', 0, 1, 1712718662, 1712718662);
- ";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240320021647InsertTask cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240320021647InsertTask cannot be reverted.\n";
- return false;
- }
- */
- }
|