|
@@ -275,7 +275,26 @@ public class WxController extends BaseController {
|
|
|
wxOrderService.save(order);
|
|
|
return Response.success(placeXcxWxOrder(order, examInfo.getName()));
|
|
|
} else if (wxOrderDTO.getGoodsType() == 2) {
|
|
|
- throw new CustomException("请正确传入GoodsType,GoodsType=2未开发");
|
|
|
+ String sponsor = configService.selectConfigByKey("sponsor");
|
|
|
+ //创建本地微信订单
|
|
|
+ WxOrder order = new WxOrder();
|
|
|
+ String orderCode = getOrderCode(userInfo.getId());
|
|
|
+ order.setGoodsId(2l); //八字记录ID
|
|
|
+ order.setGoodsName("友情赞助");
|
|
|
+ order.setGoodsType(2);
|
|
|
+ order.setOutTradeNo(orderCode);
|
|
|
+ order.setUserId(userInfo.getId());
|
|
|
+ order.setXcxOpenid(userInfo.getXcxOpenid());
|
|
|
+ order.setAppOpenid(userInfo.getAppOpenid());
|
|
|
+ order.setGzhOpenid(userInfo.getGzhOpenid());
|
|
|
+ order.setUnionId(userInfo.getUnionId());
|
|
|
+ order.setPhoneType(wxOrderDTO.getPhoneType()); //手机类型 1:苹果 2:安卓
|
|
|
+ order.setForeType(wxOrderDTO.getForeType()); //前端类型 1:app 2:小程序 3:公众号
|
|
|
+ order.setTotal(Integer.parseInt(sponsor));
|
|
|
+ order.setIsSharing(0); //不分账
|
|
|
+ order.setOrderStatus(OrderStatusEnum.PROCESSING.getCode());
|
|
|
+ wxOrderService.save(order);
|
|
|
+ return Response.success(placeXcxWxOrder(order, "友情赞助"));
|
|
|
} else if (wxOrderDTO.getGoodsType() == 3) {
|
|
|
String baziPriceStr = configService.selectConfigByKey("bazi_price");
|
|
|
BirthdayLog birthdayLog = birthdayLogService.getById(wxOrderDTO.getGoodsId()); //记录ID
|
|
@@ -319,7 +338,7 @@ public class WxController extends BaseController {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
private JSONObject placeXcxWxOrder(WxOrder order, String goodsName) throws Exception {
|
|
|
- String profitSharing = configService.selectConfigByKey("profit_sharing");
|
|
|
+ //String profitSharing = configService.selectConfigByKey("profit_sharing");
|
|
|
|
|
|
HttpPost httpPost = initHttpPost(wxpayConfig.getV3JsUrl());
|
|
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
|
@@ -332,7 +351,7 @@ public class WxController extends BaseController {
|
|
|
.put("out_trade_no", order.getOutTradeNo());
|
|
|
rootNode.putObject("amount").put("total", order.getTotal());
|
|
|
rootNode.putObject("payer").put("openid", order.getXcxOpenid());
|
|
|
- if("1".equals(profitSharing)) {
|
|
|
+ if(order.getIsSharing()==1) {
|
|
|
rootNode.putObject("settle_info").put("profit_sharing", true);
|
|
|
}
|
|
|
objectMapper.writeValue(bos, rootNode);
|