|
@@ -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;
|
|
|
}
|
|
|
|