From e6d399987c0cf5bbbce1c033aab3226d510bcec3 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 29 Dec 2021 11:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=B2=89=E4=B8=9D=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Endpoint/Api/Http/Resources/FansResource.php | 3 ++- app/Models/UserInfo.php | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Endpoint/Api/Http/Resources/FansResource.php b/app/Endpoint/Api/Http/Resources/FansResource.php index 9bed0caa..1a7d4ea6 100644 --- a/app/Endpoint/Api/Http/Resources/FansResource.php +++ b/app/Endpoint/Api/Http/Resources/FansResource.php @@ -18,7 +18,8 @@ class FansResource extends JsonResource 'phone' => $this->phone, 'nickname' => (string) $this->whenLoaded('userInfo', $this->userInfo->nickname, ''), 'avatar' => (string) $this->whenLoaded('userInfo', $this->userInfo->avatar, ''), - 'value' => (string) $this->whenLoaded('userInfo', $this->userInfo->growth_value + $this->userInfo->group_sales_value, 0), + 'value' => (string) $this->whenLoaded('userInfo', $this->userInfo->growth_value, 0), + 'level_name' => (string) $this->whenLoaded('userInfo', $this->userInfo->agent_level_name, '未知'), ]; } } diff --git a/app/Models/UserInfo.php b/app/Models/UserInfo.php index 5cde3f0a..044aa104 100644 --- a/app/Models/UserInfo.php +++ b/app/Models/UserInfo.php @@ -208,4 +208,9 @@ class UserInfo extends Model { return static::$agentLevelKeys[$this->agent_level] ?? 'unknown'; } + + public function getAgentLevelNameAttribute(): string + { + return static::$agentLevelTexts[$this->agent_level] ?? '未知'; + } }