Commit 0001530b authored by yinjiacheng's avatar yinjiacheng

update 接入TowerPro通用配置模块同步修改商户管理中心逻辑

parent c43fdfa1
......@@ -76,12 +76,12 @@ object CommonDataSource {
towerApi
.getCommonConfig(requestParams)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultObserver<GetCommonConfigBean>() {
override fun onSuccess(result: HttpResult<GetCommonConfigBean>?) {
.subscribe(object : HttpResultObserver<GetCommonConfigBean.GetCommonConfigResponse>() {
override fun onSuccess(result: HttpResult<GetCommonConfigBean.GetCommonConfigResponse>?) {
apiCallback.getCommonConfigSuccess(result?.result)
}
override fun onFailure(result: HttpResult<GetCommonConfigBean>?) {
override fun onFailure(result: HttpResult<GetCommonConfigBean.GetCommonConfigResponse>?) {
apiCallback.getCommonConfigFailure(result?.status)
}
})
......
......@@ -32,5 +32,5 @@ interface CommonService {
): Observable<HttpResult<Any?>>
@GET(getCommonConfig)
fun getCommonConfig(@QueryMap requestParams: Map<String, String>): Observable<HttpResult<GetCommonConfigBean>>
fun getCommonConfig(@QueryMap requestParams: Map<String, String>): Observable<HttpResult<GetCommonConfigBean.GetCommonConfigResponse>>
}
......@@ -2,79 +2,82 @@ package com.yidian.common.http.bean
import com.google.gson.annotations.SerializedName
/**
* author: yinjiacheng
* date: 7/12/21 10:10 PM
* description: open-tower-api.go2yd.com/api/resource
*/
data class GetCommonConfigBean(
@SerializedName("appid")
val appid: String,
@SerializedName("created_at")
val createdAt: String,
@SerializedName("creator")
val creator: String,
@SerializedName("data")
val `data`: Data,
@SerializedName("env")
val env: Int,
@SerializedName("_id")
val id: String,
@SerializedName("keyTag")
val keyTag: String,
@SerializedName("note")
val note: String,
@SerializedName("os")
val os: Int,
@SerializedName("status")
val status: String,
@SerializedName("uniqueKey")
val uniqueKey: String,
@SerializedName("updated_at")
val updatedAt: String,
@SerializedName("version")
val version: String
)
class GetCommonConfigBean {
data class GetCommonConfigResponse(
@SerializedName("appid")
val appid: String,
@SerializedName("created_at")
val createdAt: String,
@SerializedName("creator")
val creator: String,
@SerializedName("data")
val `data`: Data,
@SerializedName("env")
val env: Int,
@SerializedName("_id")
val id: String,
@SerializedName("keyTag")
val keyTag: String,
@SerializedName("note")
val note: String,
@SerializedName("os")
val os: Int,
@SerializedName("status")
val status: String,
@SerializedName("uniqueKey")
val uniqueKey: String,
@SerializedName("updated_at")
val updatedAt: String,
@SerializedName("version")
val version: String
)
data class Data(
@SerializedName("is_show_app_upgrade")
val isShowAppUpgrade: Int,
@SerializedName("merchant_manager_center")
val merchantManagerCenter: MerchantManagerCenter
)
data class Data(
@SerializedName("is_show_app_upgrade")
val isShowAppUpgrade: Int,
@SerializedName("merchant_manager_center")
val merchantManagerCenter: MerchantManagerCenter
)
data class MerchantManagerCenter(
@SerializedName("disable_text")
val disableText: String,
@SerializedName("disable_url")
val disableUrl: Any,
@SerializedName("items")
val items: List<Item>,
@SerializedName("show")
val show: Int
)
data class MerchantManagerCenter(
@SerializedName("disable_text")
val disableText: String,
@SerializedName("disable_url")
val disableUrl: Any,
@SerializedName("items")
val items: List<Item>,
@SerializedName("show")
val show: Int
)
data class Item(
@SerializedName("functions")
val functions: List<Function>,
@SerializedName("group_id")
val groupId: Int,
@SerializedName("group_name")
val groupName: String,
@SerializedName("show")
val show: Int
)
data class Item(
@SerializedName("functions")
val functions: List<Function>,
@SerializedName("group_id")
val groupId: Int,
@SerializedName("group_name")
val groupName: String,
@SerializedName("show")
val show: Int
)
data class Function(
@SerializedName("function_id")
val functionId: Int,
@SerializedName("function_name")
val functionName: String,
@SerializedName("icon_url")
val iconUrl: String,
@SerializedName("link_url")
val linkUrl: Any,
@SerializedName("show")
val show: Int
)
data class Function(
@SerializedName("function_id")
val functionId: Int,
@SerializedName("function_name")
val functionName: String,
@SerializedName("icon_url")
val iconUrl: String,
@SerializedName("link_url")
val linkUrl: Any,
@SerializedName("show")
val show: Int
)
}
......@@ -8,6 +8,6 @@ import com.yidian.common.http.bean.GetCommonConfigBean
* description: open-tower-api.go2yd.com/api/resource
*/
interface IGetCommonConfigCallback {
fun getCommonConfigSuccess(result: GetCommonConfigBean?)
fun getCommonConfigSuccess(result: GetCommonConfigBean.GetCommonConfigResponse?)
fun getCommonConfigFailure(message: String?)
}
......@@ -6,8 +6,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.yidian.common.http.bean.GetCommonConfigBean
import com.yidian.shenghuoquan.newscontent.databinding.ItemMerchantServiceFunctionBinding
import com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
/**
* author: yinjiacheng
......@@ -16,7 +16,7 @@ import com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
*/
class MerchantServiceFunctionAdapter @JvmOverloads constructor(
val context: Context,
data: List<GetConfigListBean.Function>? = null,
data: List<GetCommonConfigBean.Function>? = null,
val listener: OnItemClickListener? = null
) :
RecyclerView.Adapter<MerchantServiceFunctionAdapter.MerchantServiceViewHolder>() {
......@@ -29,14 +29,14 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
/**
* 数据源
*/
private val serviceData by lazy { ArrayList<GetConfigListBean.Function>() }
private val serviceData by lazy { ArrayList<GetCommonConfigBean.Function>() }
private lateinit var viewBinding: ItemMerchantServiceFunctionBinding
init {
// 将不显示的数据去除
data?.let {
(it as ArrayList<GetConfigListBean.Function>).iterator().apply {
(it as ArrayList<GetCommonConfigBean.Function>).iterator().apply {
while (hasNext()) {
if (next().show != FUNCTION_SHOW) remove()
}
......@@ -48,10 +48,10 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
/**
* 更新数据 将不显示的数据去除
*/
fun updateData(data: List<GetConfigListBean.Function>?) {
fun updateData(data: List<GetCommonConfigBean.Function>?) {
data?.let {
serviceData.clear()
(it as ArrayList<GetConfigListBean.Function>).iterator().apply {
(it as ArrayList<GetCommonConfigBean.Function>).iterator().apply {
while (hasNext()) {
if (next().show != FUNCTION_SHOW) remove()
}
......@@ -72,12 +72,12 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
override fun onBindViewHolder(holder: MerchantServiceViewHolder, position: Int) {
val data = serviceData[position]
if (data.icon_url.isNotEmpty()) {
Glide.with(context).load(data.icon_url).into(viewBinding.ivService)
if (data.iconUrl.isNotEmpty()) {
Glide.with(context).load(data.iconUrl).into(viewBinding.ivService)
} else {
// TODO: 6/11/21 显示本地icon
}
holder.viewBinding.tvService.text = data.function_name
holder.viewBinding.tvService.text = data.functionName
holder.viewBinding.root.setOnClickListener { listener?.onItemClick(it, position, data) }
}
......@@ -92,7 +92,7 @@ class MerchantServiceFunctionAdapter @JvmOverloads constructor(
RecyclerView.ViewHolder(itemView)
interface OnItemClickListener {
fun onItemClick(view: View, position: Int, data: GetConfigListBean.Function)
fun onItemClick(view: View, position: Int, data: GetCommonConfigBean.Function)
}
}
......@@ -7,8 +7,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yidian.common.http.bean.GetCommonConfigBean
import com.yidian.shenghuoquan.newscontent.databinding.ItemMerchantServiceGroupBinding
import com.yidian.shenghuoquan.newscontent.http.httpbean.GetConfigListBean
import com.yidian.utils.DensityUtil
/**
......@@ -18,7 +18,7 @@ import com.yidian.utils.DensityUtil
*/
class MerchantServiceGroupAdapter @JvmOverloads constructor(
val context: Context,
data: List<GetConfigListBean.Item>? = null,
data: List<GetCommonConfigBean.Item>? = null,
val listener: MerchantServiceFunctionAdapter.OnItemClickListener? = null
) :
RecyclerView.Adapter<MerchantServiceGroupAdapter.MerchantServiceGroupViewHolder>() {
......@@ -34,7 +34,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
* 数据源
*/
private val groupData by lazy {
ArrayList<GetConfigListBean.Item>()
ArrayList<GetCommonConfigBean.Item>()
}
init {
......@@ -51,7 +51,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
/**
* 刷新数据
*/
fun updateData(data: List<GetConfigListBean.Item>?) {
fun updateData(data: List<GetCommonConfigBean.Item>?) {
groupData.clear()
data?.let {
it.forEach { item ->
......@@ -81,7 +81,7 @@ class MerchantServiceGroupAdapter @JvmOverloads constructor(
override fun onBindViewHolder(holder: MerchantServiceGroupViewHolder, position: Int) {
val data = groupData[position]
holder.viewBinding.tvTitle.text = data.group_name
holder.viewBinding.tvTitle.text = data.groupName
viewBinding.rvService.layoutManager = GridLayoutManager(context, 4)
viewBinding.rvService.adapter = MerchantServiceFunctionAdapter(context, data.functions, listener)
}
......
......@@ -10,7 +10,7 @@ ext {
isUmengRelease : 'false', // 上线时改成true,使用上线版本的友盟配置
isApplication : false,
isAppUpgradeOnline: 'true', // 上线前需要开启版本升级线上环境 true
towerApiEnv : '"2"' // Tower Api环境 0:测试环境 1:内网-正式环境 2:外网-正式环境 3:内网外网-正式环境
towerApiEnv : '"0"' // Tower Api环境 0:测试环境 1:内网-正式环境 2:外网-正式环境 3:内网外网-正式环境
]
// 高德地图的key
amap = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment