Redis-黑马点评项目-05-postman测试-新增优惠券报错以及前端展示优惠劵报错NaN问题

1.测试postman 向数据库添加优惠券信息报错

原始Body:

{
   
   
  "shopId": 1,
  "title": "100元代金券",
  "subTitle": "周一至周五均可使用",
  "rules": "全场通用\\n无需预约\\n可无限叠加\\n不兑现、不找零\\n仅限堂食",
  "payValue": 8000,
  "actualValue": 10000,
  "type": 1,
  "stock": 100,
  "beginTime": "2022-01-26T10:09:17",
  "endTime": "2022-01-26T24:09:04"
}

20:51:11.991 ERROR 22384 — [nio-8081-exec-2] com.hmdp.config.WebExceptionAdvice : org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Current token (VALUE_STRING) not numeric, can not use numeric value accessors; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Current token (VALUE_STRING) not numeric, can not use numeric value accessors
at [Source: (PushbackInputStream); line: 10, column: 17] (through reference chain: com.hmdp.entity.Voucher[“beginTime”])
在这里插入图片描述
原因是我们在JacksonConfig.java中配置了

     // 从 JSON 中读取时间戳(毫秒值)
                long timestamp = p.getLongValue();// 前端要传时间戳是Long

原来是要传时间戳,不能传"2022-01-26T10:09:17"这个日期了。
修改body为:

{
   
   
  "shopId": 1,
  "title": "100元代金券",
  "subTitle": "周一至周五均可使用",
  "rules": "全场通用\\n无需预约\\n可无限叠加\\n不兑现、不找零\\n仅限堂食",
  "payValue": 8000,
  "actualValue"
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值