Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

注册回调事件验证失败 #88

Open
misgaoli opened this issue Oct 11, 2020 · 1 comment
Open

注册回调事件验证失败 #88

misgaoli opened this issue Oct 11, 2020 · 1 comment

Comments

@misgaoli
Copy link

hi,版本是:php7.3.5 ,会提示{"errcode":71009,"errmsg":"返回文本非succes},询问钉钉官方,说是不支持7.1+版本
,验证回调的写法如下,不知道有没有遇到过这个问题

    $signature = $_GET["signature"];
    $timeStamp = $_GET["timestamp"];
    $nonce = $_GET["nonce"];
    $postdata = file_get_contents("php://input");
    $postList = json_decode($postdata,true);
    $encrypt = $postList['encrypt'];
    $crypt = new DingtalkCrypt(TOKEN, ENCODING_AES_KEY, SUITE_KEY);
    $msg = "";
    $res = $crypt->DecryptMsg($signature, $timeStamp, $nonce, $encrypt, $msg);

    if ($res['ErrorCode'] != 0){//当解密失败记录
        Log::e("ErrorCode:" . $res['ErrorCode']);
        Log::e(json_encode($_GET));
        Log::e(json_encode($encrypt));
        Log::e('------------------------------------------------------------------------------------------');
    }else{
        Log::e("SuccessCode:" . $res['ErrorCode']);
        if(!$res['data']){//当返回值为空记录加密字符串信息
            Log::e(json_encode($_GET));
            Log::e(json_encode($encrypt));
        }
        Log::e(json_encode($res['data']));
        Log::e('------------------------------------------------------------------------------------------');

        //创建成功后的回调推送
        //$eventMsg = json_decode($res['data']);
        //$eventType = $eventMsg->EventType;

        //工作流变动:审批任务开始,结束,转交
        //if("bpms_task_change" === $eventType){


        //}

        //工作流变动:审批实例开始,结束
        //if("bpms_instance_change" === $eventType){


        //}
        //注册回调接口 回调URL返回值调试
        $res = "success";
        $encryptMsg = "";
        $encryData = $crypt->EncryptMsg($res, $timeStamp, $nonce, $encryptMsg);
        if($encryData['ErrorCode'] != 0){
            Log::e("ERR:" . $encryData);
        }else{
            echo $encryData['data'];
        }

    }
@mingyoung
Copy link
Owner

这个不是 EasyDingTalk 用法,恐怕无法解答你的问题…

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants