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
650194ce
Commit
650194ce
authored
May 21, 2020
by
zjz1994
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
city代码暂存
parent
5657e609
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
MainBase.ts
egret/libs/new_wx/MainBase.ts
+1
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+59
-1
No files found.
egret/libs/new_wx/MainBase.ts
View file @
650194ce
...
...
@@ -600,7 +600,7 @@ export default class MainBase extends eui.UILayer {
]);
if
(
GFun
.
isIOS
){
}
else
{
console
.
log
(
"苏宁安卓开始准备"
);
if
(
!
window
[
'baseApi'
]){
...
...
egret/libs/tw/manager/NetManager.ts
View file @
650194ce
...
...
@@ -1463,6 +1463,7 @@ export class NetManager extends ABNetManager {
public
hc_advert
(
callback
:
Function
):
void
{
var
deviceId
:
string
=
''
;
var
cityCode
:
string
=
''
;
const
net
:
INetData
=
{
name
:
'hc_advert'
,
uri
:
window
[
'duiba'
]
+
'/customActivity/happyclear/advert'
,
...
...
@@ -1470,11 +1471,13 @@ export class NetManager extends ABNetManager {
dataType
:
'json'
,
param
:
{
activityId
:
DataManager
.
ins
.
customCfgData
.
actId
,
deviceId
:
deviceId
deviceId
:
deviceId
,
city
:
cityCode
},
hideMsg
:
true
,
callback
:
callback
};
// this.changeCookieCity("测试写入city");
try
{
// console.log("苏宁原生测试",window['baseApi']);
if
(
window
[
'baseApi'
]){
...
...
@@ -1490,11 +1493,15 @@ export class NetManager extends ABNetManager {
}
if
(
GFun
.
isIOS
){
deviceId
=
resdata
.
identifier
||
''
;
cityCode
=
resdata
.
cityCode
||
''
;
}
else
{
deviceId
=
resdata
.
imei
||
''
;
cityCode
=
resdata
.
cityCode
||
''
;
}
}
console
.
log
(
'新增deviceId'
,
deviceId
);
//检查修改cookie
net
.
param
.
deviceId
=
deviceId
;
this
.
send
(
net
);
}.
bind
(
this
));
...
...
@@ -1506,6 +1513,57 @@ export class NetManager extends ABNetManager {
this
.
send
(
net
);
}
}
//获取广告时手动修改cookie
changeCookieCity
(
citycode
:
string
){
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
));
for
(
var
i
=
0
;
i
<
cookiedata
.
length
;
i
++
){
var
icookie
=
cookiedata
[
i
].
trim
();
if
(
icookie
.
length
<
1
){
console
.
log
(
"cookie-----------空删"
);
cookiedata
.
splice
(
i
,
1
);
i
--
;
continue
;
}
var
icookieinfo
=
icookie
.
split
(
"="
);
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-----------城市一致不用动"
);
}
else
{
citydatarr
[
1
]
=
citycode
;
console
.
log
(
"cookie-----------重设cookie"
);
var
cityval
=
citydatarr
.
join
(
"_"
);
cookiedata
[
i
]
=
cookie_name
+
"="
+
cityval
+
";path=/"
;;
changecookie
=
true
;
}
break
;
}
}
if
(
!
havecity
){
console
.
log
(
"cookie-----------手动加cookie"
);
var
citycookie
=
"100_"
+
citycode
+
";path=/"
;;
cookiedata
.
push
(
cookie_name
+
"="
+
citycookie
);
changecookie
=
true
;
}
if
(
changecookie
){
var
newcookie
=
cookiedata
.
join
(
";"
);
console
.
log
(
"修改cookie"
,
newcookie
);
document
.
cookie
=
newcookie
}
}
}
public
doSign
(
callback
:
Function
,
signActivityId
:
number
):
void
{
const
net
:
INetData
=
{
...
...
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