zhibing.pu
2024-09-06 dd651f5f04100100fecb55baf2d388efc4902edf
ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
@@ -9,6 +9,7 @@
import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.auth.form.LoginBody;
import com.ruoyi.auth.form.RegisterBody;
@@ -48,11 +49,11 @@
      HashMap<String, Object> map = new HashMap<>();
      map.put("token", tokenService.createToken(userInfo));
      List<SysRole> roles = userInfo.getSysUser().getRoles();
//        if(CollectionUtils.isEmpty(roles)){
//            return R.fail("请关联角色!");
//        }
        if(CollectionUtils.isEmpty(roles)){
            return R.fail("请关联角色!");
        }
//        map.put("roleName",roles.get(0).getRoleName());
        map.put("roleName",roles.get(0).getRoleName());
      map.put("info", userInfo);
      // 修改用户最后登录时间
      SysUser sysUser = new SysUser();