6
0
Fork 0

调整粉丝列表接口

release
vine_liutk 2021-12-29 11:25:33 +08:00
parent d5fe247d6f
commit e6d399987c
2 changed files with 7 additions and 1 deletions

View File

@ -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, '未知'),
];
}
}

View File

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