当前位置:网站首页>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 .");
}
}
边栏推荐
- xshell连接服务器把密钥登陆改为密码登陆
- MATLAB中polarscatter函数使用
- 解决缓存击穿问题
- Storage principle inside mongodb
- 一文读懂数仓中的pg_stat
- [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
- ESP32系列专栏
- High end for 8 years, how is Yadi now?
- Cinnamon 任务栏网速
- MongoDB复制(副本集)总结
猜你喜欢

Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set

Sed of three swordsmen in text processing

靠卖概念上市,认养一头牛能走多远?

Final review notes of single chip microcomputer principle

Distributed transaction solution

基于鲲鹏原生安全,打造安全可信的计算平台

Digital IC Design SPI

我那“不好惹”的00后下属:不差钱,怼领导,抵制加班

线程池拒绝策略最佳实践

日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
随机推荐
“新红旗杯”桌面应用创意大赛2022
靠卖概念上市,认养一头牛能走多远?
Mongodb slice summary
如何让join跑得更快?
User management summary of mongodb
Awk of three swordsmen in text processing
【等保】云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
【学习笔记】线段树选做
High end for 8 years, how is Yadi now?
[etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
Test next summary
【学习笔记】AGC010
Milkdown 控件图标
RealBasicVSR测试图片、视频
centso7 openssl 报错Verify return code: 20 (unable to get local issuer certificate)
Vscode编辑器ESP32头文件波浪线不跳转彻底解决
Grep of three swordsmen in text processing
Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
MongoDB的导入导出、备份恢复总结
【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...