当前位置:网站首页>服务器到服务器 (S2S) 事件 (Adjust)
服务器到服务器 (S2S) 事件 (Adjust)
2022-07-07 11:08:00 【雏菊小识】
<?php
namespace App\Services;
use App\Models\GoogleAffiliateModel;
use Illuminate\Support\Facades\Http;
class AdjustService
{
protected $adjust_event_uri;
protected $app_token; //控制面板上的 Adjust 应用识别码
protected $s2s; //s2s 参数设置为 1
protected $environment;
public function __construct()
{
$this->s2s = 1;
$this->app_token = 'xxxxxxxx';
$this->adjust_event_uri = 'https://s2s.adjust.com/event';
if (app()->environment('production')) {
$this->environment = 'production';
} else {
$this->environment = 'sandbox';
}
}
/** * adjust 上报数据事件 */
public function adjustUpload($order)
{
//拿到google广告ID 注:客户端传给服务端
$googleAdId = 'xxxxxxxxx';
if (empty($googleAdId)) {
return;
}
//传递请求的参数
$request = [
's2s' => $this->s2s,
'gps_adid' => $googleAdId, //目前只针对安卓 (android:gps_adid ios:idfa)
'app_token' => $this->app_token,
'event_token' => 'xxxxxxx', //控制面板上的 Adjust事件识别码
'created_at_unix' => time(),
'revenue' => $order->amount,
'currency' => $order->currency,
'orderId' => $order->id,
'environment' => $this->environment
];
$response = Http::asForm()->withHeaders(['Content-Type' => 'application/x-www-form-urlencoded'])->post($this->adjust_event_uri, $request);
\Log::info("adjust上报{
$order->item_category->label()}事件响应参数", [
'request' => $request,
'responseStatus' => $response->status(),
'responseJson' => $response->json()
]);
if ($response->successful()) {
return $response->json();
}
\Log::error("adjust上报{
$order->item_category->label()}事件失败.");
}
}
边栏推荐
- Image pixel read / write operation
- Design and implementation of communication protocol
- 解决缓存击穿问题
- [learn microservice from 0] [01] what is microservice
- What if the xshell evaluation period has expired
- Differences between MySQL storage engine MyISAM and InnoDB
- [untitled]
- ip2long与long2IP 分析
- @What is the difference between resource and @autowired?
- Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
猜你喜欢
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
Visual stdio 2017 about the environment configuration of opencv4.1
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf
Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
Differences between MySQL storage engine MyISAM and InnoDB
3D content generation based on nerf
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
随机推荐
Cookie and session comparison
【学习笔记】线段树选做
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf
Cookie
Cmu15445 (fall 2019) project 2 - hash table details
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
HZOJ #235. Recursive implementation of exponential enumeration
【无标题】
ORACLE进阶(五)SCHEMA解惑
初学XML
JNA学习笔记一:概念
How to reset Google browser? Google Chrome restore default settings?
Leetcode skimming: binary tree 21 (verifying binary search tree)
【无标题】
Four functions of opencv
企业级自定义表单引擎解决方案(十二)--体验代码目录结构
Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
Guangzhou held work safety conference
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~