package com.ruoyi.web.modules.home.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.web.modules.account.support.MemberContext;
import com.ruoyi.web.modules.home.service.IMemberShopFollowAppService;
import com.ruoyi.web.modules.home.vo.MemberShopFollowItemVO;

/**
 * C 端 · 我的店铺关注（须会员 Token）
 */
@RestController
@RequestMapping("/api/member/shop-follows")
public class MemberShopFollowAppController extends BaseController
{
    @Autowired
    private IMemberShopFollowAppService memberShopFollowAppService;

    @GetMapping
    public TableDataInfo list()
    {
        startPage();
        List<MemberShopFollowItemVO> list = memberShopFollowAppService.listFollowShops(requireMemberId());
        return getDataTable(list);
    }

    private Long requireMemberId()
    {
        Long memberId = MemberContext.getMemberId();
        if (memberId == null)
        {
            throw new ServiceException("请先登录", 401);
        }
        return memberId;
    }
}
