mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
fix: resolve PHPStan static analysis warnings
This commit is contained in:
@@ -3,7 +3,38 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* App\Models\Order
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $plan_id
|
||||
* @property int|null $payment_id
|
||||
* @property int $period
|
||||
* @property string $trade_no
|
||||
* @property int $total_amount
|
||||
* @property int|null $handling_amount
|
||||
* @property int|null $balance_amount
|
||||
* @property int $type
|
||||
* @property int $status
|
||||
* @property array|null $surplus_order_ids
|
||||
* @property int|null $coupon_id
|
||||
* @property int $created_at
|
||||
* @property int $updated_at
|
||||
* @property int|null $commission_status
|
||||
* @property int|null $invite_user_id
|
||||
* @property int|null $actual_commission_balance
|
||||
* @property int|null $commission_rate
|
||||
* @property int|null $commission_auto_check
|
||||
*
|
||||
* @property-read Plan $plan
|
||||
* @property-read Payment|null $payment
|
||||
* @property-read User $user
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, CommissionLog> $commission_log
|
||||
*/
|
||||
class Order extends Model
|
||||
{
|
||||
protected $table = 'v2_order';
|
||||
@@ -12,7 +43,8 @@ class Order extends Model
|
||||
protected $casts = [
|
||||
'created_at' => 'timestamp',
|
||||
'updated_at' => 'timestamp',
|
||||
'surplus_order_ids' => 'array'
|
||||
'surplus_order_ids' => 'array',
|
||||
'handling_amount' => 'integer'
|
||||
];
|
||||
|
||||
const STATUS_PENDING = 0; // 待支付
|
||||
@@ -40,21 +72,34 @@ class Order extends Model
|
||||
self::TYPE_RESET_TRAFFIC => '流量重置',
|
||||
];
|
||||
|
||||
public function payment()
|
||||
/**
|
||||
* 获取与订单关联的支付方式
|
||||
*/
|
||||
public function payment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Payment::class, 'payment_id', 'id');
|
||||
}
|
||||
|
||||
public function user()
|
||||
/**
|
||||
* 获取与订单关联的用户
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id', 'id');
|
||||
}
|
||||
public function plan()
|
||||
|
||||
/**
|
||||
* 获取与订单关联的套餐
|
||||
*/
|
||||
public function plan(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plan::class);
|
||||
return $this->belongsTo(Plan::class, 'plan_id', 'id');
|
||||
}
|
||||
|
||||
public function commission_log()
|
||||
/**
|
||||
* 获取与订单关联的佣金记录
|
||||
*/
|
||||
public function commission_log(): HasMany
|
||||
{
|
||||
return $this->hasMany(CommissionLog::class, 'trade_no', 'trade_no');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user