当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- 用mysql查询某字段是否有索引
- 货物摆放问题
- Practical example of propeller easydl: automatic scratch recognition of industrial parts
- “新红旗杯”桌面应用创意大赛2022
- 3D content generation based on nerf
- Unity 构建错误:当前上下文中不存在名称“EditorUtility”
- ClickHouse(03)ClickHouse怎么安装和部署
- How does MySQL create, delete, and view indexes?
- Day26 IP query items
- 明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
猜你喜欢

Sed of three swordsmen in text processing

明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东

Leetcode skimming: binary tree 21 (verifying binary search tree)

Talk about four cluster schemes of redis cache, and their advantages and disadvantages

【Presto Profile系列】Timeline使用

Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)

Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
![《ASP.NET Core 6框架揭秘》样章[200页/5章]](/img/4f/5688c391dd19129d912a3557732047.jpg)
《ASP.NET Core 6框架揭秘》样章[200页/5章]

Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion

Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)
随机推荐
用mysql查询某字段是否有索引
How to reset Firefox browser
RecyclerView的数据刷新
飞桨EasyDL实操范例:工业零件划痕自动识别
Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders
MySQL importing SQL files and common commands
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
PACP学习笔记三:PCAP方法说明
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
Day21 multithreading
Design and implementation of communication protocol
[learn microservice from 0] [01] what is microservice
How to reset Google browser? Google Chrome restore default settings?
【无标题】
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
File operation command
国泰君安证券开户怎么开的?开户安全吗?
线程池拒绝策略最佳实践
test
处理链中断后如何继续/子链出错removed from scheduling