| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace addons\CloudStock\console\migrations;
- use common\models\common\CrontabTask;
- use yii\db\Migration;
- /**
- * Class M230719014721InsertQimallCrontabTask
- */
- class M230719014721InsertQimallCrontabTask extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $res = CrontabTask::findOne(['command' => 'cloud-stock/index/team-reward']);
- if (empty($res)) {
- $sql = "INSERT INTO `qimall_crontab_task` ( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('云库存-云仓个人团队补货奖励', 'cloud-stock/index/team-reward', 2, '0 1 0 * * *', 0, 1, 1689665363, 1689665527);";
- $this->execute($sql);
- }
- $res = CrontabTask::findOne(['cloud-stock/index/pool-reward']);
- if (empty($res)) {
- $sql = "INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ( '云库存-平台分红池分红', 'cloud-stock/index/pool-reward', 2, '0 3 0 * * *', 0, 1, 1689665639, 1689665639);";
- $this->execute($sql);
- }
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230719014721InsertQimallCrontabTask cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230719014721InsertQimallCrontabTask cannot be reverted.\n";
- return false;
- }
- */
- }
|