Commit 131b3c18 by 严久程

设置设备信息

parent 8c9bb5d7
...@@ -8,9 +8,9 @@ ext { ...@@ -8,9 +8,9 @@ ext {
"m-confide" : "0.0.48.73", "m-confide" : "0.0.48.73",
"m-consultant" : "0.0.59.23", "m-consultant" : "0.0.59.23",
"m-fm" : "0.0.30.00", "m-fm" : "0.0.30.00",
"m-user" : "0.0.60.20", "m-user" : "0.0.60.21",
"m-home" : "0.0.22.20", "m-home" : "0.0.22.20",
"m-im" : "0.0.18.13", "m-im" : "0.0.18.14",
"m-dynamic" : "0.0.7.70", "m-dynamic" : "0.0.7.70",
"m-article" : "0.0.0.6", "m-article" : "0.0.0.6",
......
package com.yidianling.user; package com.yidianling.user;
import android.annotation.SuppressLint;
import android.util.Log; import android.util.Log;
import com.ydl.ydlcommon.data.http.RxUtils; import com.ydl.ydlcommon.data.http.RxUtils;
import com.ydl.ydlcommon.data.http.ThrowableConsumer; import com.ydl.ydlcommon.data.http.ThrowableConsumer;
...@@ -13,6 +14,8 @@ import com.yidianling.user.http.UserHttpImpl; ...@@ -13,6 +14,8 @@ import com.yidianling.user.http.UserHttpImpl;
import com.yidianling.user.http.request.ChannelIdParam; import com.yidianling.user.http.request.ChannelIdParam;
import de.greenrobot.event.EventBus; import de.greenrobot.event.EventBus;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
/** /**
...@@ -25,6 +28,7 @@ public class LoginHelper { ...@@ -25,6 +28,7 @@ public class LoginHelper {
public static boolean isRegister; public static boolean isRegister;
@SuppressLint("CheckResult")
public static void setChannelId() { public static void setChannelId() {
String channelId = JPushUtils.INSTANCE.getRegistrationID(); String channelId = JPushUtils.INSTANCE.getRegistrationID();
...@@ -32,13 +36,15 @@ public class LoginHelper { ...@@ -32,13 +36,15 @@ public class LoginHelper {
UserHttp userHttp = UserHttpImpl.Companion.getInstance(); UserHttp userHttp = UserHttpImpl.Companion.getInstance();
userHttp.channelId(new ChannelIdParam(channelId)) userHttp.channelId(new ChannelIdParam(channelId))
.compose(RxUtils.resultData()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(map -> { .subscribe(it -> {
if (map.get("upload_log").equals("1")) { if (it.data!=null){
LogHelper.Companion.getInstance().uploadLog(false); if (it.data.get("upload_log").equals("1")) {
LogHelper.Companion.getInstance().uploadLog(false);
}
Log.d("TAG", "setChannelId: ");
} }
Log.d("TAG", "setChannelId: ");
}, new ThrowableConsumer() { }, new ThrowableConsumer() {
@Override @Override
public void accept(@NotNull String msg) { public void accept(@NotNull String msg) {
......
...@@ -58,9 +58,9 @@ interface UserApi { ...@@ -58,9 +58,9 @@ interface UserApi {
fun register(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>> fun register(@FieldMap params: Map<String, String>): Observable<BaseResponse<Any>>
//设置推送的channelId //设置推送的channelId
@FormUrlEncoded @POST("user/device/modify")
@POST("user/set-channel-id") @Headers( YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun setChannelId(@FieldMap params: Map<String, String>): Observable<BaseResponse<LinkedTreeMap<String, String>>> fun setChannelId(@Body body: RequestBody): Observable<BaseResponse<LinkedTreeMap<String, String>>>
//第三方登录 //第三方登录
@POST("user/user_q_w") @POST("user/user_q_w")
......
...@@ -99,8 +99,9 @@ class UserHttpImpl private constructor() : UserHttp { ...@@ -99,8 +99,9 @@ class UserHttpImpl private constructor() : UserHttp {
} }
override fun channelId(param: ChannelIdParam): Observable<BaseResponse<LinkedTreeMap<String, String>>> { override fun channelId(param: ChannelIdParam): Observable<BaseResponse<LinkedTreeMap<String, String>>> {
return RxUtils.mapObservable(param) var param: String = Gson().toJson(param)
.flatMap { getUserApi().setChannelId(it) } val body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), param)
return getUserApi().setChannelId(body)
} }
override fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponseBean>> { override fun thirdPartLogin(param: ThirdLoginParam): Observable<BaseAPIResponse<UserResponseBean>> {
......
package com.yidianling.user.http.request package com.yidianling.user.http.request
import com.ydl.ydlcommon.base.BaseApp
import com.yidianling.common.tools.RxNetTool
/** /**
* author : Zhangwenchao * author : Zhangwenchao
* e-mail : zhangwch@yidianling.com * e-mail : zhangwch@yidianling.com
* time : 2018/02/05 * time : 2018/02/05
*/ */
data class ChannelIdParam(val channelId: String, val type: String) { data class ChannelIdParam(val channelId: String, val type: String,val netType: String) {
constructor(channelId: String): this(channelId, "android") constructor(channelId: String): this(channelId, "android",RxNetTool.getNetWorkTypeName(BaseApp.getApp()))
} }
\ No newline at end of file
...@@ -318,7 +318,7 @@ class HttpConfig { ...@@ -318,7 +318,7 @@ class HttpConfig {
.addHeader(VERSION, RxDeviceTool.getAppVersionName(BaseApp.getApp())) .addHeader(VERSION, RxDeviceTool.getAppVersionName(BaseApp.getApp()))
.addHeader( .addHeader(
OS_BUILD, OS_BUILD,
RxDeviceTool.getBuildMANUFACTURER() + "," + RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getOsBuileVersion() + "," + RxDeviceTool.getAppVersionName( RxDeviceTool.getBuildMANUFACTURER() + "," + RxDeviceTool.getBuildBrandModel() + "#" + RxDeviceTool.getOsBuileVersion() + "#" + RxDeviceTool.getAppVersionName(
BaseApp.getApp() BaseApp.getApp()
) )
) )
......
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