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
6af514e1
Commit
6af514e1
authored
Aug 17, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码暂存
parent
c4c6f59b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+14
-14
No files found.
egret/libs/tw/manager/NetManager.ts
View file @
6af514e1
...
...
@@ -1478,14 +1478,14 @@ export class NetManager extends ABNetManager {
hideMsg
:
true
,
callback
:
callback
};
console
.
log
(
"开始获取广告"
);
//
console.log("开始获取广告");
// this.changeCookieCity("测试写入city");
try
{
// console.log("苏宁原生测试",window['baseApi']);
if
(
window
[
'baseApi'
]){
console
.
log
(
"苏宁原生测试"
,
GFun
.
isIOS
);
//
console.log("苏宁原生测试",GFun.isIOS);
window
[
'baseApi'
].
getClientInfo
(
function
(
res
){
console
.
log
(
"啦啦啦baseApi----info"
,
res
);
//
console.log("啦啦啦baseApi----info",res);
if
(
res
){
var
resdata
;
if
(
typeof
res
==
"string"
){
...
...
@@ -1501,7 +1501,7 @@ export class NetManager extends ABNetManager {
cityCode
=
resdata
.
cityCode
||
''
;
}
}
console
.
log
(
'新增deviceId'
,
deviceId
);
//
console.log('新增deviceId',deviceId);
//检查修改cookie
// this.changeCookieCity(cityCode);
net
.
param
.
deviceId
=
deviceId
;
...
...
@@ -1509,45 +1509,45 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
}.
bind
(
this
));
}
else
{
console
.
log
(
"没有baseApi"
);
//
console.log("没有baseApi");
this
.
send
(
net
);
}
}
catch
(
e
){
console
.
log
(
'一般获取'
);
//
console.log('一般获取');
this
.
send
(
net
);
}
}
//获取广告时手动修改cookie
changeCookieCity
(
citycode
:
string
){
console
.
log
(
"cookie-----------测试写入cookie"
);
//
console.log("cookie-----------测试写入cookie");
if
(
citycode
&&
citycode
.
length
>
0
){
var
changecookie
:
boolean
=
false
;
var
havecity
:
boolean
=
false
;
var
allcookies
=
document
.
cookie
;
var
cookie_name
=
"SN_CITY"
;
var
cookiedata
=
allcookies
.
split
(
";"
);
console
.
log
(
"cookie-----------"
,
JSON
.
stringify
(
cookiedata
));
//
console.log("cookie-----------",JSON.stringify(cookiedata));
for
(
var
i
=
0
;
i
<
cookiedata
.
length
;
i
++
){
var
icookie
=
cookiedata
[
i
].
trim
();
if
(
icookie
.
length
<
1
){
console
.
log
(
"cookie-----------空删"
);
//
console.log("cookie-----------空删");
cookiedata
.
splice
(
i
,
1
);
i
--
;
continue
;
}
var
icookieinfo
=
icookie
.
split
(
"="
);
console
.
log
(
"cookie-----------"
,
JSON
.
stringify
(
icookieinfo
));
//
console.log("cookie-----------",JSON.stringify(icookieinfo));
if
(
icookieinfo
[
0
]
==
cookie_name
){
havecity
=
true
;
var
citycookie
=
icookieinfo
[
1
];
var
citydatarr
=
citycookie
.
split
(
"_"
);
var
citycode1
=
citydatarr
[
1
];
if
(
citycode1
==
citycode
){
console
.
log
(
"cookie-----------城市一致不用动"
);
//
console.log("cookie-----------城市一致不用动");
}
else
{
citydatarr
[
1
]
=
citycode
;
console
.
log
(
"cookie-----------重设cookie"
);
//
console.log("cookie-----------重设cookie");
var
cityval
=
citydatarr
.
join
(
"_"
);
cookiedata
[
i
]
=
cookie_name
+
"="
+
cityval
+
";domain=.cnsuning.com;path=/"
;;
changecookie
=
true
;
...
...
@@ -1556,14 +1556,14 @@ export class NetManager extends ABNetManager {
}
}
if
(
!
havecity
){
console
.
log
(
"cookie-----------手动加cookie"
);
//
console.log("cookie-----------手动加cookie");
var
citycookie
=
"100_"
+
citycode
+
";domain=.cnsuning.com;path=/"
;;
cookiedata
.
push
(
cookie_name
+
"="
+
citycookie
);
changecookie
=
true
;
}
if
(
changecookie
){
var
newcookie
=
cookiedata
.
join
(
";"
);
console
.
log
(
"修改cookie"
,
newcookie
);
//
console.log("修改cookie",newcookie);
document
.
cookie
=
newcookie
}
}
...
...
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