Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
42f451b3
Commit
42f451b3
authored
Jan 08, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:动态获取网关代码配置
parent
ecf3abfe
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
0 deletions
+54
-0
AppConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/AppConfig.kt
+2
-0
GlobalConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
+1
-0
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+23
-0
BaseUrlBean.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/BaseUrlBean.kt
+15
-0
ApiRequestUtil.java
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/ApiRequestUtil.java
+8
-0
NetApiStore.java
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/NetApiStore.java
+5
-0
No files found.
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/AppConfig.kt
View file @
42f451b3
...
...
@@ -9,3 +9,5 @@ const val YDL_DOMAIN = "Domain-Name:"
const
val
YDL_DOMAIN_JAVA
=
"JAVA_BASE_URL"
//JAVA 域名
const
val
YDL_DOMAIN_JAVA_URL
=
"YDL_DOMAIN_JAVA_URL"
// JAVA Api 登录注册地址
const
val
YDL_DOMAIN_LOGIN_BASE_URL
=
"JAVA_LOGIN_BASE_URL"
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/GlobalConfig.kt
View file @
42f451b3
...
...
@@ -119,6 +119,7 @@ class GlobalConfig private constructor(var builder: Builder) {
apiFactory
.
setOkClient
(
okHttpClient
)
HttpConfig
.
getInstance
().
initAuth
()
HttpConfig
.
getInstance
().
initLoginBaseUrlConfig
()
}
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
42f451b3
...
...
@@ -99,6 +99,8 @@ class HttpConfig {
*/
var
ACTION_URL
=
""
var
JAVA_LOGIN_BASE_URL
=
""
// 登录注册动态配置网关地址
fun
getInstance
():
HttpConfig
{
return
Holder
.
INSTANCE
}
...
...
@@ -361,6 +363,7 @@ class HttpConfig {
PHP_BASE_URL
=
properties
.
getProperty
(
"serverurl.$appEnv"
)
JAVA_BASE_URL
=
properties
.
getProperty
(
"javaapi.$appEnv"
)
JAVA_LOGIN_BASE_URL
=
JAVA_BASE_URL
ACTION_URL
=
properties
.
getProperty
(
"actionurl.$appEnv"
)
H5_URL
=
properties
.
getProperty
(
"h5url.$appEnv"
)
...
...
@@ -401,6 +404,26 @@ class HttpConfig {
}
}
/**
* 注册登录动态获取网关
*
*/
@SuppressLint
(
"CheckResult"
)
fun
initLoginBaseUrlConfig
(){
ApiRequestUtil
.
getBaseUrl
()
.
compose
(
RxUtils
.
applySchedulers
())
.
compose
(
RxUtils
.
resultJavaData
())
.
subscribe
({
if
(
it
.
baseUrlGatewayDTOList
.
isNotEmpty
()){
if
(
it
.
baseUrlGatewayDTOList
[
0
].
goGateway
){
JAVA_LOGIN_BASE_URL
=
it
.
baseUrlGatewayDTOList
[
0
].
baseUrl
}
}
})
{
LogUtil
.
i
(
"HttpConfig"
,
it
.
toString
())
}
}
private
object
Holder
{
val
INSTANCE
=
HttpConfig
()
}
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/bean/BaseUrlBean.kt
0 → 100644
View file @
42f451b3
package
com.ydl.ydlcommon.bean
/**
* Created by Ykai on 2021/1/8.
*/
data class
BaseUrlBean
(
var
baseUrlGatewayDTOList
:
List
<
UrlBean
>
)
data class
UrlBean
(
var
baseUrl
:
String
,
var
bizType
:
String
?,
var
goGateway
:
Boolean
)
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/ApiRequestUtil.java
View file @
42f451b3
...
...
@@ -2,6 +2,7 @@ package com.ydl.ydlcommon.data.http.api;
import
com.google.gson.Gson
;
import
com.ydl.ydlcommon.bean.AuthBean
;
import
com.ydl.ydlcommon.bean.BaseUrlBean
;
import
com.ydl.ydlcommon.bean.JavaGlobalInfo
;
import
com.ydl.ydlcommon.bean.MustUP
;
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
;
...
...
@@ -58,4 +59,11 @@ public class ApiRequestUtil {
public
static
Observable
<
BaseAPIResponse
<
JavaGlobalInfo
>>
getJavaGlobalInfo
()
{
return
YDLHttpUtils
.
Companion
.
obtainApi
(
NetApiStore
.
class
).
getJavaGlobalInfo
();
}
/**
* 获取登录注册模块网关
*/
public
static
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
(){
return
YDLHttpUtils
.
Companion
.
obtainApi
(
NetApiStore
.
class
).
getBaseUrl
();
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/data/http/api/NetApiStore.java
View file @
42f451b3
package
com
.
ydl
.
ydlcommon
.
data
.
http
.
api
;
import
com.ydl.ydlcommon.bean.AuthBean
;
import
com.ydl.ydlcommon.bean.BaseUrlBean
;
import
com.ydl.ydlcommon.bean.JavaGlobalInfo
;
import
com.ydl.ydlcommon.bean.MustUP
;
import
com.ydl.ydlcommon.data.http.BaseAPIResponse
;
...
...
@@ -14,6 +15,7 @@ import retrofit2.http.Body;
import
retrofit2.http.FieldMap
;
import
retrofit2.http.FormUrlEncoded
;
import
retrofit2.http.GET
;
import
retrofit2.http.Header
;
import
retrofit2.http.Headers
;
import
retrofit2.http.POST
;
...
...
@@ -49,4 +51,7 @@ interface NetApiStore {
@GET
(
"config/socket-config"
)
Observable
<
BaseAPIResponse
<
JavaGlobalInfo
>>
getJavaGlobalInfo
();
@Headers
({
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
,
"userPort:1"
})
@POST
(
"systemconfig/get_gateway_base_url"
)
Observable
<
BaseAPIResponse
<
BaseUrlBean
>>
getBaseUrl
();
}
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