feat(商城): 1.4.0 版本发布,更新内容如下
1. 商城搜索栏,新增搜索建议,支持拼音搜索 2. 标签栏购物车新增商品数量为微标 3. 商城购物车新增商品失效处理 4. 购物车页面、订单详情页面样式优化 5. 标签栏切换bug修复master
parent
db7b14ff19
commit
afd46d5e06
@ -1,23 +0,0 @@
|
|||||||
package com.wayn.data.redis.config;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class LettuceConfig implements InitializingBean {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RedisConnectionFactory redisConnectionFactory;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterPropertiesSet() {
|
|
||||||
if (redisConnectionFactory instanceof LettuceConnectionFactory c) {
|
|
||||||
c.setValidateConnection(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +1,45 @@
|
|||||||
package com.wayn.mobile.api.controller.callback;
|
package com.wayn.mobile.api.controller.callback;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.wayn.common.exception.BusinessException;
|
||||||
import com.wayn.common.util.R;
|
import com.wayn.common.util.R;
|
||||||
|
import com.wayn.data.redis.constant.RedisKeyEnum;
|
||||||
|
import com.wayn.data.redis.manager.RedisCache;
|
||||||
import com.wayn.message.core.dto.OrderDTO;
|
import com.wayn.message.core.dto.OrderDTO;
|
||||||
import com.wayn.mobile.api.service.IMobileOrderService;
|
import com.wayn.mobile.api.service.IMobileOrderService;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
@Slf4j
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("callback/order")
|
@RequestMapping("callback/order")
|
||||||
public class SubmitOrderController {
|
public class SubmitOrderController {
|
||||||
|
|
||||||
private IMobileOrderService iMobileOrderService;
|
private IMobileOrderService iMobileOrderService;
|
||||||
|
private RedisCache redisCache;
|
||||||
|
|
||||||
@PostMapping("submit")
|
@PostMapping("submit")
|
||||||
public R submit(String order) throws UnsupportedEncodingException {
|
public R submit(String order) {
|
||||||
|
log.info("callback order request is {}", order);
|
||||||
OrderDTO orderDTO = JSON.parseObject(order, OrderDTO.class);
|
OrderDTO orderDTO = JSON.parseObject(order, OrderDTO.class);
|
||||||
return iMobileOrderService.submit(orderDTO);
|
try {
|
||||||
|
iMobileOrderService.submit(orderDTO);
|
||||||
|
redisCache.setCacheObject(RedisKeyEnum.ORDER_RESULT_KEY.getKey(orderDTO.getOrderSn()),
|
||||||
|
"success", RedisKeyEnum.ORDER_RESULT_KEY.getExpireSecond());
|
||||||
|
return R.success();
|
||||||
|
} catch (Exception e) {
|
||||||
|
String errorMsg = "error";
|
||||||
|
if (e instanceof BusinessException businessException) {
|
||||||
|
errorMsg = businessException.getMsg();
|
||||||
|
}
|
||||||
|
redisCache.setCacheObject(RedisKeyEnum.ORDER_RESULT_KEY.getKey(orderDTO.getOrderSn()),
|
||||||
|
errorMsg, RedisKeyEnum.ORDER_RESULT_KEY.getExpireSecond());
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
return R.error();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue