Commit 131b3c18 by 严久程

设置设备信息

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