Browse Source

调整按类型的部分逻辑

master
xyiege 3 years ago
parent
commit
764db21f7f
  1. 18
      src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java
  2. 6
      src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

18
src/main/java/cn/chjyj/szwh/controller/api/GoodsController.java

@ -3,6 +3,7 @@ package cn.chjyj.szwh.controller.api;
import cn.chjyj.szwh.bean.Goods; import cn.chjyj.szwh.bean.Goods;
import cn.chjyj.szwh.controller.BaseController; import cn.chjyj.szwh.controller.BaseController;
import cn.chjyj.szwh.service.GoodsService; import cn.chjyj.szwh.service.GoodsService;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -133,13 +134,18 @@ public class GoodsController extends BaseController {
/** /**
* 根据类型获取委托信息 * 根据类型获取委托信息
* *
* @param type // * @param type
* @param createtime // * @param createtime
* @param goods_type // * @param goods_type
* @return * @return
*/ */
@RequestMapping("/getTypeGoods") @RequestMapping("/getTypeGoods")
public JSONObject getTypeGoods(String type, String createtime, String goods_type) { public JSONObject getTypeGoods(HttpServletRequest request) {
log.info("get_type_goods:");
String type = request.getParameter("type");
log.info(type);
String createtime = request.getParameter("createtime");
String goods_type = request.getParameter("goods_type");
//10长的时间戳 //10长的时间戳
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
List<Goods> goodsList = goodsService.getTypeGoods(type, createtime, goods_type); List<Goods> goodsList = goodsService.getTypeGoods(type, createtime, goods_type);
@ -153,7 +159,9 @@ public class GoodsController extends BaseController {
} }
@RequestMapping("/getTypeGoods/{type}") @RequestMapping("/getTypeGoods/{type}")
public JSONObject getTypeGoodsRest(@PathVariable String type) { public JSONObject getTypeGoodsRest(@PathVariable String type,@RequestBody String reqstr) {
log.info("get type goods json:");
log.info(reqstr);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
List<Goods> goodsList = goodsService.getTypeGoods(type, "", ""); List<Goods> goodsList = goodsService.getTypeGoods(type, "", "");
long endtime = System.currentTimeMillis(); long endtime = System.currentTimeMillis();

6
src/main/java/cn/chjyj/szwh/service/impl/GoodsServiceImpl.java

@ -567,12 +567,10 @@ public class GoodsServiceImpl implements GoodsService {
if ("1".equals(type)) { if ("1".equals(type)) {
limit=10; limit=10;
orderKey="click_count"; orderKey="click_count";
} }else if ("2".equals(type)) {
if ("2".equals(type)) {
limit=10; limit=10;
orderKey="click_count"; orderKey="click_count";
} } else{
if ("3".equals(type)) {
orderKey="recommend_sort"; orderKey="recommend_sort";
qmap.put("g.is_recommend",1); qmap.put("g.is_recommend",1);
qmap.put("g.goods_status",1); qmap.put("g.goods_status",1);

Loading…
Cancel
Save