package com.ghy.web.controller.message;

import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.ExceptionUtil;
import com.ghy.message.domain.JimUser;
import com.ghy.message.service.JimUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/jim/user")
public class JimUserController extends BaseController {

    @Autowired
    private JimUserService jimUserService;

    @PostMapping("/register")
    public AjaxResult register(){
        try {
            JimUser jimUser = new JimUser();
            jimUser.setUserName("clunt");
            jimUser.setPassword("password");
            jimUserService.registerJimUser(jimUser);
            return AjaxResult.success("注册成功!");
        }catch (Exception e){
            e.printStackTrace();
            logger.error(ExceptionUtil.getExceptionMessage(e));
            return AjaxResult.error("注册失败!");
        }
    }

}

