Files
ProxyPanel/app/Models/PaymentCallback.php

55 lines
1.9 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
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
* 支付回调日志
*
* @property int $id
* @property string|null $trade_no 本地订单号
* @property string|null $out_trade_no 外部订单号(支付平台)
* @property int|null $amount 交易金额,单位分
* @property int|null $status 交易状态0-失败、1-成功
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read string $status_label
* @method static Builder|PaymentCallback newModelQuery()
* @method static Builder|PaymentCallback newQuery()
* @method static Builder|PaymentCallback query()
* @method static Builder|PaymentCallback whereAmount($value)
* @method static Builder|PaymentCallback whereCreatedAt($value)
* @method static Builder|PaymentCallback whereId($value)
* @method static Builder|PaymentCallback whereOutTradeNo($value)
* @method static Builder|PaymentCallback whereStatus($value)
* @method static Builder|PaymentCallback whereTradeNo($value)
* @method static Builder|PaymentCallback whereUpdatedAt($value)
* @mixin \Eloquent
*/
class PaymentCallback extends Model {
protected $table = 'payment_callback';
protected $appends = ['status_label'];
public function getStatusLabelAttribute(): string {
$status_label = '';
switch($this->attributes['status']){
case 'WAIT_BUYER_PAY':
$status_label = '等待买家付款';
break;
case 'WAIT_SELLER_SEND_GOODS':
$status_label = '等待卖家发货';
break;
case 'TRADE_SUCCESS':
$status_label = '交易成功';
break;
case 'PAID':
$status_label = '支付完成';
break;
}
return $status_label;
}
}