xiongzhu %!s(int64=4) %!d(string=hai) anos
pai
achega
e0f6b3bd13

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

@@ -99,6 +99,9 @@ public class Asset extends BaseEntity {
     @ApiModelProperty("tokenId")
     private String tokenId;
 
+    @ApiModelProperty("tokenId")
+    private String chainTokenId;
+
     @ApiModelProperty("购买hash")
     private String txHash;
 

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

@@ -64,6 +64,9 @@ public class GiftOrderService {
     @Transactional
     public GiftOrder gift(Long userId, Long assetId, Long toUserId) {
         Asset asset = assetRepo.findById(assetId).orElseThrow(new BusinessException("资产不存在"));
+        if (asset.getUserId().equals(userId)) {
+            throw new BusinessException("无权限");
+        }
         if (!(asset.getStatus() == AssetStatus.NORMAL)) {
             throw new BusinessException("当前状态不可转赠");
         }

+ 1 - 1
src/main/java/com/izouma/nineth/web/OrderNotifyController.java

@@ -75,7 +75,7 @@ public class OrderNotifyController {
                 }
                 case "payGiftOrder": {
                     Long orderId = body.getLong("orderId");
-                    giftOrderService.giftNotify(orderId, PayMethod.ALIPAY, MapUtils.getString(params, "trade_no"));
+                    giftOrderService.giftNotify(orderId, PayMethod.WEIXIN, MapUtils.getString(params, "trade_no"));
                     break;
                 }
             }

+ 23 - 0
src/test/java/com/izouma/nineth/WxTest.java

@@ -0,0 +1,23 @@
+package com.izouma.nineth;
+
+import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
+import com.izouma.nineth.utils.SnowflakeIdWorker;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class WxTest extends ApplicationTests {
+    @Autowired
+    private WxPayService wxPayService;
+
+    @Test
+    public void refund() throws WxPayException {
+        WxPayRefundRequest request = new WxPayRefundRequest();
+        request.setTransactionId("4200001324202112096373883962");
+        request.setTotalFee(100);
+        request.setRefundFee(100);
+        request.setOutRefundNo(String.valueOf(new SnowflakeIdWorker(0, 0).nextId()));
+        wxPayService.refund(request);
+    }
+}