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] ?? '未知'; + } }