当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- Query whether a field has an index with MySQL
- JNA学习笔记一:概念
- File operation command
- [binary tree] delete points to form a forest
- PCAP学习笔记二:pcap4j源码笔记
- Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
- 详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
- AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
- 国泰君安证券开户怎么开的?开户安全吗?
- PACP学习笔记一:使用 PCAP 编程
猜你喜欢
Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
【Presto Profile系列】Timeline使用
- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net
Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
Cookie
leecode3. 无重复字符的最长子串
About the problem of APP flash back after appium starts the app - (solved)
HZOJ #240. 图形打印四
Practical example of propeller easydl: automatic scratch recognition of industrial parts
随机推荐
《ASP.NET Core 6框架揭秘》样章[200页/5章]
通过Keil如何查看MCU的RAM与ROM使用情况
2022 polymerization process test question simulation test question bank and online simulation test
线程池拒绝策略最佳实践
CMU15445 (Fall 2019) 之 Project#2 - Hash Table 详解
【学习笔记】线段树选做
飞桨EasyDL实操范例:工业零件划痕自动识别
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
SSM框架搭建的步骤
非分区表转换成分区表以及注意事项
Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
Common text processing tools
初学XML
Find ID value MySQL in string
- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net
AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
学习突围2 - 关于高效学习的方法
HZOJ #240. 图形打印四
为租客提供帮助
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?