当前位置:网站首页>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 .");
}
}
边栏推荐
猜你喜欢
Japanese government and enterprise employees got drunk and lost 460000 information USB flash drives. They publicly apologized and disclosed password rules
Vscade editor esp32 header file wavy line does not jump completely solved
Cinnamon 任务栏网速
Differences between MySQL storage engine MyISAM and InnoDB
cmake 学习使用笔记(一)
How to make join run faster?
Final review notes of single chip microcomputer principle
基于鲲鹏原生安全,打造安全可信的计算平台
靠卖概念上市,认养一头牛能走多远?
About the problem of APP flash back after appium starts the app - (solved)
随机推荐
JS中为什么基础数据类型可以调用方法
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
xshell连接服务器把密钥登陆改为密码登陆
Introduction and basic use of stored procedures
[etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
Analysis of DHCP dynamic host setting protocol
【学习笔记】线段树选做
Esp32 construction engineering add components
Realbasicvsr test pictures and videos
Storage principle inside mongodb
JS function 返回多个值
单片机学习笔记之点亮led 灯
MongoDB 遇见 spark(进行整合)
[Presto profile series] timeline use
[untitled]
Mongodb replication (replica set) summary
JNA learning notes 1: Concepts
JS determines whether an object is empty
OSI seven layer model
Japanese government and enterprise employees got drunk and lost 460000 information USB flash drives. They publicly apologized and disclosed password rules