Commit dc1bd305 authored by zjz1994's avatar zjz1994

修改单个广告获取

parent e72d3292
......@@ -540,7 +540,7 @@ export default class MainBase extends eui.UILayer {
return new Promise((r) => {
NetManager.ins.hc_advert(() => {
r();
})
},3)
});
}
......@@ -636,7 +636,7 @@ export default class MainBase extends eui.UILayer {
//获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(() => { })
MapScene.adData = DataManager.ins.getData('hc_advert');
MapScene.adData = DataManager.ins.getData('hc_advert_3');
Buried.init();
///////////
......
......@@ -618,9 +618,11 @@ export class DataManager extends ABDataManager {
data = this._getRecordData;
default:
if(name=="hc_advert"){
this[this.getKey(name+"_"+param.type)] = result;
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));
return data || result;
......
......@@ -1461,7 +1461,7 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public hc_advert(callback: Function): void {
public hc_advert(callback: Function,type): void {
var deviceId:string = '';
var cityCode:string = '';
const net: INetData = {
......@@ -1472,7 +1472,8 @@ export class NetManager extends ABNetManager {
param: {
activityId: DataManager.ins.customCfgData.actId,
deviceId:deviceId,
cityCode:cityCode
cityCode:cityCode,
type:type
},
hideMsg: true,
callback: callback
......
......@@ -17,7 +17,7 @@ export default class AdSmallComp extends ComponentBase {
this['img'].mask = this['adsmask'];
}
NetManager.ins.hc_advert(() => {
const { data } = DataManager.ins.getData('hc_advert');
const { data } = DataManager.ins.getData('hc_advert_2');
let { popupAdvert } = data;
if (popupAdvert == null)
popupAdvert = { enable: false, advertList: [] }
......@@ -34,7 +34,7 @@ export default class AdSmallComp extends ComponentBase {
snpmAdStatic.snpmAdReport("show","bottom",result);
this.data.img = result.img;
}
});
},2);
this['img'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(result.url.length>2){
......
......@@ -171,7 +171,7 @@ export default class MapScene extends Scene {
this.updateAdData();
this['avatar'].mask = this['avatarMask'];
NetManager.ins.getSignInfo(() => {
NetManager.ins.getSignInfo(async() => {
const parmas = [];
const panels = [];
const result = this.sendInvite(panels, parmas);
......@@ -187,22 +187,35 @@ export default class MapScene extends Scene {
const nowTimerStr2 = date.getTime() + '';
const oldTimerStr2 = localStorage.getItem('nowTimer2Str' + window['CFG'].consumerId);
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
let { noticeAdvert } = hc_advert;
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable && nowTimerStr2 != oldTimerStr2) {
// if (!adTag) {
panels.push('ad');
// adTag = true;
// }
localStorage.setItem('nowTimer2Str' + window['CFG'].consumerId, nowTimerStr2);
if(nowTimerStr2 != oldTimerStr2){
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;
if (noticeAdvert == null) {
noticeAdvert = { enable: false }
}
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
if (noticeAdvert && noticeAdvert.enable){
panels.push('ad');
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');
if (backData.success) {
backData.success = false;
......@@ -1035,7 +1048,7 @@ export default class MapScene extends Scene {
// 更新广告数据
updateAdData() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
const hc_advert = DataManager.ins.getData('hc_advert_3').data || {};
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
......@@ -1439,7 +1452,7 @@ export default class MapScene extends Scene {
* 查询邀请信息
*/
getInviteInfo() {
const hc_advert = DataManager.ins.getData('hc_advert').data || {};
const hc_advert = DataManager.ins.getData('hc_advert_3').data || {};
let { mapAdvert } = hc_advert;
mapAdvert = DataManager.ins.solveAdvertData(mapAdvert);
// tslint:disable-next-line: cyclomatic-complexity
......
......@@ -2,7 +2,7 @@ import { DataManager } from "../../libs/tw/manager/DataManager";
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;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
......
......@@ -11,7 +11,7 @@ export default class ADPanel extends Panel {
this.showlog();
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;
noticeAdvert = DataManager.ins.solveAdvertData(noticeAdvert);
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