|
|
|
@ -71,27 +71,19 @@ class WechatService extends BaseService |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* @param $url |
|
|
|
* @return array |
|
|
|
* @throws FuncException |
|
|
|
*/ |
|
|
|
public function getJsSdkSignature(): array |
|
|
|
public function getJsSdkSignature($url): array |
|
|
|
{ |
|
|
|
$timestamp = time(); |
|
|
|
|
|
|
|
$nonceStr = generate_random_string(16); |
|
|
|
$nonceStr = generate_random_string(10); |
|
|
|
|
|
|
|
$jsapi_ticket = $this->getJsApiTicket(); |
|
|
|
|
|
|
|
$ascllArr = [ |
|
|
|
'noncestr=' . $nonceStr, |
|
|
|
'jsapi_ticket=' . $jsapi_ticket, |
|
|
|
'timestamp=' . $timestamp, |
|
|
|
'url=' . 'http://mp.weixin.qq.com?params=value', |
|
|
|
]; |
|
|
|
|
|
|
|
sort($ascllArr); |
|
|
|
|
|
|
|
$signature = sha1(implode('&', $ascllArr)); |
|
|
|
$signature = sha1(sprintf('jsapi_ticket=%s&noncestr=%s×tamp=%s&url=%s', $jsapi_ticket, $nonceStr, $timestamp, $url)); |
|
|
|
|
|
|
|
return [ |
|
|
|
'appId' => env('wechat.appid'), |
|
|
|
|