mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
#978 增加微信营销相关接口
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpAdLead implements Serializable {
|
||||
private static final long serialVersionUID = -8889087268596440407L;
|
||||
/**
|
||||
* 点击ID
|
||||
*/
|
||||
@SerializedName("click_id")
|
||||
private String click_id;
|
||||
/**
|
||||
* 广告组ID
|
||||
*/
|
||||
@SerializedName("adgroup_id")
|
||||
private Long adgroup_id;
|
||||
/**
|
||||
* 广告组名称
|
||||
*/
|
||||
@SerializedName("adgroup_name")
|
||||
private String adgroup_name;
|
||||
/**
|
||||
* 推广计划ID
|
||||
*/
|
||||
@SerializedName("campaign_id")
|
||||
private Long campaign_id;
|
||||
/**
|
||||
* 推广计划名称
|
||||
*/
|
||||
@SerializedName("campaign_name")
|
||||
private String campaign_name;
|
||||
/**
|
||||
* 代理ID
|
||||
*/
|
||||
@SerializedName("agency_id")
|
||||
private String agency_id;
|
||||
/**
|
||||
* 代理名称
|
||||
*/
|
||||
@SerializedName("agency_name")
|
||||
private String agency_name;
|
||||
/**
|
||||
* 销售线索信息
|
||||
*/
|
||||
@SerializedName("leads_info")
|
||||
private List<WxMpAdLeadInfo> leads_info;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpAdLeadFilter implements Serializable {
|
||||
private static final long serialVersionUID = -1469998986497327439L;
|
||||
private String field;
|
||||
private String operator;
|
||||
private List<String> values;
|
||||
|
||||
public JsonObject toJsonObject() {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("field", field);
|
||||
json.addProperty("operator", operator);
|
||||
if (values != null) {
|
||||
JsonArray vs = new JsonArray();
|
||||
for (String value : values) {
|
||||
vs.add(value);
|
||||
}
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpAdLeadInfo implements Serializable {
|
||||
private static final long serialVersionUID = -6462312242780350479L;
|
||||
@SerializedName("key")
|
||||
private String key;
|
||||
@SerializedName("value")
|
||||
private String value;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpAdLeadPageInfo implements Serializable {
|
||||
private static final long serialVersionUID = -896765006445604780L;
|
||||
@SerializedName("page")
|
||||
private Integer page;
|
||||
@SerializedName("page_size")
|
||||
private Integer pageSize;
|
||||
@SerializedName("total_page")
|
||||
private Integer totalPage;
|
||||
@SerializedName("total_number")
|
||||
private Integer totalNumber;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
@Data
|
||||
public class WxMpAdLeadResult implements Serializable {
|
||||
private static final long serialVersionUID = -1526796632563660821L;
|
||||
protected static final JsonParser JSON_PARSER = new JsonParser();
|
||||
|
||||
@SerializedName("page_info")
|
||||
private WxMpAdLeadPageInfo pageInfo;
|
||||
@SerializedName("list")
|
||||
private List<WxMpAdLead> adLeads;
|
||||
|
||||
public static WxMpAdLeadResult fromJson(String json) {
|
||||
|
||||
return WxMpGsonBuilder.create().fromJson(
|
||||
JSON_PARSER.parse(json).getAsJsonObject().get("data"),
|
||||
new TypeToken<WxMpAdLeadResult>() {
|
||||
}.getType());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class WxMpUserAction implements Serializable {
|
||||
private static final long serialVersionUID = 7042393762652152209L;
|
||||
private Long userActionSetId;
|
||||
private String url;
|
||||
private Boolean actionTime;
|
||||
private String actionType;
|
||||
private String clickId;
|
||||
private Integer actionParam;
|
||||
|
||||
public JsonObject toJsonObject() {
|
||||
JsonObject json = new JsonObject();
|
||||
json.addProperty("user_action_set_id", this.userActionSetId);
|
||||
json.addProperty("url", this.url);
|
||||
json.addProperty("action_time", this.actionTime);
|
||||
if (this.clickId != null) {
|
||||
JsonObject traceJson = new JsonObject();
|
||||
traceJson.addProperty("click_id", this.clickId);
|
||||
json.add("trace", traceJson);
|
||||
}
|
||||
if (this.actionParam != null) {
|
||||
JsonObject actionParamJson = new JsonObject();
|
||||
actionParamJson.addProperty("value", actionParam);
|
||||
json.add("action_param", actionParamJson);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package me.chanjar.weixin.mp.bean.marketing;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author <a href="https://github.com/007gzs">007</a>
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class WxMpUserActionSet implements Serializable {
|
||||
private static final long serialVersionUID = 1979861770645159905L;
|
||||
protected static final JsonParser JSON_PARSER = new JsonParser();
|
||||
|
||||
/**
|
||||
* user_action_set_id
|
||||
* 用户行为源名称
|
||||
*/
|
||||
@SerializedName("user_action_set_id")
|
||||
private Long userActionSetId;
|
||||
|
||||
/**
|
||||
* title.
|
||||
* 用户行为源描述
|
||||
*/
|
||||
@SerializedName("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* activate_status.
|
||||
* 数据接入状态, true 表示已接入, false 表示未接入
|
||||
*/
|
||||
@SerializedName("activate_status")
|
||||
private Boolean activate_status;
|
||||
|
||||
/**
|
||||
* created_time.
|
||||
* 创建时间
|
||||
*/
|
||||
@SerializedName("created_time")
|
||||
private String createdTime;
|
||||
|
||||
public static List<WxMpUserActionSet> fromJson(String json) {
|
||||
return WxMpGsonBuilder.create().fromJson(
|
||||
JSON_PARSER.parse(json).getAsJsonObject().get("data").getAsJsonObject().get("list"),
|
||||
new TypeToken<List<WxMpUserActionSet>>() {
|
||||
}.getType());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user