OpenAppHomeController.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.goafanti.app.controller;
  2. import javax.annotation.Resource;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RequestMethod;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import com.goafanti.app.service.AppHomePageService;
  8. import com.goafanti.common.bo.Result;
  9. import com.goafanti.common.controller.BaseApiController;
  10. @RestController
  11. @RequestMapping(path = "open/app/home")
  12. public class OpenAppHomeController extends BaseApiController{
  13. @Resource
  14. private AppHomePageService appHomePageService;
  15. /**App首页轮播图、导航、知产*/
  16. @RequestMapping(value = "/getHomePageData", method = RequestMethod.GET)
  17. public Result getHomePageData(HttpServletRequest request){
  18. Result res = new Result();
  19. String path = request.getContextPath();
  20. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  21. System.out.println("path:-------------------"+path);
  22. System.out.println("basePath:-------------------"+basePath);
  23. res.setData(appHomePageService.getAppHomePage());
  24. return res;
  25. }
  26. /**技淘推荐*/
  27. @RequestMapping(value = "/getHomeRecommended", method = RequestMethod.GET)
  28. public Result getHomeRecommended(Integer type){
  29. Result res = new Result();
  30. if (null==type||type>3||type<0) {
  31. res.getError().add(buildError( "类型错误", "类型错误"));
  32. return res;
  33. }
  34. res.setData(appHomePageService.getHomeRecommended(type));
  35. return res;
  36. }
  37. }