|
@@ -537,11 +537,15 @@ class OrderService
|
|
* @param $userId
|
|
* @param $userId
|
|
* @return array|false|\PDOStatement|string|Model
|
|
* @return array|false|\PDOStatement|string|Model
|
|
*/
|
|
*/
|
|
- public static function getDetail($orderId, $userId)
|
|
|
|
|
|
+ public static function getDetail($orderId = 0, $userId = 0)
|
|
{
|
|
{
|
|
return Order::with(['orderGoods'])
|
|
return Order::with(['orderGoods'])
|
|
->where('id', $orderId)
|
|
->where('id', $orderId)
|
|
- ->where('user_id', $userId)
|
|
|
|
|
|
+ ->where(function($query) use ($userId){
|
|
|
|
+ if($userId > 0){
|
|
|
|
+ $query->where('user_id', $userId);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
->find();
|
|
->find();
|
|
}
|
|
}
|
|
|
|
|