package org.jeecg.modules.api.controller2;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiService.UserInfoService;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags="个人信息相关接口")
@RestController
@RequestMapping("/employ/user")
@Slf4j
public class UserController {

    @Resource
    private UserInfoService userInfoService;


    //lzx：查看个人信息

    @ApiOperation(value="查看个人信息", notes="查看个人信息")
    @RequestMapping(value = "/queryUser", method = {RequestMethod.GET})
    public Result<?> queryUser(@RequestHeader("X-Access-Token") String token){
        return userInfoService.queryUserInfo(token);
    }

    //lzx：修改个人信息
    @ApiOperation(value="修改个人信息", notes="修改个人信息")
    @RequestMapping(value = "/updateUser", method = {RequestMethod.POST})
    public Result<?> updateUser(@RequestHeader("X-Access-Token") String token,String nickName,String phone,String headImage){
        return userInfoService.updateUserInfo(token, nickName, phone, headImage);
    }


    //获取个人中心基础数据信息
    @ApiOperation(value="获取个人中心基础数据信息", notes="获取个人中心基础数据信息")
    @RequestMapping(value = "/getUserCenterData", method = {RequestMethod.GET})
    public Result<?> getUserCenterData(@RequestHeader("X-Access-Token") String token){
    	return userInfoService.getUserCenterData(token);
    }

}
