hasMany(StoreRefundProduct::class, 'refund_order_id', 'refund_order_id'); } public function merchant() { return $this->hasOne(Merchant::class, 'mer_id', 'mer_id'); } public function user() { return $this->hasOne(User::class, 'uid', 'uid'); } public function order() { return $this->hasOne(StoreOrder::class, 'order_id', 'order_id'); } public function searchDataAttr($query, $value) { return getModelTime($query, $value); } public function getAutoRefundTimeAttr() { $merAgree = systemConfig('mer_refund_order_agree') ?: 7; return strtotime('+' . $merAgree . ' day', strtotime($this->status_time)); } public function getCombineRefundParams() { return [ 'sub_mchid' => $this->merchant->sub_mchid, 'order_sn' => $this->order->order_sn, 'refund_order_sn' => $this->refund_order_sn, 'refund_price' => $this->refund_price, 'pay_price' => $this->order->pay_price ]; } }