all(); $url = $data['url']; if(empty($url)) return $this->json_return(201, 'URL不能为空'); $nonceStr = Str::random(); $timestamp = time(); // 1. 企业级签名 (wx.config) $wechat = new qyWechatService(); list($status, $ticket) = $wechat->getJsApiTicket(); if(! $status) { return $this->json_return(201, $ticket); } $configSignature = $wechat->makeSignature($ticket, $nonceStr, $timestamp, $url); // 2. 应用级签名 (wx.agentConfig) list($status, $agentTicket) = $wechat->getAgentTicket(); if(! $status) { return $this->json_return(201, $agentTicket); } $agentSignature = $wechat->makeSignature($agentTicket, $nonceStr, $timestamp, $url); $return = [ 'corpid' => $wechat->corpId, 'agentid' => $wechat->agentId, 'timestamp' => $timestamp, 'nonceStr' => $nonceStr, 'configSignature' => $configSignature, 'agentSignature' => $agentSignature, ]; return $this->json_return(200,'',$return); } }