Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
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
bp
ShenghuoquanBusiness
Commits
8545d40d
Commit
8545d40d
authored
Jul 17, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 用户反馈接口cookie覆盖商户后台接口cookie
parent
3552467e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
18 deletions
+30
-18
ApiSaveCookiesInterceptor.kt
.../java/com/yidian/common/http/ApiSaveCookiesInterceptor.kt
+21
-12
CommonDataSource.kt
.../src/main/java/com/yidian/common/http/CommonDataSource.kt
+3
-3
CommonService.kt
...mon/src/main/java/com/yidian/common/http/CommonService.kt
+6
-3
No files found.
CommonLib/Common/src/main/java/com/yidian/common/http/ApiSaveCookiesInterceptor.kt
View file @
8545d40d
...
@@ -5,14 +5,23 @@ import com.yidian.common.HawkConfig
...
@@ -5,14 +5,23 @@ import com.yidian.common.HawkConfig
import
okhttp3.Interceptor
import
okhttp3.Interceptor
import
okhttp3.Response
import
okhttp3.Response
class
ApiSaveCookiesInterceptor
:
Interceptor
{
class
ApiSaveCookiesInterceptor
:
Interceptor
{
companion
object
{
// 忽略cookie的host集合
val
cookieInterceptWhiteList
=
arrayListOf
(
CommonService
.
DOMAIN_YD_JIRA
)
}
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
val
originalResponse
=
chain
.
proceed
(
chain
.
request
())
val
originalResponse
=
chain
.
proceed
(
chain
.
request
())
// 如果当前请求host在白名单内则不进行cookie拦截
if
(
cookieInterceptWhiteList
.
contains
(
chain
.
request
().
url
.
host
))
{
return
originalResponse
}
val
cookieList
=
originalResponse
.
headers
(
"Set-Cookie"
)
val
cookieList
=
originalResponse
.
headers
(
"Set-Cookie"
)
if
(
cookieList
.
isNotEmpty
())
{
if
(
cookieList
.
isNotEmpty
())
{
for
(
cookie
in
cookieList
)
{
for
(
cookie
in
cookieList
)
{
if
(
cookie
.
contains
(
"JSESSIONID"
))
{
if
(
cookie
.
contains
(
"JSESSIONID"
))
{
Hawk
.
put
(
HawkConfig
.
Cookie
,
cookie
)
Hawk
.
put
(
HawkConfig
.
Cookie
,
cookie
)
}
}
}
}
...
...
CommonLib/Common/src/main/java/com/yidian/common/http/CommonDataSource.kt
View file @
8545d40d
...
@@ -24,9 +24,9 @@ object CommonDataSource {
...
@@ -24,9 +24,9 @@ object CommonDataSource {
// Tower-Api 域名
// Tower-Api 域名
private
val
domainTowerApi
by
lazy
{
private
val
domainTowerApi
by
lazy
{
if
(
BuildConfig
.
TOWER_API_ENV
==
AppConfig
.
TowerApiEnvTest
)
{
if
(
BuildConfig
.
TOWER_API_ENV
==
AppConfig
.
TowerApiEnvTest
)
{
CommonService
.
DOMAIN_TOWER_API_TEST
CommonService
.
SCHEME_HTTP
+
CommonService
.
DOMAIN_TOWER_API_TEST
}
else
{
}
else
{
CommonService
.
DOMAIN_TOWER_API_PRO
CommonService
.
SCHEME_HTTPS
+
CommonService
.
DOMAIN_TOWER_API_PRO
}
}
}
}
...
@@ -35,7 +35,7 @@ object CommonDataSource {
...
@@ -35,7 +35,7 @@ object CommonDataSource {
}
}
private
val
ydJiraApi
by
lazy
{
private
val
ydJiraApi
by
lazy
{
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
,
CommonService
.
DOMAIN_YD_JIRA
)
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
,
CommonService
.
SCHEME_HTTP
+
CommonService
.
DOMAIN_YD_JIRA
)
}
}
// 301 获取金山云token接口
// 301 获取金山云token接口
...
...
CommonLib/Common/src/main/java/com/yidian/common/http/CommonService.kt
View file @
8545d40d
...
@@ -14,12 +14,15 @@ import retrofit2.http.*
...
@@ -14,12 +14,15 @@ import retrofit2.http.*
interface
CommonService
{
interface
CommonService
{
companion
object
{
companion
object
{
const
val
SCHEME_HTTP
=
"http://"
const
val
SCHEME_HTTPS
=
"https://"
// Tower Api域名定义
// Tower Api域名定义
const
val
DOMAIN_TOWER_API_TEST
=
"
http://
open-tower-api.test.int.yidian-inc.com:8222"
const
val
DOMAIN_TOWER_API_TEST
=
"open-tower-api.test.int.yidian-inc.com:8222"
const
val
DOMAIN_TOWER_API_PRO
=
"
https://
open-tower-api.go2yd.com"
const
val
DOMAIN_TOWER_API_PRO
=
"open-tower-api.go2yd.com"
// 一点jira域名定义
// 一点jira域名定义
const
val
DOMAIN_YD_JIRA
=
"
http://
ydjira.yidian-inc.com"
const
val
DOMAIN_YD_JIRA
=
"ydjira.yidian-inc.com"
// tower-api 获取配置数据
// tower-api 获取配置数据
private
const
val
getCommonConfig
=
"/api/resource"
private
const
val
getCommonConfig
=
"/api/resource"
...
...
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