xiongzhu 3 年之前
父節點
當前提交
7966841c11

+ 8 - 9
src/main/java/com/izouma/nineth/config/Constants.java

@@ -39,20 +39,19 @@ public interface Constants {
         String GIFT     = "gift";
         String MINT     = "mintOrder";
         String RECHARGE = "recharge";
-
-        String AUCTION = "auctionOrder";
+        String AUCTION  = "auctionOrder";
     }
 
     interface Rarity {
-        String SSR    = "SSR";
-        String SR     = "SR";
-        String U     = "U";
-        String R     = "R";
+        String SSR = "SSR";
+        String SR  = "SR";
+        String U   = "U";
+        String R   = "R";
 
         String SSR_LIKE = "%SSR #%";
-        String SR_LIKE = "%SR #%";
-        String U_LIKE = "%U #%";
-        String R_LIKE = "%R #%";
+        String SR_LIKE  = "%SR #%";
+        String U_LIKE   = "%U #%";
+        String R_LIKE   = "%R #%";
 
         String ACTIVITY_RANK_ID = "activity_rank_id";
     }

+ 7 - 1
src/main/java/com/izouma/nineth/domain/Asset.java

@@ -232,6 +232,10 @@ public class Asset extends CollectionBaseEntity {
     @Column(columnDefinition = "bigint default 1 not null")
     private Long companyId;
 
+    @ApiModelProperty("bit 0: 蚂蚁链, bit 1: 华储链")
+    @Column(columnDefinition = "int default 3 not null")
+    private int chainFlag;
+
     public static Asset create(Collection collection, User user) {
         return Asset.builder()
                 .userId(user.getId())
@@ -262,6 +266,7 @@ public class Asset extends CollectionBaseEntity {
                 .prefixName(collection.getPrefixName())
                 .empower(collection.getEmpower())
                 .companyId(collection.getCompanyId())
+                .chainFlag(collection.getChainFlag())
                 .build();
     }
 
@@ -292,7 +297,8 @@ public class Asset extends CollectionBaseEntity {
                 .oldHoldDays(holdDays)
                 .source(AssetSource.OFFICIAL)
                 .opened(false)
-                .companyId(item.getCompanyId())
+                .companyId(item.getCollection().getCompanyId())
+                .chainFlag(item.getCollection().getChainFlag())
                 .build();
     }
 }

+ 3 - 0
src/main/java/com/izouma/nineth/domain/BlindBoxItem.java

@@ -103,4 +103,7 @@ public class BlindBoxItem extends BaseEntity {
 
     @Column(columnDefinition = "bigint default 1 not null")
     private Long companyId;
+
+    @Transient
+    private Collection collection;
 }

+ 4 - 0
src/main/java/com/izouma/nineth/domain/Collection.java

@@ -280,4 +280,8 @@ public class Collection extends CollectionBaseEntity {
 
     @Column(columnDefinition = "bigint default 1 not null")
     private Long companyId;
+
+    @ApiModelProperty("bit 0: 蚂蚁链, bit 1: 华储链")
+    @Column(columnDefinition = "int default 3 not null")
+    private int chainFlag;
 }

+ 2 - 1
src/main/java/com/izouma/nineth/security/WebSecurityConfig.java

@@ -101,7 +101,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/user/code2openId").permitAll()
                 .antMatchers("/blindBoxItem/all").permitAll()
                 .antMatchers("/collection/recommend").permitAll()
-                .antMatchers("/order/**/status").permitAll()
+                .antMatchers("/order/**/status", "/giftOrder/*/status", "/mintOrder/*/status", "/rechargeOrder/*/status", "/auctionOrder/*/status").permitAll()
                 .antMatchers("/mintOrder/**/status").permitAll()
                 .antMatchers("/activity/all").permitAll()
                 .antMatchers("/activity/get/*").permitAll()
@@ -145,6 +145,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 .antMatchers("/metaSpatialInfo/**").permitAll()
                 .antMatchers("/onOff/**").permitAll()
                 .antMatchers("/metaBonusScene/**").permitAll()
+                .antMatchers("/alipay/notify").permitAll()
                 .antMatchers("/metaPlayerWear/**").permitAll()
                 .antMatchers("/userHold/top").permitAll()
                 // all other requests need to be authenticated

+ 2 - 0
src/main/java/com/izouma/nineth/service/AssetMintService.java

@@ -41,6 +41,7 @@ public class AssetMintService {
     @Retryable(maxAttempts = 10, backoff = @Backoff(delay = 1000))
     public void mint(Long assetId) {
         Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("asset不存在"));
+        if ((asset.getChainFlag() & 0b01) != 0b01) return;
         User user = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("用户不存在"));
         if (StringUtils.isEmpty(user.getNftAccount())) {
             NFTAccount account = nftService.createAccount(user.getUsername() + "_");
@@ -72,6 +73,7 @@ public class AssetMintService {
     @Retryable(maxAttempts = 10, backoff = @Backoff(delay = 1000))
     public void hcMint(Long assetId) {
         Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("asset不存在"));
+        if ((asset.getChainFlag() & 0b10) != 0b10) return;
         User user = userRepo.findById(asset.getUserId()).orElseThrow(new BusinessException("用户不存在"));
         if (StringUtils.isEmpty(user.getHcChainAddress())) {
             user.setHcChainAddress(hcChainService.createAccount(user.getId()));

+ 1 - 0
src/main/java/com/izouma/nineth/service/AssetService.java

@@ -200,6 +200,7 @@ public class AssetService {
                 .orElseThrow(new BusinessException("盲盒不存在"));
         Collection collection = collectionRepo.findDetailById(winItem.getCollectionId())
                 .orElseThrow(new BusinessException("藏品不存在"));
+        winItem.setCollection(collection);
         Asset asset = Asset.create(winItem, user, holdDays);
         asset.setTokenId(TokenUtils.genTokenId());
         asset.setNumber(number);

+ 0 - 40
src/main/java/com/izouma/nineth/service/GiftOrderService.java

@@ -232,46 +232,6 @@ public class GiftOrderService {
 
     }
 
-    public void payOrderAlipay(Long id, Model model) {
-        try {
-            GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
-
-            if (order.getStatus() != OrderStatus.NOT_PAID) {
-                throw new BusinessException("订单状态错误");
-            }
-
-            JSONObject bizContent = new JSONObject();
-            bizContent.put("notifyUrl", alipayProperties.getNotifyUrl());
-            bizContent.put("returnUrl", alipayProperties.getReturnUrl());
-            bizContent.put("out_trade_no", String.valueOf(snowflakeIdWorker.nextId()));
-            bizContent.put("total_amount", order.getGasPrice().stripTrailingZeros().toPlainString());
-            bizContent.put("disable_pay_channels", "pcredit,creditCard");
-            if (Arrays.stream(env.getActiveProfiles()).noneMatch(s -> s.equals("prod"))) {
-                // 测试环境设为1分
-                bizContent.put("total_amount", "0.01");
-            }
-            bizContent.put("subject", "转赠GAS费");
-            bizContent.put("product_code", "QUICK_WAP_PAY");
-            JSONObject body = new JSONObject();
-            body.put("action", "payGiftOrder");
-            body.put("userId", order.getUserId());
-            body.put("orderId", order.getId());
-            bizContent.put("body", body.toJSONString());
-
-            AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();
-            alipayRequest.setReturnUrl(alipayProperties.getReturnUrl());
-            alipayRequest.setNotifyUrl(alipayProperties.getNotifyUrl());
-            alipayRequest.setBizContent(JSON.toJSONString(bizContent));
-
-            String form = alipayClient.pageExecute(alipayRequest).getBody();
-            model.addAttribute("form", form);
-        } catch (BusinessException err) {
-            model.addAttribute("errMsg", err.getError());
-        } catch (Exception e) {
-            model.addAttribute("errMsg", e.getMessage());
-        }
-    }
-
     public Object payOrderWeixin(Long id, String tradeType, String openId) throws WxPayException, EncoderException {
         GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
         if (order.getStatus() != OrderStatus.NOT_PAID) {

+ 54 - 9
src/main/java/com/izouma/nineth/service/OrderPayService.java

@@ -1,6 +1,11 @@
 package com.izouma.nineth.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.request.AlipayTradePrecreateRequest;
+import com.alipay.api.response.AlipayTradePrecreateResponse;
+import com.izouma.nineth.config.AlipayProperties;
 import com.izouma.nineth.config.Constants;
 import com.izouma.nineth.config.GeneralProperties;
 import com.izouma.nineth.domain.*;
@@ -18,8 +23,12 @@ import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.security.crypto.password.PasswordEncoder;
 import org.springframework.stereotype.Service;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
 
 import java.math.BigDecimal;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.time.LocalDateTime;
 import java.util.Map;
 import java.util.Objects;
@@ -53,6 +62,8 @@ public class OrderPayService {
     private final AuctionOrderRepo    auctionOrderRepo;
     private final AuctionOrderService auctionOrderService;
     private final IdentityAuthRepo    identityAuthRepo;
+    private final AlipayClient        alipayClient;
+    private final AlipayProperties    alipayProperties;
 
     public static void setPayChannel(String payChannel) {
         log.info("set pay channel {}", payChannel);
@@ -67,16 +78,50 @@ public class OrderPayService {
         if (order.getStatus() != OrderStatus.NOT_PAID) {
             throw new BusinessException("订单状态错误");
         }
-        switch (PAY_CHANNEL) {
-            case Constants.PayChannel.SAND:
-                return sandPayService.pay(orderId + "", order.getName(), order.getTotalPrice(),
-                        order.getCreatedAt().plusMinutes(3), "order");
-            case Constants.PayChannel.HM:
-                return hmPayService.requestAlipay(orderId + "", order.getTotalPrice(), order.getName(),
-                        HMPayService.getTimeout(order.getCreatedAt(), 180), Constants.OrderNotifyType.ORDER,
-                        generalProperties.getHost() + "/9th/orderDetail?id=" + orderId);
+//        switch (PAY_CHANNEL) {
+//            case Constants.PayChannel.SAND:
+//                return sandPayService.pay(orderId + "", order.getName(), order.getTotalPrice(),
+//                        order.getCreatedAt().plusMinutes(3), "order");
+//            case Constants.PayChannel.HM:
+//                return hmPayService.requestAlipay(orderId + "", order.getTotalPrice(), order.getName(),
+//                        HMPayService.getTimeout(order.getCreatedAt(), 180), Constants.OrderNotifyType.ORDER,
+//                        generalProperties.getHost() + "/9th/orderDetail?id=" + orderId);
+//        }
+//        throw new BusinessException(Constants.PAY_ERR_MSG);
+
+        AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
+        request.setNotifyUrl(alipayProperties.getNotifyUrl());
+        JSONObject bizContent = new JSONObject();
+        bizContent.put("out_trade_no", orderId + "");
+        bizContent.put("total_amount", order.getTotalPrice());
+        bizContent.put("subject", order.getName());
+        JSONObject body = new JSONObject();
+        body.put("type", Constants.OrderNotifyType.ORDER);
+        body.put("orderId", orderId);
+        bizContent.put("body", body.toString());
+
+        request.setBizContent(bizContent.toString());
+        AlipayTradePrecreateResponse response = null;
+        try {
+            response = alipayClient.execute(request);
+        } catch (AlipayApiException e) {
+            e.printStackTrace();
+            throw new BusinessException(Constants.PAY_ERR_MSG, e.getErrMsg());
+        }
+        String qrCode;
+        if (response.isSuccess()) {
+            qrCode = response.getQrCode();
+        } else {
+            throw new BusinessException(response.getSubMsg());
+        }
+        String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
+        if (ua.toLowerCase().contains("micromessenger")) {
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+                    + "&orderId=" + orderId + "&type=order&returnUrl="
+                    + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
+        } else {
+            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
         }
-        throw new BusinessException(Constants.PAY_ERR_MSG);
     }
 
     @Cacheable(value = "payOrder", key = "'order#'+#orderId")

+ 0 - 40
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -461,46 +461,6 @@ public class OrderService {
         return map;
     }
 
-    public void payOrderAlipay(Long id, Model model) {
-        try {
-            Order order = orderRepo.findByIdAndDelFalse(id).orElseThrow(new BusinessException("订单不存在"));
-
-            if (order.getStatus() != OrderStatus.NOT_PAID) {
-                throw new BusinessException("订单状态错误");
-            }
-
-            JSONObject bizContent = new JSONObject();
-            bizContent.put("notifyUrl", alipayProperties.getNotifyUrl());
-            bizContent.put("returnUrl", alipayProperties.getReturnUrl());
-            bizContent.put("out_trade_no", String.valueOf(snowflakeIdWorker.nextId()));
-            bizContent.put("total_amount", order.getTotalPrice().stripTrailingZeros().toPlainString());
-            bizContent.put("disable_pay_channels", "pcredit,creditCard");
-            if (Arrays.stream(env.getActiveProfiles()).noneMatch(s -> s.equals("prod"))) {
-                // 测试环境设为1分
-                bizContent.put("total_amount", "0.01");
-            }
-            bizContent.put("subject", order.getName());
-            bizContent.put("product_code", "QUICK_WAP_PAY");
-            JSONObject body = new JSONObject();
-            body.put("action", "payOrder");
-            body.put("userId", order.getUserId());
-            body.put("orderId", order.getId());
-            bizContent.put("body", body.toJSONString());
-
-            AlipayTradeWapPayRequest alipayRequest = new AlipayTradeWapPayRequest();
-            alipayRequest.setReturnUrl(alipayProperties.getReturnUrl());
-            alipayRequest.setNotifyUrl(alipayProperties.getNotifyUrl());
-            alipayRequest.setBizContent(JSON.toJSONString(bizContent));
-
-            String form = alipayClient.pageExecute(alipayRequest).getBody();
-            model.addAttribute("form", form);
-        } catch (BusinessException err) {
-            model.addAttribute("errMsg", err.getError());
-        } catch (Exception e) {
-            model.addAttribute("errMsg", e.getMessage());
-        }
-    }
-
     public Object payOrderWeixin(Long id, String tradeType, String openId) throws WxPayException, EncoderException {
         Order order = orderRepo.findByIdAndDelFalse(id).orElseThrow(new BusinessException("订单不存在"));
         if (order.getStatus() != OrderStatus.NOT_PAID) {

+ 91 - 0
src/main/java/com/izouma/nineth/web/AlipayNotifyController.java

@@ -0,0 +1,91 @@
+package com.izouma.nineth.web;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.internal.util.AlipaySignature;
+import com.izouma.nineth.config.AlipayProperties;
+import com.izouma.nineth.config.GeneralProperties;
+import com.izouma.nineth.enums.PayMethod;
+import com.izouma.nineth.event.OrderNotifyEvent;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.MapUtils;
+import org.apache.rocketmq.spring.core.RocketMQTemplate;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+@RestController
+@Slf4j
+@AllArgsConstructor
+public class AlipayNotifyController {
+    private AlipayProperties  alipayProperties;
+    private GeneralProperties generalProperties;
+    private RocketMQTemplate  rocketMQTemplate;
+
+    @PostMapping("/alipay/notify")
+    @ResponseBody
+    public String notify(HttpServletRequest request) throws AlipayApiException {
+        Map<String, String> params = new HashMap<>();
+        Set<Map.Entry<String, String[]>> entrySet = request.getParameterMap().entrySet();
+        for (Map.Entry<String, String[]> entry : entrySet) {
+            String name = entry.getKey();
+            String[] values = entry.getValue();
+            int valLen = values.length;
+
+            if (valLen == 1) {
+                params.put(name, values[0]);
+            } else if (valLen > 1) {
+                StringBuilder sb = new StringBuilder();
+                for (String val : values) {
+                    sb.append(",").append(val);
+                }
+                params.put(name, sb.toString().substring(1));
+            } else {
+                params.put(name, "");
+            }
+        }
+        log.info("支付宝回调 {}", JSON.toJSONString(params, true));
+        AlipaySignature.rsaCheckV1(params, alipayProperties.getAliPublicKey(), "UTF-8", "RSA2");
+        if (MapUtils.getString(params, "trade_status").equals("TRADE_SUCCESS")) {
+            JSONObject body = JSON.parseObject(params.get("body"));
+            String type = body.getString("type");
+            Long orderId = body.getLong("orderId");
+            String tradeNo = params.get("trade_no");
+            switch (type) {
+                case "order":
+                    rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
+                            new OrderNotifyEvent(orderId, PayMethod.ALIPAY,
+                                    tradeNo, System.currentTimeMillis()));
+                    break;
+                case "gift":
+                    rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
+                            new OrderNotifyEvent(orderId, PayMethod.ALIPAY, tradeNo,
+                                    System.currentTimeMillis(), OrderNotifyEvent.TYPE_GIFT_ORDER));
+                    break;
+                case "mintOrder":
+                    rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
+                            new OrderNotifyEvent(orderId, PayMethod.ALIPAY, tradeNo,
+                                    System.currentTimeMillis(), OrderNotifyEvent.TYPE_MINT_ORDER));
+                    break;
+                case "recharge":
+                    rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
+                            new OrderNotifyEvent(orderId, PayMethod.ALIPAY, tradeNo,
+                                    System.currentTimeMillis(), OrderNotifyEvent.TYPE_RECHARGE));
+                    break;
+                case "auctionOrder":
+                    rocketMQTemplate.syncSend(generalProperties.getOrderNotifyTopic(),
+                            new OrderNotifyEvent(orderId, PayMethod.ALIPAY, tradeNo,
+                                    System.currentTimeMillis(), OrderNotifyEvent.TYPE_AUCTION_ORDER));
+                    break;
+            }
+        }
+        return "success";
+    }
+}

+ 11 - 0
src/main/java/com/izouma/nineth/web/AuctionOrderController.java

@@ -1,6 +1,7 @@
 package com.izouma.nineth.web;
 
 import com.izouma.nineth.domain.AuctionOrder;
+import com.izouma.nineth.domain.GiftOrder;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.enums.AuctionPaymentType;
 import com.izouma.nineth.exception.BusinessException;
@@ -17,7 +18,9 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/auctionOrder")
@@ -98,6 +101,14 @@ public class AuctionOrderController extends BaseController {
         return auctionOrderRepo.findById(id).orElseThrow(new BusinessException("无记录"));
     }
 
+    @GetMapping("/{id}/status")
+    public Map<String, Object> status(@PathVariable Long id) {
+        AuctionOrder order = auctionOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        return new HashMap<>() {{
+            put("status", order.getStatus());
+        }};
+    }
+
     @PostMapping("/del/{id}")
     public void del(@PathVariable Long id) {
         auctionOrderRepo.softDelete(id);

+ 12 - 0
src/main/java/com/izouma/nineth/web/GiftOrderController.java

@@ -1,6 +1,7 @@
 package com.izouma.nineth.web;
 
 import com.izouma.nineth.domain.GiftOrder;
+import com.izouma.nineth.domain.Order;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.repo.GiftOrderRepo;
 import lombok.AllArgsConstructor;
@@ -9,6 +10,9 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
+import java.util.Map;
+
 @RestController
 @RequestMapping("/giftOrder")
 @AllArgsConstructor
@@ -19,4 +23,12 @@ public class GiftOrderController extends BaseController {
     public GiftOrder get(@PathVariable Long id) {
         return giftOrderRepo.findById(id).orElseThrow(new BusinessException("无记录"));
     }
+
+    @GetMapping("/{id}/status")
+    public Map<String, Object> status(@PathVariable Long id) {
+        GiftOrder order = giftOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        return new HashMap<>() {{
+            put("status", order.getStatus());
+        }};
+    }
 }

+ 35 - 0
src/main/java/com/izouma/nineth/web/RechargeOrderController.java

@@ -0,0 +1,35 @@
+package com.izouma.nineth.web;
+
+import com.izouma.nineth.domain.GiftOrder;
+import com.izouma.nineth.domain.RechargeOrder;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.RechargeOrderRepo;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/rechargeOrder")
+@AllArgsConstructor
+public class RechargeOrderController {
+
+    private final RechargeOrderRepo rechargeOrderRepo;
+
+    @GetMapping("/get/{id}")
+    public RechargeOrder get(@PathVariable Long id) {
+        return rechargeOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+    }
+
+    @GetMapping("/{id}/status")
+    public Map<String, Object> status(@PathVariable Long id) {
+        RechargeOrder order = rechargeOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        return new HashMap<>() {{
+            put("status", order.getStatus());
+        }};
+    }
+}

+ 8 - 4
src/main/resources/application.yaml

@@ -197,7 +197,7 @@ alipay:
   api-key: CRv5YFAOIEGY5PgVf14Y9g==
   app-cert-path: classpath:cert/appCertPublicKey_2021002120645023.crt
   root-cert-path: classpath:cert/alipayRootCert.crt
-  notify-url: https://test.raex.vip/notify/order/alipay
+  notify-url: https://testorder.raex.vip/alipay/notify
   return-url: https://test.raex.vip/9th/home
 #adapay:
 #  app-id: app_0e8d3acb-3d95-4ebb-8445-e470c378a787
@@ -276,6 +276,8 @@ general:
   broadcast-event-topic: broadcast-event-topic-test
   register-group: register-group-test
   register-topic: register-topic-test
+alipay:
+  notify-url: https://testorder.raex.vip/alipay/notify
 sandpay:
   notify-url: https://testorder.raex.vip/sandpay/notify
 hmpay:
@@ -385,7 +387,7 @@ wx:
     refund-notify-url: https://www.raex.vip/wx/refundNotify
     return-url: https://www.raex.vip/9th/orders
 alipay:
-  notify-url: https://www.raex.vip/notify/order/alipay
+  notify-url: https://order.raex.vip/alipay/notify
   return-url: https://www.raex.vip/9th/home
 adapay:
   notify-url: https://order.raex.vip/notify/adapay
@@ -440,7 +442,7 @@ wx:
     refund-notify-url: https://www.raex.vip/wx/refundNotify
     return-url: https://www.raex.vip/9th/orders
 alipay:
-  notify-url: https://www.raex.vip/notify/order/alipay
+  notify-url: https://order.raex.vip/alipay/notify
   return-url: https://www.raex.vip/9th/home
 adapay:
   notify-url: https://order.raex.vip/notify/adapay
@@ -493,6 +495,8 @@ rocketmq:
   name-server: 172.29.50.102:9876
   producer:
     group: my-producer
+alipay:
+  notify-url: https://testorder.raex.vip/alipay/notify
 sandpay:
   notify-url: https://testorder.raex.vip/sandpay/notify
 hmpay:
@@ -538,7 +542,7 @@ wx:
     refund-notify-url: https://oasis.raex.vip/wx/refundNotify
     return-url: https://oasis.raex.vip/9th/orders
 alipay:
-  notify-url: https://oasis.raex.vip/notify/order/alipay
+  notify-url: https://oasis.raex.vip/alipay/notify
   return-url: https://oasis.raex.vip/9th/home
 adapay:
   notify-url: https://oasis.raex.vip/notify/adapay

+ 198 - 0
src/main/resources/static/wx_alipay_bridge.html

@@ -0,0 +1,198 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <title>支付</title>
+    <script src="./js/jquery.min.js"></script>
+    <style>
+        html {
+            width: 100%;
+            height: 100%;
+            padding: 0;
+            margin: 0;
+            font-family: -apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif;
+            font-size: 14px;
+            font-weight: 400;
+            line-height: 1.6;
+        }
+
+        body {
+            width: 100%;
+            height: 100%;
+            padding: 0;
+            margin: 0;
+            background: #1677ff;
+            /*background: #1677ff url(./img/zfb.png) no-repeat top;*/
+            background-size: 100%;
+        }
+
+        .overlay .overlay-img {
+            width: 186px;
+            height: 210px;
+            margin-right: 15px;
+        }
+
+        .overlay .overlay-text1 {
+            width: 272px;
+            font-size: 16px;
+            font-weight: bold;
+            color: rgba(255, 255, 255, 1);
+            line-height: 22px;
+            margin: 15px auto 0;
+        }
+
+        .overlay .overlay-text2 {
+            width: 272px;
+            font-size: 13px;
+            color: rgba(255, 255, 255, 1);
+            line-height: 18px;
+            margin: 15px auto 0;
+        }
+
+        .overlay {
+            position: fixed;
+            top: 0;
+            right: 0;
+            bottom: 0;
+            left: 0;
+            background: rgba(0, 0, 0, 0.7);
+            display: none;
+        }
+
+        #btn-zfb {
+            width: 100%;
+            margin: auto;
+            background: #ffffff;
+            line-height: 52px;
+            height: 52px;
+            outline: none;
+            color: #1677ff;
+            font-size: 18px;
+            letter-spacing: 3px;
+            font-weight: 400;
+            border-radius: 8px;
+            border: none;
+        }
+
+        #btn-zfb:active {
+            background: rgba(240, 240, 240, 1);
+        }
+
+        #btn-finish:active {
+            background: rgba(0, 0, 0, 0.03);
+        }
+
+        #btn-finish {
+            width: 100%;
+            line-height: 50px;
+            height: 52px;
+            outline: none;
+            font-size: 18px;
+            letter-spacing: 3px;
+            font-weight: 400;
+            border-radius: 8px;
+            margin: 20px auto 0 auto;
+            border: 2px solid #ffffff;
+            color: #ffffff;
+            background: none;
+        }
+
+        .btns {
+            width: 80%;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            position: absolute;
+            left: 0;
+            right: 0;
+            top: 0;
+            bottom: 0;
+            margin: auto;
+            flex-direction: column;
+        }
+
+        .btns a {
+            width: 100%;
+        }
+    </style>
+</head>
+
+<body>
+<div class="overlay" id="overlay">
+    <div style="text-align: right"><img class="overlay-img" src="./img/zhifu_img_liulanqi_ios.png" alt=""/>
+    </div>
+    <div class="overlay-text1">请点击右上角,选择在默认浏览器中打开然后继续完成支付</div>
+    <div class="overlay-text2">注:由于微信限制,需要在浏览器中打开才可以完成支付宝支付</div>
+</div>
+
+<div class="btn-wrapper" style="display: none">
+    <div class="btns">
+        <a id="link">
+            <button id="btn-zfb">打开支付宝</button>
+        </a>
+        <a id="" href="weixin://">
+            <button id="btn-finish">我已完成支付</button>
+        </a>
+    </div>
+</div>
+<script>
+    function GetQueryString(name) {
+        var after = window.location.href.split("?")[1];
+        if (after) {
+            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+            var r = after.match(reg);
+            if (r != null) {
+                return decodeURIComponent(r[2]);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    var payUrl = decodeURIComponent(GetQueryString("payUrl"));
+    var returnUrl = decodeURIComponent(GetQueryString("returnUrl"));
+    var orderId = decodeURIComponent(GetQueryString("orderId"));
+    var type = decodeURIComponent(GetQueryString("type"));
+    $('#link').attr('href', payUrl);
+
+
+    window.onload = function () {
+        if (/micromessenger/i.test(navigator.userAgent)) {
+            $('.overlay').fadeIn();
+            setInterval(function () {
+                var url;
+                switch (type) {
+                    case 'order':
+                        url = '/order/' + orderId + '/status';
+                        break;
+                    case 'gift':
+                        url = '/giftOrder/' + orderId + '/status';
+                        break;
+                    case 'mintOrder':
+                        url = '/mintOrder/' + orderId + '/status';
+                        break;
+                    case 'recharge':
+                        url = '/recharge/' + orderId + '/status';
+                        break;
+                    case 'auctionOrder':
+                        url = '/auctionOrder/' + orderId + '/status';
+                        break;
+                }
+                $.get(url, function (data) {
+                    if (data === 'FINISH') {
+                        window.location.replace(returnUrl);
+                    }
+                });
+            }, 1000);
+        } else {
+            $('.btn-wrapper').fadeIn();
+            $('#link')[0].click();
+        }
+    }
+</script>
+</body>
+
+</html>

+ 15 - 3
src/main/vue/src/views/BlindBoxEdit.vue

@@ -150,11 +150,22 @@
                         <el-button size="mini" @click="addItem" :disabled="!canEdit">添加作品</el-button>
                     </el-form-item>
                     <el-form-item prop="prefixName" label="系列名称">
-                        <el-input v-model="formData.prefixName" style="width: 200px" placeholder="请输入系列名称"></el-input>
+                        <el-input
+                            v-model="formData.prefixName"
+                            style="width: 200px"
+                            placeholder="请输入系列名称"
+                        ></el-input>
                     </el-form-item>
                     <!-- <el-form-item prop="likes" label="点赞">
                         <el-input-number v-model="formData.likes"></el-input-number>
                     </el-form-item> -->
+                    <el-form-item prop="chainFlag" label="上链">
+                        <el-select v-model="formData.chainFlag" placeholder="请选择">
+                            <el-option label="蚂蚁链+华储链" :value="3" :key="3"></el-option>
+                            <el-option label="华储链" :value="2" :key="2"></el-option>
+                            <el-option label="蚂蚁链" :value="1" :key="1"></el-option>
+                        </el-select>
+                    </el-form-item>
                     <el-form-item prop="scanCode" label="仅扫码可见">
                         <el-radio v-model="formData.scanCode" :label="true">是</el-radio>
                         <el-radio v-model="formData.scanCode" :label="false">否</el-radio>
@@ -273,7 +284,7 @@
                         <single-upload v-model="formData.registerBg"></single-upload>
                     </el-form-item>
                     <el-form-item label="活动规则" v-if="formData.assignment > 0">
-                         <rich-text style="width:500px" onlyText v-model="formData.rule"></rich-text>
+                        <rich-text style="width:500px" onlyText v-model="formData.rule"></rich-text>
                     </el-form-item>
                     <el-form-item class="form-submit">
                         <el-button @click="onSave" :loading="saving" type="primary" v-if="!formData.id">
@@ -464,7 +475,8 @@ export default {
                 scanCode: false,
                 noSoldOut: true,
                 assignment: 0,
-                couponPayment: false
+                couponPayment: false,
+                chainFlag: 3
             },
             rules: {
                 name: [

+ 9 - 2
src/main/vue/src/views/CollectionEdit.vue

@@ -181,7 +181,13 @@
                             placeholder="请输入系列名称"
                         ></el-input>
                     </el-form-item>
-
+                    <el-form-item prop="chainFlag" label="上链">
+                        <el-select v-model="formData.chainFlag" placeholder="请选择">
+                            <el-option label="蚂蚁链+华储链" :value="3" :key="3"></el-option>
+                            <el-option label="华储链" :value="2" :key="2"></el-option>
+                            <el-option label="蚂蚁链" :value="1" :key="1"></el-option>
+                        </el-select>
+                    </el-form-item>
                     <!-- <el-form-item prop="likes" label="点赞">
                         <el-input-number v-model="formData.likes"></el-input-number>
                     </el-form-item> -->
@@ -668,7 +674,8 @@ export default {
                         },
                         trigger: 'blur'
                     }
-                ]
+                ],
+                chainFlag: [{ required: true, message: '请选择区块链', trigger: 'blur' }]
             },
             typeOptions: [
                 { label: '默认', value: 'DEFAULT' },