include/chajian/getuiChajian.php
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* 个推2023-07-06
*/
class getuiChajian extends Chajian{
private $appid = '';
private $appkey = '';
private $mastersecret = '';
private $apptype = '0'; //0所有平台,1仅安卓,2仅苹果
private $pushurl = 'https://restapi.getui.com/v2/{appid}';
protected function initChajian()
{
$this->appid = getconfig('getui_appid');
$this->appkey = getconfig('getui_appkey');
$this->mastersecret = getconfig('getui_mastersecret');
$this->apptype = getconfig('getui_apptype','0');
}
/**
* 获取token
*/
public function gettoken(){
$url = str_replace('{appid}',$this->appid, $this->pushurl).'/auth';
$token = c('cache')->get('getui'.$this->appid.'');
if(isempt($token)){
$timestamp = ''.time().'000';
$sign = hash("sha256", $this->appkey.$timestamp.$this->mastersecret);
$result = c('curl')->postcurl($url, json_encode(array(
"sign" => $sign,
"timestamp" => $timestamp,
"appkey" => $this->appkey,
)),0, array(
'content-type' => 'application/json;charset=utf-8'
));
if($result){
$barr = json_decode($result, true);
if($barr['code']==0){
$token = $barr['data']['token'];
$expire_time = $barr['data']['expire_time'];
c('cache')->set('getui'.$this->appid.'',$token, $expire_time * 0.001 - time());
}else{
echo $result;
}
}
}
return $token;
}
/**
* 判断是否可以发送
*/
public function sendbool()
{
if(!$this->appid || !$this->appkey || !$this->mastersecret)return false;
return true;
}
后面还有 81 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
