| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace addons\LuckyGroup\console\migrations;
- use common\models\common\CrontabTask;
- use yii\db\Migration;
- /**
- * Class M230816060159InsertQimallCrontabTask
- */
- class M230816060159InsertQimallCrontabTask extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $res = CrontabTask::findOne(['name' => '幸运拼团每日自动重置参团会员参团次数']);
- if (empty($res)) {
- $sql = "INSERT INTO `qimall_crontab_task` ( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '幸运拼团每日自动重置参团会员参团次数', 'lucky-group/lucky-group-crontab/update-attend-times', 2, '0 10 0 * * *', 0, 1, 1652930361, 1655175672);";
- $this->execute($sql);
- }
- $res = CrontabTask::findOne(['name' => '幸运拼团结算奖金池分红']);
- if (empty($res)) {
- $sql = "INSERT INTO `qimall_crontab_task` ( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '幸运拼团结算奖金池分红', 'lucky-group/lucky-group-crontab/bonus-pool-dividend-log', 2, '0 31 0 * * *', 0, 1, 1652930384, 1655175666);";
- $this->execute($sql);
- }
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230816060159InsertQimallCrontabTask cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230816060159InsertQimallCrontabTask cannot be reverted.\n";
- return false;
- }
- */
- }
|