退款单号
parent
92f441b75b
commit
08eb0f11d9
|
|
@ -19,10 +19,27 @@ class OrderRefundTask extends Model
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
'sn',
|
||||||
'order_id',
|
'order_id',
|
||||||
'after_sale_id',
|
'after_sale_id',
|
||||||
'amount',
|
'amount',
|
||||||
'status',
|
'status',
|
||||||
'failed_reason',
|
'failed_reason',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只查询待退款的任务
|
||||||
|
*/
|
||||||
|
public function scopePending($query)
|
||||||
|
{
|
||||||
|
return $query->where('status', static::STATUS_PENDING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 此退款任务所属的订单
|
||||||
|
*/
|
||||||
|
public function order()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Order::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class CreateOrderRefundTasksTable extends Migration
|
||||||
{
|
{
|
||||||
Schema::create('order_refund_tasks', function (Blueprint $table) {
|
Schema::create('order_refund_tasks', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
|
$table->string('sn')->comment('退款单号');
|
||||||
$table->unsignedBigInteger('order_id')->comment('订单ID');
|
$table->unsignedBigInteger('order_id')->comment('订单ID');
|
||||||
$table->unsignedBigInteger('after_sale_id')->nullable()->comment('售后ID');
|
$table->unsignedBigInteger('after_sale_id')->nullable()->comment('售后ID');
|
||||||
$table->unsignedBigInteger('amount')->comment('退款金额');
|
$table->unsignedBigInteger('amount')->comment('退款金额');
|
||||||
|
|
@ -22,6 +23,7 @@ class CreateOrderRefundTasksTable extends Migration
|
||||||
$table->string('failed_reason')->nullable()->comment('失败原因');
|
$table->string('failed_reason')->nullable()->comment('失败原因');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
|
|
||||||
|
$table->unique('sn');
|
||||||
$table->unique(['order_id', 'after_sale_id']);
|
$table->unique(['order_id', 'after_sale_id']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue