当前位置:网站首页>Server to server (S2S) event (adjust)
Server to server (S2S) event (adjust)
2022-07-07 13:27:00 【Daisy knowledge】
<?php
namespace App\Services;
use App\Models\GoogleAffiliateModel;
use Illuminate\Support\Facades\Http;
class AdjustService
{
protected $adjust_event_uri;
protected $app_token; // On the control panel Adjust Application ID
protected $s2s; //s2s Parameter set to 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 Report data events */
public function adjustUpload($order)
{
// Get google advertisement ID notes : From the client to the server
$googleAdId = 'xxxxxxxxx';
if (empty($googleAdId)) {
return;
}
// Pass the parameters of the request
$request = [
's2s' => $this->s2s,
'gps_adid' => $googleAdId, // Currently only for Android (android:gps_adid ios:idfa)
'app_token' => $this->app_token,
'event_token' => 'xxxxxxx', // On the control panel Adjust Event ID
'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 Report {
$order->item_category->label()} Event response parameters ", [
'request' => $request,
'responseStatus' => $response->status(),
'responseJson' => $response->json()
]);
if ($response->successful()) {
return $response->json();
}
\Log::error("adjust Report {
$order->item_category->label()} Event failed .");
}
}
边栏推荐
- Practical example of propeller easydl: automatic scratch recognition of industrial parts
- Cinnamon 任务栏网速
- “新红旗杯”桌面应用创意大赛2022
- [untitled]
- Final review notes of single chip microcomputer principle
- MongoDB的用户管理总结
- Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
- PACP学习笔记一:使用 PCAP 编程
- Mongodb meets spark (for integration)
- MongoDB的导入导出、备份恢复总结
猜你喜欢

Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~

MATLAB中polarscatter函数使用
![[learning notes] zkw segment tree](/img/18/21f455a06e8629243fc5cf4df0044c.png)
[learning notes] zkw segment tree

将数学公式在el-table里面展示出来

My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime

1. Deep copy 2. Call apply bind 3. For of in differences

JS缓动动画原理教学(超细节)

自定义线程池拒绝策略

ESP32构解工程添加组件

我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
随机推荐
Distributed transaction solution
ROS机器人更换新雷达需要重新配置哪些参数
Read PG in data warehouse in one article_ stat
[untitled]
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours
MongoDB的用户管理总结
[untitled]
Mongodb command summary
LIS 最长上升子序列问题(动态规划、贪心+二分)
数字ic设计——SPI
RecyclerView的数据刷新
10 张图打开 CPU 缓存一致性的大门
JS中为什么基础数据类型可以调用方法
Scrapy教程经典实战【新概念英语】
【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...
Simple and easy-to-use code specification
Grep of three swordsmen in text processing
Test next summary
【学习笔记】AGC010
[untitled]