Toggle navigation
Toggle navigation
This project
Loading...
Sign in
YOHOBUY
/
yohobuy-union
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
zhengwen.ge
9 years ago
Commit
00bdddecdc5b0314096bbcb379db6657383bc0ed
1 parent
12d3df9c
适配IOS
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
common/src/main/java/com/yoho/unions/common/enums/ClientTypeEnum.java
server/src/main/java/com/yoho/unions/server/restapi/ActivateUnionRest.java
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
common/src/main/java/com/yoho/unions/common/enums/ClientTypeEnum.java
View file @
00bddde
...
...
@@ -2,7 +2,7 @@ package com.yoho.unions.common.enums;
public
enum
ClientTypeEnum
{
I
OS
(
"ios
"
),
I
PHONE
(
"iphone
"
),
ANDROID
(
"android"
);
...
...
server/src/main/java/com/yoho/unions/server/restapi/ActivateUnionRest.java
View file @
00bddde
...
...
@@ -46,7 +46,7 @@ public class ActivateUnionRest {
ActivateUnionRequestBO
bo
=
new
ActivateUnionRequestBO
();
BeanUtils
.
copyProperties
(
vo
,
bo
);
String
clientType
=
vo
.
getClient_type
();
if
(!
ClientTypeEnum
.
ANDROID
.
getName
().
equalsIgnoreCase
(
clientType
)
&&
!
ClientTypeEnum
.
I
OS
.
getName
().
equalsIgnoreCase
(
clientType
))
{
if
(!
ClientTypeEnum
.
ANDROID
.
getName
().
equalsIgnoreCase
(
clientType
)
&&
!
ClientTypeEnum
.
I
PHONE
.
getName
().
equalsIgnoreCase
(
clientType
))
{
log
.
warn
(
"activateUnion error with param is {}"
,
vo
);
return
new
ActiveUnionResponseBO
(
600
,
"error"
);
}
...
...
@@ -67,7 +67,7 @@ public class ActivateUnionRest {
log
.
warn
(
"addUnion error with param is {}"
,
vo
);
}
}
}
else
if
(
ClientTypeEnum
.
I
OS
.
getName
().
equalsIgnoreCase
(
clientType
))
{
}
else
if
(
ClientTypeEnum
.
I
PHONE
.
getName
().
equalsIgnoreCase
(
clientType
))
{
//处理iOS的服务
for
(
String
str
:
UnionConstant
.
iOSServiceList
)
{
//捕获异常,不影响后面的联盟
...
...
server/src/main/java/com/yoho/unions/server/service/impl/GDTServiceImpl.java
View file @
00bddde
...
...
@@ -55,7 +55,7 @@ public class GDTServiceImpl implements MainUnionService {
log
.
warn
(
"activateUnionCheck error because appid is null with param is {}"
,
request
);
return
new
UnionResponseBO
(
false
,
"appid is null"
);
}
if
(
StringUtils
.
isEmpty
(
request
.
getClient_type
())
||
(!
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
ANDROID
.
getName
())
&&
!
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
I
OS
.
getName
())))
{
if
(
StringUtils
.
isEmpty
(
request
.
getClient_type
())
||
(!
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
ANDROID
.
getName
())
&&
!
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
I
PHONE
.
getName
())))
{
log
.
warn
(
"activateUnionCheck error with param is {}"
,
request
);
return
new
UnionResponseBO
(
false
,
"app_type is error"
);
}
...
...
@@ -63,7 +63,7 @@ public class GDTServiceImpl implements MainUnionService {
log
.
warn
(
"activateUnionCheck error because imei is null with client_type is andriod with param is {}"
,
request
);
return
new
UnionResponseBO
(
false
,
"imei is error"
);
}
if
(
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
I
OS
.
getName
())
&&
StringUtils
.
isEmpty
(
request
.
getIdfa
()))
{
if
(
request
.
getClient_type
().
equalsIgnoreCase
(
ClientTypeEnum
.
I
PHONE
.
getName
())
&&
StringUtils
.
isEmpty
(
request
.
getIdfa
()))
{
log
.
warn
(
"activateUnionCheck error because idfa is null with client_type is ios with param is {}"
,
request
);
return
new
UnionResponseBO
(
false
,
"idfa is error"
);
}
...
...
@@ -89,7 +89,7 @@ public class GDTServiceImpl implements MainUnionService {
UnionLogs
unionLogs
=
new
UnionLogs
();
unionLogs
.
setAppId
(
String
.
valueOf
(
request
.
getAppid
()));
unionLogs
.
setUdid
(
""
);
if
(
ClientTypeEnum
.
I
OS
.
getName
().
equalsIgnoreCase
(
request
.
getClient_type
())){
if
(
ClientTypeEnum
.
I
PHONE
.
getName
().
equalsIgnoreCase
(
request
.
getClient_type
())){
unionLogs
.
setIdfa
(
request
.
getIdfa
());
}
else
{
unionLogs
.
setImei
(
request
.
getImei
());
...
...
@@ -135,13 +135,13 @@ public class GDTServiceImpl implements MainUnionService {
* @param requestBO
* @return
*/
private
static
String
urlEode
(
ActivateUnionRequestBO
requestBO
)
{
private
String
urlEode
(
ActivateUnionRequestBO
requestBO
)
{
log
.
info
(
"enter GDTServiceImpl.urlEode param{} is "
,
requestBO
);
// 根据不同的应用类型,获取不同的加密密钥和签名密钥
String
encryptKey
=
null
;
String
signKey
=
null
;
String
muid4MD5
=
""
;
if
(
ClientTypeEnum
.
I
OS
.
getName
().
equalsIgnoreCase
(
requestBO
.
getClient_type
()))
{
if
(
ClientTypeEnum
.
I
PHONE
.
getName
().
equalsIgnoreCase
(
requestBO
.
getClient_type
()))
{
DynamicStringProperty
ios_encrypt_key
=
DynamicPropertyFactory
.
getInstance
().
getStringProperty
(
"ios_encrypt_key"
,
""
);
encryptKey
=
ios_encrypt_key
.
get
();
DynamicStringProperty
ios_sign_key
=
DynamicPropertyFactory
.
getInstance
().
getStringProperty
(
"ios_sign_key"
,
""
);
...
...
@@ -216,11 +216,23 @@ public class GDTServiceImpl implements MainUnionService {
// conv_type,,现在只有移动应用激活类型(MOBILEAPP_ACTIVITE);
String
convType
=
"MOBILEAPP_ACTIVITE"
;
String
uid
=
"1261905"
;
url
=
sb
.
append
(
DynamicPropertyFactory
.
getInstance
().
getStringProperty
(
"guangdiantong.url"
,
""
).
get
()).
append
(
requestBO
.
getAppid
()).
append
(
"/conv?v="
).
append
(
retRep
).
append
(
"&conv_type="
).
append
(
convType
).
append
(
"&app_type="
).
append
(
requestBO
.
getClient_type
(
)).
append
(
"&advertiser_id="
).
append
(
uid
).
toString
();
url
=
sb
.
append
(
DynamicPropertyFactory
.
getInstance
().
getStringProperty
(
"guangdiantong.url"
,
""
).
get
()).
append
(
requestBO
.
getAppid
()).
append
(
"/conv?v="
).
append
(
retRep
).
append
(
"&conv_type="
).
append
(
convType
).
append
(
"&app_type="
).
append
(
clientTypeConver
(
requestBO
.
getClient_type
()
)).
append
(
"&advertiser_id="
).
append
(
uid
).
toString
();
log
.
info
(
"activateUnion url is {}"
,
url
);
return
url
;
}
private
String
clientTypeConver
(
String
clientType
)
{
if
(
StringUtils
.
isEmpty
(
clientType
))
{
return
null
;
}
if
(
ClientTypeEnum
.
ANDROID
.
getName
().
equalsIgnoreCase
(
clientType
))
{
return
clientType
.
toUpperCase
();
}
else
{
return
"IOS"
;
}
}
/**
* 简单异或
*
...
...
@@ -228,7 +240,7 @@ public class GDTServiceImpl implements MainUnionService {
* @param key
* @return
*/
private
static
String
simpleXorByGdt
(
String
source
,
String
key
)
{
private
String
simpleXorByGdt
(
String
source
,
String
key
)
{
String
result
=
""
;
int
j
=
0
;
for
(
int
i
=
0
;
i
<
source
.
length
();
i
++)
{
...
...
Please
register
or
login
to post a comment