Commit 207f3324 by 徐健

私聊改造关注功能修复

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