master
kira 6 years ago
parent 2d530b36c8
commit 106c9b98c6

@ -6,6 +6,8 @@ import au.com.royalpay.payment.tools.connections.mpsupport.beans.WxOauthType;
import au.com.royalpay.payment.tools.permission.alipay.AlipayMapping;
import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@ -14,17 +16,19 @@ import javax.annotation.Resource;
/**
* Created by yixian on 2017-04-28.
*/
@RestController
@Controller
@RequestMapping("/act/encourage_money")
public class EncourageMoneyController {
@Resource
private EncourageService encourageService;
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.PUT)
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.GET)
public String takeEncourageMoney(@PathVariable String orderId,@RequestHeader("User-Agent") String ua) {
ua = ua.toLowerCase();
if (ua.contains("micromessenger")) {
return "redirect:/act/encourage_money/orders/" + orderId + "/wechat";
}
if (ua.contains("alipayclient")) {
return "redirect:/act/encourage_money/orders/" + orderId + "/alipay";
@ -33,7 +37,7 @@ public class EncourageMoneyController {
}
@WechatMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.PUT)
@WechatMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyWeChat(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
if (wxUser == null) {
return new JSONObject();
@ -41,7 +45,7 @@ public class EncourageMoneyController {
return encourageService.takeEncourageMoney(orderId, wxUser.getString("openid"));
}
@AlipayMapping(value = "/orders/{orderId}/alipay", method = RequestMethod.PUT)
@AlipayMapping(value = "/orders/{orderId}/alipay", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyAlipay(@PathVariable String orderId, @ModelAttribute(CommonConsts.ALIUSER) JSONObject alipayInfo) {
if (alipayInfo == null) {
return new JSONObject();

Loading…
Cancel
Save