当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- . Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
- 博文推荐|Apache Pulsar 跨地域复制方案选型实践
- ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics
- Cookie and session comparison
- - Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net
- Talk about four cluster schemes of redis cache, and their advantages and disadvantages
- DrawerLayout禁止侧滑显示
- 2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
- Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
- @Resource和@Autowired的区别?
猜你喜欢
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
Analysis of DHCP dynamic host setting protocol
滑轨步进电机调试(全国海洋航行器大赛)(STM32主控)
通过Keil如何查看MCU的RAM与ROM使用情况
ICLR 2022 | pre training language model based on anti self attention mechanism
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
Go语言学习笔记-结构体(Struct)
人均瑞数系列,瑞数 4 代 JS 逆向分析
Session
Leetcode skimming: binary tree 21 (verifying binary search tree)
随机推荐
详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
HZOJ #235. 递归实现指数型枚举
Find ID value MySQL in string
MySQL master-slave replication
线程池拒绝策略最佳实践
PHP调用纯真IP数据库返回具体地址
[binary tree] delete points to form a forest
日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
有什么类方法或是函数可以查看某个项目的Laravel版本的?
【无标题】
How to reset Firefox browser
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
Day21 multithreading
人均瑞数系列,瑞数 4 代 JS 逆向分析
学习突围2 - 关于高效学习的方法
TPG x AIDU|AI领军人才招募计划进行中!
How to apply @transactional transaction annotation to perfection?
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
Leetcode skimming: binary tree 20 (search in binary search tree)
DrawerLayout禁止侧滑显示