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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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.domain.AjaxResult;
import com.ruoyi.web.modules.account.support.MemberContext;
import com.ruoyi.web.modules.entry.dto.EntryApplySubmitDTO;
import com.ruoyi.web.modules.entry.service.IMerchantEntryApplyService;

/**
 * C 端商户入驻申请
 */
@RestController
@RequestMapping("/api/merchant/entry")
public class MerchantEntryApplyAppController extends BaseController
{
    @Autowired
    private IMerchantEntryApplyService applyService;

    @PostMapping("/apply")
    public AjaxResult apply(@RequestBody EntryApplySubmitDTO dto)
    {
        Long memberId = MemberContext.getMemberId();
        return success(applyService.submitApply(memberId, dto));
    }

    @GetMapping("/my")
    public AjaxResult my()
    {
        Long memberId = MemberContext.getMemberId();
        return success(applyService.listMyApplies(memberId));
    }
}
