当前位置:网站首页>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 .");
}
}
边栏推荐
- Common text processing tools
- Initialization script
- php——laravel缓存cache
- Day26 IP query items
- 【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...
- Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
- DrawerLayout禁止侧滑显示
- Sed of three swordsmen in text processing
- 为租客提供帮助
- Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set
猜你喜欢
存储过程的介绍与基本使用
TPG x AIDU|AI领军人才招募计划进行中!
单片机原理期末复习笔记
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
Practical example of propeller easydl: automatic scratch recognition of industrial parts
Ogre入门尝鲜
[untitled]
Final review notes of single chip microcomputer principle
Awk of three swordsmen in text processing
LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)
随机推荐
OSI seven layer model
【等保】云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
OSI 七层模型
记一次 .NET 某新能源系统 线程疯涨 分析
Sed of three swordsmen in text processing
[learning notes] zkw segment tree
基于鲲鹏原生安全,打造安全可信的计算平台
error LNK2019: 无法解析的外部符号
Cinnamon 任务栏网速
记一次 .NET 某新能源系统 线程疯涨 分析
Ikvm of toolbox Net project new progress
Why can basic data types call methods in JS
Cmake learning and use notes (1)
ROS机器人更换新雷达需要重新配置哪些参数
mysql 局域网内访问不到的问题
LED light of single chip microcomputer learning notes
MongoDB 分片总结
MySQL入门尝鲜
LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)
Pay close attention to the work of safety production and make every effort to ensure the safety of people's lives and property