Merge branch 'develop' of gitee.com:zi-chunsheng-e-commerce/mall-server into 1.x
commit
d2b47e3505
|
|
@ -16,7 +16,9 @@ class AfterSaleSimpleResource extends JsonResource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'order_sn' => $this->whenLoaded('order')?->sn,
|
'order_sn' => $this->whenLoaded('order', function () {
|
||||||
|
return $this->order->sn;
|
||||||
|
}, ''),
|
||||||
'product'=>[
|
'product'=>[
|
||||||
'name' => $this->orderProduct->name,
|
'name' => $this->orderProduct->name,
|
||||||
'cover' => $this->orderProduct->cover,
|
'cover' => $this->orderProduct->cover,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ class ArticleResource extends JsonResource
|
||||||
'content'=>$this->content,
|
'content'=>$this->content,
|
||||||
'points'=> $this->points,
|
'points'=> $this->points,
|
||||||
'likes' => $this->likes,
|
'likes' => $this->likes,
|
||||||
'like_status' => $this->whenLoaded('likesInfo', $this->likesInfo->count() > 0),
|
'like_status' => $this->whenLoaded('likesInfo', function () {
|
||||||
|
return $this->likesInfo->count() > 0;
|
||||||
|
}, false),
|
||||||
'has_read' => $this->hasRead($request->user()),
|
'has_read' => $this->hasRead($request->user()),
|
||||||
'media_type'=> $this->media_type,
|
'media_type'=> $this->media_type,
|
||||||
'media_content'=> json_decode($this->media_content, true),
|
'media_content'=> json_decode($this->media_content, true),
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@ class ArticleSimpleResource extends JsonResource
|
||||||
'cover' => $this->cover,
|
'cover' => $this->cover,
|
||||||
'points'=> $this->points,
|
'points'=> $this->points,
|
||||||
'likes' => $this->likes,
|
'likes' => $this->likes,
|
||||||
'like_status' => $this->whenLoaded('likesInfo', $this->likesInfo->count() > 0),
|
'like_status' => $this->whenLoaded('likesInfo', function () {
|
||||||
|
return $this->likesInfo->count() > 0;
|
||||||
|
}, false),
|
||||||
'jump_type' => $this->jump_type,
|
'jump_type' => $this->jump_type,
|
||||||
'jump_link' => (string) $this->jump_link,
|
'jump_link' => (string) $this->jump_link,
|
||||||
'created_at' => $this->created_at->toDateTimeString(),
|
'created_at' => $this->created_at->toDateTimeString(),
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ class CouponResource extends JsonResource
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'amount' => $this->amount,
|
'amount' => $this->amount,
|
||||||
'threshold' => $this->threshold,
|
'threshold' => $this->threshold,
|
||||||
// 'receive_status' => $this->whenLoaded('likesInfo', $this->likesInfo->count() > 0),
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ class DealerEarningSimpleResource extends JsonResource
|
||||||
'status' => $this->status_format,
|
'status' => $this->status_format,
|
||||||
'status_name' => $this->status_name,
|
'status_name' => $this->status_name,
|
||||||
'is_payer' => $this->payer_id ? ($this->payer_id == $request->user()->id) : false,
|
'is_payer' => $this->payer_id ? ($this->payer_id == $request->user()->id) : false,
|
||||||
'beneficiary_phone' => (string) $this->whenLoaded('user', $this->user->phone, ''),
|
'beneficiary_phone' => (string) $this->whenLoaded('user', function () {
|
||||||
|
return $this->user?->phone ?? '';
|
||||||
|
}, ''),
|
||||||
// 'settle_at'
|
// 'settle_at'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,18 @@ class DealerFansResource extends JsonResource
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'phone' => $this->phone,
|
'phone' => $this->phone,
|
||||||
'nickname' => (string) $this->whenLoaded('userInfo', $this->userInfo->nickname, ''),
|
'nickname' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
'avatar' => (string) $this->whenLoaded('userInfo', $this->userInfo->avatar, ''),
|
return $this->userInfo->nickname;
|
||||||
'team_sales_value' => (string) $this->whenLoaded('dealer', $this->dealer->team_sales_value, 0),
|
}, ''),
|
||||||
'lvl_name' => (string) $this->whenLoaded('dealer', $this->dealer->lvl_text, '未知'),
|
'avatar' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
|
return $this->userInfo->avatar;
|
||||||
|
}, ''),
|
||||||
|
'team_sales_value' => (string) $this->whenLoaded('dealer', function () {
|
||||||
|
return $this->dealer->team_sales_value;
|
||||||
|
}, 0),
|
||||||
|
'lvl_name' => (string) $this->whenLoaded('dealer', function () {
|
||||||
|
return $this->dealer->lvl_text;
|
||||||
|
}, '未知'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,18 @@ class FansResource extends JsonResource
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'phone' => $this->phone,
|
'phone' => $this->phone,
|
||||||
'nickname' => (string) $this->whenLoaded('userInfo', $this->userInfo->nickname, ''),
|
'nickname' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
'avatar' => (string) $this->whenLoaded('userInfo', $this->userInfo->avatar, ''),
|
return $this->userInfo->nickname;
|
||||||
'value' => (string) $this->whenLoaded('userInfo', $this->userInfo->growth_value, 0),
|
}, ''),
|
||||||
'level_name' => (string) $this->whenLoaded('userInfo', $this->userInfo->agent_level_name, '未知'),
|
'avatar' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
|
return $this->userInfo->avatar;
|
||||||
|
}, ''),
|
||||||
|
'value' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
|
return $this->userInfo->growth_value;
|
||||||
|
}, 0),
|
||||||
|
'level_name' => (string) $this->whenLoaded('userInfo', function () {
|
||||||
|
return $this->userInfo->agent_level_name;
|
||||||
|
}, '未知'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,9 @@ class MessageResource extends JsonResource
|
||||||
'ext' => $this->ext,
|
'ext' => $this->ext,
|
||||||
'jump_type' => $this->jump_type,
|
'jump_type' => $this->jump_type,
|
||||||
'jump_link' => (string) $this->jump_link,
|
'jump_link' => (string) $this->jump_link,
|
||||||
'has_read' => $this->whenLoaded('logs', $this->logs->count()>0),
|
'has_read' => $this->whenLoaded('logs', function () {
|
||||||
|
return $this->logs->count() > 0;
|
||||||
|
}, false),
|
||||||
'created_at'=> $this->created_at->toDateTimeString(),
|
'created_at'=> $this->created_at->toDateTimeString(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue