人人商城地图授权过期相信不少开发者都遇到过,这个问题解决本来很简单,就是百度授权的api过期了,我们只需要去百度地图官网http://lbsyun.baidu.com/apiconsole/key#/home,申请一个新的api替换就可以了,但问题是商城开发者似乎并没有思考这个问题的发生,所以百度地图api并没有使用变量,而是写死了,导致许多文件报错,找起来很麻烦。
该怎么快速解决呢?
其实有个方法最靠谱,那就是用php找出有地图的文件批量替换(当然了如果是本地代码,用notepad++批量查找肯定也没问题)
我们新建一个php文件,命名为:scfgwg.php,然后把一下代码复制保存.
* @param 目录地址
*/
function readDirs($path,$name) {
$dir_handle = openDir($path);
$i = 0;
while(false !== $file=readDir($dir_handle)) {
if ($file=='.' || $file=='..') continue;
$i++;
// mysql_set_charset('utf8',$file);
//输出该文件
//判断当前是否为目录
if(is_dir($path . '/' . $file)) {
//是目录
readDirs($path . '/' . $file,$name);
// print_r($path . '/' . $file);
}else{
$con = file_get_contents($path.'/'.$file);
if(strpos($con,$name) !== false){
echo $path.'/'.$file;
echo "<br ?-->";
}else{
// echo 2;
}
}
}
closeDir($dir_handle);
}
//注意填写你自己的路径
$path = './addons/ewei_shopv2/plugin';
$name = $_GET["name"];
readDirs($path,$_GET["name"]);
然后我们访问/scfgwg.php?name=api.map.baidu.com,就会获得网站目录:

我们把ak文件复制一下:

打开搜索到的文件,搜索AK,然后把后边的值替换成自己申请的ak值就OK了,我把目录也分享出来,但随着版本更新,可能会有改变,最好的办法还是自己搜一下:
./addons/ewei_shopv2/plugin/merch/template/mobile/default/list/merchuser.html
./addons/ewei_shopv2/plugin/article/template/mobile/default/index.html
./addons/ewei_shopv2/plugin/groups/template/mobile/default/orders/detail.html
./addons/ewei_shopv2/plugin/groups/template/mobile/default/orders/confirm.html
./addons/ewei_shopv2/plugin/cycelbuy/template/mobile/default/goods/detail.html
./addons/ewei_shopv2/plugin/cycelbuy/template/mobile/default/order/create.html
./addons/ewei_shopv2/plugin/pc/template/mobile/default/goods/detail.html.back
./addons/ewei_shopv2/plugin/pc/template/mobile/default/order/detail.html
./addons/ewei_shopv2/plugin/pc/template/mobile/default/order/create.html
./addons/ewei_shopv2/plugin/pc/template/mobile/default/order/create.html.back
./addons/ewei_shopv2/plugin/pc/template/mobile/default/order/pay/success.html
./addons/ewei_shopv2/plugin/pc/template/mobile/default/creditshop/create.html
./addons/ewei_shopv2/plugin/pc/template/mobile/default/creditshop/log_detail.html
./addons/ewei_shopv2/plugin/diypage/template/mobile/default/index.html
./addons/ewei_shopv2/plugin/diypage/template/mobile/default/template/tpl_detail_store.html
./addons/ewei_shopv2/plugin/creditshop/template/mobile/default/create.html
./addons/ewei_shopv2/plugin/creditshop/template/mobile/default/log_detail.html
评论0