Commit dc1bd305 authored by zjz1994's avatar zjz1994

修改单个广告获取

parent e72d3292
...@@ -540,7 +540,7 @@ export default class MainBase extends eui.UILayer { ...@@ -540,7 +540,7 @@ export default class MainBase extends eui.UILayer {
return new Promise((r) => { return new Promise((r) => {
NetManager.ins.hc_advert(() => { NetManager.ins.hc_advert(() => {
r(); r();
}) },3)
}); });
} }
...@@ -636,7 +636,7 @@ export default class MainBase extends eui.UILayer { ...@@ -636,7 +636,7 @@ export default class MainBase extends eui.UILayer {
//获取分享加体力的shareCode,不影响初始化场景,不进await //获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(() => { }) NetManager.ins.getUserShareCode(() => { })
MapScene.adData = DataManager.ins.getData('hc_advert'); MapScene.adData = DataManager.ins.getData('hc_advert_3');
Buried.init(); Buried.init();
/////////// ///////////
......
...@@ -618,10 +618,12 @@ export class DataManager extends ABDataManager { ...@@ -618,10 +618,12 @@ export class DataManager extends ABDataManager {
data = this._getRecordData; data = this._getRecordData;
default: default:
if(name=="hc_advert"){ if(name=="hc_advert"){
this[this.getKey(name+"_"+param.type)] = result;
console.log("新广告,分展示位单个区别获取",name,result,param); console.log("新广告,分展示位单个区别获取",name,result,param);
} }else{
this[this.getKey(name)] = result; this[this.getKey(name)] = result;
} }
}
this.dispatchEvent(new egret.Event('dataUpdate', false, false, name)); this.dispatchEvent(new egret.Event('dataUpdate', false, false, name));
return data || result; return data || result;
} }
......
...@@ -1461,7 +1461,7 @@ export class NetManager extends ABNetManager { ...@@ -1461,7 +1461,7 @@ export class NetManager extends ABNetManager {
this.send(net); this.send(net);
} }
public hc_advert(callback: Function): void { public hc_advert(callback: Function,type): void {
var deviceId:string = ''; var deviceId:string = '';
var cityCode:string = ''; var cityCode:string = '';
const net: INetData = { const net: INetData = {
...@@ -1472,7 +1472,8 @@ export class NetManager extends ABNetManager { ...@@ -1472,7 +1472,8 @@ export class NetManager extends ABNetManager {
param: { param: {
activityId: DataManager.ins.customCfgData.actId, activityId: DataManager.ins.customCfgData.actId,
deviceId:deviceId, deviceId:deviceId,
cityCode:cityCode cityCode:cityCode,
type:type
}, },
hideMsg: true, hideMsg: true,
callback: callback callback: callback
......
...@@ -17,7 +17,7 @@ export default class AdSmallComp extends ComponentBase { ...@@ -17,7 +17,7 @@ export default class AdSmallComp extends ComponentBase {
this['img'].mask = this['adsmask']; this['img'].mask = this['adsmask'];
} }
NetManager.ins.hc_advert(() => { NetManager.ins.hc_advert(() => {
const { data } = DataManager.ins.getData('hc_advert'); const { data } = DataManager.ins.getData('hc_advert_2');
let { popupAdvert } = data; let { popupAdvert } = data;
if (popupAdvert == null) if (popupAdvert == null)
popupAdvert = { enable: false, advertList: [] } popupAdvert = { enable: false, advertList: [] }
...@@ -34,7 +34,7 @@ export default class AdSmallComp extends ComponentBase { ...@@ -34,7 +34,7 @@ export default class AdSmallComp extends ComponentBase {
snpmAdStatic.snpmAdReport("show","bottom",result); snpmAdStatic.snpmAdReport("show","bottom",result);
this.data.img = result.img; this.data.img = result.img;
} }
}); },2);
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url.length>2){ if(result.url.length>2){
......
...@@ -171,7 +171,7 @@ export default class MapScene extends Scene { ...@@ -171,7 +171,7 @@ export default class MapScene extends Scene {
this.updateAdData(); this.updateAdData();
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
NetManager.ins.getSignInfo(() => { NetManager.ins.getSignInfo(async() => {
const parmas = []; const parmas = [];
const panels = []; const panels = [];
const result = this.sendInvite(panels, parmas); const result = this.sendInvite(panels, parmas);
...@@ -187,21 +187,34 @@ export default class MapScene extends Scene { ...@@ -187,21 +187,34 @@ export default class MapScene extends Scene {
const nowTimerStr2 = date.getTime() + ''; const nowTimerStr2 = date.getTime() + '';
const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId); const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId);
if(nowTimerStr2 != oldTimerStr2){
const hc_advert = DataManager.ins.getData('hc_advert').data || {}; console.log("时间上需要弹出广告");
var adpro = new Promise(res=>{
NetManager.ins.hc_advert(()=>{
const hc_advert = DataManager.ins.getData('hc_advert_1').data || {};
console.log("1广告数据",hc_advert);
let { noticeAdvert } = hc_advert; let { noticeAdvert } = hc_advert;
if (noticeAdvert == null) { if (noticeAdvert == null) {
noticeAdvert = { enable: false } noticeAdvert = { enable: false }
} }
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert); noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable){
if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) {
panels.push('ad'); panels.push('ad');
// adTag = true;
// }
localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2); localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
} }
},1);
});
await adpro;
console.log("时间弹出广告结束");
}
// if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// // if (!adTag) {
// panels.push('ad');
// // adTag = true;
// // }
// localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
// }
const backData = DataManager.ins.getData('hc_hasBackReward'); const backData = DataManager.ins.getData('hc_hasBackReward');
if (backData.success) { if (backData.success) {
...@@ -1035,7 +1048,7 @@ export default class MapScene extends Scene { ...@@ -1035,7 +1048,7 @@ export default class MapScene extends Scene {
// 更新广告数据 // 更新广告数据
updateAdData() { updateAdData() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {}; const hc_advert = DataManager.ins.getData('hc_advert_3').data || {};
let { mapAdvert } = hc_advert; let { mapAdvert } = hc_advert;
if (mapAdvert == null) if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] } mapAdvert = { enable: false, advertList: [] }
...@@ -1439,7 +1452,7 @@ export default class MapScene extends Scene { ...@@ -1439,7 +1452,7 @@ export default class MapScene extends Scene {
* 查询邀请信息 * 查询邀请信息
*/ */
getInviteInfo() { getInviteInfo() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {}; const hc_advert = DataManager.ins.getData('hc_advert_3').data || {};
let { mapAdvert } = hc_advert; let { mapAdvert } = hc_advert;
mapAdvert = DataManager.ins.solveAdvertData(mapAdvert); mapAdvert = DataManager.ins.solveAdvertData(mapAdvert);
// tslint:disable-next-line: cyclomatic-complexity // tslint:disable-next-line: cyclomatic-complexity
......
...@@ -2,7 +2,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager"; ...@@ -2,7 +2,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
export default () => { export default () => {
const hc_advert:any = DataManager.ins.getData('hc_advert').data || {}; const hc_advert:any = DataManager.ins.getData('hc_advert_3').data || {};
let { mapAdvert } = hc_advert; let { mapAdvert } = hc_advert;
if (mapAdvert == null) if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] } mapAdvert = { enable: false, advertList: [] }
......
...@@ -11,7 +11,7 @@ export default class ADPanel extends Panel { ...@@ -11,7 +11,7 @@ export default class ADPanel extends Panel {
this.showlog(); this.showlog();
let result; let result;
const hc_advert = DataManager.ins.getData('hc_advert').data; const hc_advert = DataManager.ins.getData('hc_advert_1').data;
let { noticeAdvert } = hc_advert; let { noticeAdvert } = hc_advert;
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert); noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
this.visible = noticeAdvert.enable; this.visible = noticeAdvert.enable;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment