一键连客服更改

This commit is contained in:
level 2025-06-13 15:23:30 +08:00
parent f8a3ff8d7c
commit 3fad9e6843
5 changed files with 55 additions and 107 deletions

View File

@ -660,104 +660,6 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
})
}
private fun getYmKefu(mmkvHost: String?) {
loginViewMode.getYmKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getYunTiKefu(mmkvHost: String?) {
loginViewMode.getYunTiKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getBzyKefu(mmkvHost: String?) {
loginViewMode.getBzyKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
private fun getTzKefu(mmkvHost: String?) {
loginViewMode.getTzKefuHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
kefuHost = str
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(str)))
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse(mmkvHost)
)
)
}
}
})
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == LOGIN_TO_REGISTER_REQUEST_CODE) {

View File

@ -190,11 +190,25 @@ open class PublicViewMode : BaseViewMode() {
}
fun getYmKefuHost(callback: AsyncBodyCallback) {
val baseUrl=BuildConfig.service_url
val rt =
NetService.instances.createFreeBaseUrl(baseUrl)
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try {
var host = rt.getKefuHost()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()
callback.err()
}
}
}
fun getCustomServiceHost(callback: AsyncBodyCallback) {
val rt =
NetService.instances.createFreeBaseUrl("https://pubtofile.oss-cn-hongkong.aliyuncs.com/")
doAsyncNoNeedReturn(HttpReqType.GET_HOST) {
try { //TODO bug 会引起崩溃
var host = rt.getYingMaoKefuHost()
try {
val host = rt.getYingMaoKefuHost()
callback.suc(host)
} catch (e: Exception) {
e.printStackTrace()

View File

@ -236,6 +236,9 @@ interface HttpApi {
suspend fun getYuntiRegister(): String
//客服链接
@GET("/oss/kf/yjl_kefu.txt")
suspend fun getKefuHost(): String
@GET("/yjl_kefu.txt")
suspend fun getYingMaoKefuHost(): String

View File

@ -93,7 +93,6 @@ class CustomerServiceWebView:BaseActivity() {
val userName = MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_REMEMBER_USERNAME, "")
val enName = URLEncoder.encode(userName, "UTF-8")
Log.d("getCustomerServiceUrl enName==>${enName}")
if (TextUtils.isEmpty(customerServiceHost)) {
val mmkvHost = MMKV.defaultMMKV()
.decodeString(BZYConstants.MMKV_KEY_KEFU_HOST, "")
webViewVM.getYmKefuHost(object : AsyncBodyCallback {
@ -107,15 +106,26 @@ class CustomerServiceWebView:BaseActivity() {
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
csWebView.loadUrl(mmkvHost + "&app_account=${enName}")
}
webViewVM.getCustomServiceHost(object : AsyncBodyCallback {
override suspend fun suc(str: String) {
if (str != mmkvHost) {
MMKV.defaultMMKV()
.encode(BZYConstants.MMKV_KEY_KEFU_HOST, str)
}
csWebView.loadUrl(str)
}
override fun err() {
if (!TextUtils.isEmpty(mmkvHost)) {
csWebView.loadUrl(mmkvHost + "&app_account=${enName}")
}
}
})
}
})
} else {
csWebView.loadUrl(customerServiceHost)
}
initKeyboardListener()
}
private fun initKeyboardListener() {

View File

@ -119,6 +119,25 @@ subprojects {
)
)
}
create("8671") {
isDefault = true
dimension = flavorDimensionList[0]
buildConfigField("boolean", "PREMIUM", "Boolean.parseBoolean(\"false\")")
buildConfigField("boolean", "is_back_cn", "false")
buildConfigField("boolean", "is_ym", "true")
buildConfigField("boolean", "is_tz", "false")
buildConfigField("boolean", "is_yunti", "false")
buildConfigField("String", "applicationId", "\"com.jsq.wufu\"")
buildConfigField("String", "service_url", "\"https://api.yijianlianjsq.com/\"")
buildConfigField("boolean", "is_free", "false")
buildConfigField("String", "productId", "\"8671\"")
manifestPlaceholders(
mapOf(
"APP_NAME" to "@string/wf",
"APP_ICON" to "@mipmap/oneclickconnection"
)
)
}
}
sourceSets {
getByName("8888") {