师兄,你修改支付授信息后,发起支付时,页面错误提示已经由"数据库无此openid" 变成了404了. 这也是什么原因啊,视频中没有提到会遇见这个情况呀.
以上是我的配置截图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | @Controller //@RequestMapping("/pay") //错误在此,多一层路径,导致访问 http://xsell.natapp1.cc/pay 出现404 public class PayController { @Autowired private OrderService orderService; @Autowired private PayService payService; /** * 微信支付帐号借用 * 前端支付地址调用回调 * @param openid 师兄干货处获取的openid * @param orderId 订单id * @param returnUrl 支付完返回地址 * @param map 后端支付页面动态参数 * @return 用户支付页面调用 */ @GetMapping ( "/pay" ) public ModelAndView index( @RequestParam ( "openid" ) String openid, @RequestParam ( "orderId" ) String orderId, @RequestParam ( "returnUrl" ) String returnUrl, Map<String, Object> map) { return create(orderId, returnUrl, map); } @GetMapping ( "/pay/create" ) public ModelAndView create( @RequestParam ( "orderId" ) String orderId, @RequestParam ( "returnUrl" ) String returnUrl, Map<String, Object> map) { //1. 查询订单 OrderDTO one = orderService.findOne(orderId); if (one == null ) { throw new SellExecption(ResultTypeInfoEnum.ORDER_NOT_EXIST); } //2.发起支付 PayResponse payResponse = payService.create(one); map.put( "payResponse" , payResponse); map.put( "returnUrl" , returnUrl); return new ModelAndView( "pay/create" , map); } } |