Files
datahub/backend/app/Model/Refund.php
T
2026-03-13 11:37:37 +08:00

85 lines
4.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Model;
use OpenApi\Attributes as OA;
/**
* @property int $id 主键
* @property int $company_id 公司 ID
* @property int $platform_id 平台 ID
* @property int $store_id 店铺 ID
* @property int $order_id 关联本地 orders 表 ID
* @property string $platform_order_id 平台订单 ID
* @property string $platform_refund_id 平台退款单 ID
* @property int $refund_status_id 退款状态 ID
* @property int $refund_type_id 退款类型:1 仅退款 2 退货退款 3 补偿退款
* @property string $reason 退款原因
* @property string $refund_amount 退款金额
* @property string $freight_refund 退运费金额
* @property string $refund_total 退款合计金额,为退款金额+退运费金额,为主要参与聚合计算的字段
* @property string $currency 币种
* @property string $buyer_user_id 平台买家 ID
* @property string $order_created_date 关联订单的创建时间
* @property string $order_paid_date 关联订单的付款时间
* @property string $created_date 退款单在平台的创建时间
* @property string $updated_date 退款单在平台的更新时间
* @property string $completed_date 退款完成时间
* @property array $raw 平台返回的原始数据
* @property array $ext 扩展字段
* @property string $hash raw 字段的 MD5 哈希值,用于检测数据变化
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @mixin \App_Model_Refund
*/
#[OA\Schema(
schema: 'Refund',
type: 'object',
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'company_id', type: 'integer', example: 1),
new OA\Property(property: 'platform_id', type: 'integer', example: 2),
new OA\Property(property: 'store_id', type: 'integer', example: 100),
new OA\Property(property: 'order_id', type: 'integer', nullable: true, example: 500),
new OA\Property(property: 'platform_order_id', type: 'string', example: 'ORD-20260101-001'),
new OA\Property(property: 'platform_refund_id', type: 'string', example: 'RF-20260115-001'),
new OA\Property(property: 'refund_status_id', type: 'integer', example: 1),
new OA\Property(property: 'refund_type_id', type: 'integer', example: 2),
new OA\Property(property: 'reason', type: 'string', nullable: true, example: '商品质量问题'),
new OA\Property(property: 'buyer_user_id', type: 'string', nullable: true, example: 'buyer_123'),
new OA\Property(property: 'refund_amount', type: 'number', format: 'decimal', example: 99.99),
new OA\Property(property: 'freight_refund', type: 'number', format: 'decimal', example: 10.00),
new OA\Property(property: 'refund_total', type: 'number', format: 'decimal', example: 109.99),
new OA\Property(property: 'currency', type: 'string', example: 'CNY'),
new OA\Property(property: 'hash', type: 'string', example: 'a1b2c3d4e5f6...'),
new OA\Property(property: 'raw', type: 'object', nullable: true, description: '平台原始数据'),
new OA\Property(property: 'ext', type: 'object', nullable: true, description: '扩展字段'),
new OA\Property(property: 'order_created_date', type: 'string', format: 'date-time', nullable: true),
new OA\Property(property: 'order_paid_date', type: 'string', format: 'date-time', nullable: true),
new OA\Property(property: 'created_date', type: 'string', format: 'date-time'),
new OA\Property(property: 'updated_date', type: 'string', format: 'date-time', nullable: true),
new OA\Property(property: 'completed_date', type: 'string', format: 'date-time', nullable: true),
new OA\Property(property: 'created_at', type: 'string', format: 'date-time'),
new OA\Property(property: 'updated_at', type: 'string', format: 'date-time'),
]
)]
class Refund extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'refunds';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'company_id', 'platform_id', 'store_id', 'order_id', 'platform_order_id', 'platform_refund_id', 'refund_status_id', 'refund_type_id', 'reason', 'refund_amount', 'freight_refund', 'refund_total', 'currency', 'buyer_user_id', 'order_created_date', 'order_paid_date', 'created_date', 'updated_date', 'completed_date', 'raw', 'ext', 'hash', 'created_at', 'updated_at'];
/**
* The attributes that should be cast to native types.
*/
protected array $casts = ['id' => 'integer', 'company_id' => 'integer', 'platform_id' => 'integer', 'store_id' => 'integer', 'order_id' => 'integer', 'refund_status_id' => 'integer', 'refund_type_id' => 'integer', 'raw' => 'json', 'ext' => 'json', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
}