'待支付', 'paid' => '已支付', 'refunded' => '已退款', 'refunding' => '退款处理中', 'refund_failed' => '退款失败', 'closed' => '已关闭']; } public function getStatusTextAttr($value, $data) { $value = $value ?: ($data['status'] ?? ''); $list = $this->getStatusList(); return $list[$value] ?? ''; } /** * 微信退款单状态字典 */ public function getRefundStatusList() { return ['none' => '未发起', 'processing' => '退款受理中', 'success' => '退款成功', 'abnormal' => '退款异常', 'closed' => '退款已关闭']; } public function getRefundStatusTextAttr($value, $data) { $value = $value ?: ($data['refund_status'] ?? 'none'); $list = $this->getRefundStatusList(); return $list[$value] ?? ''; } /** * 支付场景字典 */ public function getSceneList() { return ['order' => '订单支付', 'prepay' => '预付款充值']; } public function getSceneTextAttr($value, $data) { $value = $value ?: ($data['scene'] ?? ''); $list = $this->getSceneList(); return $list[$value] ?? ''; } /** * 关联业务订单 */ public function order() { return $this->belongsTo('Order', 'order_id', 'id', [], 'LEFT')->setEagerlyType(0); } /** * 关联支付用户 */ public function user() { return $this->belongsTo('User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); } }