开发者社区> 问答> 正文

手机应用多页方式实现时,钉钉认证时间过长,求解决方案?

有两个页面,一个是my,一个是detail
通过调试日志时间戳看:
dd.config 到完成 dd.requestAuthCode完成耗时都将近1秒和超过1秒。尤其是:requestAuthCode 耗时较长。
请教,应用在多页实现过程中,这种问题怎么处理?
Util.log("Before dd config", location.href.substring(location.href.lastIndexOf('/')+1));
dd.config({
    agentId: _config.agentId,
    corpId: _config.corpId,
    timeStamp: _config.timeStamp,
    nonceStr: _config.nonceStr,
    signature: _config.signature,
    jsApiList: [
        'runtime.info',
        'device.notification.prompt',
        'biz.chat.pickConversation',
        'device.notification.confirm',
        'device.notification.alert',
        'device.notification.prompt',
        'biz.chat.open',
        'biz.util.open',
        'biz.user.get',
        'biz.contact.choose',
        'biz.telephone.call',
        'biz.ding.post',
        'device.geolocation.get',
        'biz.navigation.setLeft',
        'biz.navigation.close',
        'ui.pullToRefresh.disable',
    ]
});
Util.log("End dd config", location.href.substring(location.href.lastIndexOf('/')+1));
Util.log("Before dd ready", location.href.substring(location.href.lastIndexOf('/')+1));
dd.ready(function () {
//    alert("dd ready");
    dd.runtime.info({
        onSuccess: function (info) {
            Util.log("dd ready runtime success", location.href.substring(location.href.lastIndexOf('/')+1));
        },
        onFail: function (err) {
            Util.log("dd ready runtime failed", location.href.substring(location.href.lastIndexOf('/')+1));
        }
    });
    setTimeout(dd.runtime.permission.requestAuthCode({
        corpId: _config.corpId,
        onSuccess: function (info) {
            logger.i('authcode: ' + info.code);
            Util.log("dd ready requestAuthCode success", location.href.substring(location.href.lastIndexOf('/')+1));
            dd.ui.pullToRefresh.disable();
            $.ajax({
                url: '/authUser',
                type: "GET",
                data: {"access_token": _config.token, "code": info.code},
                dataType: 'json',
                timeout: 9000,
                success: function (data, status, xhr) {
                    Util.log("dd ready ajax success", location.href.substring(location.href.lastIndexOf('/')+1));
                },
                error: function (xhr, errorType, error) {
                    Util.log("dd ready ajax failed", location.href.substring(location.href.lastIndexOf('/')+1));
                }
            });
        },
        onFail: function (err) {
            Util.log("dd ready requestAuthCode failed", location.href.substring(location.href.lastIndexOf('/')+1));
        }
    }), 10000);
});[/code]

展开
收起
伏案的小强 2016-10-09 01:34:33 3330 0
2 条回答
写回答
取消 提交回答
  • 你好,感谢反馈,我们排查下这个问题。
    2016-10-12 10:46:54
    赞同 展开评论 打赏
  • Re手机应用多页方式实现时,钉钉认证时间过长,求解决方案?
    我也遇到这样的问题, 认证时间还不止一秒, 有时候会有3,4秒
    2016-10-11 16:19:07
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Tangram 立即下载
360手机卫士 插件化漫谈 立即下载
手机京东Crash自动分析处理系统 立即下载