|
@@ -267,7 +267,7 @@ class RewardPointRepository extends Repository
|
|
|
throw $e;
|
|
throw $e;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- public function getHistory($customerId, $limit = 20, $page = null)
|
|
|
|
|
|
|
+ public function getHistory($customerId, $limit = 20, $page = null,$amountType = '')
|
|
|
{
|
|
{
|
|
|
$query = $this->where('customer_id', $customerId)
|
|
$query = $this->where('customer_id', $customerId)
|
|
|
->orderBy('transaction_time', 'desc');
|
|
->orderBy('transaction_time', 'desc');
|
|
@@ -275,7 +275,12 @@ class RewardPointRepository extends Repository
|
|
|
if ($page) {
|
|
if ($page) {
|
|
|
return $query->paginate($limit, ['*'], 'page', $page);
|
|
return $query->paginate($limit, ['*'], 'page', $page);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+// 根据视图类型筛选(仅获取或全部)
|
|
|
|
|
+ if ($amountType === 'earned') {
|
|
|
|
|
+ $query->where('amount', '>', 0)->where('status',1);
|
|
|
|
|
+ } elseif ($amountType === 'redeemed') {
|
|
|
|
|
+ $query->where('amount', '<', 0);
|
|
|
|
|
+ }
|
|
|
return $query->paginate($limit);
|
|
return $query->paginate($limit);
|
|
|
}
|
|
}
|
|
|
|
|
|