| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace addons\BusinessActivity\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230705071957BusinessActivityCrontabTask
- */
- class M230705071957BusinessActivityCrontabTask extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $list = $this->db->createCommand("select * from qimall_crontab_task where
- `command` IN ('business-activity/activity/sign-in-expire',
- 'business-activity/activity/activity-finish') ")->queryAll();
- if($list && count($list) == 2) return true;
- $this->execute("INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('招商活动 - 定时解除绑定关系', 'business-activity/activity/sign-in-expire', 2, '0 */1 * * * *', 0, 1, 1678879219, 1678879219);");
- $this->execute("INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('招商活动 - 定时启用/结束', 'business-activity/activity/activity-finish', 2, '0 */1 * * * *', 0, 1, 1678879140, 1678879140);");
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230705071957BusinessActivityCrontabTask cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230705071957BusinessActivityCrontabTask cannot be reverted.\n";
- return false;
- }
- */
- }
|