Authored by zhaojun2

mock sort template

... ... @@ -3,6 +3,7 @@ package com.yohoufo.product.controller;
import com.yoho.tools.docs.ApiOperation;
import com.yohoufo.common.utils.UfoJsonUtil;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.SortTemplateResp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -14,6 +15,7 @@ import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.cache.Cachable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ProductController {
... ... @@ -41,4 +43,24 @@ public class ProductController {
return resp;
}
@ApiOperation(name = "ufo.product.sort.template", desc="商品列表")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.sort.template")
//@Cachable(expire=600)
public ApiResponse querySortTemplateData(
@RequestParam(value = "skns", required = false) String skns) {
if (null == skns) {
return new ApiResponse(500, "skns Is Null", null);
}
return new ApiResponse.ApiResponseBuilder().data(querySortTemplateData()).code(200).message("product data").build();
}
private SortTemplateResp querySortTemplateData(){
String mockJson = "{\"list\":[{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2012/11/07/15/02c24ff8521007bad91dfa5d55e667d8f7.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\",\"title\":\"鞋子\"},{\"src\":\"http://img13.static.yhbimg.com/goodsimg/2012/11/07/15/02c24ff8521007bad91dfa5d55e667d8f7.jpg?imageMogr2/thumbnail/{width}x{height}/background/d2hpdGU=/position/center/quality/80\",\"title\":\"袜子\"}]}";
SortTemplateResp resp = UfoJsonUtil.safelyParseObject(mockJson, SortTemplateResp.class);
return resp;
}
}
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@ public class ProductSearchController {
private final Logger LOG = LoggerFactory.getLogger(ProductSearchController.class);
@ApiOperation(name = "ufo.product.list", desc="首页商品推荐")
@ApiOperation(name = "ufo.product.search.list", desc="首页商品推荐")
@RequestMapping(params = "method=ufo.product.list")
@IgnoreSession
@Cachable
... ... @@ -51,7 +51,7 @@ public class ProductSearchController {
}
@ApiOperation(name = "ufo.product.data.recommend", desc="商品详情页的相似商品推荐")
@ApiOperation(name = "ufo.product.data.search.recommend", desc="商品详情页的相似商品推荐")
@RequestMapping(params = "method=ufo.product.data.recommend")
@IgnoreSession
@Cachable
... ...
package com.yohoufo.product.model;
public class ImageTitleTemplate {
private String src;
private String title;
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
... ...
... ... @@ -24,12 +24,12 @@ public class ProductSearchReq {
public ProductSearchReq setProductId(Integer productId) {
this.limit = limit;
this.productId = productId;
return this;
}
public ProductSearchReq setType(Integer type) {
this.productId = productId;
this.type = type;
return this;
}
... ...
package com.yohoufo.product.response;
import com.yohoufo.product.model.ImageTitleTemplate;
import java.util.List;
public class SortTemplateResp {
private List<ImageTitleTemplate> list;
public List<ImageTitleTemplate> getList() {
return list;
}
public void setList(List<ImageTitleTemplate> list) {
this.list = list;
}
}
... ...