package com.dgtis.dorm.manager.wx.service;

import com.dgtis.dorm.manager.db.domain.AlumniUser;
import com.dgtis.dorm.manager.db.service.UserService;
import com.dgtis.dorm.manager.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 UserService userService;


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


}
