package cn.pluss.platform.controller.home;

import cn.pluss.platform.api.Result;
import cn.pluss.platform.api.ResultGenerator;
import cn.pluss.platform.entity.MerchantMemberCode;
import cn.pluss.platform.life.LifeApiHandler;
import cn.pluss.platform.life.LifeParam;
import cn.pluss.platform.systemConfig.SystemConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.sql.ResultSet;

/**
 * TODO
 * 生活圈apiController
 * @author crystal
 * @date 2022/6/7 15:00
 */
@Slf4j
@RestController
@RequestMapping(value = "life")
public class LifeApiController {

    @Resource
    private LifeApiHandler lifeApiHandler;

    /**
     * 生活圈获取会员卡过期时间
     * @return
     */
    @RequestMapping(value = "/card/expire")
    public Result<Object> getCardExpire(){
        String value = lifeApiHandler.getCardExpire();
        return ResultGenerator.genSuccessResult("获取成功",value);
    }

    /**
     * 会员卡刷新code
     * @param code
     * @return
     */
    @RequestMapping(value = "/card/refresh")
    public Result<Object> refreshCardCode(MerchantMemberCode code){
        return lifeApiHandler.refreshCardCode(code);
    }

    /**
     * 获取商户信息
     * @return
     */
    @RequestMapping(value = "/merchant/info")
    public Result<Object> getMerchantInfo(LifeParam param){
        return lifeApiHandler.getMerchantInfo(param);
    }
}
