Files
datahub/backend/app/Model/OrderItem.php
T
2025-12-12 13:15:02 +08:00

56 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace App\Model;
use Hyperf\DbConnection\Model\Model;
/**
* @property int $id 主键
* @property int $company_id 公司 ID 与 Tools 保持一致
* @property int $platform_id 平台 ID 与 Tools 保持一致
* @property int $store_id 店铺 ID 与 Tools 保持一致
* @property int $order_id 父订单 ID
* @property string $platform_order_id 平台父订单 ID
* @property string $sub_order_id 平台子订单 ID,部分平台有,如 Tmall
* @property int $sub_order_type_id 平台子订单 类型 id,标记字段
* @property int $product_id 商品 ID 与 Tools 保持一致
* @property string $platform_product_id 平台商品 ID 与 Tools 保持一致
* @property string $product_sku 商品 SKU 编码, 客户提供的内部商品编码
* @property string $product_barcode 商品 条形码 GTIN 等
* @property string $unit_price 单件价格
* @property int $quantity 商品子项总数量
* @property string $discount 订单子项总的折扣金额
* @property string $total 总金额 = 单价X数量 - 折扣
* @property string $ext 扩展字段
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @mixin \App_Model_OrderItem
*/
class OrderItem extends Model
{
/**
* The table associated with the model.
*/
protected ?string $table = 'order_items';
/**
* The attributes that are mass assignable.
*/
protected array $fillable = ['id', 'company_id', 'platform_id', 'store_id', 'order_id', 'platform_order_id', 'sub_order_id', 'sub_order_type_id', 'product_id', 'platform_product_id', 'product_sku', 'product_barcode', 'unit_price', 'quantity', 'discount', 'total', 'ext', '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', 'sub_order_type_id' => 'integer', 'product_id' => 'integer', 'quantity' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];
/**
* Get the order that owns the order item.
*/
public function order()
{
return $this->belongsTo(Order::class, 'order_id', 'id');
}
}