package com.stylefeng.guns.modular.api;
|
|
|
import com.stylefeng.guns.modular.system.service.IUserInfoService;
|
import com.stylefeng.guns.modular.system.util.ICBCPayUtil;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.Map;
|
|
|
/**
|
* 支付回调
|
*/
|
@RestController
|
@RequestMapping("/base")
|
public class UserCallbackController {
|
|
@Autowired
|
private IUserInfoService userInfoService;
|
|
@Autowired
|
private ICBCPayUtil icbcPayUtil;
|
|
|
|
|
|
/**
|
* 微信余额充值回调函数
|
* @param request
|
*/
|
@ResponseBody
|
@PostMapping("/wxCancelUserBalance")
|
public void wxCancelUserBalance(HttpServletRequest request, HttpServletResponse response){
|
try {
|
Map<String, String> map = icbcPayUtil.payCallback(request);
|
String id = map.get("out_trade_no");
|
String order_id = map.get("order_id");
|
String uid = map.get("attach");
|
userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 1);
|
icbcPayUtil.answer(response);
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
|
|
/**
|
* 支付宝余额充值回调
|
* @param request
|
*/
|
@ResponseBody
|
@PostMapping("/aliCancelUserBalance")
|
public void aliCancelUserBalance(HttpServletRequest request, HttpServletResponse response){
|
try {
|
Map<String, String> map = icbcPayUtil.payCallback(request);
|
String id = map.get("out_trade_no");
|
String order_id = map.get("order_id");
|
String uid = map.get("attach");
|
userInfoService.payCancelUserBalance(Integer.valueOf(uid), order_id, Integer.valueOf(id), 2);
|
icbcPayUtil.answer(response);
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
}
|
|
|
|
}
|