|
|
@@ -10,12 +10,14 @@ import com.fdkankan.pay.httpClient.client.WxClient;
|
|
|
import com.fdkankan.pay.service.IOrderService;
|
|
|
import com.fdkankan.pay.service.IWxConfigService;
|
|
|
import com.fdkankan.pay.service.impl.PayOrderService;
|
|
|
+import com.fdkankan.pay.util.CacheUtil;
|
|
|
import com.fdkankan.pay.util.UrlUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-@RestController
|
|
|
+@Controller
|
|
|
@RequestMapping("/service/pay")
|
|
|
@Slf4j
|
|
|
public class PayController extends BaseController {
|
|
|
@@ -30,6 +32,7 @@ public class PayController extends BaseController {
|
|
|
IWxConfigService wxConfigService;
|
|
|
|
|
|
@GetMapping("/wxLogin")
|
|
|
+ @ResponseBody
|
|
|
public ResultData wxLogin(@RequestParam(required = false) String code,@RequestParam(required = false) String orderSn){
|
|
|
log.info("wx-login----orderSn:{},code:{}",orderSn,code);
|
|
|
Order order = orderService.getByOrderSn(orderSn);
|
|
|
@@ -47,14 +50,16 @@ public class PayController extends BaseController {
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/openPay")
|
|
|
+ @ResponseBody
|
|
|
public ResultData openPay(@RequestBody Order param) throws Exception {
|
|
|
return ResultData.ok(payOrderService.openPay(param, UrlUtils.getIpAddr(request)));
|
|
|
}
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/callBack/{orderSn}")
|
|
|
- public void callback(@PathVariable String orderSn) {
|
|
|
- payOrderService.callBack(orderSn,request,response);
|
|
|
+ public String callback(@PathVariable String orderSn) {
|
|
|
+ payOrderService.callBack(orderSn, request, response);
|
|
|
+ return "redirect:" + CacheUtil.mainUrl + "/payment/?id="+orderSn;
|
|
|
}
|
|
|
|
|
|
|