This commit is contained in:
wangcongtao
2020-01-07 21:04:56 +08:00
parent 75d699ed9a
commit 5799e932a6
3 changed files with 73 additions and 2 deletions

View File

@@ -31,7 +31,6 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
private static final String TAG = "SocketManager";
public static final int MSG_PRODUCT_LINE = MogoCommon.Product.mogoBussiness_VALUE;
private static final int MSG_HEADER_TYPE = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
@@ -86,7 +85,7 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
Logger.d( TAG, "received msg type = %d", msgType );
IMogoOnMessageListener listener = mListeners.get( msgType );
if ( listener != null ) {
listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toString(), listener.target() ) );
listener.onMsgReceived( GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() ) );
}
} catch ( InvalidProtocolBufferException e ) {
Logger.e( TAG, "parse msg error.", e );

View File

@@ -0,0 +1,25 @@
package com.mogo.module.extensions.net;
import com.mogo.module.extensions.weather.WebWeatherData;
import io.reactivex.Observer;
import retrofit2.http.GET;
import retrofit2.http.Query;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 描述
*/
public interface NetApiServices {
/**
* 天气接口
*
* @param area 城市Id
* @return
*/
@GET( "/common/?type=observe&key=a2c37c5b84a29761bf0abf8b98e6b708" )
Observer< WebWeatherData > requestWeatherData( @Query( "area" ) String area );
}

View File

@@ -0,0 +1,47 @@
package com.mogo.module.extensions.weather;
import com.google.gson.annotations.SerializedName;
/**
* @author congtaowang
* @since 2020-01-07
* <p>
* 天气数据描述
*/
public class WebWeatherData {
@SerializedName( "observe" )
public ObserveDataType observe;
/**
* 实时数据
*/
public static class ObserveDataType {
@SerializedName( "101010200" )
public ObserveData data;
}
/**
* 实时数据对象
*/
public static class ObserveData {
@SerializedName( "1001002" )
public Data data;
}
/**
* what the fuck.
*/
public static class Data {
@SerializedName( "000" )
public String time;
@SerializedName( "001" )
public String phenomena;
@SerializedName( "002" )
public String temperature;
@SerializedName( "003" )
public String windForce;
@SerializedName( "004" )
public String windDirection;
}
}