Commit 207f3324 by 徐健

私聊改造关注功能修复

parent 302fa15a
...@@ -180,8 +180,8 @@ dependencies { ...@@ -180,8 +180,8 @@ dependencies {
implementation fileTree(dir: 'aars', include: ['*.aar']) implementation fileTree(dir: 'aars', include: ['*.aar'])
implementation project(':m-user') implementation project(':m-user')
implementation modularPublication('com.ydl:m-user-api') implementation modularPublication('com.ydl:m-user-api')
// implementation project(':m-tests') api project(':m-tests')
implementation project(':m-consultant') api project(':m-consultant')
implementation modularPublication('com.ydl:m-consultant-api') implementation modularPublication('com.ydl:m-consultant-api')
// implementation project(':m-confide') // implementation project(':m-confide')
......
...@@ -28,7 +28,7 @@ import com.yidianling.common.tools.ToastUtil ...@@ -28,7 +28,7 @@ import com.yidianling.common.tools.ToastUtil
//import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME //import com.yidianling.consultant.ExpertSearchActivity.Companion.HOT_SEARCH_DOCTOR_NAME
import com.yidianling.consultant.api.IConsultantService import com.yidianling.consultant.api.IConsultantService
import com.yidianling.fm.api.service.IFMService import com.yidianling.fm.api.service.IFMService
//import com.yidianling.tests.home.NewTestHomeActivity import com.yidianling.tests.home.NewTestHomeActivity
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
/** /**
...@@ -102,7 +102,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>( ...@@ -102,7 +102,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
FragmentContainerActivity.start(this,"TrendsHomeFragment") FragmentContainerActivity.start(this,"TrendsHomeFragment")
} }
bt_to_tests.setOnClickListener { bt_to_tests.setOnClickListener {
// startActivity(Intent(this, NewTestHomeActivity::class.java)) startActivity(Intent(this, NewTestHomeActivity::class.java))
} }
// bt_to_confide.setOnClickListener { // bt_to_confide.setOnClickListener {
// YDLavManager.instances.login("1193016") // YDLavManager.instances.login("1193016")
......
...@@ -47,12 +47,12 @@ ext { ...@@ -47,12 +47,12 @@ ext {
"m-fm" : "0.0.24", "m-fm" : "0.0.24",
"m-user" : "0.0.42", "m-user" : "0.0.42",
"m-home" : "0.0.8.2", "m-home" : "0.0.8.2",
"m-im" : "0.0.4.64", "m-im" : "0.0.4.68",
"m-dynamic" : "0.0.2", "m-dynamic" : "0.0.2",
"m-muse" : "0.0.21", "m-muse" : "0.0.23.2",
"m-tests" : "0.0.16", "m-tests" : "0.0.18.2",
"m-course" : "0.0.35", "m-course" : "0.0.37.2",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5", "m-audioim-api" : "0.0.5",
...@@ -81,7 +81,7 @@ ext { ...@@ -81,7 +81,7 @@ ext {
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.1", "ydl-net" : "0.0.3.1",
"ydl-utils" : "0.0.3", "ydl-utils" : "0.0.3",
"ydl-flutter-base": "0.0.5.21", "ydl-flutter-base": "0.0.5.41",
] ]
...@@ -98,7 +98,7 @@ ext { ...@@ -98,7 +98,7 @@ ext {
"m-dynamic" : "0.0.1.7", "m-dynamic" : "0.0.1.7",
"m-muse" : "0.0.20.7", "m-muse" : "0.0.20.7",
"m-tests" : "0.0.15.7", "m-tests" : "0.0.18.1",
"m-course" : "0.0.34.10", "m-course" : "0.0.34.10",
//-------------- 业务模块 API 层 -------------- //-------------- 业务模块 API 层 --------------
"m-audioim-api" : "0.0.5", "m-audioim-api" : "0.0.5",
...@@ -128,7 +128,7 @@ ext { ...@@ -128,7 +128,7 @@ ext {
"router" : "0.0.1", "router" : "0.0.1",
"ydl-net" : "0.0.3.1", "ydl-net" : "0.0.3.1",
"ydl-utils" : "0.0.3", "ydl-utils" : "0.0.3",
"ydl-flutter-base": "0.0.5.21", "ydl-flutter-base": "0.0.5.41",
] ]
dependencies = [ dependencies = [
...@@ -266,7 +266,7 @@ ext { ...@@ -266,7 +266,7 @@ ext {
//flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块 //flutter功能组件升级===>发布ydl-flutter组件===>引用flutter相关的业务模块
"ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块 "ydl-flutter-base" : "com.ydl:ydl-flutter-base:${ydlCompileVersion["ydl-flutter-base"]}", //组件化项目中的flutter base模块
"ydl-flutter" : "com.ydl:ydl-flutter:0.0.16.8@aar", //flutter aar "ydl-flutter" : "com.ydl:ydl-flutter:0.0.16.9@aar", //flutter aar
"ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar "ydl-flutter-sp" : "com.ydl:ydl-flutter-sp:0.0.2@aar", //flutter 缓存 aar
//基础组件 <<--- 先发这个,发完改这里的版本号 //基础组件 <<--- 先发这个,发完改这里的版本号
......
...@@ -13,6 +13,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage; ...@@ -13,6 +13,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.ydlcommon.base.BaseApp; import com.ydl.ydlcommon.base.BaseApp;
import com.ydl.ydlcommon.base.config.YDLConstants; import com.ydl.ydlcommon.base.config.YDLConstants;
import com.ydl.ydlcommon.utils.YDLCacheUtils; import com.ydl.ydlcommon.utils.YDLCacheUtils;
import com.yidianling.im.BuildConfig;
import com.yidianling.im.R; import com.yidianling.im.R;
import com.yidianling.im.config.constants.UserPreferences; import com.yidianling.im.config.constants.UserPreferences;
import com.yidianling.im.config.provider.CustomUserInfoProvider; import com.yidianling.im.config.provider.CustomUserInfoProvider;
...@@ -43,8 +44,10 @@ class NimSDKOptionConfig { ...@@ -43,8 +44,10 @@ class NimSDKOptionConfig {
String appEnv = BaseApp.Companion.getInstance().getGlobalConfig().getAppEnv(); String appEnv = BaseApp.Companion.getInstance().getGlobalConfig().getAppEnv();
//debug包根据url判断使用正式或者测试key //debug包根据url判断使用正式或者测试key
if (!TextUtils.isEmpty(YDLCacheUtils.Companion.getCacheApi())) { String cacheAppEnv = YDLCacheUtils.Companion.getCacheApi();
if (YDLConstants.ENV_TEST.equals(appEnv)) { //这边不能加BuildConfig.DEBUG,因为发布了aar之后,必定为release,导致切换云信的环境失败
if (!TextUtils.isEmpty(cacheAppEnv)) {
if (YDLConstants.ENV_TEST.equals(cacheAppEnv)) {
options.appKey = "9a8cefe97b7690537fc1334091af9208"; options.appKey = "9a8cefe97b7690537fc1334091af9208";
} else { } else {
options.appKey = "4e258ba5cdf489fa188274ebf0fb5669"; options.appKey = "4e258ba5cdf489fa188274ebf0fb5669";
......
...@@ -483,7 +483,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -483,7 +483,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
try { try {
good_num_icons.setGrade(Float.parseFloat(good_num)); good_num_icons.setGrade(Float.parseFloat(good_num));
}catch (Exception e) { } catch (Exception e) {
LogUtil.i(e.toString()); LogUtil.i(e.toString());
} }
...@@ -513,7 +513,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -513,7 +513,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private void initCommentBanner() { private void initCommentBanner() {
if (ActionHandlerStorage.getL(sessionId).getInfo().commentList.size() == 0) { if (ActionHandlerStorage.getL(sessionId).getInfo().commentList.size() == 0) {
comment_banner_view_ll.setVisibility(View.GONE); comment_banner_view_ll.setVisibility(View.GONE);
return ; return;
} }
int commentCounter = ActionHandlerStorage.getL(sessionId).getInfo().commentCounter; int commentCounter = ActionHandlerStorage.getL(sessionId).getInfo().commentCounter;
...@@ -531,7 +531,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -531,7 +531,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
im_focus_btn.setText("已关注"); im_focus_btn.setText("已关注");
im_focus_btn.setTextColor(Color.parseColor("#999999")); im_focus_btn.setTextColor(Color.parseColor("#999999"));
im_focus_btn.setBackgroundResource(R.drawable.im_unfocus_btn_bg); im_focus_btn.setBackgroundResource(R.drawable.im_unfocus_btn_bg);
}else { } else {
im_focus_btn.setText("关注"); im_focus_btn.setText("关注");
im_focus_btn.setTextColor(Color.parseColor("#1DA1F2")); im_focus_btn.setTextColor(Color.parseColor("#1DA1F2"));
im_focus_btn.setBackgroundResource(R.drawable.im_focus_btn_bg); im_focus_btn.setBackgroundResource(R.drawable.im_focus_btn_bg);
...@@ -548,20 +548,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -548,20 +548,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
// 未关注才能进行关注 // 未关注才能进行关注
if (ActionHandlerStorage.getL(sessionId).getInfo().isFollowed == false) { if (ActionHandlerStorage.getL(sessionId).getInfo().isFollowed == false) {
ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = true; ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = true;
ServiceImpl.Companion.getInstance().focus(new FocusParams(ActionHandlerStorage.getL(sessionId).getInfo().toUid, "1")) ServiceImpl.Companion.getInstance().focus(ActionHandlerStorage.getL(sessionId).getInfo().doctorId, "1")
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> { .subscribe(res -> {
if (res.code == 0) { if ("200".equals(res.code)) {
String status = String.valueOf(res.status); ToastUtil.toastShort("关注成功");
if ("1".equals(status)) { im_focus_btn.setText("已关注");
ToastUtil.toastShort("关注成功"); im_focus_btn.setTextColor(Color.parseColor("#999999"));
im_focus_btn.setText("已关注"); im_focus_btn.setBackgroundResource(R.drawable.im_unfocus_btn_bg);
im_focus_btn.setTextColor(Color.parseColor("#999999")); if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
im_focus_btn.setBackgroundResource(R.drawable.im_unfocus_btn_bg); ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = true;
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = true;
}
} }
} }
}, throwable -> { }, throwable -> {
...@@ -582,7 +579,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -582,7 +579,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
View rela_zixun = rootView.findViewById(R.id.rela_zixun); View rela_zixun = rootView.findViewById(R.id.rela_zixun);
rela_zixun.setOnClickListener(view -> { rela_zixun.setOnClickListener(view -> {
if (sessionId!= null && ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) { if (sessionId != null && ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (expertConsultServiceListDialog == null) { if (expertConsultServiceListDialog == null) {
ServiceImpl.Companion.getInstance().serviceList(ActionHandlerStorage.getL(sessionId).getInfo().doctorId) ServiceImpl.Companion.getInstance().serviceList(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
...@@ -593,12 +590,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -593,12 +590,12 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
expertConsultServiceListDialog = new ExpertConsultServiceListDialog(getActivity(), res.data); expertConsultServiceListDialog = new ExpertConsultServiceListDialog(getActivity(), res.data);
expertConsultServiceListDialog.show(); expertConsultServiceListDialog.show();
} }
}else { } else {
ToastUtil.toastShort("咨询师暂未发布服务"); ToastUtil.toastShort("咨询师暂未发布服务");
} }
}, throwable -> { }, throwable -> {
}); });
}else { } else {
expertConsultServiceListDialog.show(); expertConsultServiceListDialog.show();
} }
} else { } else {
......
...@@ -51,9 +51,9 @@ interface ServiceApi{ ...@@ -51,9 +51,9 @@ interface ServiceApi{
fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>> fun submitUserCollect(@Body body: RequestBody): Observable<BaseAPIResponse<Any>>
//关注 //关注
@FormUrlEncoded @GET("consult/expert-page/toggle-follow")
@POST("sq-active/focus") @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun focus(@FieldMap params: Map<String, String>): Observable<BaseResponse<FocusBean>> fun focus(@Query("doctorId") doctorId: String, @Query("status") status: String): Observable<BaseAPIResponse<Any>>
//服务列表 //服务列表
@GET("consult/expert-page/products") @GET("consult/expert-page/products")
......
...@@ -72,9 +72,8 @@ class ServiceImpl private constructor(){ ...@@ -72,9 +72,8 @@ class ServiceImpl private constructor(){
/** /**
* 关注用户 * 关注用户
*/ */
fun focus(param: FocusParams): Observable<BaseResponse<FocusBean>> { fun focus(doctorId: String, status: String): Observable<BaseAPIResponse<Any>> {
return RxUtils.mapObservable(param) return YDLHttpUtils.obtainApi(ServiceApi::class.java).focus(doctorId, status)
.flatMap { YDLHttpUtils.obtainApi(ServiceApi::class.java).focus(it) }
} }
/** /**
......
package com.yidianling.uikit.custom.http.request package com.yidianling.uikit.custom.http.request
class FocusParams( class FocusParams(
val id: String, //话题id或用户uid val doctorId: String, //话题id或用户uid
val type: String//业务类型:1关注用户,2关注话题 val status: String//业务类型:1关注用户,2关注话题
) )
\ No newline at end of file
package com.yidianling.uikit.custom.http.response
class FocusBean (
val status: Int
)
\ No newline at end of file
...@@ -5,9 +5,11 @@ import android.text.TextUtils ...@@ -5,9 +5,11 @@ import android.text.TextUtils
import com.channel.ydl_flutter_base.BuildConfig import com.channel.ydl_flutter_base.BuildConfig
import com.channel.ydl_flutter_base.base.BaseFlutterFragment import com.channel.ydl_flutter_base.base.BaseFlutterFragment
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.data.PlatformDataManager import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.SharedPreferencesEditor import com.ydl.ydlcommon.utils.SharedPreferencesEditor
import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxDeviceTool import com.yidianling.common.tools.RxDeviceTool
import io.flutter.app.FlutterActivity import io.flutter.app.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine import io.flutter.embedding.engine.FlutterEngine
...@@ -55,7 +57,17 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler { ...@@ -55,7 +57,17 @@ class YDLCommonPlugin : MethodChannel.MethodCallHandler {
val loginBean = ModularServiceManager.getPlatformUserService()?.getUser() val loginBean = ModularServiceManager.getPlatformUserService()?.getUser()
val mMap = mutableMapOf<String, Any>() val mMap = mutableMapOf<String, Any>()
var uid = loginBean?.userId ?: "" var uid = loginBean?.userId ?: ""
mMap["isDevelopment"] = false
val appEnv = BaseApp.instance.getGlobalConfig().appEnv
val cacheAppEnv = YDLCacheUtils.getCacheApi()
var isDevelopment: Boolean = false
if (!TextUtils.isEmpty(cacheAppEnv)) {
isDevelopment = YDLConstants.ENV_TEST == cacheAppEnv
} else {
isDevelopment = YDLConstants.ENV_TEST == appEnv || YDLConstants.ENV_AUTO_TEST == appEnv
}
mMap["isDevelopment"] = isDevelopment
mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid mMap["uid"] = if (TextUtils.isEmpty(uid)) "0" else uid
mMap["accessToken"] = loginBean?.token ?: "" mMap["accessToken"] = loginBean?.token ?: ""
?: "" ?: ""
......
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