From 2b0bab249140ff568084576d56b09785bfb8b27d Mon Sep 17 00:00:00 2001 From: weigang Date: Fri, 11 Sep 2020 15:28:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=BD=93=E9=9D=A2=E4=BB=98?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=EF=BC=8C=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/OrderMain.php | 9 +++++++++ app/Service/v3/Implementations/OrderListService.php | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/Model/v3/OrderMain.php b/app/Model/v3/OrderMain.php index c3abfc8..3e2c185 100644 --- a/app/Model/v3/OrderMain.php +++ b/app/Model/v3/OrderMain.php @@ -91,6 +91,15 @@ class OrderMain extends Model return Shipping::getMessage($this->attributes['shipping_type']); } + public function getNoteAttribute($value) + { + if ($this->attributes['refuse_refund_note'] || $this->attributes['total_refund_note']) { + return $this->attributes['refuse_refund_note'] ?: $this->attributes['total_refund_note']; + } + + return $value; + } + public function market() { return $this->belongsTo(Market::class, 'market_id', 'id'); diff --git a/app/Service/v3/Implementations/OrderListService.php b/app/Service/v3/Implementations/OrderListService.php index db7f6c7..99bae87 100644 --- a/app/Service/v3/Implementations/OrderListService.php +++ b/app/Service/v3/Implementations/OrderListService.php @@ -161,7 +161,8 @@ class OrderListService implements OrderListServiceInterface ->with(['orders' => function($query) { $query->with('store'); }]) - ->where(['user_id' => $userId, 'type' => OrderType::OFFLINE]); + ->where(['user_id' => $userId, 'type' => OrderType::OFFLINE]) + ->whereIn('state', [OrderState::PAID,OrderState::DELIVERY,OrderState::COMPLETED]); $paginate = $builder->orderBy('created_at', 'desc')->paginate($pagesize); $orders = $paginate->toArray();