This commit is contained in:
2023-03-08 09:16:04 +08:00
commit e78454540f
1318 changed files with 210569 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentAlipaysTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_alipays', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('app_id');
$table->string('notify_url')->nullable();
$table->string('return_url')->nullable();
$table->text('ali_public_key')->nullable();
$table->text('private_key')->nullable();
$table->string('app_cert_path')->nullable()->comment('应用公钥证书');
$table->string('alipay_cert_path')->nullable()->comment('支付宝公钥证书');
$table->string('alipay_root_cert_path')->nullable()->comment('支付宝根证书文件');
$table->json('log');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_alipays');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentBillsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_bills', function (Blueprint $table) {
$table->id();
$table->date('date')->comment('账单日期');
$table->decimal('total', 20)->comment('累计收款');
$table->decimal('refund', 20)->comment('累计退款');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_bills');
}
}

View File

@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentNotifiesTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_notifies', function (Blueprint $table) {
$table->id();
$table->foreignId('payment_id');
$table->json('payload');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_notifies');
}
}

View File

@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentRedpacksTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_redpacks', function (Blueprint $table) {
$table->id();
$table->boolean('type')->default(0)->index()->comment('0:普通红包1:裂变红包');
$table->uuid('redpack_no')->comment('商户订单号')->index();
$table->decimal('amount')->comment('发放金额');
$table->unsignedTinyInteger('number')->default(1)->comment('总发放个数');
$table->enum('driver', ['alipay', 'wechat'])->index()->comment('付款渠道');
$table->string('to')->index()->comment('用户OPENID');
$table->string('status', 16)->nullable()->comment('发放状态');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_redpacks');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentRefundsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_refunds', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('payment_id')->index();
$table->uuid('refund_no')->comment('退款单号');
$table->decimal('total', 20)->comment('退款金额');
$table->timestamp('refund_at')->nullable()->comment('退款时间');
$table->timestamps();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_refunds');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentSettingsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_settings', function (Blueprint $table) {
$table->id();
$table->string('name')->comment('配置名称');
$table->tinyInteger('trade_id_counter_length')->default(6);
$table->boolean('in_use')->default(0)->comment('是否是使用中的配置');
$table->unsignedBigInteger('alipay_id')->nullable();
$table->unsignedBigInteger('wechat_id')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_settings');
}
}

View File

@@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentTransfersTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_transfers', function (Blueprint $table) {
$table->id();
$table->uuid('transfer_no')->index()->comment('商户订单号');
$table->decimal('amount')->comment('转账金额');
$table->enum('driver', ['alipay', 'wechat'])->index()->comment('付款渠道');
$table->string('to')->index()->comment('微信openid支付宝identity');
$table->boolean('check')->default(0)->comment('是否校验真实姓名');
$table->string('user_name')->nullable()->comment('收款人姓名');
$table->string('desc')->nullable()->comment('付款说明');
$table->string('status', 16)->nullable()->comment('转账状态');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_transfers');
}
}

View File

@@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentWechatsTable extends Migration
{
/**
* Run the migrations.
* @return void
*/
public function up()
{
Schema::create('payment_wechats', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('appid')->nullable();
$table->string('app_id')->nullable();
$table->string('miniapp_id')->nullable();
$table->string('mch_id');
$table->string('key');
$table->string('notify_url')->nullable();
$table->string('cert_client')->nullable();
$table->string('cert_key')->nullable();
$table->json('log');
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
* @return void
*/
public function down()
{
Schema::dropIfExists('payment_wechats');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatePaymentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payments', function (Blueprint $table) {
$table->id();
$table->morphs('order');
$table->unsignedBigInteger('user_id')->index();
$table->uuid('trade_id')->unique();
$table->decimal('total', 20, 2)->unsigned()->comment('支付金额');
$table->enum('driver', ['alipay', 'wechat', 'score'])->index()->comment('支付方式');
$table->string('gateway', 16)->comment('支付渠道');
$table->string('state', 16)->index()->comment('订单状态');
$table->uuid('transaction_id')->nullable()->index()->comment('三方交易号');
$table->timestamp('paid_at')->nullable()->comment('订单支付时间');
$table->timestamps();
$table->index('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payments');
}
}