最近给客户独立版啦啦外卖配置七牛云提示失败,参数都正确但是不行,特此记录一下修改

路径web/controller/sys/

<?php
/*** 啦啦外卖 - 做好用的外卖系统!* =========================================================* Copy right 2015-2038 太原多讯网络科技有限公司, 保留所有权利。* ----------------------------------------------* 官方网址: http://www.duoxunwl.com/* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。* =========================================================* @author : 啦啦外卖团队* @微信客服:HEIGEZX*/
defined('IN_IA') or exit('Access Denied');
load()->model('attachment');
$dos = array('attachment', 'remote', 'buckets');
$do = in_array($do, $dos) ? $do : 'attachment';if($do == 'attachment') {$_W['page']['title'] = '全局设置';if (empty($_W['setting']['upload'])) {$upload = $_W['config']['upload'];} else {$upload = $_W['setting']['upload'];}$post_max_size = ini_get('post_max_size');$post_max_size = $post_max_size > 0 ? bytecount($post_max_size) / 1024 : 0;$upload_max_filesize = ini_get('upload_max_filesize');if($_W['ispost']) {$harmtype = array('asp', 'php', 'jsp', 'js', 'css', 'php3', 'php4', 'php5', 'ashx', 'aspx', 'exe', 'cgi');$upload['attachment_limit'] = max(0, intval($_GPC['attachment_limit']));$upload['image']['thumb'] = intval($_GPC['image']['thumb']);$upload['image']['width'] = intval($_GPC['image']['width']);$upload['image']['extentions'] = array();$image_extentions = explode("\n", safe_gpc_string($_GPC['image']['extentions']));foreach ($image_extentions as $item) {$item = safe_gpc_string(trim($item));if (!empty($item) && !in_array($item, $harmtype) && !in_array($item, $upload['image']['extentions'])) {$upload['image']['extentions'][] = $item;}}$upload['image']['limit'] = max(0, min(intval($_GPC['image']['limit']), $post_max_size));$zip_percentage = intval($_GPC['image']['zip_percentage']);if ($zip_percentage <= 0 || $zip_percentage > 100) {$zip_percentage = 100;}$upload['image']['zip_percentage'] = $zip_percentage;$upload['audio']['extentions'] = array();$audio_extentions = explode("\n", safe_gpc_string($_GPC['audio']['extentions']));foreach ($audio_extentions as $item) {$item = safe_gpc_string(trim($item));if (!empty($item) && !in_array($item, $harmtype) && !in_array($item, $upload['audio']['extentions'])) {$upload['audio']['extentions'][] = $item;}}$upload['audio']['limit'] = max(0, min(intval($_GPC['audio']['limit']), $post_max_size));setting_set('upload', $upload);message(error(0, '附件设置保存成功'), url('sys/attachment/attachment'), 'ajax');}if(empty($upload['image']['thumb'])) {$upload['image']['thumb'] = 0;} else {$upload['image']['thumb'] = 1;}$upload['image']['width'] = intval($upload['image']['width']);if(empty($upload['image']['width'])) {$upload['image']['width'] = 800;}if(!empty($upload['image']['extentions']) && is_array($upload['image']['extentions'])) {$upload['image']['extentions'] = implode("\n", $upload['image']['extentions']);}if(!empty($upload['audio']['extentions']) && is_array($upload['audio']['extentions'])) {$upload['audio']['extentions'] = implode("\n", $upload['audio']['extentions']);}if(empty($upload['image']['zip_percentage'])) {$upload['image']['zip_percentage'] = 100;}
}elseif($do == 'remote') {$_W['page']['title'] = '远程附件';$remote = $_W['setting']['remote_complete_info'];$remote_urls = array('alioss' => array('old_url' => $remote['alioss']['url']),'ftp' => array('old_url' => $remote['ftp']['url']),'qiniu' => array('old_url' => $remote['qiniu']['url']),'cos' => array('old_url' => $remote['cos']['url']),);if($_W['ispost']) {$remote = array('type' => intval($_GPC['type']),'ftp' => array('ssl' => intval($_GPC['ftp']['ssl']),'host' => $_GPC['ftp']['host'],'port' => $_GPC['ftp']['port'],'username' => $_GPC['ftp']['username'],'password' => strexists($_GPC['ftp']['password'], '*') ? $_W['setting']['remote_complete_info']['ftp']['password'] : $_GPC['ftp']['password'],'pasv' => intval($_GPC['ftp']['pasv']),'dir' => $_GPC['ftp']['dir'],'url' => $_GPC['ftp']['url'],'overtime' => intval($_GPC['ftp']['overtime']),),'alioss' => array('key' => trim($_GPC['alioss']['key']),'secret' => strexists($_GPC['alioss']['secret'], '*') ? $_W['setting']['remote_complete_info']['alioss']['secret'] : trim($_GPC['alioss']['secret']),'bucket' => $_GPC['alioss']['bucket'],'internal' => $_GPC['alioss']['internal'],),'qiniu' => array('accesskey' => trim($_GPC['qiniu']['accesskey']),'secretkey' => strexists($_GPC['qiniu']['secretkey'], '*') ? $_W['setting']['remote_complete_info']['qiniu']['secretkey'] : trim($_GPC['qiniu']['secretkey']),'bucket' => trim($_GPC['qiniu']['bucket']),'url' => trim($_GPC['qiniu']['url']),),'cos' => array('appid' => trim($_GPC['cos']['appid']),'secretid' => trim($_GPC['cos']['secretid']),'secretkey' => strexists(trim($_GPC['cos']['secretkey']), '*') ? $_W['setting']['remote_complete_info']['cos']['secretkey'] : trim($_GPC['cos']['secretkey']),'bucket' => trim($_GPC['cos']['bucket']),'local' => trim($_GPC['cos']['local']),'url' => trim($_GPC['cos']['url']),),);if($remote['type'] == 2) {if(empty($remote['alioss']['key'])) {message(error(-1, '阿里云OSS-Access Key ID不能为空'), '', 'ajax');}if(empty($remote['alioss']['secret'])) {message(error(-1, '阿里云OSS-Access Key Secret不能为空'), '', 'ajax');}$buckets = attachment_alioss_buctkets($remote['alioss']['key'], $remote['alioss']['secret']);if(is_error($buckets)) {message(error(-1, 'OSS-Access Key ID 或 OSS-Access Key Secret错误,请重新填写'), '', 'ajax');}list($remote['alioss']['bucket'], $remote['alioss']['url']) = explode('@@', $_GPC['alioss']['bucket']);if(empty($buckets[$remote['alioss']['bucket']])) {message(error(-1, 'Bucket不存在或是已经被删除'), '', 'ajax');}$remote['alioss']['url'] = 'http://' . $remote['alioss']['bucket'] . '.' . $buckets[$remote['alioss']['bucket']]['location'] . '.aliyuncs.com';$remote['alioss']['ossurl'] = $buckets[$remote['alioss']['bucket']]['location'] . '.aliyuncs.com';if (!empty($_GPC['custom']['url'])) {$url = trim($_GPC['custom']['url'], '/');if (!strexists($url, 'http://') && !strexists($url, 'https://')) {$url = 'http://' . $url;}$remote['alioss']['url'] = $url;}attachment_replace_article_remote_url($remote_urls['alioss']['old_url'], $remote['alioss']['url']);} elseif($remote['type'] == 1) {if (empty($remote['ftp']['host'])) {message(error(-1, 'FTP服务器地址为必填项.'), '', 'ajax');}if (empty($remote['ftp']['username'])) {message(error(-1, 'FTP帐号为必填项.'), '', 'ajax');}if (empty($remote['ftp']['password'])) {message(error(-1, 'FTP密码为必填项.'), '', 'ajax');}attachment_replace_article_remote_url($remote_urls['ftp']['old_url'], $_GPC['ftp']['url']);} elseif($remote['type'] == 3) {if (empty($remote['qiniu']['accesskey'])) {message(error(-1, '请填写Accesskey'), '', 'ajax');}if (empty($remote['qiniu']['secretkey'])) {message(error(-1, '请填写secretkey'), '', 'ajax');}if (empty($remote['qiniu']['bucket'])) {message(error(-1, '请填写bucket'), '', 'ajax');}if (empty($remote['qiniu']['url'])) {message(error(-1, '请填写url'), '', 'ajax');} else {$remote['qiniu']['url'] = strexists($remote['qiniu']['url'], 'http') ? trim($remote['qiniu']['url'], '/') : 'http://' . trim($remote['qiniu']['url'], '/');}attachment_replace_article_remote_url($remote_urls['qiniu']['old_url'], $remote['qiniu']['url']);
//          $auth = attachment_qiniu_auth($remote['qiniu']['accesskey'], $remote['qiniu']['secretkey'], $remote['qiniu']['bucket']);
//          if (is_error($auth)) {
//              $message = $auth['message']['error'] == 'bad token' ? 'Accesskey或Secretkey填写错误, 请检查后重新提交' : 'bucket填写错误或是bucket所对应的存储区域选择错误,请检查后重新提交';
//              message(error(-1, $message), '', 'ajax');
//          }} elseif ($remote['type'] == 4) {if (empty($remote['cos']['appid'])) {message(error(-1, '请填写APPID'), '', 'ajax');}if (empty($remote['cos']['secretid'])) {message(error(-1, '请填写SECRETID'), '', 'ajax');}if (empty($remote['cos']['secretkey'])) {message(error(-1, '请填写SECRETKEY'), '', 'ajax');}if (empty($remote['cos']['bucket'])) {message(error(-1, '请填写BUCKET'), '', 'ajax');}$remote['cos']['bucket'] = str_replace("-{$remote['cos']['appid']}", '', trim($remote['cos']['bucket']));if (empty($url)) {$url = sprintf('https://%s-%s.cos%s.myqcloud.com', $bucket, $appid, $_GPC['local']);}if (empty($remote['cos']['url'])) {$remote['cos']['url'] = sprintf('https://%s-%s.cos%s.myqcloud.com', $remote['cos']['bucket'], $remote['cos']['appid'], $remote['cos']['local']);}$remote['cos']['url'] = rtrim($remote['cos']['url'], '/');$_W['setting']['remote']['cos'] = array();attachment_replace_article_remote_url($remote_urls['cos']['old_url'], $remote['cos']['url']);$auth = attachment_cos_auth($remote['cos']['bucket'], $remote['cos']['appid'], $remote['cos']['secretid'], $remote['cos']['secretkey'], $remote['cos']['local']);if(is_error($auth)) {message(error(-1, $auth['message']), '', 'ajax');}}$_W['setting']['remote_complete_info']['type'] = $remote['type'];$_W['setting']['remote_complete_info']['alioss'] = $remote['alioss'];$_W['setting']['remote_complete_info']['ftp'] = $remote['ftp'];$_W['setting']['remote_complete_info']['qiniu'] = $remote['qiniu'];$_W['setting']['remote_complete_info']['cos'] = $remote['cos'];$result = setting_set('remote', $_W['setting']['remote_complete_info']);message(error(0, '远程附件配置信息更新成功!'), url('sys/attachment/remote'), 'ajax');}
}elseif($do == 'buckets') {$key = $_GPC['key'];$secret = $_GPC['secret'];$buckets = attachment_alioss_buctkets($key, $secret);if(is_error($buckets)) {message($buckets, '', 'ajax');}$bucket_datacenter = attachment_alioss_datacenters();$bucket = array();foreach ($buckets as $key => $value) {$value['bucket_key'] = $value['name'] . '@@' . $value['location'];$value['loca_name'] = $key . '@@' . $bucket_datacenter[$value['location']];$bucket[] = $value;}message(error(0, $bucket), '', 'ajax');
}template('sys/attachment');

啦啦外卖独立版七牛云配置失败解决方案相关推荐

  1. 七牛云配置二级域名,从而避免七牛云30天自动更改域名的问题

    七牛云配置二级域名,从而避免七牛云30天自动更改域名的问题 写在前面 为什么要解决这个问题呢,我们都知道七牛云在你新建一个存储空间的时候会给你分配一个临时的域名,这个域名是有时间限制的(一般是30天) ...

  2. 啦啦外卖独立版41.7完美运营版!全功能插件

    啦啦外卖独立版41.7完美运营版!全功能插件

  3. 【七牛云配置免费SSL证书 记录】

    七牛云配置免费SSL证书 记录 第一步 七牛云SSL证书 购买证书 第二步 补全信息 第三步 DNS配置 第四步 配置成功后 部署 启动即可 第一步 七牛云SSL证书 购买证书 点击购买即可 第二步 ...

  4. 七牛云配置 koa 上传文件到七牛云

    一.七牛云配置 七牛官网 1.创建七牛存储空间 2.空间添加备案的域名 (若是测试空间可不需要配置) 3.解析CNAME 添加域名后会有CNAME(别名记录),需要将它解析到你的备案域名下 链接-CN ...

  5. 如何快速接入直播服务 七牛云企业直播解决方案来了

    在新形势下,直播不再是带货主播们的专属,它的边界已然从互联网跨向了各行各业,成为企业对内交流培训和对外营销的重要手段. 七牛云企业直播解决方案帮助企业快速集成和接入直播服务,覆盖营销.活动.企业培训. ...

  6. 七牛云配置怎么配CDN

    对象存储 1.1新建空间(创建空间,例如img.video.txt仓库) 2.融合cdn 2.1域名管理 2.2添加域名 2.3创建域名 域名类型 普通 加速域名 新二级域名 通信协议 先用http建 ...

  7. 七牛云配置完成后访问提示:{error:bucket is protected}

    配置个人博客时使用了七牛云的对象存储,但是配置完后图片加载不出来,直接访问图片链接提示:{"error":"bucket is protected"} 解决办法 ...

  8. 七牛云配置CDN,阿里云,ERROR: ACCESS DENIED,访问失败

    ####首先说下配置,最近七牛云出了一个cdn加速. 第一步,七牛云->CDN->创建一个绑定的域名 ####第二步,添加域名信息 举个栗子: images.baidu.com 就是普通域 ...

  9. WP Super Cache+七牛云配置CDN加速,让你的网站秒开

    CDN加速网站是几乎所有的站长都在考虑的问题,CDN,全称是Content Delivery Network,即内容分发网络.所谓CDN加速,通俗的来说就是把原服务器上数据复制到其他服务器上,用户访问 ...

  10. 关于微信服务器ngrok 配置失败解决方案

    在本地用ngrok 内网穿透代理本地端口后,因为代理地址的ip 在国外的原因导致配置失败. 解决方案: 用nginx 代理一次,再用ngrok 代理nginx 成功解决

最新文章

  1. Python中文处理(转)
  2. dsoFramer 的原代码
  3. spring AOP注解实现
  4. C语言 函数指针一(函数指针的定义)
  5. 2021年高压电工考试内容及高压电工考试报名
  6. electron最小化托盘、禁用右键菜单
  7. 对等商务_对等| 第三部分
  8. 运用计算机技术和语文教学,计算机信息技术与小学语文教学整合的优势
  9. 阴阳师双小小黑通关真八岐大蛇攻略——附式神配置和打法
  10. Android应用开发编译框架流程与IDE及Gradle概要
  11. 我的创业项目steam游戏王子斗恶龙(含技术透露)
  12. 反问疑问_反问疑问句
  13. 邮箱授权码正确,却连接失败
  14. can not access a member of class xxx with modifiers “private“
  15. 基于Python的新闻聚合网站设计与实现
  16. 对字节码文件的抑或加密
  17. 为什么不推荐你去阿里,这些公司朝九晚五不打卡,时薪高到逆天…
  18. alias简化k8s命令,节约生命
  19. IP组播协议——IGMP协议之IGMPv1
  20. Echarts柱状图(顶部和内部的数值显示)/(内部数值的百分比计算)/(顶部显示多行数据)/(柱体圆角)

热门文章

  1. 智能算法之免疫算法求解TSP问题
  2. 卸载不了mysql2008_卸载SQL2008遇到的问题及解决办法
  3. STEP 7 V5.5 版本特性
  4. 2019年美赛建模总结与e题思路
  5. Ubuntu16.0.4 通过Docker安装酷Q
  6. 第十二次博文:免费教你从官网中下载全部AD库,保姆级别!
  7. CCS安装教程——学习DSP的第一步
  8. Repast——Agent对象换成图标和显示属性问题
  9. 小程序下载PDF等类型文件并保存到本地
  10. 马斯克震撼演讲:世界上最可怕的事情,是没有内驱力