Commit 5d1001a1332328616d35b1ae9e38db6cd04a9f3d
1 parent
02fde78d
Exists in
master
and in
3 other branches
x
Showing
6 changed files
with
22 additions
and
14 deletions
Show diff stats
wxsdk/WXSDK.ts
| ... | ... | @@ -36,11 +36,10 @@ export default class WXSDK { |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public static async init() { |
| 39 | - // await platf | |
| 40 | 39 | if (this.isWx) { |
| 41 | 40 | WxInit.I.init(); |
| 42 | - //视频预加载 启动预加载视频会闪屏 | |
| 43 | - if (cc.sys.platform === cc.sys.WECHAT_GAME) { | |
| 41 | + // 视频预加载 启动预加载视频会闪屏 | |
| 42 | + if (cc.sys.platform === cc.sys.WECHAT_GAME && typeof qq == 'undefined') { | |
| 44 | 43 | setTimeout(() => { |
| 45 | 44 | WxInterstitial.initInterstitialAd();//插屏预加载 |
| 46 | 45 | ShareVideoService.I.preloadVideo(); | ... | ... |
wxsdk/base/SDKConst.ts
wxsdk/base/SDKDefault.ts
wxsdk/http/SDKHttp.ts
| ... | ... | @@ -43,9 +43,9 @@ export default class SDKHttp { |
| 43 | 43 | responseText = JSON.parse(responseText); |
| 44 | 44 | // cc.log("responseText22", responseText) |
| 45 | 45 | if (url.indexOf('.json') > -1) { |
| 46 | - resolve({ code: 0, data: responseText, msg: responseText.msg }); | |
| 46 | + resolve({ code: 0, data: responseText, msg: responseText.msg , servertime: responseText.servertime}); | |
| 47 | 47 | } else { |
| 48 | - resolve({ code: +responseText.code, data: responseText.data, msg: responseText.msg }); | |
| 48 | + resolve({ code: +responseText.code, data: responseText.data, msg: responseText.msg , servertime: responseText.servertime}); | |
| 49 | 49 | } |
| 50 | 50 | return |
| 51 | 51 | } catch (ex) { |
| ... | ... | @@ -119,7 +119,7 @@ export default class SDKHttp { |
| 119 | 119 | |
| 120 | 120 | url = baseUrl + url; |
| 121 | 121 | let res = await this.httpRequest(url, "POST", data, dataType); |
| 122 | - if (this.onErrorResponse && !res.code) { | |
| 122 | + if (this.onErrorResponse && res.code) { | |
| 123 | 123 | // |
| 124 | 124 | this.onErrorResponse(res); |
| 125 | 125 | } | ... | ... |
wxsdk/service/ShareVideoService.ts
| ... | ... | @@ -27,19 +27,26 @@ export default class ShareVideoService { |
| 27 | 27 | this.forward(this.forwardKey); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - async init() { | |
| 30 | + private cnt: number = 1 | |
| 31 | + async initList() { //初始化List | |
| 31 | 32 | let data = await SDKApi.ShareList(); |
| 33 | + if (data.code) { | |
| 34 | + console.log('拉取ShareList失败!') | |
| 35 | + setTimeout(this.initList.bind(this), 200 * this.cnt) | |
| 36 | + this.cnt++; | |
| 37 | + return | |
| 38 | + } | |
| 32 | 39 | this.setShareVideoData(data); |
| 33 | - // console.log(JSON.stringify(data)) | |
| 40 | + if (this.forwardKey) this.forward(this.forwardKey); | |
| 41 | + } | |
| 42 | + async init() { | |
| 43 | + this.initList(); | |
| 34 | 44 | SDKShare.I.updateShareMenu(true);//打开群分享 |
| 35 | - | |
| 36 | 45 | if (cc.sys.platform === cc.sys.WECHAT_GAME) { |
| 37 | 46 | if (GAMEDATA.shareMessageToFriend.scene > 0) { |
| 38 | 47 | wx.setMessageToFriendQuery({ shareMessageToFriendScene: GAMEDATA.shareMessageToFriend.scene }) |
| 39 | 48 | } |
| 40 | 49 | } |
| 41 | - | |
| 42 | - if (this.forwardKey) this.forward(this.forwardKey); | |
| 43 | 50 | } |
| 44 | 51 | |
| 45 | 52 | preload = true; | ... | ... |
wxsdk/share/SDKVideo.ts
| ... | ... | @@ -140,8 +140,8 @@ export default class SDKVideo { |
| 140 | 140 | // __LOG__ && console.warn("handleLoaded2", that.videoAd, that.videoAd.isReady()); |
| 141 | 141 | LogService.I.adStat(this.videoKey, this.adUnitId, DOT_AD_TYPE.video, DOT_AD_STATUS.show) |
| 142 | 142 | |
| 143 | - if (cc.sys.platform === cc.sys.WECHAT_GAME) { | |
| 144 | - if (that.videoAd.isReady()) {//抖音没有 isReady | |
| 143 | + if (cc.sys.platform === cc.sys.WECHAT_GAME && typeof qq == 'undefined') { | |
| 144 | + if (that.videoAd.isReady()) {//抖音、qq 没有 isReady | |
| 145 | 145 | that.show_time = Date.now(); |
| 146 | 146 | await that.videoAd.show(); |
| 147 | 147 | } else { | ... | ... |