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
75dddeea
Commit
75dddeea
authored
Aug 03, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 用户反馈接口迁移到BSetting组件
parent
672b2865
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
42 additions
and
126 deletions
+42
-126
AppConfig.kt
...on/src/main/java/com/yidian/bcommon/constant/AppConfig.kt
+3
-0
ApiSaveCookiesInterceptor.kt
...java/com/yidian/bcommon/http/ApiSaveCookiesInterceptor.kt
+0
-9
CommonDataSource.kt
...src/main/java/com/yidian/bcommon/http/CommonDataSource.kt
+0
-34
CommonService.kt
...on/src/main/java/com/yidian/bcommon/http/CommonService.kt
+0
-30
GetKSYunObjectIdBean.kt
...java/com/yidian/bcommon/http/bean/GetKSYunObjectIdBean.kt
+0
-10
GetKSYunTokenBean.kt
...in/java/com/yidian/bcommon/http/bean/GetKSYunTokenBean.kt
+0
-21
IGetKSYunObjectIdCallback.kt
...yidian/bcommon/http/callback/IGetKSYunObjectIdCallback.kt
+0
-13
SettingApiService.kt
...om/yidian/shenghuoquan/bsetting/http/SettingApiService.kt
+9
-2
SettingRemoteDataSource.kt
...ian/shenghuoquan/bsetting/http/SettingRemoteDataSource.kt
+27
-4
FeedbackViewModel.kt
...ian/shenghuoquan/bsetting/ui/setting/FeedbackViewModel.kt
+3
-3
No files found.
CommonLib/BCommon/src/main/java/com/yidian/bcommon/constant/AppConfig.kt
View file @
75dddeea
...
...
@@ -44,6 +44,9 @@ class AppConfig {
const
val
TowerApiKeyTagMerchantC
=
"function-config-c"
const
val
TowerApiVersion
=
"1.0.0"
// 任意门域名定义
const
val
JiraDomain
=
"https://hub.go2yd.com"
// 用户反馈配置
const
val
feedbackAssignee
=
"chengxiaofeng"
// 经办人
const
val
feedbackProject
=
"10721"
// 项目
...
...
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/ApiSaveCookiesInterceptor.kt
View file @
75dddeea
...
...
@@ -7,17 +7,8 @@ import okhttp3.Response
class
ApiSaveCookiesInterceptor
:
Interceptor
{
companion
object
{
// 忽略cookie的host集合
val
cookieInterceptWhiteList
=
arrayListOf
(
CommonService
.
DOMAIN_YD_JIRA
)
}
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
val
originalResponse
=
chain
.
proceed
(
chain
.
request
())
// 如果当前请求host在白名单内则不进行cookie拦截
if
(
cookieInterceptWhiteList
.
contains
(
chain
.
request
().
url
.
host
))
{
return
originalResponse
}
val
cookieList
=
originalResponse
.
headers
(
"Set-Cookie"
)
if
(
cookieList
.
isNotEmpty
())
{
for
(
cookie
in
cookieList
)
{
...
...
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/CommonDataSource.kt
deleted
100644 → 0
View file @
672b2865
package
com.yidian.bcommon.http
import
com.yidian.bcommon.http.bean.CommitFeedbackBean
import
com.yidian.bcommon.http.callback.ICommitFeedbackCallback
import
com.yidian.http.ServiceFactory
/**
* author: yinjiacheng
* date: 7/8/21 4:54 PM
* description: Common网络请求实现
*/
object
CommonDataSource
{
private
val
ydJiraApi
by
lazy
{
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
,
CommonService
.
SCHEME_HTTPS
+
CommonService
.
DOMAIN_YD_JIRA
)
}
// 用户反馈提交
fun
commitFeedback
(
apiCallback
:
ICommitFeedbackCallback
,
requestParams
:
CommitFeedbackBean
.
CommitFeedbackRequest
)
{
ydJiraApi
.
commitFeedback
(
requestParams
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultObserver
<
CommitFeedbackBean
.
CommitFeedbackResponse
>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>?)
{
apiCallback
.
commitFeedbackSuccess
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>?)
{
apiCallback
.
commitFeedbackFailure
(
result
?.
reason
)
}
})
}
}
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/CommonService.kt
deleted
100644 → 0
View file @
672b2865
package
com.yidian.bcommon.http
import
com.yidian.bcommon.http.bean.CommitFeedbackBean
import
io.reactivex.rxjava3.core.Observable
import
retrofit2.http.Body
import
retrofit2.http.Headers
import
retrofit2.http.POST
/**
* author: yinjiacheng
* date: 7/8/21 4:53 PM
* description: Common网络请求定义
*/
interface
CommonService
{
companion
object
{
const
val
SCHEME_HTTP
=
"http://"
const
val
SCHEME_HTTPS
=
"https://"
// 一点jira域名定义
const
val
DOMAIN_YD_JIRA
=
"hub.go2yd.com"
// 用户反馈提交
private
const
val
commitFeedback
=
"/feedback/save"
}
@Headers
(
"Content-Type: application/json"
)
@POST
(
commitFeedback
)
fun
commitFeedback
(
@Body
requestParams
:
CommitFeedbackBean
.
CommitFeedbackRequest
):
Observable
<
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>>
}
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/bean/GetKSYunObjectIdBean.kt
deleted
100644 → 0
View file @
672b2865
package
com.yidian.bcommon.http.bean
/**
* author: yinjiacheng
* date: 5/23/21 12:13 PM
* description: 获取金山云bucket和objectId
*/
class
GetKSYunObjectIdBean
{
data class
Response
(
val
bucket
:
String
,
val
objectId
:
String
)
}
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/bean/GetKSYunTokenBean.kt
deleted
100644 → 0
View file @
672b2865
package
com.yidian.bcommon.http.bean
/**
* author: yinjiacheng
* date: 5/23/21 12:13 PM
* description: 获取金山云token
*/
class
GetKSYunTokenBean
(
val
request
:
Request
,
val
response
:
Response
)
{
data class
Request
(
val
http_method
:
String
,
val
date
:
String
,
val
resource
:
String
,
val
content_md5
:
String
,
val
content_type
:
String
,
val
headers
:
String
)
data class
Response
(
val
token
:
String
)
}
CommonLib/BCommon/src/main/java/com/yidian/bcommon/http/callback/IGetKSYunObjectIdCallback.kt
deleted
100644 → 0
View file @
672b2865
package
com.yidian.bcommon.http.callback
import
com.yidian.bcommon.http.bean.GetKSYunObjectIdBean
/**
* author: yinjiacheng
* date: 5/23/21 12:18 PM
* description: 获取金山云ObjectId
*/
interface
IGetKSYunObjectIdCallback
{
fun
getKSYunObjectIdSuccess
(
result
:
GetKSYunObjectIdBean
.
Response
?)
fun
getKSYunObjectIdFailure
(
message
:
String
?)
}
Components/BSetting/src/main/java/com/yidian/shenghuoquan/bsetting/http/SettingApiService.kt
View file @
75dddeea
package
com.yidian.shenghuoquan.bsetting.http
import
com.yidian.bcommon.http.HttpResult
import
com.yidian.bcommon.http.bean.CommitFeedbackBean
import
io.reactivex.rxjava3.core.Observable
import
retrofit2.http.GET
import
retrofit2.http.QueryMap
import
retrofit2.http.*
interface
SettingApiService
{
private
companion
object
{
const
val
mobileLogin
=
"/user/user/login"
const
val
userLogout
=
"/user/user/logout"
const
val
commitFeedback
=
"/feedback/save"
}
/**
...
...
@@ -24,5 +25,11 @@ interface SettingApiService {
@GET
(
userLogout
)
fun
userLogout
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@QueryMap
params
:
Map
<
String
,
String
?
>):
Observable
<
HttpResult
<
Any
?
>>
/**
* 用户反馈提交
*/
@Headers
(
"Content-Type: application/json"
)
@POST
(
commitFeedback
)
fun
commitFeedback
(
@Body
requestParams
:
CommitFeedbackBean
.
CommitFeedbackRequest
):
Observable
<
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>>
}
Components/BSetting/src/main/java/com/yidian/shenghuoquan/bsetting/http/SettingRemoteDataSource.kt
View file @
75dddeea
package
com.yidian.shenghuoquan.bsetting.http
import
com.yidian.bcommon.
http.HttpParamsUtils
import
com.yidian.bcommon.http.
HttpResult
import
com.yidian.bcommon.http.
HttpResultSubscriber
import
com.yidian.bcommon.http.
TransformUtil
import
com.yidian.bcommon.
constant.AppConfig
import
com.yidian.bcommon.http.
*
import
com.yidian.bcommon.http.
bean.CommitFeedbackBean
import
com.yidian.bcommon.http.
callback.ICommitFeedbackCallback
import
com.yidian.http.ServiceFactory
import
com.yidian.shenghuoquan.bsetting.bean.MobileLoginBean
...
...
@@ -11,6 +11,10 @@ object SettingRemoteDataSource {
private
var
api
=
ServiceFactory
.
getInstance
().
createService
(
SettingApiService
::
class
.
java
)
private
val
jiraApi
by
lazy
{
ServiceFactory
.
getInstance
().
createService
(
SettingApiService
::
class
.
java
,
AppConfig
.
JiraDomain
)
}
/**
* 手机号登录
*/
...
...
@@ -50,4 +54,23 @@ object SettingRemoteDataSource {
})
}
/**
* 用户反馈提交
*/
fun
commitFeedback
(
apiCallback
:
ICommitFeedbackCallback
,
requestParams
:
CommitFeedbackBean
.
CommitFeedbackRequest
)
{
jiraApi
.
commitFeedback
(
requestParams
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultObserver
<
CommitFeedbackBean
.
CommitFeedbackResponse
>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>?)
{
apiCallback
.
commitFeedbackSuccess
(
result
?.
result
)
}
override
fun
onFailure
(
result
:
HttpResult
<
CommitFeedbackBean
.
CommitFeedbackResponse
>?)
{
apiCallback
.
commitFeedbackFailure
(
result
?.
reason
)
}
})
}
}
Components/BSetting/src/main/java/com/yidian/shenghuoquan/bsetting/ui/setting/FeedbackViewModel.kt
View file @
75dddeea
...
...
@@ -2,13 +2,13 @@ package com.yidian.shenghuoquan.bsetting.ui.setting
import
androidx.lifecycle.MutableLiveData
import
com.orhanobut.hawk.Hawk
import
com.yidian.bcommon.constant.AppConfig
import
com.yidian.bcommon.BuildConfig
import
com.yidian.bcommon.constant.AppConfig
import
com.yidian.bcommon.constant.HawkConfig
import
com.yidian.bcommon.http.CommonDataSource
import
com.yidian.bcommon.http.bean.CommitFeedbackBean
import
com.yidian.bcommon.http.callback.ICommitFeedbackCallback
import
com.yidian.bcommon.mvvm.BaseViewModel
import
com.yidian.shenghuoquan.bsetting.http.SettingRemoteDataSource
/**
* author: yinjiacheng
...
...
@@ -53,7 +53,7 @@ class FeedbackViewModel : BaseViewModel(), ICommitFeedbackCallback {
}
// 拼接获取到的用户信息
val
description
=
"uid:${Hawk.get(HawkConfig.UserId, 0L)},appversion:${BuildConfig.VERSION_NAME},platform:${AppConfig.feedbackPlatform}"
Common
DataSource
.
commitFeedback
(
SettingRemote
DataSource
.
commitFeedback
(
this
,
CommitFeedbackBean
.
CommitFeedbackRequest
(
CommitFeedbackBean
.
Fields
(
CommitFeedbackBean
.
Assignee
(
AppConfig
.
feedbackAssignee
),
...
...
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