Browse Source

feat(order): 管理员确认收款时触发支付成功事件

- 移除 try-catch 包裹,简化确认收款逻辑
- 在确认收款成功后触发 PaymentSuccessEvent事件
- 添加支付业务类型枚举 PaymentBizEnum::ORDER_PAY
- 优化代码结构,提升可读性与维护性
runphp 4 tháng trước cách đây
mục cha
commit
c04bea6c7b

+ 5 - 16
database/migrations/20250724080000_create_message_tables.php

@@ -1,15 +1,13 @@
 <?php
 declare(strict_types=1);
 
-use think\migration\Migrator;
-use think\migration\db\Column;
 
-class CreateMessageTables extends Migrator
+class CreateMessageTables extends \Phinx\Migration\AbstractMigration
 {
     /**
      * 执行迁移
      */
-    public function up()
+    public function change(): void
     {
         // 创建系统公告表
         $this->table('message_announcements', [
@@ -103,6 +101,9 @@ class CreateMessageTables extends Migrator
             ->addIndex(['code'], ['name' => 'idx_code', 'unique' => true])
             ->create();
 
+        if (!$this->isMigratingUp()) {
+            return;
+        }
         // 插入默认消息模板数据
         $currentTime = time();
         $this->table('message_templates')
@@ -176,16 +177,4 @@ class CreateMessageTables extends Migrator
             ])
             ->save();
     }
-
-    /**
-     * 回滚迁移
-     */
-    public function down()
-    {
-        $this->table('message_announcements')->drop();
-        $this->table('message_notifications')->drop();
-        $this->table('message_privates')->drop();
-        $this->table('message_settings')->drop();
-        $this->table('message_templates')->drop();
-    }
 }

+ 13 - 1
database/migrations/20251015053004_notifications_template_context.php

@@ -17,11 +17,23 @@ final class NotificationsTemplateContext extends AbstractMigration
      * Remember to call "create()" or "update()" and NOT "save()" when working
      * with the Table class.
      */
-    public function change(): void
+    public function up(): void
     {
+
         $table = $this->table('message_notifications');
         $table->addColumn('template_context', 'json', ['comment' => '模板上下文', 'after' => 'template_code'])
             ->removeColumn('template_content')
             ->update();
+
+    }
+
+    public function down(): void
+    {
+
+        $table = $this->table('message_notifications');
+        $table->addColumn('template_content', 'text', ['comment' => '模板内容', 'after' => 'template_code'])
+            ->removeColumn('template_context')
+            ->update();
+
     }
 }