profit
parent
c38749e452
commit
93bbb07cee
|
|
@ -21,4 +21,12 @@ class ProfitController extends Controller
|
||||||
|
|
||||||
return OrderProfitResource::collection($list);
|
return OrderProfitResource::collection($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show($id, Request $request)
|
||||||
|
{
|
||||||
|
$user = $request->user();
|
||||||
|
$info = $user->profits()->with(['order', 'fromUser'])->findOrFail($id);
|
||||||
|
|
||||||
|
return OrderProfitResource::make($info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class OrderProfitResource extends JsonResource
|
||||||
'order' => $this->when($this->whenLoaded('order'), [
|
'order' => $this->when($this->whenLoaded('order'), [
|
||||||
'id' => $this->order?->id,
|
'id' => $this->order?->id,
|
||||||
'sn' => $this->order?->sn,
|
'sn' => $this->order?->sn,
|
||||||
'total_amount' => $this->order?->total_amount
|
'total_amount' => $this->order ? $this->order->total_amount / 100 : 0
|
||||||
]),
|
]),
|
||||||
'from_user_id' => $this->from_user_id,
|
'from_user_id' => $this->from_user_id,
|
||||||
'user_id' => $this->user_id,
|
'user_id' => $this->user_id,
|
||||||
|
|
@ -24,10 +24,10 @@ class OrderProfitResource extends JsonResource
|
||||||
'phone' => $this->fromUser?->phone
|
'phone' => $this->fromUser?->phone
|
||||||
]),
|
]),
|
||||||
|
|
||||||
'growth_value' => $this->growth_value,
|
'growth_value' => (int)$this->growth_value,
|
||||||
'ratio' => $this->ratio,
|
'ratio' => $this->ratio,
|
||||||
'money' => $this->money,
|
'money' => (int)$this->money,
|
||||||
'sub_money' => $this->sub_money,
|
'sub_money' => (int)$this->sub_money,
|
||||||
'status' => $this->status,
|
'status' => $this->status,
|
||||||
'created_at' => $this->created_at->timestamp,
|
'created_at' => $this->created_at->timestamp,
|
||||||
'paid_at' => $this->paid_at?->timestamp,
|
'paid_at' => $this->paid_at?->timestamp,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue