商户订单

This commit is contained in:
liu
2026-06-17 10:52:47 +08:00
parent 8d52e863b9
commit 845bea4b81
35 changed files with 1716 additions and 0 deletions
@@ -79,6 +79,29 @@ return new class extends Migration
});
}
// 订单支付日志(支付成功后写入,关联三方支付流水)
if (! Schema::hasTable('order_payments')) {
Schema::create('order_payments', function (Blueprint $table) {
$table->id();
$table->string('payment_no', 32)->comment('支付日志编号');
$table->unsignedBigInteger('order_id')->comment('订单ID');
$table->unsignedInteger('user_id')->comment('支付用户ID');
$table->unsignedBigInteger('payment_transaction_id')->nullable()->comment('三方支付流水ID');
$table->decimal('amount', 10, 2)->comment('支付金额');
$table->tinyInteger('pay_type')->comment('支付方式:0=余额,1=微信支付');
$table->tinyInteger('status')->default(0)->comment('状态:0=待支付,1=已支付,2=已退款');
$table->timestamp('paid_at')->nullable()->comment('支付时间');
$table->timestamp('refund_at')->nullable()->comment('退款时间');
$table->timestamps();
$table->unique('payment_no');
$table->index('order_id');
$table->index('user_id');
$table->index('payment_transaction_id');
$table->index('status');
$table->comment('订单支付日志');
});
}
// 商户提现
if (! Schema::hasTable('merchant_withdrawals')) {
Schema::create('merchant_withdrawals', function (Blueprint $table) {
@@ -103,6 +126,7 @@ return new class extends Migration
public function down(): void
{
Schema::dropIfExists('merchant_withdrawals');
Schema::dropIfExists('order_payments');
Schema::dropIfExists('order_refunds');
Schema::dropIfExists('order_items');
Schema::dropIfExists('orders');