package cn.exploring.engine.server.wx.service;

import cn.exploring.engine.server.db.domain.WxUser;
import cn.exploring.engine.server.db.service.WxUserService;
import cn.exploring.engine.server.wx.dao.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

@Service
public class UserInfoService {
    @Autowired
    private WxUserService userService;


    public UserInfo getInfo(Integer userId) {
        WxUser user = userService.findById(userId);
        Assert.state(user != null, "用户不存在");
        UserInfo userInfo = new UserInfo();
        userInfo.setNickName(user.getNickname());
        userInfo.setAvatarUrl(user.getAvatar());
        return userInfo;
    }
}
