fix: profile页未显示关注状态

经测试,原接口会返回{"code":-403,"message":"访问权限不足","ttl":1},所以统一为hasFollow接口,并收录了更多的状态文本
This commit is contained in:
orz12
2023-12-23 17:25:09 +08:00
parent e32ddeaec0
commit 2b51ec2674
3 changed files with 50 additions and 26 deletions

View File

@ -116,16 +116,28 @@ class MemberController extends GetxController {
Future relationSearch() async {
if (userInfo == null) return;
if (mid == ownerMid) return;
var res = await UserHttp.relationSearch(mid);
var res = await UserHttp.hasFollow(mid);
if (res['status']) {
attribute.value = res['data']['relation']['attribute'];
attributeText.value = attribute.value == 0
? '关注'
: attribute.value == 2
? '已关注'
: attribute.value == 6
? '互粉'
: '已拉黑';
attribute.value = res['data']['attribute'];
switch (attribute.value) {
case 1:
attributeText.value = '悄悄关注';
break;
case 2:
attributeText.value = '关注';
break;
case 6:
attributeText.value = '已互关';
break;
case 128:
attributeText.value = '已拉黑';
break;
default:
attributeText.value = '关注';
}
if (res['data']['special'] == 1) {
attributeText.value += 'SP';
}
}
}