Skip to content

Commit

Permalink
aaa: 增加企业微信js sdk api get_jsapi_ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
qq1060656096 committed Sep 3, 2018
1 parent 4e2bb6e commit d64c90b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/JsSdk/JsSdkApi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php
/**
* Created by PhpStorm.
* User: 赵思贵
* Date: 2018/9/3
* Time: 11:01
*/

namespace Zwei\WorkWechat\JsSdk;

use Zwei\WorkWechat\ApiBase;

/**
* js sdk api
*
* Class JsSdkApi
* @package Zwei\WorkWechat\JsSdk
*/
class JsSdkApi extends ApiBase implements JsSdkApiDefineInterface
{
/**
* @inheritdoc
*/
public function getJsApiTicket($accessToken)
{
$url = sprintf(self::URL_JS_API_TICKET, $accessToken);
$response = $this->client->request('get', $url, ['verify' => $this->sslVerify,]);
return $this->parseApiResult($response);
}

}
34 changes: 34 additions & 0 deletions src/JsSdk/JsSdkApiDefineInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Created by PhpStorm.
* User: 赵思贵
* Date: 2018/9/3
* Time: 11:01
*/

namespace Zwei\WorkWechat\JsSdk;

/**
* js sdk api
*
* Interface JsSdkApiDefineInterface
* @package Zwei\WorkWechat\JsSdk
*/
interface JsSdkApiDefineInterface
{
/**
* 获取企业的 jsapi_ticket
* 请求方式:GET(HTTPS)
* @var string
*/
const URL_JS_API_TICKET = 'https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=%s';

/**
* 获取企业的jsapi_ticket
*
* @param string $accessToken 企业access_token
* @return array
* @throws WorkWechatApiErrorCodeException 企业微信接口返回错误码异常
*/
public function getJsApiTicket($accessToken);
}

0 comments on commit d64c90b

Please sign in to comment.