소스 검색

修改缩略图路径,增加优软科技官网服务器地址

Dev 8 년 전
부모
커밋
fb0fe6bab8

+ 3 - 2
src/main/java/com/uas/cloud/mall/shop/news/api/NewsController.java

@@ -3,6 +3,7 @@ package com.uas.cloud.mall.shop.news.api;
 import com.alibaba.fastjson.JSON;
 import com.uas.cloud.mall.shop.news.model.News;
 import com.uas.cloud.mall.shop.news.service.NewsService;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 /**
@@ -52,11 +54,10 @@ public class NewsController {
      * @return
      */
     @RequestMapping(value="/created" ,method = RequestMethod.GET, produces = "application/json")
-    public List<News> getNewsByCreated() {
+    public List<News> getNewsByCreated(HttpServletRequest request) {
         ServiceInstance instance = client.getLocalServiceInstance();
         logger.info("/news, get, host:" + instance.getHost() + ", serviceId:" + instance.getServiceId() + "get news order by created time");
         List<News> newsList = newsService.findBycreated();
-        System.out.println("读取到新闻" + JSON.toJSONString(newsList));
         return newsList;
     }
 

+ 3 - 4
src/main/java/com/uas/cloud/mall/shop/news/model/News.java

@@ -21,9 +21,9 @@ public class News{
 
 //    @Value("${application.indexUrl}")
 //    private String INDEX_USOFTCHINA;
-    private static final String INDEX_USOFTCHINA = "10.10.100.88:9090/";
+    private static final String INDEX_USOFTCHINA = "http://10.10.100.88:9090";
 
-    private static final String NEWS_TEXT = "c/";
+    private static final String NEWS_TEXT = "/c/";
 
     @Id
     @Column(name = "id")
@@ -116,7 +116,7 @@ public class News{
     }
 
     public String getThumbnail() {
-        return thumbnail;
+        return INDEX_USOFTCHINA + thumbnail;
     }
 
     public void setThumbnail(String thumbnail) {
@@ -125,7 +125,6 @@ public class News{
 
     // 跳转到文章详情的URL
     public String getHrefUrl() {
-        System.out.println(INDEX_USOFTCHINA);
         StringBuffer linkTo = new StringBuffer();
         linkTo.append(INDEX_USOFTCHINA);
         linkTo.append(NEWS_TEXT);

+ 1 - 1
src/main/resources/application.yml

@@ -2,4 +2,4 @@ spring:
   application:
     name: mall-news-service
   profiles:
-    active: dev
+    active: prod