master
kira 6 years ago
parent bd7786e40f
commit 735aaadc27

@ -8,12 +8,12 @@ import au.com.royalpay.payment.tools.permission.wechat.WechatMapping;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@ -31,20 +31,21 @@ public class EncourageMoneyController {
private EncourageService encourageService;
@RequestMapping(value = "/orders/{orderId}", method = RequestMethod.GET)
public ModelAndView takeEncourageMoney(@PathVariable String orderId,@RequestHeader("User-Agent") String ua) {
ua = ua.toLowerCase();
if (ua.contains("micromessenger")) {
return new ModelAndView("redirect:/act/encourage_money/orders/" + orderId + "/wechat");
public JSONObject takeEncourageMoney(@PathVariable String orderId,@ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser,@ModelAttribute(CommonConsts.ALIUSER) JSONObject aliuser) {
String user_id = "";
if(wxUser==null){
user_id = aliuser.getString("user_id");
}else {
user_id = wxUser.getString("openid");
}
if (ua.contains("alipayclient")) {
return new ModelAndView("redirect:/act/encourage_money/orders/" + orderId + "/alipay");
if(StringUtils.isEmpty(user_id)){
return new JSONObject();
}
return null;
return encourageService.takeEncourageMoney(orderId, user_id);
}
@WechatMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.GET)
@RequestMapping(value = "/orders/{orderId}/wechat", method = RequestMethod.GET)
public JSONObject takeEncourageMoneyWeChat(@PathVariable String orderId, @ModelAttribute(CommonConsts.WECHATINFO) JSONObject wxUser) {
logger.info("kiratest---wechat");
if (wxUser == null) {

Loading…
Cancel
Save