chengjie 3 dagar sedan
förälder
incheckning
5490d2edab

+ 6 - 6
app.js

@@ -1,7 +1,7 @@
1 1
 App({
2 2
   globalData: {
3
-    Version: "2.5.10",
4
-    //IsProduction: true,
3
+    Version: "2.6.0",
4
+    IsProduction: true,
5 5
     ShareTitle: "高效学习从秒过开始",
6 6
     SharePath: "pages/index/index",
7 7
     ShareImage: '../images/program_share-a01.png',
@@ -10,9 +10,9 @@ App({
10 10
     AppID: "wx84b3feac6069eec3",
11 11
     serverUrl: "https://www.kylx365.com/apiData/",
12 12
     serverUrlServer: "https://www.kylx365.com/apiData/",
13
-    serverUrlServer2: "https://scoreline.kylx365.com/apiData/",
14
-    serverUrlLocalhost: "http://localhost:3020/apiData/",
15
-    serverUrlLocalhost2: "http://localhost:3000/apiData/",
13
+    serverUrlServer2: "https://www.kylx365.com/apiData/",
14
+    serverUrlLocalhost: "http://localhost:3010/apiData/",
15
+    serverUrlLocalhost2: "http://localhost:3010/apiData/",
16 16
     audioUrlBaidu: "https://tsn.baidu.com/text2audio?lan=zh&ctp=1&cuid=abcdxxx&tok=[token]&tex=[word]&vol=9&per=0&spd=3&pit=5",
17 17
     audioUrlYoudao: "https://dict.youdao.com/dictvoice?rate=10&le=auto&audio=[word]",
18 18
     uploadImageUrl: "https://miaguo-1253256735.file.myqcloud.com/",
@@ -106,4 +106,4 @@ App({
106 106
     }
107 107
   }
108 108
 
109
-})
109
+})

+ 0 - 6
app.json

@@ -18,13 +18,10 @@
18 18
     "pages/main/mainlist",
19 19
     "pages/main/addInfomation",
20 20
     "pages/main/addInfomationDetail",
21
-
22 21
     "pages/main/searchCard",
23
-    
24 22
     "pages/main/preview",
25 23
     "pages/index/accredit",
26 24
     "pages/other/openSetting",
27
-
28 25
     "pages/main/default",
29 26
     "pages/main/cardInfo",
30 27
     "pages/main/cardInfoDetail",
@@ -32,8 +29,6 @@
32 29
     "pages/main/detail",
33 30
     "pages/main/systemsetting",
34 31
     "pages/main/symbolsetting",
35
-
36
-    
37 32
     "pages/other/family",
38 33
     "pages/other/recover",
39 34
     "pages/other/grade",
@@ -57,7 +52,6 @@
57 52
     "pages/other/annualreport",
58 53
     "pages/other/systemrestore",
59 54
     "pages/other/pay"
60
-    
61 55
   ],
