Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaoleTuia
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王剑峰
xiaoxiaoleTuia
Commits
d753103e
Commit
d753103e
authored
Feb 19, 2020
by
liupengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
正式
parent
d242b4c7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
44 deletions
+66
-44
adVideo.ts
egret/src/adVideo/adVideo.ts
+2
-2
dianxiangVideo.ts
egret/src/adVideo/dianxiangVideo.ts
+9
-10
utils.ts
egret/src/adVideo/utils.ts
+49
-29
MapScene.ts
egret/src/mapScene/MapScene.ts
+2
-1
videoCtrl.ts
egret/src/myVideo/videoCtrl.ts
+3
-1
VideoBuyPanel.ts
egret/src/panels/VideoBuyPanel.ts
+1
-1
No files found.
egret/src/adVideo/adVideo.ts
View file @
d753103e
...
...
@@ -140,13 +140,13 @@ class MyAdvideo {
}
// 请求视频的来源
async
getVideo
()
{
async
getVideo
(
type
=
1
)
{
if
(
this
.
isVideoIng
)
{
return
;
}
this
.
isVideoIng
=
true
;
this
.
strategy
=
'dianxing'
;
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
();
const
res
=
await
this
.
stragegyFn
[
this
.
strategy
].
getVideo
(
type
);
console
.
log
(
res
);
if
(
res
)
{
// 上报app?
...
...
egret/src/adVideo/dianxiangVideo.ts
View file @
d753103e
...
...
@@ -77,18 +77,17 @@ interface adRes {
ads
:
Array
<
any
>
};
async
function
getVideo
()
{
async
function
getVideo
(
type
)
{
let
videoRes
=
{};
try
{
if
(
!
config
)
{
const
appInfo
=
await
getAppInfo
()
console
.
log
(
getDefaultConfig
());
const
defaultConfig
=
defautToNew
(
getDefaultConfig
(),
reflectConfig
);
console
.
log
(
defaultConfig
);
config
=
createConfig
(
appInfo
,
defaultConfig
);
}
config
[
'requsetId'
]
=
createUnique
(
config
[
'network'
][
'ip'
])
const
res
:
any
=
await
window
.
fetch
(
'http://47.95.31.238/adx/ssp/dspAdTest'
,
{
const
appInfo
=
await
getAppInfo
(
type
)
console
.
log
(
appInfo
);
console
.
log
(
getDefaultConfig
());
const
defaultConfig
=
defautToNew
(
getDefaultConfig
(),
reflectConfig
);
console
.
log
(
defaultConfig
);
config
=
createConfig
(
appInfo
,
defaultConfig
);
config
[
'requsetId'
]
=
createUnique
(
config
[
'network'
][
'ip'
])
const
res
:
any
=
await
window
.
fetch
(
'http://47.95.31.238/adx/ssp/dspAdVideo'
,
{
body
:
JSON
.
stringify
(
config
),
headers
:
{
'content-type'
:
'application/json;charset=UTF-8'
,
...
...
egret/src/adVideo/utils.ts
View file @
d753103e
...
...
@@ -23,6 +23,19 @@ export const getUrl = (name) => {
return
''
;
};
// 获取网络信息
// 0- 未知网络 2- 2G
// 3- 3G
// 4- 4G
// 5- 5G
// 100-WIFI 101—ETHERNET 999--NEW_TYPE
const
reflectObj
=
{
wifi
:
100
,
'2g'
:
2
,
'3g'
:
3
,
'4g'
:
4
,
'5g'
:
5
,
other
:
0
};
export
function
getNetworkType
(
obj
=
{})
{
const
ua
=
navigator
.
userAgent
;
let
networkStr
=
ua
.
match
(
/NetType
\/\w
+/
)
?
ua
.
match
(
/NetType
\/\w
+/
)[
0
]
:
'NetType/other'
;
...
...
@@ -47,7 +60,7 @@ export function getNetworkType(obj = {}) {
default
:
networkType
=
'other'
;
}
if
(
obj
[
networkType
]
)
{
if
(
obj
.
hasOwnProperty
(
networkType
)
)
{
return
obj
[
networkType
];
}
return
networkType
;
...
...
@@ -63,27 +76,41 @@ interface appInfo {
connectionType
:
number
,
operatorType
:
number
}
// 1- 中国移动 2- 中国电信 3- 中国联通
const
yunyingShang
=
{
'移动'
:
1
,
'中国移动'
:
1
,
'联通'
:
2
,
'中国联通'
:
2
,
'电信'
:
3
,
'中国电信'
:
3
,
'其他'
:
99
}
// 获取平台信息, app相关的,slotId , ip。
export
function
getAppInfo
():
Promise
<
appInfo
>
{
const
tSlotId
=
getUrl
(
'tSlotId'
);
console
.
log
(
tSlotId
);
return
new
Promise
((
resolve
)
=>
{
// window.fetch(`https://activity.tuiatest.cn/commercialloanv/common/config/video/get?slotId=${tSlotId}`).then(res => {
// return res.json();
// }).then(res => {
// console.log(res);
// });
resolve
({
appId
:
"ZG08HD"
,
appPackage
:
"com.test"
,
appName
:
"测试 APP"
,
appVersion
:
"1.1.0"
,
slotId
:
"test1030"
,
ip
:
"115.236.166.122"
,
connectionType
:
4
,
operatorType
:
2
})
});
export
function
getAppInfo
(
type
):
Promise
<
appInfo
>
{
const
tSlotId
=
getUrl
(
'tSlotId'
)
||
10000
;
console
.
log
();
return
window
.
fetch
(
`https://activity.tuia.cn/commercialloanv/common/config/video/get?slotId=
${
tSlotId
}
`
)
.
then
(
res
=>
{
return
res
.
json
();
}).
then
(
res
=>
{
console
.
log
(
res
);
if
(
res
.
code
===
'0000000'
&&
res
.
data
)
{
const
config
=
res
.
data
.
config
||
[];
console
.
log
(
type
);
const
appInfo
=
config
.
find
(
e
=>
e
.
platform
===
'dianxing'
&&
Number
(
e
.
type
)
===
type
)
const
ipInfo
=
res
.
data
.
ipInfoDetail
||
{};
const
ip
=
ipInfo
.
ip
const
op
=
ipInfo
.
isp
||
'未知'
const
operatorType
=
yunyingShang
[
op
]
||
99
;
appInfo
.
ip
=
ip
;
appInfo
.
operatorType
=
operatorType
;
appInfo
.
connectionType
=
getNetworkType
(
reflectObj
);
return
appInfo
;
}
else
{
return
'error'
;
}
});
}
// 根据ip 生成唯一的值。
...
...
@@ -103,14 +130,7 @@ export function createUnique(ip) {
// imsi() 不做要求。
// ppi
// connt(网络状况) 优先传递
const
reflectObj
=
{
wifi
:
101
,
'2g'
:
2
,
'3g'
:
3
,
'4g'
:
4
,
'5g'
:
5
,
other
:
0
};
let
defaultConfig
;
export
function
getDefaultConfig
()
{
if
(
defaultConfig
)
return
defaultConfig
;
...
...
egret/src/mapScene/MapScene.ts
View file @
d753103e
...
...
@@ -85,7 +85,8 @@ export default class MapScene extends Scene {
}
},
()
=>
{
NetManager
.
ins
.
getIconAward
(()
=>
{
})
},
window
[
"slotidIcon"
]
window
[
"slotidIcon"
],
1
)
},
this
)
}
...
...
egret/src/myVideo/videoCtrl.ts
View file @
d753103e
...
...
@@ -7,6 +7,7 @@ import MyAdvideo from "../adVideo/adVideo";
import
{
stopBg
,
playBg
}
from
"../soundCtrl"
;
let
videoIns
:
MyAdvideo
;
let
videoContanier
=
document
.
querySelector
(
'#video-contanier'
);
// 消消乐的监听
window
[
'playingVideoClose'
]
=
()
=>
{
if
(
videoIns
&&
videoIns
.
isPlaying
)
{
videoIns
.
isPlaying
=
false
;
...
...
@@ -27,6 +28,7 @@ export const handleVideo = (
returnCallback
:
(
s
:
boolean
)
=>
void
,
completeCallback
:
Function
,
slotid
:
string
,
type
=
2
,
)
=>
{
Loading
.
instace
.
show
();
if
(
!
videoIns
)
{
...
...
@@ -34,7 +36,7 @@ export const handleVideo = (
el
:
videoContanier
})
}
videoIns
.
getVideo
().
then
((
res
)
=>
{
videoIns
.
getVideo
(
type
).
then
((
res
)
=>
{
stopBg
()
Loading
.
instace
.
hide
();
if
(
res
)
{
...
...
egret/src/panels/VideoBuyPanel.ts
View file @
d753103e
...
...
@@ -72,7 +72,7 @@ export default class VideoBuyPanel extends Panel {
}
},
()
=>
{
},
window
[
"slotid"
]
window
[
"slotid"
]
,
)
},
this
);
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment