Ver código fonte

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

panhui 4 anos atrás
pai
commit
2b8e877c54

+ 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;
 

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

@@ -22,6 +22,7 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Service;
 
 import java.io.File;
+import java.util.concurrent.LinkedBlockingQueue;
 
 @Service
 @Slf4j

+ 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("当前状态不可转赠");
         }

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

@@ -59,8 +59,8 @@ public class NFTService {
         }
     }
 
-    @Retryable(maxAttempts = 10, backoff = @Backoff(delay = 5000), value = BusinessException.class)
-    public NFT createToken(String toAccount) throws Exception {
+    @Retryable(maxAttempts = 100, backoff = @Backoff(delay = 5000), value = BusinessException.class)
+    public synchronized NFT createToken(String toAccount) throws Exception {
         JSONArray jsonArray = new JSONArray();
         jsonArray.add(Utils.getIdentityByName(toAccount));
         CallRestBizParam callRestBizParam = CallRestBizParam.builder()

+ 2 - 3
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -303,15 +303,14 @@ public class OrderService {
         if (divMembers.size() > 1) {
             paymentParams.put("div_members", divMembers);
         }
-
+        Map<String, Object> expend = new HashMap<>();
+        paymentParams.put("expend", expend);
         if ("wx_pub".equals(payChannel)) {
             if (StringUtils.isBlank(openId)) {
                 throw new BusinessException("缺少openId");
             }
-            Map<String, Object> expend = new HashMap<>();
             expend.put("open_id", openId);
             expend.put("limit_pay", "1");
-            paymentParams.put("expend", expend);
         }
 
         Map<String, Object> response;

+ 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;
                 }
             }

+ 1 - 0
src/main/nine-space/package.json

@@ -19,6 +19,7 @@
         "dayjs": "^1.10.7",
         "echarts": "^4.9.0",
         "element-ui": "^2.15.6",
+        "eruda": "^2.4.1",
         "html2canvas": "^1.3.2",
         "lodash": "^4.17.21",
         "mathjs": "^9.5.1",

+ 0 - 2
src/main/nine-space/public/index.html

@@ -28,7 +28,5 @@
         </noscript>
         <div id="app"></div>
         <!-- built files will be auto injected -->
-        <script src="//cdn.jsdelivr.net/npm/eruda"></script>
-        <script>eruda.init();</script>
     </body>
 </html>

+ 6 - 36
src/main/nine-space/src/main.js

@@ -19,46 +19,16 @@ import common from './mixins/common';
 import VueClipboard from 'vue-clipboard2';
 import queryString from 'query-string';
 import PageBar from './components/PageBar';
+import eruda from 'eruda';
+
+let showConsole = localStorage.getItem('showConsole');
+if (showConsole && parseInt(showConsole) > new Date().getTime()) {
+    eruda.init();
+}
 store.commit('setFirstUrl', location.href);
 
 import ImgContent from './components/ImgContent.vue';
 
-http.http
-    .get('/wx/jsapiSign', { url: location.href })
-    .then(res => {
-        wx.config({
-            debug: false,
-            appId: res.appId,
-            timestamp: res.timestamp,
-            nonceStr: res.nonceStr,
-            signature: res.signature,
-            jsApiList: [
-                'chooseWXPay',
-                'updateAppMessageShareData',
-                'updateTimelineShareData',
-                'hideAllNonBaseMenuItem',
-                'scanQRCode'
-            ]
-        });
-        wx.error(function (res) {
-            console.log(res);
-        });
-        wx.ready(function () {
-            wx.updateAppMessageShareData({
-                title: '第九空间',
-                desc: '全球首个基于区块链的游戏资产集换中心',
-                link: location.origin + '/9th',
-                imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
-            });
-            wx.updateTimelineShareData({
-                title: '第九空间-全球首个基于区块链的游戏资产集换中心',
-                link: location.origin + '/9th',
-                imgUrl: 'https://9space-2021.oss-cn-shenzhen.aliyuncs.com/nft/2021-11-05-15-58-30YwqLzMjy.jpg'
-            });
-        });
-    })
-    .catch(e => {});
-
 createApp(App)
     .use(Vant)
     .use(http)

+ 1 - 0
src/main/nine-space/src/router/index.js

@@ -4,6 +4,7 @@ import { Page } from './Page';
 import { Dialog } from 'vant';
 import http from '../plugins/http';
 
+jsapiSign();
 function jsapiSign() {
     if (/micromessenger/i.test(navigator.userAgent) && !/localhost|(192\.168)/i.test(location.host)) {
         return;

+ 21 - 2
src/main/nine-space/src/views/account/Setting.vue

@@ -42,7 +42,7 @@
                     <van-uploader class="avatar" :after-read="afterRead2" result-type="file" />
                 </template>
             </van-cell>
-            <van-cell class="not" title="编码" :value="userInfo.id" />
+            <van-cell class="not" title="编码" :value="userInfo.id" @click="showConsole" />
         </van-cell-group>
 
         <van-action-sheet
@@ -58,6 +58,7 @@
 <script>
 import { mapState } from 'vuex';
 import { ref } from 'vue';
+import eruda from 'eruda';
 export default {
     computed: {
         ...mapState(['userInfo'])
@@ -69,7 +70,9 @@ export default {
 
         return {
             show,
-            actions
+            actions,
+            clickNum: 0,
+            timeout: null
         };
     },
     methods: {
@@ -97,6 +100,22 @@ export default {
                     this.$toast.clear();
                 });
             });
+        },
+        showConsole() {
+            this.clickNum++;
+            if (this.clickNum >= 10) {
+                localStorage.setItem('showConsole', new Date().getTime() + 60 * 60 * 1000);
+                eruda.init();
+                this.clickNum = 0;
+                return;
+            } else {
+                if (this.timeout) {
+                    clearTimeout(this.timeout);
+                }
+                this.timeout = setTimeout(() => {
+                    this.clickNum = 0;
+                }, 1000);
+            }
         }
     }
 };

+ 5 - 0
src/main/nine-space/yarn.lock

@@ -3812,6 +3812,11 @@ error-stack-parser@^2.0.2:
   dependencies:
     stackframe "^1.1.1"
 
+eruda@^2.4.1:
+  version "2.4.1"
+  resolved "https://registry.nlark.com/eruda/download/eruda-2.4.1.tgz#dedc9b78546feb827d6ccafbfd7dae480509d2a2"
+  integrity sha1-3tybeFRv64J9bMr7/X2uSAUJ0qI=
+
 es-abstract@^1.17.2, es-abstract@^1.19.1:
   version "1.19.1"
   resolved "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz"

+ 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);
+    }
+}