feat: 新增关注列表与个人主页接口,新增用户主页与支付结果页面

这个提交包含在:
2026-10-23 18:49:30 +08:00
父节点 1b78c8359f
当前提交 c2b2f03202
共有 19 个文件被更改,包括 3922 次插入 和 3980 次删除

查看文件

@@ -87,6 +87,61 @@ class Favorite extends V1
$this->ok(['faved' => $faved, 'count' => $count]);
}
/**
* GET /api/v1/follow/list {page,size}
* → 分页 {list,page,size,total,hasMore}
* 返回当前登录用户关注的用户/商家列表
*
* @return void
*/
public function followList()
{
$user = $this->auth();
list($rows, $total, $page, $size) = $this->pageQuery(function ($forCount) use ($user) {
$q = Db::name('fc_follow')->where('user_id', $user['id']);
if ($forCount) {
return $q;
}
return $q->order('id desc');
});
$list = [];
foreach ($rows as $row) {
$targetId = (int)$row['target_user_id'];
$targetUser = Db::name('user')->where('id', $targetId)->find();
if (!$targetUser) {
continue;
}
$ext = Db::name('fc_user_ext')->where('user_id', $targetId)->find();
$merchant = Db::name('fc_merchant')->where('user_id', $targetId)->find();
$isMerchant = $merchant && (int)$merchant['audit_status'] === 1;
// 统计该用户发布的有效信息条数
$postCount = (int)Db::name('fc_post')
->where('user_id', $targetId)
->where('status', 1)
->where('audit_status', 1)
->whereNull('deletetime')
->count();
$list[] = [
'id' => (int)$row['id'],
'userId' => $targetId,
'nickname' => (string)($merchant && $merchant['name'] ? $merchant['name'] : $targetUser['nickname']),
'avatar' => (string)($merchant && $merchant['logo'] ? $merchant['logo'] : $targetUser['avatar']),
'isMerchant' => $isMerchant,
'merchantId' => $merchant ? (int)$merchant['id'] : 0,
'category' => (string)($merchant && $merchant['category'] ? $merchant['category'] : ''),
'postCount' => $postCount,
'followed' => true,
'followTime' => $this->iso($row['createtime']),
];
}
$this->ok($this->paginate($list, $total, $page, $size));
}
/**
* POST /api/v1/follow/toggle {userId}
* → {followed}