vivo归因
This commit is contained in:
parent
801df735c0
commit
c0cc5157f0
|
|
@ -16,6 +16,10 @@ import com.ruoyi.system.domain.OppoCheck;
|
||||||
import com.ruoyi.system.service.IClewPhoneService;
|
import com.ruoyi.system.service.IClewPhoneService;
|
||||||
import com.ruoyi.system.service.ISysUserService;
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import okhttp3.MediaType;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
|
@ -172,6 +176,37 @@ public class ClewController extends BaseController
|
||||||
return toAjax(clewService.insertClew(clew));
|
return toAjax(clewService.insertClew(clew));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//huawei-归因
|
||||||
|
public String getHuaWeiToken(){
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String send() throws Exception{
|
||||||
|
JSONObject vivoJson = new JSONObject();
|
||||||
|
vivoJson.put("srcType", "APP");
|
||||||
|
vivoJson.put("pkgName", "");
|
||||||
|
vivoJson.put("pageUrl", "");
|
||||||
|
vivoJson.put("srcId", "");
|
||||||
|
vivoJson.put("dataFrom", "0");
|
||||||
|
String url = "https://sandbox-marketing-api.vivo.com.cn/openapi/v1/advertiser/behavior/upload";
|
||||||
|
String advertiserId = "X";
|
||||||
|
String nonce = "XX";
|
||||||
|
String accessToken = "595a46633e3f8162363a37092037a436f62e4d462102ddbf3eb503fa52017b93";
|
||||||
|
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||||
|
OkHttpClient client = new OkHttpClient().newBuilder().build();
|
||||||
|
MediaType mediaType = MediaType.parse("application/json");
|
||||||
|
String jsonStr = "XX"; //使用请求参数的json串替换,格式如下方示例
|
||||||
|
okhttp3.RequestBody body = okhttp3.RequestBody.create(mediaType, jsonStr);
|
||||||
|
Request request = new Request.Builder()
|
||||||
|
.url(url + "?access_token=" + accessToken + "×tamp=" + timestamp + "&nonce=" + nonce + "&advertiser_id=" + advertiserId)
|
||||||
|
.method("POST", body)
|
||||||
|
.addHeader("Content-Type", "application/json")
|
||||||
|
.build();
|
||||||
|
Response response = client.newCall(request).execute();
|
||||||
|
return response.body().string();
|
||||||
|
}
|
||||||
|
|
||||||
public static String encode(byte[] data) throws GeneralSecurityException {
|
public static String encode(byte[] data) throws GeneralSecurityException {
|
||||||
final Key dataKey = new SecretKeySpec(Base64.decodeBase64("XGAXicVG5GMBsx5bueOe4w=="), "AES");
|
final Key dataKey = new SecretKeySpec(Base64.decodeBase64("XGAXicVG5GMBsx5bueOe4w=="), "AES");
|
||||||
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue