You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
839 B

<?php
namespace zixishi;
class Token extends Base
{
/**
* 门禁获取token
* @param $is_obtain
* @date 2022-08-02
*/
public function getRAccessToken()
{
//获取access_token接口
$str = md5(base64_encode($this->config['api_id'] . ":" . $this->config['api_key']) . time());
$header = [
'cache-control:no-cache',
'Content-Type:application/json',
'datetime:' . time(),
'Authorization:' . $str
];
$result = $this->httpPData($this->url . 'v1/Base/createToken', ['appid' => $this->config['api_id']], $header);
// 记录日志
$uid = defined('UID') ? UID : '';
platformLog(['appid' => $this->config['api_id']], $result, 'zixishi_get_access_token_uid_' . $uid);
return $result;
}
}