常见问题:ECJia到家:到家后台出现“鉴权失败,请传入正确的key”问题解决方案

来自ECJiaWiki
跳到导航 跳到搜索

问题描述

  • 当在地图定位页面出现如图所示警告时:“鉴权失败,请传入正确的key”,可以按照下面的方法进行修复
到家后台出现“鉴权失败,请传入正确的key”问题解决方案01.png

问题修复

  • 首先在该页面932行添加以下方法content/system/functions/global.func.php
if (! function_exists('ecjia_location_mapjs'))
{
    /**
     * 获取定位地图的JS地址
     * @param null $libraries
     * @return string
     */
    function ecjia_location_mapjs($libraries = null)
    {
        if (is_null($libraries)) {
            $jsurl = 'https://map.qq.com/api/js?v=2.exp&key='.ecjia::config('map_qq_key');
        } else {
            $jsurl = "https://map.qq.com/api/js?v=2.exp&libraries={$libraries}&key=".ecjia::config('map_qq_key');
        }
        return $jsurl;
    }
}


  • 问题涉及以下页面,需要替换,sites/m/content/themes/mendian/ 为购买过ECJia到家门店H5模板的用户,如果没有购买过该模板则不用替换,也没有该文件路径。
第一部分需要替换的页面
RC_Script::enqueue_script('qq_map', 'https://map.qq.com/api/js?v=2.exp');
替换为
RC_Script::enqueue_script('qq_map', ecjia_location_mapjs());
content/apps/express/admin.php   
content/apps/express/admin_express.php
content/apps/express/admin_merchant.php
content/apps/express/admin_reminder.php
content/apps/express/merchant.php
content/apps/express/mh_express.php
content/apps/express/mh_match.php
content/apps/franchisee/merchant.php
content/apps/merchant/admin_store_setting.php
content/apps/merchant/mh_franchisee.php
content/apps/staff/admin_store_staff.php
content/apps/store/admin.php
content/apps/store/admin_preaudit.php
content/themes/ecjia-pc/extras/controller/merchant_controller.php
第二部分需要替换的页面
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&libraries=convertor"></script>
替换为
<script charset="utf-8" src="{ecjia_location_mapjs('convertor')}"></script>
sites/m/content/themes/h5/ecjia-touch.dwt.php
sites/m/content/themes/mendian/ecjia-touch.dwt.php   


第三部分需要替换的页面
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp"></script>
替换为
<script charset="utf-8" src="{ecjia_location_mapjs()}"></script>
sites/m/content/themes/h5/franchisee_get_location.dwt.php
sites/m/content/themes/h5/merchant_position.dwt.php
sites/m/content/themes/h5/user_express_position.dwt.php
sites/m/content/themes/h5/user_order_status.dwt.php
sites/m/content/themes/mendian/franchisee_get_location.dwt.php
sites/m/content/themes/mendian/merchant_position.dwt.php
sites/m/content/themes/mendian/user_express_position.dwt.php
sites/m/content/themes/mendian/user_order_status.dwt.php