silent 4 лет назад
Родитель
Сommit
974959fabf

+ 16 - 8
src/main/java/org/springblade/gateway/goods_gateway/controller/AppHelpGoodsController.java

@@ -1,5 +1,7 @@
 package org.springblade.gateway.goods_gateway.controller;
 
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
@@ -29,6 +31,7 @@ import javax.annotation.PostConstruct;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Author: Silent
@@ -83,13 +86,14 @@ public class AppHelpGoodsController {
 	@PostMapping("/createCashPropsOrder")
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "创建现金道具订单")
-	public R<YeepayOrder> createCashPropsOrder(@ApiParam(value = "道具ID", required = true) @RequestParam Long helpGoodsId,
-											   @ApiParam(value = "用户ID", required = true) @RequestParam Long userId,
-											   @ApiParam(value = "手机号码", required = true) @RequestParam String phone,
-											   @ApiParam(value = "作品ID", required = true) @RequestParam Long productId,
-											   @ApiParam(value = "购买数量", required = true) @RequestParam Integer num) {
+	public R<Map<String, Object>> createCashPropsOrder(@ApiParam(value = "道具ID", required = true) @RequestParam Long helpGoodsId,
+													   @ApiParam(value = "用户ID", required = true) @RequestParam Long userId,
+													   @ApiParam(value = "手机号码", required = true) @RequestParam String phone,
+													   @ApiParam(value = "作品ID", required = true) @RequestParam Long productId,
+													   @ApiParam(value = "openId", required = true) @RequestParam String openId,
+													   @ApiParam(value = "购买数量", required = true) @RequestParam Integer num) {
 		try {
-			YeepayOrder yeepayOrder = new YeepayOrder(){{
+			YeepayOrder yeepayOrder = new YeepayOrder() {{
 				setNum(num);
 				setHelpGoodsId(helpGoodsId);
 				setPhone(phone);
@@ -98,7 +102,11 @@ public class AppHelpGoodsController {
 			}};
 			//创建随机单号
 			appHelpGoodsService.createCashPropsOrder(yeepayOrder);
-			return R.data(yeepayOrder);
+			String prePayTn = yeepayOrder.getPrePayTn();
+			yeepayOrder.setPrePayTn(null);
+			Map<String, Object> yeepayMap = BeanUtils.beanToMap(yeepayOrder);
+			yeepayMap.putAll(JSONObject.parseObject(prePayTn));
+			return R.data(yeepayMap);
 		} catch (Exception e) {
 			log.error(e.getMessage());
 			return R.fail(e.getMessage());
@@ -109,7 +117,7 @@ public class AppHelpGoodsController {
 	 * 现金支付回调地址
 	 */
 	@ApiLog("现金支付回调地址")
-	@RequestMapping(value ="/callbackUrl",method = {RequestMethod.GET, RequestMethod.POST})
+	@RequestMapping(value = "/callbackUrl", method = {RequestMethod.GET, RequestMethod.POST})
 	@ApiOperationSupport(order = 1)
 	@ApiOperation(value = "现金支付回调地址")
 	public String callbackUrl(HttpServletRequest request) {

+ 3 - 0
src/main/resources/payConfig.properties

@@ -20,5 +20,8 @@ yee-pay.platformServiceNo = 10086160165
 #商户号
 yee-pay.merchantNo = 10086226651
 
+#重定向
+yee-pay.redirectUrl = https://vote.guosen-fumao.cn/api
+
 #充值回调地址
 yee-pay.rechargeReturnUrl = https://vote.guosen-fumao.cn/api