示例代码

        $erp_uid = $_COOKIE['uid'];
        $erp_name = $_COOKIE['username'];
        $apigw = Yii::$app->params['apigw'];
        if (!$erp_uid) {
            echo "请先登录erp";
            exit;
        }
        $script = "<script type='text/javascript'>
            function dealPost(aid, url) {
                var postData = {};
                var oAjax = null;
                postData[\"operatorId\"] = " . $erp_uid . ";
                postData[\"operatorName\"] = \"" . $erp_name . "\";
                postData[\"operationType\"] = 4;
                postData[\"platformId\"] = 1;
                postData[\"auditObjectId\"] = aid;
                postData[\"route\"] = \"客服系统-综合查询-全部信息\";
                postData[\"recordUrl\"] = url;
                postData[\"business\"] = \"生态自动分派\";
                postData = JSON.stringify(postData)
                try{
                    oAjax = new XMLHttpRequest();
                }catch(e){
                    oAjax = new ActiveXObject(\"Microsoft.XMLHTTP\");
                }
                oAjax.open('post','" . $apigw . "/XXX/addRecordLog', true);
                oAjax.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");
                oAjax.send(postData);
                oAjax.onreadystatechange = function(){
                    if(oAjax.readyState == 4){
                        try{
                            console.log(oAjax.responseText);
                        }catch(e){
                            alert('你访问的页面出错了');
                        }
                    }
                };
            }";
        $html = '<div style="margin-top: 10px; color:#625c5c;"><b>一、审核录音资料(点击链接播放录音详情)</b><br/>';
        $script1 = '';
        if (!empty($arrays)) {
            foreach ($arrays as $i => $v) {
                $script_id = 'audio' . $i;
                $html .= '<div style="margin-top: 10px;"><audio id="' . $script_id . '" src="'.$v['url'].'"  controls="controls" controlsList="nodownload">您的浏览器不支持 audio 标签。</audio></div>';
                $script1 .= "var " . $script_id . " = document.getElementById('" . $script_id . "');" . $script_id . ".onplay = function() {dealPost(" . $id . ", \"" . $v['url'] . "\")}";
            }
        }
        echo $html . "</div>";
        echo $script . $script1 . '</script>';

最后修改日期: 2022-02-24

留言

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。