当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- Grep of three swordsmen in text processing
- Query whether a field has an index with MySQL
- MySQL master-slave replication
- Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
- How to continue after handling chain interruption / sub chain error removed from scheduling
- 【学习笔记】AGC010
- Layer pop-up layer closing problem
- Awk of three swordsmen in text processing
- ip2long与long2IP 分析
- RecyclerView的数据刷新
猜你喜欢
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

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

. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst

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

Four functions of opencv

【学习笔记】AGC010

ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集

人均瑞数系列,瑞数 4 代 JS 逆向分析

- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net

AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
随机推荐
Visual stdio 2017 about the environment configuration of opencv4.1
PHP calls the pure IP database to return the specific address
Four functions of opencv
Session
HZOJ #236. Recursive implementation of combinatorial enumeration
DrawerLayout禁止侧滑显示
DHCP 动态主机设置协议 分析
Leetcode skimming: binary tree 23 (mode in binary search tree)
Practical example of propeller easydl: automatic scratch recognition of industrial parts
国泰君安证券开户怎么开的?开户安全吗?
Leetcode skimming: binary tree 27 (delete nodes in the binary search tree)
File operation command
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
How does MySQL create, delete, and view indexes?
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
非分区表转换成分区表以及注意事项
How to apply @transactional transaction annotation to perfection?
Grep of three swordsmen in text processing
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)