//package com.kexue.skills.controller;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Controller;
//import org.springframework.ui.Model;
//import org.springframework.web.bind.annotation.GetMapping;
//
//import javax.annotation.Resource;
//import jakarta.servlet.http.HttpServletRequest;
//
///**
// * 所有页面controller再这里声明
// */
//@Controller
//@Slf4j
//public class PageController {
//
//    @Resource
////    private BizCardService bizCardService;
//
////    @GetMapping("")
////    public String goHome(HttpServletRequest request, Model model) {
////        model.addAttribute("baseUrl",getServerInfo(request));
////        try {
////            BizCardDto bizCardDto = bizCardService.queryById(1L);
////            if (bizCardDto != null && bizCardDto.getBizCardProducts() != null) {
////                model.addAttribute("bizCardProducts",bizCardDto.getBizCardProducts());
////            } else {
////                model.addAttribute("bizCardProducts",Collections.emptyList());
////            }
////        } catch (Exception e) {
////            log.error("Error fetching bizCardDto: ", e);
////            model.addAttribute("",Collections.emptyList());
////        }
////        return "index";
////    }
///*
//
//    @GetMapping("/portal")
//    public String portal(HttpServletRequest request, Model model) {
//        model.addAttribute("baseUrl",getServerInfo(request));
//        try {
//            BizCardDto bizCardDto = bizCardService.queryById(1);
//            if (bizCardDto != null && bizCardDto.getBizCardProducts() != null) {
//                model.addAttribute("bizCardProducts",bizCardDto.getBizCardProducts());
//            } else {
//                model.addAttribute("bizCardProducts",Collections.emptyList());
//            }
//        } catch (Exception e) {
//            log.error("Error fetching bizCardDto: ", e);
//            model.addAttribute("",Collections.emptyList());
//        }
//        return "index";
//    }
//*/
//
//    @GetMapping("/login")
//    public String login(HttpServletRequest request, Model model) {
//        model.addAttribute("baseUrl",getServerInfo(request));
//        return "login";
//    }
//
//    @GetMapping("/main")
//    public String main(HttpServletRequest request, Model model) {
//        model.addAttribute("baseUrl",getServerInfo(request));
//        return "main";
//    }
//
//    @GetMapping("/dashboard")
//    public String dashboard(HttpServletRequest request, Model model) {
//        model.addAttribute("baseUrl",getServerInfo(request));
//        return "dashboard";
//    }
//
//
//    @GetMapping("/orderManage")
//    public String orderManage(HttpServletRequest request, Model model) {
//        model.addAttribute("baseUrl",getServerInfo(request));
//        return "dashboard";
//    }
//
//
//    //写一个获取服务器ip、端口、上下文路径的函数
//    public String getServerInfo(HttpServletRequest request) {
//        StringBuilder sb = new StringBuilder();
//        sb.append("http://").append(request.getServerName())
//                .append(":").append(request.getServerPort())
//                .append(request.getContextPath());
//        return sb.toString();
//    }
//
//}
