当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- 在字符串中查找id值MySQL
- Sequoia China completed the new phase of $9billion fund raising
- Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
- Sed of three swordsmen in text processing
- 抓细抓实抓好安全生产各项工作 全力确保人民群众生命财产安全
- regular expression
- Master formula. (used to calculate the time complexity of recursion.)
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- How to apply @transactional transaction annotation to perfection?
- Layer pop-up layer closing problem
猜你喜欢

Creation and assignment of graphic objects

HZOJ #240. 图形打印四

飞桨EasyDL实操范例:工业零件划痕自动识别

详细介绍六种开源协议(程序员须知)

Blog recommendation | Apache pulsar cross regional replication scheme selection practice

【学习笔记】zkw 线段树

共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf

博文推荐|Apache Pulsar 跨地域复制方案选型实践

Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]
随机推荐
HZOJ #236. 递归实现组合型枚举
Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
环境配置篇
What if the xshell evaluation period has expired
处理链中断后如何继续/子链出错removed from scheduling
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
高瓴投的澳斯康生物冲刺科创板:年营收4.5亿 丢掉与康希诺合作
Leetcode brush questions: binary tree 19 (merge binary tree)
详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
Master formula. (used to calculate the time complexity of recursion.)
HZOJ #240. 图形打印四
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
[crawler] avoid script detection when using selenium
What are the benefits of ip2long?
Day-24 UDP, regular expression
【学习笔记】AGC010
[learn wechat from 0] [00] Course Overview
Analysis of DHCP dynamic host setting protocol