package com.easyproject.client.controller.member;

import com.easyproject.common.core.controller.BaseController;
import com.easyproject.common.core.domain.AjaxClientResult;
import com.easyproject.common.core.domain.model.RegisterBody;
import com.easyproject.common.utils.MessageUtils;
import com.easyproject.core.web.service.MemberRegisterService;
import com.easyproject.clientbus.service.config.IClientConfigService;
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;

import javax.annotation.Resource;

/**
 * 注册验证
 *
 * @author java001
 */
@RestController
@RequestMapping("/member")
public class MemberRegisterController extends BaseController {
    @Autowired
    private MemberRegisterService registerService;
    @Resource
    private IClientConfigService configService;

    /**
     * 方法说明: 用户注册 账号+密码
     *
     * @param
     * @return
     * @author java-101
     * @date 2024-07-03 14:36:00
     */
    @PostMapping("/registerqiyongDeleteInfo")
    public AjaxClientResult register(@RequestBody RegisterBody user) {
        if (!("true".equals(configService.selectConfigByKey("with.account.registerUser")))) {
            return AjaxClientResult.error(MessageUtils.message("member.register.001"));
        }
        return registerService.register(user);
    }
}
