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.
55 lines
1.4 KiB
55 lines
1.4 KiB
<?php
|
|
|
|
namespace addons\qingdong\controller;
|
|
|
|
use addons\qingdong\model\Staff;
|
|
use addons\qingdong\model\AdminConfig;
|
|
use think\Log;
|
|
use WeWork\Crypt\WXBizMsgCrypt;
|
|
|
|
/**
|
|
* * 操作文档:https://doc.fastadmin.net/qingdong
|
|
* 软件介绍:https://www.fastadmin.net/store/qingdong.html
|
|
* 售后微信:qingdong_crm
|
|
* 企业微信接口
|
|
*/
|
|
class Wx extends StaffApi
|
|
{
|
|
protected $noNeedLogin = ['userid','template','token'];
|
|
protected $noNeedRight = [];
|
|
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
}
|
|
|
|
//验证
|
|
public function token()
|
|
{
|
|
$corpId = AdminConfig::getConfigValue('wechat', 'corpid');
|
|
$token = '';
|
|
$encodingAesKey = '';
|
|
Log::write('a---' . json_encode($_GET));
|
|
|
|
$sVerifyMsgSig = input('msg_signature');
|
|
$sVerifyTimeStamp = input('timestamp');
|
|
$sVerifyNonce = input('nonce');
|
|
$sVerifyEchoStr = input('echostr');
|
|
|
|
if (empty($sVerifyMsgSig) || empty($sVerifyTimeStamp) || empty($sVerifyNonce) || empty($sVerifyEchoStr)) {
|
|
$this->error('参数不正确');
|
|
}
|
|
|
|
$sEchoStr = "";
|
|
$wxcpt = new WXBizMsgCrypt($token, $encodingAesKey, $corpId);
|
|
$errCode = $wxcpt->VerifyURL($sVerifyMsgSig, $sVerifyTimeStamp, $sVerifyNonce, $sVerifyEchoStr, $sEchoStr);
|
|
if ($errCode == 0) {
|
|
return $sEchoStr;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
}
|