Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
42f0d642
Commit
42f0d642
authored
Apr 06, 2021
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂存提交加密
parent
f2edbe76
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
8 deletions
+82
-8
index.html
egret/index.html
+3
-0
ABNetManager.ts
egret/libs/tc/manager/ABNetManager.ts
+23
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+56
-7
No files found.
egret/index.html
View file @
42f0d642
...
@@ -34,7 +34,10 @@
...
@@ -34,7 +34,10 @@
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"false"
data-show-log=
"false"
data-content-height=
"1624"
data-multi-fingered=
"2"
data-show-fps=
"false"
data-show-log=
"false"
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
data-show-fps-style=
"x:0,y:0,size:12,textColor:0xffffff,bgAlpha:0.9"
>
</div>
</div>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/db_games/libs/aes.js"
></script>
<script
crossorigin=
"anonymous"
src=
"//yun.duiba.com.cn/db_games/libs/pad-zeropadding.js"
></script>
<script
src=
"libs/modules/egret/egret.js"
></script>
<script
src=
"libs/modules/egret/egret.js"
></script>
<script
src=
"libs/modules/egret/egret.web.js"
></script>
<script
src=
"libs/modules/egret/egret.web.js"
></script>
<script
src=
"libs/modules/eui/eui.js"
></script>
<script
src=
"libs/modules/eui/eui.js"
></script>
...
...
egret/libs/tc/manager/ABNetManager.ts
View file @
42f0d642
...
@@ -20,7 +20,7 @@ export abstract class ABNetManager {
...
@@ -20,7 +20,7 @@ export abstract class ABNetManager {
* 发送请求
* 发送请求
* @param net
* @param net
*/
*/
public
send
(
net
:
INetData
):
void
{
public
send
(
net
:
INetData
,
header
=
null
):
void
{
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
let
realUrl
:
string
=
net
.
uri
;
let
realUrl
:
string
=
net
.
uri
;
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
...
@@ -32,6 +32,28 @@ export abstract class ABNetManager {
...
@@ -32,6 +32,28 @@ export abstract class ABNetManager {
realUrl
+=
net
.
addUrl
;
realUrl
+=
net
.
addUrl
;
}
}
// console.log(`[send][${net.uri}]${JSON.stringify(net.param)}`)
// console.log(`[send][${net.uri}]${JSON.stringify(net.param)}`)
//提交专门处理header
if
(
header
){
window
[
'$'
].
ajax
({
type
:
net
.
type
,
// url: realUrl + gTime,
url
:
realUrl
,
headers
:
{
"Hdtool-Content"
:
header
},
dataType
:
net
.
dataType
,
data
:
net
.
param
,
async
:
true
,
success
:
(
result
)
=>
{
// console.log(`[success][${net.uri}]${JSON.stringify(result)}`)
this
.
onResponse
(
net
,
result
);
},
error
:
(
message
)
=>
{
this
.
onError
(
net
);
}
});
return
;
}
window
[
'$'
].
ajax
({
window
[
'$'
].
ajax
({
type
:
net
.
type
,
type
:
net
.
type
,
// url: realUrl + gTime,
// url: realUrl + gTime,
...
...
egret/libs/tw/manager/NetManager.ts
View file @
42f0d642
...
@@ -416,9 +416,58 @@ export class NetManager extends ABNetManager {
...
@@ -416,9 +416,58 @@ export class NetManager extends ABNetManager {
sgin
:
sign
,
sgin
:
sign
,
dynamicData
:
JSON
.
stringify
(
dynamicData
)
dynamicData
:
JSON
.
stringify
(
dynamicData
)
};
};
function
createSgin
(
ticketId
,
score
,
gameData
,
submitToken
)
{
return
window
[
'duiba_md5'
](
ticketId
+
''
+
score
+
''
+
gameData
+
''
+
submitToken
);
}
function
encrypt
(
data
)
{
//约定的键值
var
kk
=
(
+
window
[
'CFG'
].
consumerId
).
toString
(
32
)
kk
=
kk
.
substring
(
0
,
16
);
//补0;
var
len
=
kk
.
length
;
while
(
len
<
16
)
{
kk
=
kk
+
"0"
;
len
++
;
}
//约定iv
var
ii
=
(
+
window
[
'CFG'
].
consumerId
).
toString
(
16
)
ii
=
ii
.
substring
(
0
,
16
);
//补0;
var
len
=
ii
.
length
;
while
(
len
<
16
)
{
ii
=
ii
+
"0"
;
len
++
;
}
var
CryptoJS
=
window
[
"CryptoJS"
];
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
kk
);
var
iv
=
CryptoJS
.
enc
.
Utf8
.
parse
(
ii
);
return
CryptoJS
.
AES
.
encrypt
(
JSON
.
stringify
(
data
),
key
,
{
iv
:
iv
,
mode
:
CryptoJS
.
mode
.
CBC
,
padding
:
CryptoJS
.
pad
.
ZeroPadding
}).
toString
();
}
let
pp
=
{
orderId
,
score
,
gameData
,
sign
,
dynamicData
,
rankId
}
if
(
rankId
)
{
if
(
rankId
)
{
param
.
rankId
=
rankId
;
param
.
rankId
=
rankId
;
pp
[
"rankId"
]
=
rankId
;
}
}
//加密拼参数
pp
=
encrypt
(
pp
);
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
'ngameSubmit'
,
name
:
'ngameSubmit'
,
uri
:
'/hdtool/recon/ngame/ngameSubmit'
,
uri
:
'/hdtool/recon/ngame/ngameSubmit'
,
...
@@ -428,7 +477,7 @@ export class NetManager extends ABNetManager {
...
@@ -428,7 +477,7 @@ export class NetManager extends ABNetManager {
hideMsg
:
true
,
hideMsg
:
true
,
callback
:
callback
callback
:
callback
};
};
this
.
send
(
net
);
this
.
send
(
net
,
pp
);
}
}
getOrderStatus
(
callback
:
Function
,
orderId
:
number
,
pollingCheck
?:
Function
,
pollingCount
=
10
):
void
{
getOrderStatus
(
callback
:
Function
,
orderId
:
number
,
pollingCheck
?:
Function
,
pollingCount
=
10
):
void
{
...
@@ -752,13 +801,13 @@ export class NetManager extends ABNetManager {
...
@@ -752,13 +801,13 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
reportMusic
(
callback
:
Function
,
durationOfPlay
,
songListId
,
songId
,
playCount
,
timestamp
,
bitrate
,
songDuration
):
void
{
public
reportMusic
(
callback
:
Function
,
durationOfPlay
,
songListId
,
songId
,
playCount
,
timestamp
,
bitrate
,
songDuration
):
void
{
const
data
:
any
=
{
const
data
:
any
=
{
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
durationOfPlay
:
durationOfPlay
,
songListId
:
songListId
,
songId
:
songId
,
timestamp
:
timestamp
,
action
:
7
,
action
:
7
,
playCount
:
playCount
,
playCount
:
playCount
,
bitrate
:
bitrate
,
bitrate
:
bitrate
,
isOnline
:
1
,
songDuration
:
songDuration
isOnline
:
1
,
songDuration
:
songDuration
};
};
// if (categoryID) data.categoryID = categoryID;
// if (categoryID) data.categoryID = categoryID;
...
...
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