1
zyy3
2025-11-08 993755aece09ef32798c04cfdaf4921cd5572743
src/main/java/com/nq/service/impl/SiteInfoServiceImpl.java
@@ -1,6 +1,7 @@
package com.nq.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.nq.common.ServerResponse;
@@ -101,10 +102,12 @@
    public ServerResponse getInfo(HttpServletRequest request) {
        List<SiteInfo> siteInfos = this.siteInfoMapper.findAll();
        SiteInfo siteInfo = (SiteInfo) siteInfos.get(0);
        User user = iUserService.getCurrentRefreshUser(request);
        if(ObjectUtil.isEmpty(user)){
            return ServerResponse.createBySuccess(siteInfo);
        }
        if (siteInfos.size() > 0) {
            SiteInfo siteInfo = (SiteInfo) siteInfos.get(0);
            User user = iUserService.getCurrentRefreshUser(request);
            log.info("当前以后名");
            if(user != null ){
                AgentUser agentUser = agentUserMapper.findAgentByAgentId(user.getAgentId());
@@ -116,16 +119,16 @@
                }
            }
            ObjectMapper objectMapper = new ObjectMapper();
            Map<String, String> metadataMap = new HashMap<>();
            metadataMap.put("name", user.getNickName());
            String url = null;
            try {
                url = siteInfo.getOnlineService() + "&metadata=" + objectMapper.writeValueAsString(metadataMap);
            } catch (JsonProcessingException e) {
                throw new RuntimeException(e);
            }
            siteInfo.setOnlineService(url);
//            ObjectMapper objectMapper = new ObjectMapper();
//            Map<String, String> metadataMap = new HashMap<>();
//            metadataMap.put("name", StringUtils.isNotEmpty(user.getNickName()) ? user.getNickName() : "");
//            String url = null;
//            try {
//                url = siteInfo.getOnlineService() + "&metadata=" + objectMapper.writeValueAsString(metadataMap);
//            } catch (JsonProcessingException e) {
//                throw new RuntimeException(e);
//            }
//            siteInfo.setOnlineService(url);
            return ServerResponse.createBySuccess(siteInfo);
        }
        return ServerResponse.createByErrorMsg("设置信息info不存在");