From d84a16e8b606ca34766a7a6a023850559f27ad01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 11 Apr 2017 11:43:14 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E6=9B=B4=E6=96=B0Node?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Auth.php | 4 +- application/admin/controller/Index.php | 4 +- application/admin/controller/Login.php | 2 +- application/admin/controller/Menu.php | 4 +- application/admin/controller/Node.php | 2 +- application/admin/controller/Plugs.php | 12 ++-- .../admin/model/{Node.php => NodeModel.php} | 2 +- application/common.php | 2 +- application/wechat/controller/Api.php | 2 +- application/wechat/controller/Config.php | 10 ++++ application/wechat/view/config.index.html | 7 ++- application/wechat/view/config.pay.html | 7 +-- composer.lock | 38 ++++++------- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 14 ++--- vendor/composer/autoload_static.php | 8 +-- vendor/composer/installed.json | 44 +++++++------- vendor/endroid/qrcode/src/QrCode.php | 17 +++++- .../Tests/OptionsResolverTest.php | 10 ++-- vendor/topthink/think-helper/src/helper.php | 26 +++++++++ .../wechat-php-sdk/Wechat/Lib/Prpcrypt.php | 57 ++++++++----------- .../wechat-php-sdk/Wechat/Lib/Tools.php | 2 +- .../wechat-php-sdk/Wechat/Loader.php | 2 +- .../wechat-php-sdk/Wechat/WechatCard.php | 20 ++++--- .../wechat-php-sdk/Wechat/WechatReceive.php | 50 +++++++--------- 25 files changed, 188 insertions(+), 160 deletions(-) rename application/admin/model/{Node.php => NodeModel.php} (99%) diff --git a/application/admin/controller/Auth.php b/application/admin/controller/Auth.php index 40a8a7c7a..8c9dd900b 100644 --- a/application/admin/controller/Auth.php +++ b/application/admin/controller/Auth.php @@ -14,7 +14,7 @@ namespace app\admin\controller; -use app\admin\model\Node as NodeModal; +use app\admin\model\NodeModel; use controller\BasicAdmin; use service\DataService; use service\ToolsService; @@ -51,7 +51,7 @@ class Auth extends BasicAdmin { $auth_id = $this->request->get('id', '0'); switch (strtolower($this->request->get('action', '0'))) { case 'getnode': - $nodes = NodeModal::get(); + $nodes = NodeModel::get(); $checked = Db::name('SystemAuthNode')->where('auth', $auth_id)->column('node'); foreach ($nodes as $key => &$node) { $node['checked'] = in_array($node['node'], $checked); diff --git a/application/admin/controller/Index.php b/application/admin/controller/Index.php index 400812276..b4df59081 100644 --- a/application/admin/controller/Index.php +++ b/application/admin/controller/Index.php @@ -14,7 +14,7 @@ namespace app\admin\controller; -use app\admin\model\Node; +use app\admin\model\NodeModel; use controller\BasicAdmin; use service\DataService; use service\ToolsService; @@ -35,7 +35,7 @@ class Index extends BasicAdmin { * @return View */ public function index() { - Node::applyAuthNode(); + NodeModel::applyAuthNode(); $list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select(); $menus = $this->_filterMenu(ToolsService::arr2tree($list)); $this->assign('title', '后台管理'); diff --git a/application/admin/controller/Login.php b/application/admin/controller/Login.php index 9342820bb..04f6fbb90 100644 --- a/application/admin/controller/Login.php +++ b/application/admin/controller/Login.php @@ -14,7 +14,7 @@ namespace app\admin\controller; -use app\admin\model\Node as NodeModal; +use app\admin\model\NodeModel as NodeModal; use controller\BasicAdmin; use service\LogService; use think\Db; diff --git a/application/admin/controller/Menu.php b/application/admin/controller/Menu.php index 1e17cc6e2..8f31d35bc 100644 --- a/application/admin/controller/Menu.php +++ b/application/admin/controller/Menu.php @@ -14,7 +14,7 @@ namespace app\admin\controller; -use app\admin\model\Node; +use app\admin\model\NodeModel; use controller\BasicAdmin; use service\DataService; use service\ToolsService; @@ -96,7 +96,7 @@ class Menu extends BasicAdmin { } } // 读取系统功能节点 - $nodes = Node::get(APP_PATH); + $nodes = NodeModel::get(APP_PATH); foreach ($nodes as $key => $_vo) { if (empty($_vo['is_menu'])) { unset($nodes[$key]); diff --git a/application/admin/controller/Node.php b/application/admin/controller/Node.php index 3333f3b6a..05cc39275 100644 --- a/application/admin/controller/Node.php +++ b/application/admin/controller/Node.php @@ -14,7 +14,7 @@ namespace app\admin\controller; -use app\admin\model\Node as NodeModel; +use app\admin\model\NodeModel as NodeModel; use controller\BasicAdmin; use service\DataService; use service\ToolsService; diff --git a/application/admin/controller/Plugs.php b/application/admin/controller/Plugs.php index 23ec04295..8dbeb1a3d 100644 --- a/application/admin/controller/Plugs.php +++ b/application/admin/controller/Plugs.php @@ -47,7 +47,7 @@ class Plugs extends BasicAdmin { $types = $this->request->get('type', 'jpg,png'); $this->assign('mode', $mode); $this->assign('types', $types); - $this->assign('uptype', sysconf('storage_type')); + $this->assign('uptype', $this->request->get('uptype', sysconf('storage_type'))); $this->assign('mimes', FileService::getFileMine($types)); $this->assign('field', $this->request->get('field', 'file')); return view(); @@ -61,8 +61,11 @@ class Plugs extends BasicAdmin { if ($this->request->isPost()) { $md5s = str_split($this->request->post('md5'), 16); if (($info = $this->request->file('file')->move('upload' . DS . $md5s[0], $md5s[1], true))) { - $site_url = FileService::getFileUrl(join('/', $md5s) . '.' . $info->getExtension()); - return json(['data' => ['site_url' => $site_url], 'code' => 'SUCCESS']); + $filename = join('/', $md5s) . '.' . $info->getExtension(); + $site_url = FileService::getFileUrl($filename, 'local'); + if ($site_url) { + return json(['data' => ['site_url' => $site_url], 'code' => 'SUCCESS']); + } } } return json(['code' => 'ERROR']); @@ -70,7 +73,6 @@ class Plugs extends BasicAdmin { /** * 文件状态检查 - * @return string */ public function upstate() { $post = $this->request->post(); @@ -81,7 +83,7 @@ class Plugs extends BasicAdmin { } // 需要上传文件,生成上传配置参数 $config = ['uptype' => $post['uptype'], 'file_url' => $filename, 'server' => url('admin/plugs/upload')]; - switch (strtolower(sysconf('storage_type'))) { + switch (strtolower($post['uptype'])) { case 'qiniu': $config['server'] = sysconf('storage_qiniu_is_https') ? 'https://up.qbox.me' : 'http://upload.qiniu.com'; $config['token'] = $this->_getQiniuToken($filename); diff --git a/application/admin/model/Node.php b/application/admin/model/NodeModel.php similarity index 99% rename from application/admin/model/Node.php rename to application/admin/model/NodeModel.php index eb47ebfb8..61f087ad3 100644 --- a/application/admin/model/Node.php +++ b/application/admin/model/NodeModel.php @@ -24,7 +24,7 @@ use think\Db; * @author Anyon * @date 2017/03/14 18:12 */ -class Node { +class NodeModel { /** * 应用用户权限节点 diff --git a/application/common.php b/application/common.php index 41ebb1417..35ff785be 100644 --- a/application/common.php +++ b/application/common.php @@ -13,7 +13,7 @@ // +---------------------------------------------------------------------- -use app\admin\model\Node as NodeModal; +use app\admin\model\NodeModel as NodeModal; use think\Config; use think\Db; use Wechat\Loader; diff --git a/application/wechat/controller/Api.php b/application/wechat/controller/Api.php index bf050f122..576d15370 100644 --- a/application/wechat/controller/Api.php +++ b/application/wechat/controller/Api.php @@ -46,7 +46,7 @@ class Api extends Controller { $this->wechat = &load_wechat('Receive'); /* 验证接口请求 */ if ($this->wechat->valid() === false) { - $msg = "微信消息验证失败,{$this->wechat->errMsg}[{$this->wechat->errCode}]"; + $msg = "{$this->wechat->errMsg}[{$this->wechat->errCode}]"; Log::error($msg); exit($msg); } diff --git a/application/wechat/controller/Config.php b/application/wechat/controller/Config.php index 8eab434ba..d5f208b32 100644 --- a/application/wechat/controller/Config.php +++ b/application/wechat/controller/Config.php @@ -58,6 +58,16 @@ class Config extends BasicAdmin { return view(); } $data = $this->request->post(); + if (!empty($data['cert_zip_md5'])) { + $filename = ROOT_PATH . 'public/upload/' . join('/', str_split($data['cert_zip_md5'], 16)) . '.zip'; + if (file_exists($filename)) { + $zip = new \PclZip($filename); + $dirpath = APP_PATH . 'extra/wechat/cert'; + !file_exists($dirpath) && mkdir($dirpath, 0755, true); + $result = $zip->extract(PCLZIP_OPT_PATH, $dirpath); + dump($result); + } + } foreach ($data as $key => $vo) { DataService::save($this->table, ['name' => $key, 'value' => $vo], 'name'); } diff --git a/application/wechat/view/config.index.html b/application/wechat/view/config.index.html index b52f6c745..2354aa10c 100644 --- a/application/wechat/view/config.index.html +++ b/application/wechat/view/config.index.html @@ -8,9 +8,10 @@
- +

- 注意:接口链接的域名必需要备案,目前微信官方只支持80端口和443端口。 + 注意:服务器域名必需备案,微信官方只支持80端口和443端口。

@@ -30,7 +31,7 @@
-
diff --git a/application/wechat/view/config.pay.html b/application/wechat/view/config.pay.html index f208b8340..9ca4e5aa8 100644 --- a/application/wechat/view/config.pay.html +++ b/application/wechat/view/config.pay.html @@ -36,10 +36,9 @@
- -
+ +
已设置支付证书 (cert.zip)
diff --git a/composer.lock b/composer.lock index 4939c5219..7b83ab763 100644 --- a/composer.lock +++ b/composer.lock @@ -9,16 +9,16 @@ "packages": [ { "name": "endroid/qrcode", - "version": "1.9.1", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/endroid/QrCode.git", - "reference": "ab09b42778ad67cfe850f9c23165f8d08b756680" + "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/endroid/QrCode/ab09b42778ad67cfe850f9c23165f8d08b756680.zip", - "reference": "ab09b42778ad67cfe850f9c23165f8d08b756680", + "url": "https://files.phpcomposer.com/files/endroid/QrCode/c9644bec2a9cc9318e98d1437de3c628dcd1ef93.zip", + "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93", "shasum": "" }, "require": { @@ -65,7 +65,7 @@ "qrcode", "symfony" ], - "time": "2017-01-03 11:02:14" + "time": "2017-04-08 09:13:59" }, { "name": "pclzip/pclzip", @@ -157,16 +157,16 @@ }, { "name": "symfony/options-resolver", - "version": "v3.2.6", + "version": "v3.2.7", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "56e3d0a41313f8a54326851f10690d591e62a24c" + "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/symfony/options-resolver/56e3d0a41313f8a54326851f10690d591e62a24c.zip", - "reference": "56e3d0a41313f8a54326851f10690d591e62a24c", + "url": "https://files.phpcomposer.com/files/symfony/options-resolver/6a19be85237fe8bbd4975f86942b4763bb0da6ca.zip", + "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca", "shasum": "" }, "require": { @@ -207,7 +207,7 @@ "configuration", "options" ], - "time": "2017-02-21 09:12:04" + "time": "2017-03-21 21:44:32" }, { "name": "topthink/framework", @@ -298,16 +298,16 @@ }, { "name": "topthink/think-helper", - "version": "v1.0.5", + "version": "v1.0.6", "source": { "type": "git", "url": "https://github.com/top-think/think-helper.git", - "reference": "ed64408cdc4cdbd390365ba0906d208b987af520" + "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/top-think/think-helper/ed64408cdc4cdbd390365ba0906d208b987af520.zip", - "reference": "ed64408cdc4cdbd390365ba0906d208b987af520", + "url": "https://files.phpcomposer.com/files/top-think/think-helper/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f.zip", + "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", "shasum": "" }, "type": "library", @@ -330,7 +330,7 @@ } ], "description": "The ThinkPHP5 Helper Package", - "time": "2016-12-01 07:08:40" + "time": "2017-04-05 07:15:37" }, { "name": "topthink/think-installer", @@ -492,12 +492,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/wechat-php-sdk.git", - "reference": "a7590727eac59b918274399eea3c16eb01242087" + "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/a7590727eac59b918274399eea3c16eb01242087.zip", - "reference": "a7590727eac59b918274399eea3c16eb01242087", + "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/e04062d1c1cfb25e56bccb237e59382cfcc8facc.zip", + "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc", "shasum": "" }, "require": { @@ -518,7 +518,7 @@ "keywords": [ "wechat-php-sdk" ], - "time": "2017-03-27 06:30:12" + "time": "2017-04-07 03:34:14" } ], "packages-dev": [], diff --git a/vendor/autoload.php b/vendor/autoload.php index 8eacd6f2c..363b685a8 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82::getLoader(); +return ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index f2da767e0..ba27bd699 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82 +class ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5 { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire8520da1d36357c0d503d181bd00e9d82($fileIdentifier, $file); + composerRequire42475d352d15c1c328bfca6e545ab2b5($fileIdentifier, $file); } return $loader; } } -function composerRequire8520da1d36357c0d503d181bd00e9d82($fileIdentifier, $file) +function composerRequire42475d352d15c1c328bfca6e545ab2b5($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 9949957e6..aabbfca51 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit8520da1d36357c0d503d181bd00e9d82 +class ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5 { public static $files = array ( '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', @@ -314,9 +314,9 @@ class ComposerStaticInit8520da1d36357c0d503d181bd00e9d82 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$prefixDirsPsr4; - $loader->classMap = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 342a0b188..a1f80136e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -88,18 +88,18 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/wechat-php-sdk.git", - "reference": "a7590727eac59b918274399eea3c16eb01242087" + "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/a7590727eac59b918274399eea3c16eb01242087.zip", - "reference": "a7590727eac59b918274399eea3c16eb01242087", + "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/e04062d1c1cfb25e56bccb237e59382cfcc8facc.zip", + "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2017-03-27 06:30:12", + "time": "2017-04-07 03:34:14", "type": "project", "installation-source": "dist", "autoload": { @@ -335,20 +335,20 @@ }, { "name": "topthink/think-helper", - "version": "v1.0.5", - "version_normalized": "1.0.5.0", + "version": "v1.0.6", + "version_normalized": "1.0.6.0", "source": { "type": "git", "url": "https://github.com/top-think/think-helper.git", - "reference": "ed64408cdc4cdbd390365ba0906d208b987af520" + "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/top-think/think-helper/ed64408cdc4cdbd390365ba0906d208b987af520.zip", - "reference": "ed64408cdc4cdbd390365ba0906d208b987af520", + "url": "https://files.phpcomposer.com/files/top-think/think-helper/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f.zip", + "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", "shasum": "" }, - "time": "2016-12-01 07:08:40", + "time": "2017-04-05 07:15:37", "type": "library", "installation-source": "dist", "autoload": { @@ -420,23 +420,23 @@ }, { "name": "symfony/options-resolver", - "version": "v3.2.6", - "version_normalized": "3.2.6.0", + "version": "v3.2.7", + "version_normalized": "3.2.7.0", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "56e3d0a41313f8a54326851f10690d591e62a24c" + "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/symfony/options-resolver/56e3d0a41313f8a54326851f10690d591e62a24c.zip", - "reference": "56e3d0a41313f8a54326851f10690d591e62a24c", + "url": "https://files.phpcomposer.com/files/symfony/options-resolver/6a19be85237fe8bbd4975f86942b4763bb0da6ca.zip", + "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "time": "2017-02-21 09:12:04", + "time": "2017-03-21 21:44:32", "type": "library", "extra": { "branch-alias": { @@ -476,17 +476,17 @@ }, { "name": "endroid/qrcode", - "version": "1.9.1", - "version_normalized": "1.9.1.0", + "version": "1.9.3", + "version_normalized": "1.9.3.0", "source": { "type": "git", "url": "https://github.com/endroid/QrCode.git", - "reference": "ab09b42778ad67cfe850f9c23165f8d08b756680" + "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93" }, "dist": { "type": "zip", - "url": "https://files.phpcomposer.com/files/endroid/QrCode/ab09b42778ad67cfe850f9c23165f8d08b756680.zip", - "reference": "ab09b42778ad67cfe850f9c23165f8d08b756680", + "url": "https://files.phpcomposer.com/files/endroid/QrCode/c9644bec2a9cc9318e98d1437de3c628dcd1ef93.zip", + "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93", "shasum": "" }, "require": { @@ -501,7 +501,7 @@ "symfony/framework-bundle": "^2.3|^3.0", "symfony/http-kernel": "^2.3|^3.0" }, - "time": "2017-01-03 11:02:14", + "time": "2017-04-08 09:13:59", "type": "library", "extra": { "branch-alias": { diff --git a/vendor/endroid/qrcode/src/QrCode.php b/vendor/endroid/qrcode/src/QrCode.php index 1fe249ce8..b128cfc42 100644 --- a/vendor/endroid/qrcode/src/QrCode.php +++ b/vendor/endroid/qrcode/src/QrCode.php @@ -1397,7 +1397,10 @@ class QrCode ++$i; } - $mib = $max_modules_1side + 8; + $mib = $max_modules_1side; + if ($this->draw_quiet_zone) { + $mib += 8; + } if ($this->size == 0) { $this->size = $mib * $qrcode_module_size; @@ -1458,7 +1461,7 @@ class QrCode if ($this->draw_quiet_zone == true) { imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 0, 0, $this->size, $this->size, $mib, $mib); } else { - imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 4, 4, $this->size, $this->size, $mib - 8, $mib - 8); + imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 4, 4, $this->size, $this->size, $mib, $mib); } if ($this->draw_border == true) { @@ -1559,7 +1562,15 @@ class QrCode $output_image = imagecreatetruecolor($image_width, $image_height); imagecopy($output_image, $output_image_org, 0, 0, 0, 0, $image_width, $image_height); - $logo_image = call_user_func('imagecreatefrom'.$this->image_type, $this->logo); + $image_info = getimagesize($this->logo); + + if ($image_info !== false) { + $image_type = strtolower(substr(image_type_to_extension($image_info [2]), 1)); + $logo_image = call_user_func('imagecreatefrom'.$image_type, $this->logo); + } else { + $logo_image = call_user_func('imagecreatefrom'.$this->image_type, $this->logo); + } + if (!$logo_image) { throw new ImageFunctionFailedException('imagecreatefrom'.$this->image_type.' '.$this->logo.' failed'); } diff --git a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php index da223bd20..d09dece33 100644 --- a/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php +++ b/vendor/symfony/options-resolver/Tests/OptionsResolverTest.php @@ -1102,7 +1102,7 @@ class OptionsResolverTest extends TestCase $this->resolver->resolve(); } - public function testCatchedExceptionFromNormalizerDoesNotCrashOptionResolver() + public function testCaughtExceptionFromNormalizerDoesNotCrashOptionResolver() { $throw = true; @@ -1116,7 +1116,7 @@ class OptionsResolverTest extends TestCase } }); - $this->resolver->setNormalizer('thrower', function (Options $options) use (&$throw) { + $this->resolver->setNormalizer('thrower', function () use (&$throw) { if ($throw) { $throw = false; throw new \UnexpectedValueException('throwing'); @@ -1125,10 +1125,10 @@ class OptionsResolverTest extends TestCase return true; }); - $this->resolver->resolve(); + $this->assertSame(array('catcher' => false, 'thrower' => true), $this->resolver->resolve()); } - public function testCatchedExceptionFromLazyDoesNotCrashOptionResolver() + public function testCaughtExceptionFromLazyDoesNotCrashOptionResolver() { $throw = true; @@ -1149,7 +1149,7 @@ class OptionsResolverTest extends TestCase return true; }); - $this->resolver->resolve(); + $this->assertSame(array('catcher' => false, 'thrower' => true), $this->resolver->resolve()); } public function testInvokeEachNormalizerOnlyOnce() diff --git a/vendor/topthink/think-helper/src/helper.php b/vendor/topthink/think-helper/src/helper.php index 5d2b63adc..f6a55233e 100644 --- a/vendor/topthink/think-helper/src/helper.php +++ b/vendor/topthink/think-helper/src/helper.php @@ -64,4 +64,30 @@ if (!function_exists('trait_uses_recursive')) { return $traits; } +} +if (!function_exists('classnames')) { + /** + * css样式名生成器 + * classnames("foo", "bar"); // => "foo bar" + * classnames("foo", [ "bar"=> true ]); // => "foo bar" + * classnames([ "foo-bar"=> true ]); // => "foo-bar" + * classnames([ "foo-bar"=> false ]); // => " + * classnames([ "foo" => true ], [ "bar"=> true ]); // => "foo bar" + * classnames([ "foo" => true, "bar"=> true ]); // => "foo bar" + * classnames("foo", [ "bar"=> true, "duck"=> false ], "baz", [ "quux"=> true ]); // => "foo bar baz quux" + * classnames(null, false, "bar", 0, 1, [ "baz"=> null ]); // => "bar 1" + */ + function classnames() + { + $args = func_get_args(); + $classes = array_map(function ($arg) { + if (is_array($arg)) { + return implode(" ", array_filter(array_map(function ($expression, $class) { + return $expression ? $class : false; + }, $arg, array_keys($arg)))); + } + return $arg; + }, $args); + return implode(" ", array_filter($classes)); + } } \ No newline at end of file diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Prpcrypt.php b/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Prpcrypt.php index bc72e300d..074046207 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Prpcrypt.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Prpcrypt.php @@ -12,15 +12,13 @@ class PKCS7Encoder { /** * 对需要加密的明文进行填充补位 - * @param $text 需要进行填充补位操作的明文 - * @return 补齐明文字符串 + * @param string $text 需要进行填充补位操作的明文 + * @return string 补齐明文字符串 */ function encode($text) { - $block_size = PKCS7Encoder::$block_size; - $text_length = strlen($text); - $amount_to_pad = PKCS7Encoder::$block_size - ($text_length % PKCS7Encoder::$block_size); + $amount_to_pad = PKCS7Encoder::$block_size - (strlen($text) % PKCS7Encoder::$block_size); if ($amount_to_pad == 0) { - $amount_to_pad = PKCS7Encoder::block_size; + $amount_to_pad = PKCS7Encoder::$block_size; } $pad_chr = chr($amount_to_pad); $tmp = ""; @@ -32,8 +30,8 @@ class PKCS7Encoder { /** * 对解密后的明文进行补位删除 - * @param decrypted 解密后的明文 - * @return 删除填充补位后的明文 + * @param string $text 解密后的明文 + * @return string 删除填充补位后的明文 */ function decode($text) { $pad = ord(substr($text, -1)); @@ -62,46 +60,39 @@ class Prpcrypt { /** * 对明文进行加密 * @param string $text 需要加密的明文 + * @param string $appid 公众号APPID * @return string 加密后的密文 */ public function encrypt($text, $appid) { try { - $random = $this->getRandomStr(); + //获得16位随机字符串,填充到明文之前 + $random = $this->getRandomStr();//"aaaabbbbccccdddd"; $text = $random . pack("N", strlen($text)) . $text . $appid; - $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); - $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv = substr($this->key, 0, 16); - $pkc_encoder = new PKCS7Encoder(); + $pkc_encoder = new PKCS7Encoder; $text = $pkc_encoder->encode($text); - mcrypt_generic_init($module, $this->key, $iv); - $encrypted = mcrypt_generic($module, $text); - mcrypt_generic_deinit($module); - mcrypt_module_close($module); - return array(ErrorCode::$OK, base64_encode($encrypted)); + $encrypted = openssl_encrypt($text, 'AES-256-CBC', substr($this->key, 0, 32), OPENSSL_ZERO_PADDING, $iv); + return array(ErrorCode::$OK, $encrypted); } catch (Exception $e) { - return array(ErrorCode::$EncryptAESError, ErrorCode::getErrText(ErrorCode::$EncryptAESError)); + return array(ErrorCode::$EncryptAESError, null); } } /** * 对密文进行解密 * @param string $encrypted 需要解密的密文 + * @param string $appid 公众号APPID * @return string 解密得到的明文 */ public function decrypt($encrypted, $appid) { try { - $ciphertext_dec = base64_decode($encrypted); - $module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv = substr($this->key, 0, 16); - mcrypt_generic_init($module, $this->key, $iv); - $decrypted = mdecrypt_generic($module, $ciphertext_dec); - mcrypt_generic_deinit($module); - mcrypt_module_close($module); + $decrypted = openssl_decrypt($encrypted, 'AES-256-CBC', substr($this->key, 0, 32), OPENSSL_ZERO_PADDING, $iv); } catch (Exception $e) { - return array(ErrorCode::$DecryptAESError, ErrorCode::getErrText(ErrorCode::$DecryptAESError)); + return array(ErrorCode::$DecryptAESError, null); } try { - $pkc_encoder = new PKCS7Encoder(); + $pkc_encoder = new PKCS7Encoder; $result = $pkc_encoder->decode($decrypted); if (strlen($result) < 16) { return ""; @@ -115,7 +106,7 @@ class Prpcrypt { $appid = $from_appid; } } catch (Exception $e) { - return array(ErrorCode::$IllegalBuffer, ErrorCode::getErrText(ErrorCode::$IllegalBuffer)); + return array(ErrorCode::$IllegalBuffer, null); } return array(0, $xml_content, $from_appid); } @@ -137,10 +128,9 @@ class Prpcrypt { } /** - * 仅用作类内部使用,不用于官方API接口的errCode码 - * @category WechatSDK - * @subpackage library - * @date 2016/06/28 11:59 + * 仅用作类内部使用 + * 不用于官方API接口的errCode码 + * Class ErrorCode */ class ErrorCode { @@ -173,15 +163,14 @@ class ErrorCode { /** * 获取错误消息内容 - * @param type $err + * @param string $err * @return bool */ public static function getErrText($err) { if (isset(self::$errCode[$err])) { return self::$errCode[$err]; - } else { - return false; } + return false; } } diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Tools.php b/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Tools.php index 0d6f463de..52f618df5 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Tools.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/Lib/Tools.php @@ -136,7 +136,7 @@ class Tools { /** * 以post方式提交请求 * @param string $url - * @param array|string $postdata + * @param array|string $data * @return bool|mixed */ static public function httpPost($url, $data) { diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php b/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php index 428e48cc7..370394a7a 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/Loader.php @@ -76,7 +76,7 @@ class Loader { if (!isset(self::$cache[$index])) { $basicName = 'Wechat' . ucfirst(strtolower($type)); $className = "\\Wechat\\{$basicName}"; - /* 注册类的无命名空间别名,兼容未带命名空间的老版本SDK */ + // 注册类的无命名空间别名,兼容未带命名空间的老版本SDK !class_exists($basicName, FALSE) && class_alias($className, $basicName); self::$cache[$index] = new $className(self::config($config)); } diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatCard.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatCard.php index cbbad872c..5fb258f92 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatCard.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatCard.php @@ -46,6 +46,7 @@ class WechatCard extends Common { const CARD_PAYCELL_SET = '/card/paycell/set?'; /*设置开卡字段接口*/ const CARD_MEMBERCARD_ACTIVATEUSERFORM_SET = '/card/membercard/activateuserform/set?'; + /** * 获取微信卡券 api_ticket * @param string $appid @@ -722,19 +723,20 @@ class WechatCard extends Common { } return false; } + /** * 设置买单接口 - * @DateTime 2016-12-02T19:19:45+0800 - * @param [type] $card_id [description] - * @param boolean $is_openid [description] + * @param string $card_id + * @param bool $is_openid + * @return bool|mixed */ - public function setPaycell($card_id,$is_openid = true){ + public function setPaycell($card_id, $is_openid = true) { if (!$this->access_token && !$this->getAccessToken()) { return false; } $data = array( - 'card_id' => $card_id, - 'is_open' => $is_openid, + 'card_id' => $card_id, + 'is_open' => $is_openid, ); $result = Tools::httpPost(self::API_BASE_URL_PREFIX . self::CARD_PAYCELL_SET . "access_token={$this->access_token}", Tools::json_encode($data)); if ($result) { @@ -751,10 +753,10 @@ class WechatCard extends Common { /** * 设置开卡字段信息接口 - * @DateTime 2016-12-02T20:31:43+0800 - * @param [type] $data [description] + * @param array $data + * @return bool|array */ - public function setMembercardActivateuserform($data){ + public function setMembercardActivateuserform($data) { if (!$this->access_token && !$this->getAccessToken()) { return false; } diff --git a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatReceive.php b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatReceive.php index 2a351c9fa..1c33199b2 100644 --- a/vendor/zoujingli/wechat-php-sdk/Wechat/WechatReceive.php +++ b/vendor/zoujingli/wechat-php-sdk/Wechat/WechatReceive.php @@ -51,7 +51,7 @@ class WechatReceive extends Common { return $this; } $postStr = !empty($this->postxml) ? $this->postxml : file_get_contents("php://input"); - !empty($postStr) && $this->_receive = (array) simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); + !empty($postStr) && $this->_receive = (array)simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); return $this; } @@ -70,9 +70,8 @@ class WechatReceive extends Common { public function getRevFrom() { if (isset($this->_receive['FromUserName'])) { return $this->_receive['FromUserName']; - } else { - return false; } + return false; } /** @@ -82,9 +81,8 @@ class WechatReceive extends Common { public function getRevTo() { if (isset($this->_receive['ToUserName'])) { return $this->_receive['ToUserName']; - } else { - return false; } + return false; } /** @@ -94,9 +92,8 @@ class WechatReceive extends Common { public function getRevType() { if (isset($this->_receive['MsgType'])) { return $this->_receive['MsgType']; - } else { - return false; } + return false; } /** @@ -106,9 +103,8 @@ class WechatReceive extends Common { public function getRevID() { if (isset($this->_receive['MsgId'])) { return $this->_receive['MsgId']; - } else { - return false; } + return false; } /** @@ -118,9 +114,8 @@ class WechatReceive extends Common { public function getRevCtime() { if (isset($this->_receive['CreateTime'])) { return $this->_receive['CreateTime']; - } else { - return false; } + return false; } /** @@ -131,9 +126,8 @@ class WechatReceive extends Common { public function getRevCardPass() { if (isset($this->_receive['CardId'])) { return $this->_receive['CardId']; - } else { - return false; } + return false; } /** @@ -155,9 +149,8 @@ class WechatReceive extends Common { } if (isset($array) && count($array) > 0) { return $array; - } else { - return false; } + return false; } /** @@ -174,9 +167,8 @@ class WechatReceive extends Common { } if (isset($array) && count($array) > 0) { return $array; - } else { - return false; } + return false; } /** @@ -188,9 +180,8 @@ class WechatReceive extends Common { return $this->_receive['Content']; } else if (isset($this->_receive['Recognition'])) { //获取语音识别文字内容,需申请开通 return $this->_receive['Recognition']; - } else { - return false; } + return false; } /** @@ -201,11 +192,10 @@ class WechatReceive extends Common { if (isset($this->_receive['PicUrl'])) { return array( 'mediaid' => $this->_receive['MediaId'], - 'picurl' => (string) $this->_receive['PicUrl'], //防止picurl为空导致解析出错 + 'picurl' => (string)$this->_receive['PicUrl'], //防止picurl为空导致解析出错 ); - } else { - return false; } + return false; } /** @@ -219,9 +209,8 @@ class WechatReceive extends Common { 'title' => $this->_receive['Title'], 'description' => $this->_receive['Description'] ); - } else { - return false; } + return false; } /** @@ -236,9 +225,8 @@ class WechatReceive extends Common { 'scale' => $this->_receive['Scale'], 'label' => $this->_receive['Label'] ); - } else { - return false; } + return false; } /** @@ -284,7 +272,7 @@ class WechatReceive extends Common { public function getRevScanInfo() { if (isset($this->_receive['ScanCodeInfo'])) { if (!is_array($this->_receive['ScanCodeInfo'])) { - $array = (array) $this->_receive['ScanCodeInfo']; + $array = (array)$this->_receive['ScanCodeInfo']; $this->_receive['ScanCodeInfo'] = $array; } else { $array = $this->_receive['ScanCodeInfo']; @@ -319,13 +307,13 @@ class WechatReceive extends Common { public function getRevSendPicsInfo() { if (isset($this->_receive['SendPicsInfo'])) { if (!is_array($this->_receive['SendPicsInfo'])) { - $array = (array) $this->_receive['SendPicsInfo']; + $array = (array)$this->_receive['SendPicsInfo']; if (isset($array['PicList'])) { - $array['PicList'] = (array) $array['PicList']; + $array['PicList'] = (array)$array['PicList']; $item = $array['PicList']['item']; $array['PicList']['item'] = array(); foreach ($item as $key => $value) { - $array['PicList']['item'][$key] = (array) $value; + $array['PicList']['item'][$key] = (array)$value; } } $this->_receive['SendPicsInfo'] = $array; @@ -358,7 +346,7 @@ class WechatReceive extends Common { public function getRevSendGeoInfo() { if (isset($this->_receive['SendLocationInfo'])) { if (!is_array($this->_receive['SendLocationInfo'])) { - $array = (array) $this->_receive['SendLocationInfo']; + $array = (array)$this->_receive['SendLocationInfo']; if (empty($array['Poiname'])) { $array['Poiname'] = ""; }