当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- How does MySQL create, delete, and view indexes?
- How to continue after handling chain interruption / sub chain error removed from scheduling
- [difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
- Guangzhou held work safety conference
- 环境配置篇
- 云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
- Day-24 UDP, regular expression
- 【无标题】
- Find ID value MySQL in string
- 有什么类方法或是函数可以查看某个项目的Laravel版本的?
猜你喜欢
博文推荐|Apache Pulsar 跨地域复制方案选型实践
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
Leetcode skimming: binary tree 21 (verifying binary search tree)
处理链中断后如何继续/子链出错removed from scheduling
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
Go language learning notes - structure
DHCP 动态主机设置协议 分析
随机推荐
How to continue after handling chain interruption / sub chain error removed from scheduling
2022a special equipment related management (boiler, pressure vessel and pressure pipeline) simulated examination question bank simulated examination platform operation
[untitled]
JS中为什么基础数据类型可以调用方法
API query interface for free mobile phone number ownership
Visual stdio 2017 about the environment configuration of opencv4.1
Find ID value MySQL in string
How to reset Firefox browser
How to apply @transactional transaction annotation to perfection?
Creation and assignment of graphic objects
《ASP.NET Core 6框架揭秘》样章[200页/5章]
Steps of building SSM framework
通过Keil如何查看MCU的RAM与ROM使用情况
【无标题】
RecyclerView的数据刷新
leecode3. 无重复字符的最长子串
Day-24 UDP, regular expression
[difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
滑轨步进电机调试(全国海洋航行器大赛)(STM32主控)
Cmu15445 (fall 2019) project 2 - hash table details