Commit 6f2a5683 authored by wildfirecode's avatar wildfirecode

Merge branch 'dev' of gitlab2.dui88.com:wanghongyuan/xiaoxiaole into dev

parents 0cbf40d8 46d69171
......@@ -10,22 +10,24 @@ import { IExposureData } from '../data/common/IExposureData';
import { GDispatcher } from '../../tc/util/GDispatcher';
import onNotSuccess from '../../new_wx/onNotSuccess';
import { showToast } from '../../new_wx/ctrls/toastCtrl';
// import { IExposureData } from '..';
export class NetManager extends ABNetManager {
private static instance: NetManager;
public static get ins(): NetManager {
if (!this.instance) {
if(!this.instance) {
this.instance = new NetManager();
}
return this.instance;
}
private isInit: boolean;
constructor() {
super();
if (this.isInit) {
if(this.isInit) {
throw Error(TwLang.lang_001);
}
this.isInit = true;
......@@ -96,7 +98,7 @@ export class NetManager extends ABNetManager {
*/
public addTimesForActivity(callback: Function, type: number, count: number, validType: number): void {
let activityId: number;
if (type == 1) {
if(type == 1) {
activityId = DataManager.ins.gameCfgData.gameInfo.oaId;
} else {
activityId = DataManager.ins.customCfgData.oaId;
......@@ -106,7 +108,7 @@ export class NetManager extends ABNetManager {
addCount: count,
activityId: activityId
};
if (validType) {
if(validType) {
param.validType = validType;
}
......@@ -147,15 +149,15 @@ export class NetManager extends ABNetManager {
public openCollectGoodsPrize(callback: Function, collectRuleId: number, type?: number): void {
let actId: number;
let param: any;
if (type == 1) {
if(type == 1) {
actId = DataManager.ins.gameCfgData.gameInfo.oaId;
} else if (type == 2) {
} else if(type == 2) {
actId = DataManager.ins.customCfgData.oaId;
}
if (type) {
param = { collectRuleId: collectRuleId, actId: actId }
if(type) {
param = {collectRuleId: collectRuleId, actId: actId}
} else {
param = { collectRuleId: collectRuleId };
param = {collectRuleId: collectRuleId};
}
const net: INetData = {
name: NetName.OPEN_COLLECT,
......@@ -236,14 +238,13 @@ export class NetManager extends ABNetManager {
uri: '/summer/getToyInfo',
type: 'get',
dataType: 'json',
param: { operatingActivityId: operatingActivityId },
param: {operatingActivityId: operatingActivityId},
callback: callback
};
this.send(net);
}
/**
* 开始游戏
* @param {string} isAgain 是否是再来一次
......@@ -253,7 +254,7 @@ export class NetManager extends ABNetManager {
public doStart(callback: Function, isAgain: boolean, credits?: number, customizedType?: number): void {
let addUrl = '';
if (isAgain) {
if(isAgain) {
addUrl += '?dpm=' + DataManager.ins.gameGetSubmitResultData.againExposure.dpm;
}
......@@ -262,11 +263,11 @@ export class NetManager extends ABNetManager {
oaId: DataManager.ins.gameCfgData.gameInfo.oaId
};
if (credits) {
if(credits) {
param.credits = credits;
}
if (customizedType) {
if(customizedType) {
param.customizedType = customizedType;
}
......@@ -293,7 +294,7 @@ export class NetManager extends ABNetManager {
const param: any = {
ticketId: ticketId
};
if (customizedType) {
if(customizedType) {
param.customizedType = customizedType
}
......@@ -327,6 +328,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
/**
* 复活
*/
......@@ -345,6 +347,7 @@ export class NetManager extends ABNetManager {
};
this.getToken(net);
}
/**
* 获得复活卡数量
*/
......@@ -363,6 +366,7 @@ export class NetManager extends ABNetManager {
this.getToken(net);
}
/**
* 猜扑克
* @param {number} pluginId 插件ID
......@@ -417,7 +421,7 @@ export class NetManager extends ABNetManager {
sgin: sign,
dynamicData: JSON.stringify(dynamicData)
};
if (rankId) {
if(rankId) {
param.rankId = rankId;
}
const net: INetData = {
......@@ -437,15 +441,20 @@ export class NetManager extends ABNetManager {
kk = kk.substring(0, 16);
//补0;
var len = kk.length;
while (len < 16) {
while(len < 16) {
kk = kk + "0";
len++;
}
var CryptoJS = window["CryptoJS"];
var key = CryptoJS.enc.Utf8.parse(kk);
var iv = CryptoJS.enc.Utf8.parse(kk);
return CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.ZeroPadding }).toString();
return CryptoJS.AES.encrypt(data, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.ZeroPadding
}).toString();
}
/**
*
* @param callback
......@@ -489,6 +498,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
hc_openTreasureBox(callback: Function): void {
const net: INetData = {
name: 'hc_openTreasureBox',
......@@ -558,10 +568,10 @@ export class NetManager extends ABNetManager {
sgin: sign,
dynamicData: dynamicData
};
if (checkScore) {
if(checkScore) {
param.checkScore = checkScore;
}
if (customizedType) {
if(customizedType) {
param.customizedType = customizedType;
}
......@@ -731,7 +741,7 @@ export class NetManager extends ABNetManager {
public getPlugOrderStatus(callback: Function, orderId: number, pollingCheck: Function, pollingCount = 10, prizeLevel?: number): void {
const net: INetData = {
name: 'getPlugOrderStatus',
uri:window['duiba'] + '/plugin/getOrderStatus',
uri: window['duiba'] + '/plugin/getOrderStatus',
type: 'get',
dataType: 'json',
param: {
......@@ -740,7 +750,7 @@ export class NetManager extends ABNetManager {
callback: callback,
pollingCheck: pollingCheck,
pollingCount: pollingCount,
hideMsg:true
hideMsg: true
};
this.send(net);
}
......@@ -818,10 +828,11 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public getShareInfo(callback: Function, ): void {
public getShareInfo(callback: Function,): void {
const net: INetData = {
name: 'getShareInfo',
uri:window['duiba'] + '/wechatShare/getShareInfo/v2',
uri: window['duiba'] + '/wechatShare/getShareInfo/v2',
type: 'get',
hideMsg: true,
dataType: 'json',
......@@ -833,6 +844,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public imgUrl(callback: Function, img64: string): void {
const net: INetData = {
name: 'imgURL',
......@@ -862,6 +874,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_getLevelInfo(callback: Function, getLevelInfo: number): void {
const net: INetData = {
name: 'hc_getLevelInfo',
......@@ -877,12 +890,13 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_exchange(callback: Function, propType?: number): void {
const d: any = {
activityId: DataManager.ins.customCfgData.actId
};
if (propType) {
if(propType) {
d.propType = propType;
}
const net: INetData = {
......@@ -895,6 +909,7 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_askForEnergy(callback: Function): void {
const net: INetData = {
name: 'hc_askForEnergy',
......@@ -908,10 +923,11 @@ export class NetManager extends ABNetManager {
};
this.send(net);
}
public hc_useProp(callback: Function, propType: number): void {
const net: INetData = {
name: 'hc_useProp',
uri:window['duiba'] + '/customActivity/happyclear/useProp',
uri: window['duiba'] + '/customActivity/happyclear/useProp',
type: 'post',
dataType: 'json',
param: {
......@@ -925,9 +941,9 @@ export class NetManager extends ABNetManager {
public getMusicCategory(callback: Function, categoryID?: number, categoryCode?, liteVersion?): void {
const data: any = {};
if (categoryID) data.categoryID = categoryID;
if (categoryCode) data.categoryCode = categoryCode;
if (liteVersion) data.liteVersion = liteVersion;
if(categoryID) data.categoryID = categoryID;
if(categoryCode) data.categoryCode = categoryCode;
if(liteVersion) data.liteVersion = liteVersion;
const net: INetData = {
name: 'getMusicCategory',
uri: '/aaw/music/category',
......@@ -962,8 +978,8 @@ export class NetManager extends ABNetManager {
public getMusicItem(callback: Function, songListId, itemId): void {
const data: any = {};
if (itemId) data.itemId = itemId;
if (songListId) data.songListId = songListId;
if(itemId) data.itemId = itemId;
if(songListId) data.songListId = songListId;
const net: INetData = {
name: 'getMusicItem',
uri: '/aaw/music/item',
......@@ -1018,10 +1034,10 @@ export class NetManager extends ABNetManager {
activityType: 'hdtool',
consumerId: window['CFG'].consumerId
};
if (credits) {
if(credits) {
param.credits = credits;
}
if (collectRuleId) {
if(collectRuleId) {
param.collectRuleId = collectRuleId;
}
const net: INetData = {
......@@ -1242,7 +1258,7 @@ export class NetManager extends ABNetManager {
public getSignInfo(callback: Function, signActivityId: number): void {
const net: INetData = {
name: 'getSignInfo',
uri: window['duiba']+'/signactivity/getSignInfo',
uri: window['duiba'] + '/signactivity/getSignInfo',
type: 'post',
dataType: 'json',
param: {
......@@ -1285,8 +1301,8 @@ export class NetManager extends ABNetManager {
public doSign(callback: Function, signActivityId: number): void {
const net: INetData = {
name:'dosign',
uri: window['duiba']+'/signactivity/doSign',
name: 'dosign',
uri: window['duiba'] + '/signactivity/doSign',
type: 'post',
dataType: 'json',
param: {
......@@ -1294,7 +1310,7 @@ export class NetManager extends ABNetManager {
detect: window['detect'],
deviceSessionId: window['_device_session_id']
},
hideMsg:true,
hideMsg: true,
callback: callback
};
this.send(net);
......@@ -1669,7 +1685,7 @@ export class NetManager extends ABNetManager {
* @param net
*/
public getToken(net: INetData): void {
if (window['getDuibaToken']) {
if(window['getDuibaToken']) {
window['getDuibaToken']((tokenObj: any) => {
net.param.token = tokenObj.token;
this.send(net);
......@@ -1700,12 +1716,12 @@ export class NetManager extends ABNetManager {
let gTime: string = '?_=' + GTime.getTimestamp();
let realUrl: string = net.uri;
if (realUrl.indexOf('?') != -1) {
if(realUrl.indexOf('?') != -1) {
gTime = '&_=' + GTime.getTimestamp();
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if (net.addUrl) {
if(net.addUrl) {
realUrl += net.addUrl;
}
......@@ -1801,19 +1817,19 @@ export class NetManager extends ABNetManager {
}
public remainDuration(remain,first,from=1): void {
public remainDuration(remain, first, from = 1): void {
const net: INetData = {
name: 'remainDuration',
uri: window['duiba'] +'/customActivity/api/remainDuration',
uri: window['duiba'] + '/customActivity/api/remainDuration',
type: 'get',
dataType: 'json',
param: {
id: DataManager.ins.customCfgData.hdToolId,
activityId: DataManager.ins.customCfgData.actId,
activityType:'hdtool',
remain:remain,
first:first,
from:from
activityType: 'hdtool',
remain: remain,
first: first,
from: from
},
callback: null,
hideMsg: true
......@@ -1830,30 +1846,30 @@ export class NetManager extends ABNetManager {
if(net.name == 'hc_home') {
// if(result.data.refectionCountdown==null)
// result.data.refectionCountdown==0;
if(result.data.refectionCountdown==0)
result.data.refectionCountdown=5;
result.data.refectionCountdown += Math.floor(new Date().getTime()/1000);
if(result.data.refectionCountdown == 0)
result.data.refectionCountdown = 5;
result.data.refectionCountdown += Math.floor(new Date().getTime() / 1000);
}
//数据处理
const data: Data = DataManager.ins.updateData(net.name, result, net.param);
//接口成功
if (net.pollingCount && net.pollingCheck(data)) {
if(net.pollingCount && net.pollingCheck(data)) {
net.pollingCount -= 1;
//轮询接口特殊处理
setTimeout(() => {
this.send(net);
}, 500);
} else if (net.callback) {
if (net.pollingCheck && net.pollingCount == 0 && net.pollingCheck(data)) {
} else if(net.callback) {
if(net.pollingCheck && net.pollingCount == 0 && net.pollingCheck(data)) {
result.message = '系统异常,请稍后再试。';
data['success'] = false;
}
net.callback(data.success, data || result);
}
if (!data.success && !net.hideMsg) {
if(!data.success && !net.hideMsg) {
GDispatcher.dispatchEvent(ABNetManager.ERROR, net, result.message || result.desc || result.msg);
}
if (!data.success && !net.hideMsg) {
if(!data.success && !net.hideMsg) {
onNotSuccess(data, net.name)
}
}
......@@ -1866,14 +1882,75 @@ export class NetManager extends ABNetManager {
* @param message
*/
protected onError(net: INetData): void {
if (net.callback) {
if(net.callback) {
net.callback(false);
}
if (!net.hideMsg) {
if(!net.hideMsg) {
GDispatcher.dispatchEvent(ABNetManager.ERROR, net);
showToast('网络开小差了,再试一次吧');
}
}
// tslint:disable-next-line:max-file-line-count
/////////////////////////////// 消消乐邀请有礼 /////////////////////////////////////
/**
* 邀请有礼-获取邀请码
* @param callback
*/
public getShareCode(callback: Function): void {
const net: INetData = {
name: NetName.CUSTOM_THROUGH_SUBMIT,
uri: '/customActivity/happyclear/getShareCode',
type: 'post',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
},
callback: callback
};
this.send(net);
}
/**
* 邀请有礼-助力
* @param callback
* @param shareCode 分享码
* @param orderId 参与关卡流水记录id
*/
public doHelp(callback: Function, shareCode: any, orderId: number): void {
const net: INetData = {
name: NetName.CUSTOM_THROUGH_SUBMIT,
uri: '/customActivity/happyclear/doHelp',
type: 'post',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
shareCode: shareCode,
orderId: orderId
},
callback: callback
};
this.send(net);
}
/**
* 获取邀请详情
* @param callback
*/
public getInvateInfo(callback: Function): void {
const net: INetData = {
name: NetName.CUSTOM_THROUGH_SUBMIT,
uri: '/customActivity/happyclear/invitationInfo',
type: 'post',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
},
callback: callback
};
this.send(net);
}
///////////////////////////////////////////////////////////////////////////////////
}
\ No newline at end of file
......@@ -20,10 +20,5 @@
</e:Skin>
</e:skinName>
</e:Button>
<e:Group x="84" y="845.33">
<e:Image y="0" source="invite_prize_ad_png" x="0"/>
<e:Image id="ad_ico" source="" x="48" y="55.67"/>
<e:Label id="label1" text="Label" x="277.5" y="77.5" textColor="0xe5150e" size="24"/>
<e:Label id="label2" text="Label" x="262.5" y="124.5" textColor="0xE5150E" size="34" bold="true"/>
</e:Group>
<e:Component y="845.33" skinName="ADSmallSkin" horizontalCenter="0"/>
</e:Skin>
\ No newline at end of file
......@@ -10,7 +10,7 @@
</e:layout>
</e:Group>
</e:Scroller>
<e:Button id="closeBtn" label="" x="614" y="280">
<e:Button id="closeBtn" label="" x="608" y="322">
<e:skinName>
<e:Skin states="up,down,disabled">
<e:Image width="100%" height="100%" source="closeCommonBtn_png" source.down="closeCommonBtn_png" source.disabled="closeCommonBtn_png"/>
......
......@@ -4,9 +4,7 @@ import layers from "../../libs/new_wx/views/layers";
import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import { iswx } from "../iswx";
import getSkinPath from "../../libs/new_wx/utils/getSkinPath";
import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
import InviteRulePanel from "./InviteRulePanel";
import Loading from "../../libs/new_wx/components/Loading";
export default class InvitePanel extends Panel {
public prizeImg: eui.Image;
......
......@@ -10,9 +10,6 @@ export default class InvitePrizePanel extends Panel {
public prizeImg:eui.Image;
public closeBtn:eui.Button;
public ok_btn:eui.Button;
public ad_ico:eui.Image;
public label1:eui.Label;
public label2:eui.Label;
start() {
super.start();
......
......@@ -108,8 +108,17 @@ const config = {
},
'/hdtool/recon/ngame/resurrectionStatus': {
data: './resurrectionStatus.json'
}
},
//////////////////// 消消乐邀请有礼 ////////////////////
'/customActivity/happyclear/getShareCode': {
data: './happyclear/getShareCode.json'
},
'/customActivity/happyclear/doHelp': {
data: './happyclear/doHelp.json'
},
'/customActivity/happyclear/invitationInfo': {
data: './happyclear/getInviteInfo.json'
},
}
for (let item in config) {
......
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":""
}
\ No newline at end of file
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":{
"invitationId":"活动id",
"invitationCount":1,
"img":"图片",
"sysTime":1566199822308,
"endTime":1566199822308,
"invitationUser":[
{
"nickname":"nickname",
"avatar":"avatar"
}
],
"completeFlag":true,
"openPriz":true,
"openPrizMsg":"图片"
}
}
\ No newline at end of file
{
"success":true,
"code":null,
"desc":null,
"timestamp":1566199822308,
"data":""
}
\ No newline at end of file
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