| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace app\migrations;
- use common\enums\RabbitMqEnum;
- use common\listeners\census\OrderRefundListener;
- use yii\db\Migration;
- /**
- * 统计商城支付方式单月数据-添加退款金额统计
- * Class M240910140623AlterCensusMallPaymentSingleMonth
- */
- class M240910140623AlterCensusMallPaymentSingleMonth extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $sql = <<<SQL
- ALTER TABLE `qimall_census_mall_payment_single_month`
- ADD COLUMN `total_refund_money` decimal(12, 2) NOT NULL DEFAULT 0 COMMENT '退款金额' AFTER `total_pay_money`;
- SQL;
- $this->execute($sql);
- // 初始化退款月度统计
- \Yii::$app->services->rabbitMq->push(RabbitMqEnum::EXCHANGE_TASK_CENSUS, RabbitMqEnum::CENSUS_QUEUE, [], OrderRefundListener::class, 'initialSetMallRefundMonth');
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240910140623AlterCensusMallPaymentSingleMonth cannot be reverted.\n";
- return false;
- }
- }
|