|
|
@@ -1,6 +1,5 @@ |
|
|
|
package cn.binarywang.wx.miniapp.util.json; |
|
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeData; |
|
|
|
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; |
|
|
|
import com.google.gson.JsonElement; |
|
|
|
import com.google.gson.JsonObject; |
|
|
@@ -9,8 +8,12 @@ import com.google.gson.JsonSerializer; |
|
|
|
|
|
|
|
import java.lang.reflect.Type; |
|
|
|
|
|
|
|
/** |
|
|
|
* . |
|
|
|
* |
|
|
|
* @author S |
|
|
|
*/ |
|
|
|
public class WxMaSubscribeMessageGsonAdapter implements JsonSerializer<WxMaSubscribeMessage> { |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonElement serialize(WxMaSubscribeMessage message, Type typeOfSrc, JsonSerializationContext context) { |
|
|
|
JsonObject messageJson = new JsonObject(); |
|
|
@@ -20,7 +23,6 @@ public class WxMaSubscribeMessageGsonAdapter implements JsonSerializer<WxMaSubsc |
|
|
|
messageJson.addProperty("page", message.getPage()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
JsonObject data = new JsonObject(); |
|
|
|
messageJson.add("data", data); |
|
|
|
|
|
|
@@ -28,7 +30,7 @@ public class WxMaSubscribeMessageGsonAdapter implements JsonSerializer<WxMaSubsc |
|
|
|
return messageJson; |
|
|
|
} |
|
|
|
|
|
|
|
for (WxMaSubscribeData datum : message.getData()) { |
|
|
|
for (WxMaSubscribeMessage.Data datum : message.getData()) { |
|
|
|
JsonObject dataJson = new JsonObject(); |
|
|
|
dataJson.addProperty("value", datum.getValue()); |
|
|
|
data.add(datum.getName(), dataJson); |
|
|
|