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
Show 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 {
addUrl
?:
string
;
//是否显示错误提示
hideMsg
?:
boolean
;
addgtime
?:
boolean
}
\ No newline at end of file
egret/libs/tc/manager/ABNetManager.ts
View file @
855474a9
...
...
@@ -24,14 +24,17 @@ export abstract class ABNetManager {
* @param net
*/
public
send
(
net
:
INetData
):
void
{
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
()
;
let
addgtime
=
net
.
addgtime
;
let
realUrl
:
string
=
net
.
uri
;
if
(
!
addgtime
){
let
gTime
:
string
=
'?_='
+
GTime
.
getTimestamp
();
if
(
realUrl
.
indexOf
(
'?'
)
!=
-
1
)
{
gTime
=
'&_='
+
GTime
.
getTimestamp
();
}
realUrl
+=
gTime
;
}
//url加参数等特殊需求(例如再玩一次需要在dostart接口的url上加埋点)
if
(
net
.
addUrl
)
{
...
...
@@ -133,8 +136,11 @@ export abstract class ABNetManager {
// } else {
// console.log("不加密请求post");
//修改
if
(
url
.
indexOf
(
"https:"
)
==-
1
){
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);
var
upload
=
new
Promise
(
function
(
resolve
,
reject
)
{
...
...
egret/libs/tw/enum/NetName.ts
View file @
855474a9
...
...
@@ -87,6 +87,6 @@ export enum NetName {
EXCHANGE_COIN
,
GET_CLOUD_NUM
,
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 {
};
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";
import
layers
from
"../../libs/new_wx/views/layers"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
import
{
getlogItem
}
from
"../Main"
;
import
{
INetData
}
from
"../../libs/tc/interface/INetData"
;
import
{
NetName
}
from
"../../libs/tw/enum/NetName"
;
export
enum
CodeChannels
{
/**
...
...
@@ -110,10 +112,12 @@ class ShareCodePanel extends ComponentBase {
//获取code先
generateCode
((
s
,
res
)
=>
{
if
(
!
s
||
!
res
.
data
||
!
res
.
data
.
result
||
!
res
.
data
.
result
.
content
)
{
return
}
if
(
res
&&
res
.
data
&&
res
.
data
.
result
&&
res
.
data
.
result
.
content
){
this
.
code
=
res
.
data
.
result
.
content
;
}
else
{
return
;
}
},
this
.
data
.
channel
,
this
.
data
.
shareCode
)
}
...
...
@@ -216,7 +220,9 @@ class ShareCodePanel extends ComponentBase {
if
(
!
this
.
code
)
{
this
.
enableMouseEvent
(
false
)
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
)
showToast
(
"口令生成失败,请重试"
)
return
...
...
@@ -308,23 +314,31 @@ function generateCode(callback: Function, channel: CodeChannels, shareCode: stri
// var activityCode = "ACT0000002664";
var
sceneCode
=
channel
;
var
token
=
shareCode
||
"0"
;
window
[
'$'
].
ajax
({
type
:
"post"
,
url
:
"https://gameapi.suning.com/sngame-web/api/getShareGameInfo.do"
,
dataType
:
"json"
,
data
:
{
const
param
:
any
=
{
activityCode
,
sceneCode
,
token
},
async
:
true
,
success
:
(
result
)
=>
{
callback
(
true
,
result
)
},
error
:
(
message
)
=>
{
callback
(
false
,
message
)
}
});
console
.
log
(
"新请求233567456"
);
NetManager
.
ins
.
getShareContent
(
callback
,
activityCode
,
sceneCode
,
token
);
// window['$'].ajax({
// type: "post",
// url: "https://gameact.suning.com/sngame-web/share/api/gateway/getShareContentByToken.do",
// dataType: "json",
// data: {
// activityCode,
// 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