62 56
   "window": {
63 57
     "navigationBarBackgroundColor": "#ffffff",

+ 8 - 1
pages/index/index.js

@@ -278,6 +278,13 @@ Page({
278 278
               isShow = 1;
279 279
             }
280 280
           }
281
+          
282
+          // if (app.globalData.userInfo.UserID<7 && isShow==1){
283
+          //   app.globalData.serverUrl=app.globalData.serverUrlServer2;
284
+          //   app.globalData.serverUrlServer=app.globalData.serverUrlServer2;
285
+          // }
286
+          
287
+
281 288
           app.globalData.userInfo.isShow = isShow;
282 289
 
283 290
           if (app.globalData.userInfo.IsMember == 1)
@@ -285,7 +292,7 @@ Page({
285 292
 
286 293
           wx.removeStorageSync("UserID");
287 294
           wx.removeStorageSync("UserName");
288
-
295
+          
289 296
           // //测试****************
290 297
           // var url = '../share/shareindex';
291 298
           // wx.redirectTo({

+ 3 - 2
pages/main/addInfomation.js

@@ -77,13 +77,14 @@ Page({
77 77
     });
78 78
   },
79 79
   onSearchHistory: function (e) {
80
+    //debugger;
80 81
     var index = Number(e.currentTarget.dataset.index);
81 82
     var obj = {};
82 83
     if (e.currentTarget.dataset.type == "SearchWord3")
83 84
       obj = this.data.SearchWord3[index];
84 85
     else
85 86
       obj = this.data.SearchList[index];
86
-
87
+    
87 88
     main.updateSearchList(obj);
88 89
     app.globalData.TempSearchBackNumber = 2;
89 90
     app.globalData.CardList2=[];
@@ -93,6 +94,7 @@ Page({
93 94
   },
94 95
 
95 96
   searchResult: function (e) {
97
+    
96 98
     var that = this;
97 99
     var search = that.data.SearchInfo;
98 100
     app.globalData.TempStr=search;
@@ -115,7 +117,6 @@ Page({
115 117
     var author=e.currentTarget.dataset.author;
116 118
     var shiciurl=e.currentTarget.dataset.shiciurl;
117 119
     main.searchInfomation(search,searchtype,author,shiciurl,function(list,obj){
118
-      
119 120
       if (obj){
120 121
         main.updateSearchList(obj,function(){
121 122
           updateData(that,search);

+ 2 - 2
pages/other/newuser.js

@@ -85,7 +85,7 @@ Page({
85 85
     //console.log(detail);
86 86
     //console.log(money);
87 87
     var remark = null;
88
-    main.payMoney(9, remark, money, detail, function () {
88
+    main.virtualPayMoney(9, remark, money, detail, function () {
89 89
       that.setData({
90 90
         PanelShow:1,
91 91
       });
@@ -130,4 +130,4 @@ Page({
130 130
       imageUrl: app.globalData.ShareImage,
131 131
     }
132 132
   },
133
-})
133
+})

+ 2 - 2
pages/other/pay.js

@@ -87,7 +87,7 @@ Page({
87 87
     var remark = null;
88 88
     if (that.data.Options && that.data.Options.Remark)
89 89
       remark = that.data.Options.Remark;
90
-    main.payMoney(7, remark, money, detail, function () {
90
+    main.virtualPayMoney(7, remark, money, detail, function () {
91 91
       that.setData({
92 92
         PayPanel: 1,
93 93
       });
@@ -105,4 +105,4 @@ Page({
105 105
       imageUrl: app.globalData.ShareImage,
106 106
     }
107 107
   },
108
-})
108
+})

+ 1 - 1
pages/share/shareitem.js

@@ -274,7 +274,7 @@ Page({
274 274
     if (url3=="../images/universalpic_face_default_blue_120x120.png")
275 275
       url3="https://miaguo-1253256735.file.myqcloud.com/web/universalpic_face_default_blue_120x120.png";
276 276
 
277
-    debugger;
277
+    //debugger;
278 278
     var _uid = common.Encrypt(app.globalData.userInfo.UserID);
279 279
     if (_uid.indexOf("/") >= 0)
280 280
       _uid = common.ReplaceAllString(_uid, "/", "___");

+ 1 - 0
pages_agent/main/index.js

@@ -87,6 +87,7 @@ Page({
87 87
             data.RealName="";
88 88
             
89 89
           app.globalData.userInfo = data;
90
+          
90 91
           that.setData({
91 92
             IsPromoter:app.globalData.userInfo.IsPromoter,
92 93
           });    

+ 9 - 2
project.private.config.json

@@ -6,12 +6,19 @@
6 6
   "condition": {
7 7
     "miniprogram": {
8 8
       "list": [
9
+        {
10
+          "name": "pages/markdown/index",
11
+          "pathName": "pages/markdown/index",
12
+          "query": "",
13
+          "scene": null,
14
+          "launchMode": "default"
15
+        },
9 16
         {
10 17
           "name": "语境",
11 18
           "pathName": "pages/index/index",
12 19
           "query": "SourceID=173&&type=buildcard&Words=Boy,girl,king,come",
13
-          "scene": null,
14
-          "launchMode": "default"
20
+          "launchMode": "default",
21
+          "scene": null
15 22
         },
16 23
         {
17 24
           "name": "分享",

+ 159 - 7
utils/main.js

@@ -196,6 +196,159 @@ function payMoney(payType, remark, money, detail, callback) {
196 196
   });
197 197
 }
198 198
 
199
+function compareVersion(v1, v2) {
200
+  v1 = String(v1 || '').split('.');
201
+  v2 = String(v2 || '').split('.');
202
+  var len = Math.max(v1.length, v2.length);
203
+  while (v1.length < len) v1.push('0');
204
+  while (v2.length < len) v2.push('0');
205
+  for (var i = 0; i < len; i++) {
206
+    var n1 = parseInt(v1[i], 10) || 0;
207
+    var n2 = parseInt(v2[i], 10) || 0;
208
+    if (n1 > n2) return 1;
209
+    if (n1 < n2) return -1;
210
+  }
211
+  return 0;
212
+}
213
+
214
+function getVirtualPayPlatform(systemInfo) {
215
+  var platform = String(systemInfo.platform || '').toLowerCase();
216
+  var system = String(systemInfo.system || '').toLowerCase();
217
+  if (platform == 'ios' || system.indexOf('ios') >= 0) return 'ios';
218
+  if (platform == 'ohos' || system.indexOf('harmony') >= 0) return 'harmony';
219
+  if (platform == 'windows' || system.indexOf('windows') >= 0) return 'windows';
220
+  if (platform == 'android' || system.indexOf('android') >= 0) return 'android';
221
+  return platform || 'unknown';
222
+}
223
+
224
+function checkVirtualPaySupport(systemInfo, platform) {
225
+  if (platform == 'ios') {
226
+    var iosVersion = String(systemInfo.system || '').replace(/[^0-9.]/g, '');
227
+    //debugger;
228
+    if (app.globalData.userInfo.UserID==1)
229
+      iosVersion="26.3.1";
230
+
231
+    if (iosVersion && compareVersion(iosVersion, '15.0') < 0)
232
+      return 'iOS 15 以下系统暂不支持虚拟支付';
233
+
234
+    var version=app.globalData.systemInfo.version;
235
+    if (app.globalData.userInfo.UserID==1)
236
+      version="8.0.68";
237
+    if (version && compareVersion(version, '8.0.68') < 0)
238
+      return '请将微信升级到 8.0.68 或更高版本';
239
+  }
240
+  var sdkSupported = compareVersion(systemInfo.SDKVersion, '2.19.2') >= 0;
241
+  var canUse = wx.canIUse && wx.canIUse('requestVirtualPayment');
242
+  if ((!sdkSupported && !canUse) || typeof wx.requestVirtualPayment != 'function')
243
+    return '当前微信版本不支持虚拟支付,请升级微信后再试';
244
+  return '';
245
+}
246
+
247
+function showVirtualPayError(message) {
248
+  wx.hideLoading();
249
+  wx.showModal({
250
+    title: '支付未完成',
251
+    content: message || '系统忙,请稍后再试',
252
+    showCancel: false,
253
+  });
254
+}
255
+
256
+function waitVirtualPayDelivered(tradeNo, callback, createData, attempt) {
257
+  attempt = attempt || 0;
258
+  getData('MiaoguoVirtualPayOrderStatus500?TradeNo=' + encodeURIComponent(tradeNo), function (status) {
259
+    if (status && status.Fulfilled) {
260
+      wx.hideLoading();
261
+      callback(createData);
262
+      return;
263
+    }
264
+    if (attempt >= 9) {
265
+      wx.hideLoading();
266
+      wx.showModal({
267
+        title: '支付已受理',
268
+        content: '权益正在后台开通,请稍后下拉刷新查看。',
269
+        showCancel: false,
270
+        success: function () {
271
+          callback(createData);
272
+        }
273
+      });
274
+      return;
275
+    }
276
+    setTimeout(function () {
277
+      waitVirtualPayDelivered(tradeNo, callback, createData, attempt + 1);
278
+    }, 1500);
279
+  });
280
+}
281
+
282
+function virtualPayMoney(payType, remark, money, detail, callback) {
283
+  var systemInfo = wx.getSystemInfoSync();
284
+  var platform = getVirtualPayPlatform(systemInfo);
285
+  var supportError = checkVirtualPaySupport(systemInfo, platform);
286
+  if (!supportError && platform == 'ios' && Number(money) < 1)
287
+    supportError = 'iOS 虚拟支付的最低金额为 1 元';
288
+
289
+  if (app.globalData.userInfo.UserID < 8 ||
290
+      app.globalData.userInfo.UserID == 3089)
291
+      money = 1;
292
+      
293
+  if (supportError) {
294
+    showVirtualPayError(supportError);
295
+    return;
296
+  }
297
+
298
+  wx.showLoading({ title: '正在准备支付', mask: true });
299
+  wx.login({
300
+    success: function (loginResult) {
301
+      if (!loginResult.code) {
302
+        showVirtualPayError('获取微信登录态失败,请稍后再试');
303
+        return;
304
+      }
305
+      var url = 'MiaoguoVirtualPayLogin500'
306
+        + '?code=' + encodeURIComponent(loginResult.code)
307
+        + '&payType=' + encodeURIComponent(payType)
308
+        + '&money=' + encodeURIComponent(money)
309
+        + '&detail=' + encodeURIComponent(detail)
310
+        + '&productID=' + encodeURIComponent(app.globalData.ProgramID)
311
+        + '&Remark=' + encodeURIComponent(remark || '')
312
+        + '&platform=' + encodeURIComponent(platform);
313
+      getData(url, function (data) {
314
+        if (!data || data.errorMessage) {
315
+          showVirtualPayError(data && data.errorMessage);
316
+          return;
317
+        }
318
+        wx.hideLoading();
319
+        wx.requestVirtualPayment({
320
+          signData: data.signData,
321
+          paySig: data.paySig,
322
+          signature: data.signature,
323
+          mode: data.mode,
324
+          success: function () {
325
+            wx.showLoading({ title: '正在开通权益', mask: true });
326
+            waitVirtualPayDelivered(data.TradeNo, callback, data, 0);
327
+          },
328
+          fail: function (error) {
329
+            var message = error && error.errMsg ? error.errMsg : '';
330
+            if (message.toLowerCase().indexOf('cancel') >= 0) return;
331
+            if (error && Number(error.errCode) == -15010) {
332
+              var envName = Number(data.env) == 1 ? '沙箱环境' : '正式环境';
333
+              message = '微信虚拟支付' + envName + '尚未发布商品 productId=' + (data.productId || app.globalData.ProgramID);
334
+            } else if (error && Number(error.errCode) == -15014) {
335
+              message = '微信新发布的道具 ' + (data.productId || '') + ' 正在生效,通常约需 10 分钟,请稍后重试';
336
+            } else if (error && Number(error.errCode) == -15013) {
337
+              message = '微信后台商品价格与本次支付金额不一致';
338
+            } else if (error && error.errCode) {
339
+              message = (message || '微信支付失败') + '(' + error.errCode + ')';
340
+            }
341
+            showVirtualPayError(message);
342
+          }
343
+        });
344
+      });
345
+    },
346
+    fail: function () {
347
+      showVirtualPayError('获取微信登录态失败,请稍后再试');
348
+    }
349
+  });
350
+}
351
+
199 352
 function getTimeFormat(duration) {
200 353
   //console.log("duration:" + duration);
201 354
   var arr = ['', '', '']
@@ -755,7 +908,7 @@ function updateSearchList(obj, callback) {
755 908
   var arr = wx.getStorageSync("SearchWord3");
756 909
   if (!arr)
757 910
     arr = [];
758
-
911
+  //debugger;
759 912
   if (obj && obj.Type && obj.Type == "shici") {
760 913
     if (obj.Value.CHN.ShiciTitle)
761 914
       obj.Key = obj.Value.CHN.ShiciTitle;
@@ -764,12 +917,12 @@ function updateSearchList(obj, callback) {
764 917
   }
765 918
   for (var i = 0; i < arr.length; i++) {
766 919
     if (obj.Key && arr[i].Key == obj.Key) {
767
-      if (obj.Type == "shici") {
768
-        if (arr[i].ShiciUrl == obj.ShiciUrl) {
920
+      if (arr[i].Type == "shici" && obj.Type=="shici") {
921
+        //if (arr[i].ShiciUrl == obj.ShiciUrl) {
769 922
           obj.Value = arr[i].Value;
770 923
           arr.splice(i, 1);
771 924
           break;
772
-        }
925
+        //}
773 926
       } else {
774 927
         var b = true;
775 928
         if (obj.Type && arr[i].Type && arr[i].Type != obj.Type)
@@ -1574,10 +1727,8 @@ function searchInfomation(search, searchtype, author, shiciurl, callback) {
1574 1727
   getData(url, function (data) {
1575 1728
     wx.hideLoading();
1576 1729
     clearTimeout(timeout);
1577
-
1730
+    console.log(data);
1578 1731
     if (data) {
1579
-      //console.log(data);
1580
-
1581 1732
       if (data.List) {
1582 1733
         var len = WORD_LENGTH;
1583 1734
         var list = data.List;
@@ -2072,6 +2223,7 @@ module.exports = {
2072 2223
   getData2: getData2,
2073 2224
   postData2: postData2,
2074 2225
   payMoney: payMoney,
2226
+  virtualPayMoney: virtualPayMoney,
2075 2227
   getLocalHost: getLocalHost,
2076 2228
   getTimeFormat: getTimeFormat,
2077 2229
   getWindowHeight: getWindowHeight,