package cn.wisenergy.web.admin.controller.app;

import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.vo.SetMemberPercentVo;
import cn.wisenergy.service.app.MemberPercentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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;

/**
 * @author 86187
 */
@Api(tags = "后台管理 -- 应用设置")
@RestController
@RequestMapping("/set")
@Slf4j
public class SettingController {
    @Autowired
    private MemberPercentService memberPercentService;

    @ApiOperation(value = "参数设置", notes = "参数设置", httpMethod = "POST")
    @ApiImplicitParam(name = "percentVo", value = "参数信息", dataType = "SetMemberPercentVo")
    @PostMapping("/param")
    public R<Boolean> param(@RequestBody SetMemberPercentVo percentVo) {
        log.info("shop-mall[]SettingController[]param[]input.param.percentVo:" + percentVo);
        if (null == percentVo || null == percentVo.getPercent() ||
                null == percentVo.getType() || null == percentVo.getUserLevel()) {
            return R.error("入参为空!");
        }
        return memberPercentService.setMemberPercent(percentVo);
    }

}
