Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
wildfirecode13
xiaoxiaole
Commits
855474a9
Commit
855474a9
authored
Sep 03, 2020
by
zhangjinzhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
e7177f55
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
30 deletions
+69
-30
INetData.ts
egret/libs/tc/interface/INetData.ts
+1
-0
ABNetManager.ts
egret/libs/tc/manager/ABNetManager.ts
+14
-8
NetName.ts
egret/libs/tw/enum/NetName.ts
+1
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+18
-0
ShareCodePanel.ts
egret/src/panels/ShareCodePanel.ts
+35
-21
No files found.
egret/libs/tc/interface/INetData.ts
View file @
855474a9
...
@@ -19,4 +19,5 @@ export interface INetData {
...
@@ -19,4 +19,5 @@ export interface INetData {
addUrl
?:
string
;
addUrl
?:
string
;
//是否显示错误提示
//是否显示错误提示
hideMsg
?:
boolean
;
hideMsg
?:
boolean
;
addgtime
?:
boolean
}
}
\ No newline at end of file
egret/libs/tc/manager/ABNetManager.ts
View file @
855474a9
...
@@ -24,15 +24,18 @@ export abstract class ABNetManager {
...
@@ -24,15 +24,18 @@ export abstract class ABNetManager {
* @param net
* @param net
*/
*/
public
send
(
net
:
INetData
):
void
{
public
send
(
net
:
INetData
):
void
{
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
()
;
let
addgtime
=
net
.
addgtime
;
let
realUrl
:
string
=
net
.
uri
;
let
realUrl
:
string
=
net
.
uri
;
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
if
(
!
addgtime
){
gTime
=
'&_='
+
GTime
.
getTimestamp
();
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
gTime
=
'&_='
+
GTime
.
getTimestamp
();
}
realUrl
+=
gTime
;
}
}
realUrl
+=
gTime
;
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if
(
net
.
addUrl
)
{
if
(
net
.
addUrl
)
{
realUrl
+=
net
.
addUrl
;
realUrl
+=
net
.
addUrl
;
...
@@ -133,8 +136,11 @@ export abstract class ABNetManager {
...
@@ -133,8 +136,11 @@ export abstract class ABNetManager {
// } else {
// } else {
// console.log("不加密请求post");
// console.log("不加密请求post");
//修改
//修改
url
=
"https://"
+
window
.
location
.
host
+
url
;
if
(
url
.
indexOf
(
"https:"
)
==-
1
){
url
=
url
.
indexOf
(
'http:'
)
>
-
1
||
url
.
indexOf
(
'https:'
)
>
-
1
?
url
:
window
.
location
.
protocol
+
url
;
url
=
"https://"
+
window
.
location
.
host
+
url
;
url
=
url
.
indexOf
(
'http:'
)
>
-
1
||
url
.
indexOf
(
'https:'
)
>
-
1
?
url
:
window
.
location
.
protocol
+
url
;
}
// }
// }
// console.log("新post------发送请求",url,_refer,photoInfo,postData);
// console.log("新post------发送请求",url,_refer,photoInfo,postData);
var
upload
=
new
Promise
(
function
(
resolve
,
reject
)
{
var
upload
=
new
Promise
(
function
(
resolve
,
reject
)
{
...
...
egret/libs/tw/enum/NetName.ts
View file @
855474a9
...
@@ -87,6 +87,6 @@ export enum NetName {
...
@@ -87,6 +87,6 @@ export enum NetName {
EXCHANGE_COIN
,
EXCHANGE_COIN
,
GET_CLOUD_NUM
,
GET_CLOUD_NUM
,
GET_CONFIG
,
GET_CONFIG
,
GAME_GETSHARECODE
,
//获取口令
}
}
\ No newline at end of file
egret/libs/tw/manager/NetManager.ts
View file @
855474a9
...
@@ -2587,4 +2587,22 @@ export class NetManager extends ABNetManager {
...
@@ -2587,4 +2587,22 @@ export class NetManager extends ABNetManager {
};
};
this
.
send
(
net
);
this
.
send
(
net
);
}
}
public
getShareContent
(
callback
,
activityCode
,
sceneCode
,
token
){
const
net
:
INetData
=
{
name
:
"generateCode"
,
uri
:
"https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do?activityCode="
+
activityCode
+
"&sceneCode="
+
sceneCode
+
"&token="
+
token
,
type
:
'get'
,
dataType
:
'json'
,
hideMsg
:
true
,
param
:
{
// activityCode:activityCode,
// sceneCode:sceneCode,
// token:token
},
addgtime
:
true
,
callback
:
callback
};
this
.
send
(
net
);
}
}
}
\ No newline at end of file
egret/src/panels/ShareCodePanel.ts
View file @
855474a9
...
@@ -3,6 +3,8 @@ import ComponentBase from "../../libs/new_wx/components/ComponentBase";
...
@@ -3,6 +3,8 @@ import ComponentBase from "../../libs/new_wx/components/ComponentBase";
import
layers
from
"../../libs/new_wx/views/layers"
;
import
layers
from
"../../libs/new_wx/views/layers"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
INetData
}
from
"../../libs/tc/interface/INetData"
;
import
{
NetName
}
from
"../../libs/tw/enum/NetName"
;
export
enum
CodeChannels
{
export
enum
CodeChannels
{
/**
/**
...
@@ -110,10 +112,12 @@ class ShareCodePanel extends ComponentBase {
...
@@ -110,10 +112,12 @@ class ShareCodePanel extends ComponentBase {
//获取code先
//获取code先
generateCode
((
s
,
res
)
=>
{
generateCode
((
s
,
res
)
=>
{
if
(
!
s
||
!
res
.
data
||
!
res
.
data
.
result
||
!
res
.
data
.
result
.
content
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
result
&&
res
.
data
.
result
.
content
){
return
this
.
code
=
res
.
data
.
result
.
content
;
}
else
{
return
;
}
}
this
.
code
=
res
.
data
.
result
.
content
;
},
this
.
data
.
channel
,
this
.
data
.
shareCode
)
},
this
.
data
.
channel
,
this
.
data
.
shareCode
)
}
}
...
@@ -216,7 +220,9 @@ class ShareCodePanel extends ComponentBase {
...
@@ -216,7 +220,9 @@ class ShareCodePanel extends ComponentBase {
if
(
!
this
.
code
)
{
if
(
!
this
.
code
)
{
this
.
enableMouseEvent
(
false
)
this
.
enableMouseEvent
(
false
)
generateCode
((
s
,
res
)
=>
{
generateCode
((
s
,
res
)
=>
{
if
(
!
s
||
!
res
.
data
||
!
res
.
data
.
result
||
!
res
.
data
.
result
.
content
)
{
if
(
res
&&
res
.
data
&&
res
.
data
.
result
&&
res
.
data
.
result
.
content
){
// this.code = res.data.result.content;
}
else
{
this
.
enableMouseEvent
(
true
)
this
.
enableMouseEvent
(
true
)
showToast
(
"口令生成失败,请重试"
)
showToast
(
"口令生成失败,请重试"
)
return
return
...
@@ -308,23 +314,31 @@ function generateCode(callback: Function, channel: CodeChannels, shareCode: stri
...
@@ -308,23 +314,31 @@ function generateCode(callback: Function, channel: CodeChannels, shareCode: stri
// var activityCode = "ACT0000002664";
// var activityCode = "ACT0000002664";
var
sceneCode
=
channel
;
var
sceneCode
=
channel
;
var
token
=
shareCode
||
"0"
;
var
token
=
shareCode
||
"0"
;
window
[
'$'
].
ajax
({
const
param
:
any
=
{
type
:
"post"
,
activityCode
,
url
:
"https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do"
,
sceneCode
,
dataType
:
"json"
,
token
data
:
{
}
activityCode
,
console
.
log
(
"新请求233567456"
);
sceneCode
,
NetManager
.
ins
.
getShareContent
(
callback
,
activityCode
,
sceneCode
,
token
);
token
},
// window['$'].ajax({
async
:
true
,
// type: "post",
success
:
(
result
)
=>
{
// url: "https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do",
callback
(
true
,
result
)
// dataType: "json",
},
// data: {
error
:
(
message
)
=>
{
// activityCode,
callback
(
false
,
message
)
// sceneCode,
}
// token
});
// },
// async: true,
// success: (result) => {
// callback(true, result)
// },
// error: (message) => {
// callback(false, message)
// }
// });
}
}
...
...
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