package com.younike.member;

import com.younike.common.core.controller.BaseController;
import com.younike.common.core.domain.AjaxResult;
import com.younike.framework.config.AnonymousAccess;
import com.younike.system.domain.SysConfig;
import com.younike.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
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;

/**
 * 配置Controller
 *
 * @author zulu.chen
 * @date 2022-01-04
 */
@Api("member配置接口")
@RestController
@RequestMapping("/member/config")
public class MemberConfigController extends BaseController {

    @Autowired
    private ISysConfigService sysConfigService;

    @ApiOperation("商家是否可使用优金豆")
    @AnonymousAccess
    @GetMapping
    public AjaxResult polite() {

        SysConfig config = sysConfigService.polite("home.pay.user-ujd");
        if (ObjectUtils.isEmpty(config)) {
            return AjaxResult.error("查无数据");
        }

        return AjaxResult.success(new Boolean(config.getConfigValue()));
    }
}
