当前位置:网站首页>服务器到服务器 (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()}事件失败.");
}
}
边栏推荐
- 线程池拒绝策略最佳实践
- 2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
- ip2long之后有什么好处?
- Common text processing tools
- 2022 polymerization process test question simulation test question bank and online simulation test
- 非分区表转换成分区表以及注意事项
- leecode3. 无重复字符的最长子串
- Go语言学习笔记-结构体(Struct)
- 明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
- [untitled]
猜你喜欢
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
leecode3. 无重复字符的最长子串
3D content generation based on nerf
【无标题】
【Presto Profile系列】Timeline使用
红杉中国完成新一期90亿美元基金募集
2022a special equipment related management (boiler, pressure vessel and pressure pipeline) simulated examination question bank simulated examination platform operation
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
线程池拒绝策略最佳实践
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
随机推荐
HZOJ #235. 递归实现指数型枚举
飞桨EasyDL实操范例:工业零件划痕自动识别
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
2022 polymerization process test question simulation test question bank and online simulation test
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Layer pop-up layer closing problem
Master formula. (used to calculate the time complexity of recursion.)
Design and implementation of communication protocol
Sequoia China completed the new phase of $9billion fund raising
Practical example of propeller easydl: automatic scratch recognition of industrial parts
[untitled]
[difficult and miscellaneous]pip running suddenly appears modulenotfounderror: no module named 'pip‘
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
人均瑞数系列,瑞数 4 代 JS 逆向分析
免费手机号码归属地API查询接口
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
Leetcode skimming: binary tree 25 (the nearest common ancestor of binary search tree)
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
ICLR 2022 | pre training language model based on anti self attention mechanism