|
@@ -63,7 +63,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
object.put("items", Collections.singletonList(param));
|
|
object.put("items", Collections.singletonList(param));
|
|
|
//若添加成功,API返回应用uuid和 app_key
|
|
//若添加成功,API返回应用uuid和 app_key
|
|
|
//修改时应该使用put 新增使用post
|
|
//修改时应该使用put 新增使用post
|
|
|
- String res=TakuRequestUtil.doRequest(StringUtils.isNotBlank(param.getUuid())? HttpPut.METHOD_NAME:HttpPost.METHOD_NAME, API_VERSION_V3 + "/apps", object.toJSONString());
|
|
|
|
|
|
|
+ String res=TakuRequestUtil.doRequest(StringUtils.isNotBlank(param.getUuid())? HttpPut.METHOD_NAME:HttpPost.METHOD_NAME, API_VERSION_V3 + "/apps", object.toJSONString(),param.getTakuPublicKey());
|
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
JSONObject jsonObject = JSON.parseObject(res);
|
|
|
// 1. 优先检查错误列表 (errs)
|
|
// 1. 优先检查错误列表 (errs)
|
|
|
if (jsonObject.containsKey("errs")) {
|
|
if (jsonObject.containsKey("errs")) {
|
|
@@ -96,8 +96,8 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 查询应用列表
|
|
* 查询应用列表
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultTable<AppV1View> getAppList() {
|
|
|
|
|
- String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/apps", null);
|
|
|
|
|
|
|
+ public ResultTable<AppV1View> getAppList(String takuPublicKey) {
|
|
|
|
|
+ String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/apps", null,takuPublicKey);
|
|
|
List<AppV1View> v1View = JSONArray.parseArray(res, AppV1View.class);
|
|
List<AppV1View> v1View = JSONArray.parseArray(res, AppV1View.class);
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(v1View));
|
|
return ResultTable.resultTableOk(new PageInfo<>(v1View));
|
|
|
}
|
|
}
|
|
@@ -106,10 +106,10 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 删除应用
|
|
* 删除应用
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Result<AddAppResponse> delApp(String appId) {
|
|
|
|
|
|
|
+ public Result<AddAppResponse> delApp(String appId,String takuPublicKey) {
|
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("app_ids", Collections.singletonList(appId));
|
|
object.put("app_ids", Collections.singletonList(appId));
|
|
|
- TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_apps", object.toJSONString());
|
|
|
|
|
|
|
+ TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_apps", object.toJSONString(),takuPublicKey);
|
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -137,7 +137,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
appAuthContent.setApp_id(channelParam.getNetworkAppId());
|
|
appAuthContent.setApp_id(channelParam.getNetworkAppId());
|
|
|
networkAppInfo.setApp_auth_content(appAuthContent);
|
|
networkAppInfo.setApp_auth_content(appAuthContent);
|
|
|
network.setNetwork_app_info(Collections.singletonList(networkAppInfo));
|
|
network.setNetwork_app_info(Collections.singletonList(networkAppInfo));
|
|
|
- String res = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/set_networks", JSONObject.toJSONString(network));
|
|
|
|
|
|
|
+ String res = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/set_networks", JSONObject.toJSONString(network),channelParam.getTakuPublicKey());
|
|
|
Network result = JSONObject.parseObject(res, Network.class);
|
|
Network result = JSONObject.parseObject(res, Network.class);
|
|
|
return Result.resultOk(RepMessage.RELATIVE_SUCCESS, result);
|
|
return Result.resultOk(RepMessage.RELATIVE_SUCCESS, result);
|
|
|
}
|
|
}
|
|
@@ -146,9 +146,9 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 获取广告平台维度信息
|
|
* 获取广告平台维度信息
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultTable<Network> getNetworks() {
|
|
|
|
|
|
|
+ public ResultTable<Network> getNetworks(String takuPublicKey) {
|
|
|
// 这个接口虽然没有参数但是要设置为 " ", 如果reqBody设置为NULL会报601
|
|
// 这个接口虽然没有参数但是要设置为 " ", 如果reqBody设置为NULL会报601
|
|
|
- String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/networks", "");
|
|
|
|
|
|
|
+ String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/networks", "",takuPublicKey);
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(res, Network.class)));
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(res, Network.class)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -157,7 +157,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<AddPlacementResponse> addPlacements(AddPlacementParam param) {
|
|
public ResultTable<AddPlacementResponse> addPlacements(AddPlacementParam param) {
|
|
|
- String res = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/deal_placement", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String res = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/deal_placement", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
List<AddPlacementResponse> placements = JSONArray.parseArray(res, AddPlacementResponse.class);
|
|
List<AddPlacementResponse> placements = JSONArray.parseArray(res, AddPlacementResponse.class);
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(placements));
|
|
return ResultTable.resultTableOk(new PageInfo<>(placements));
|
|
|
}
|
|
}
|
|
@@ -167,7 +167,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<?> getPlacementList(AddPlacementParam param) {
|
|
public ResultTable<?> getPlacementList(AddPlacementParam param) {
|
|
|
- String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/placements", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String res = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V1 + "/placements", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
List<AddPlacementResponse> placements = JSONArray.parseArray(res, AddPlacementResponse.class);
|
|
List<AddPlacementResponse> placements = JSONArray.parseArray(res, AddPlacementResponse.class);
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(placements));
|
|
return ResultTable.resultTableOk(new PageInfo<>(placements));
|
|
|
}
|
|
}
|
|
@@ -176,10 +176,10 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 删除广告位
|
|
* 删除广告位
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Result<?> delPlacement(List<String> placementIds) {
|
|
|
|
|
|
|
+ public Result<?> delPlacement(List<String> placementIds,String takuPublicKey) {
|
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("placement_ids", placementIds);
|
|
object.put("placement_ids", placementIds);
|
|
|
- TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_placements", object.toJSONString());
|
|
|
|
|
|
|
+ TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_placements", object.toJSONString(),takuPublicKey);
|
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -188,7 +188,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<UnitsListView> getUnitsList(UnitsListParam unitsListParam) {
|
|
public ResultTable<UnitsListView> getUnitsList(UnitsListParam unitsListParam) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V3 + "/units/list", JSON.toJSONString(unitsListParam));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V3 + "/units/list", JSON.toJSONString(unitsListParam),unitsListParam.getTakuPublicKey());
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(result, UnitsListView.class)));
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(result, UnitsListView.class)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -196,10 +196,10 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 查询广告源详情
|
|
* 查询广告源详情
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public ResultTable<UnitsView> getUnitsView(List<Integer> ids) {
|
|
|
|
|
|
|
+ public ResultTable<UnitsView> getUnitsView(List<Integer> ids,String takuPublicKey) {
|
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("ids", ids);
|
|
object.put("ids", ids);
|
|
|
- String result = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(object));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpGet.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(object),takuPublicKey);
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(result, UnitsView.class)));
|
|
return ResultTable.resultTableOk(new PageInfo<>(JSON.parseArray(result, UnitsView.class)));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -208,7 +208,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Result<?> saveUnits(UnitsParam param) {
|
|
public Result<?> saveUnits(UnitsParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
return Result.resultObjOk(JSONObject.parseObject(result, UnitsAddResponse.class));
|
|
return Result.resultObjOk(JSONObject.parseObject(result, UnitsAddResponse.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -217,7 +217,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Result<?> updateUnits(UnitsParam param) {
|
|
public Result<?> updateUnits(UnitsParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3 + "/units", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
return Result.resultObjOk(JSONObject.parseObject(result, UnitsUpdateResponse.class));
|
|
return Result.resultObjOk(JSONObject.parseObject(result, UnitsUpdateResponse.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -225,10 +225,10 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
* 删除广告源
|
|
* 删除广告源
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Result<?> delUnits(List<Integer> adsource_ids) {
|
|
|
|
|
|
|
+ public Result<?> delUnits(List<Integer> adsource_ids,String takuPublicKey) {
|
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("adsource_ids", adsource_ids);
|
|
object.put("adsource_ids", adsource_ids);
|
|
|
- TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_units", JSON.toJSONString(object));
|
|
|
|
|
|
|
+ TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V1 + "/del_units", JSON.toJSONString(object),takuPublicKey);
|
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -237,7 +237,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Result<ComprehensiveReportView> comprehensiveReport(ComprehensiveReportParam param) {
|
|
public Result<ComprehensiveReportView> comprehensiveReport(ComprehensiveReportParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V2+"/fullreport", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V2+"/fullreport", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
return Result.resultObjOk(JSONObject.parseObject(result, ComprehensiveReportView.class));
|
|
return Result.resultObjOk(JSONObject.parseObject(result, ComprehensiveReportView.class));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,7 +246,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public List<ComprehensiveAppReport> getAppReport(ComprehensiveReportParam param) {
|
|
public List<ComprehensiveAppReport> getAppReport(ComprehensiveReportParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, "/v2/fullreport", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, "/v2/fullreport", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
String records = object.getString("records");
|
|
String records = object.getString("records");
|
|
|
List<ComprehensiveAppReport> appReports = JSONArray.parseArray(records, ComprehensiveAppReport.class);
|
|
List<ComprehensiveAppReport> appReports = JSONArray.parseArray(records, ComprehensiveAppReport.class);
|
|
@@ -258,7 +258,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<ReportRoiView> getReportRoi(RoiReportParam param) {
|
|
public ResultTable<ReportRoiView> getReportRoi(RoiReportParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/roi", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/roi", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
Integer count = object.getInteger("count");
|
|
Integer count = object.getInteger("count");
|
|
|
if(Objects.nonNull(count)){
|
|
if(Objects.nonNull(count)){
|
|
@@ -274,7 +274,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<ReportRoiView> getReportRoiLtv(RoiReportParam param) {
|
|
public ResultTable<ReportRoiView> getReportRoiLtv(RoiReportParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/roi_ltv", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/roi_ltv", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
Integer count = object.getInteger("count");
|
|
Integer count = object.getInteger("count");
|
|
|
if(Objects.nonNull(count)){
|
|
if(Objects.nonNull(count)){
|
|
@@ -290,7 +290,7 @@ public class TakuApiServiceImpl implements TakuApiService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public ResultTable<HourReportView> hourReport(HourReportParam param) {
|
|
public ResultTable<HourReportView> hourReport(HourReportParam param) {
|
|
|
- String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/tk_hour", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ String result = TakuRequestUtil.doRequest(HttpPost.METHOD_NAME, API_VERSION_V3+"/report/tk_hour", JSON.toJSONString(param),param.getTakuPublicKey());
|
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
JSONObject object = JSONObject.parseObject(result);
|
|
|
Integer count = object.getInteger("count");
|
|
Integer count = object.getInteger("count");
|
|
|
if(Objects.nonNull(count)){
|
|
if(Objects.nonNull(count)){
|