[更新]更新Node模型名称

This commit is contained in:
邹景立 2017-04-11 11:43:14 +08:00
parent 2b2b852361
commit d84a16e8b6
25 changed files with 188 additions and 160 deletions

View File

@ -14,7 +14,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Node as NodeModal; use app\admin\model\NodeModel;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\DataService; use service\DataService;
use service\ToolsService; use service\ToolsService;
@ -51,7 +51,7 @@ class Auth extends BasicAdmin {
$auth_id = $this->request->get('id', '0'); $auth_id = $this->request->get('id', '0');
switch (strtolower($this->request->get('action', '0'))) { switch (strtolower($this->request->get('action', '0'))) {
case 'getnode': case 'getnode':
$nodes = NodeModal::get(); $nodes = NodeModel::get();
$checked = Db::name('SystemAuthNode')->where('auth', $auth_id)->column('node'); $checked = Db::name('SystemAuthNode')->where('auth', $auth_id)->column('node');
foreach ($nodes as $key => &$node) { foreach ($nodes as $key => &$node) {
$node['checked'] = in_array($node['node'], $checked); $node['checked'] = in_array($node['node'], $checked);

View File

@ -14,7 +14,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Node; use app\admin\model\NodeModel;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\DataService; use service\DataService;
use service\ToolsService; use service\ToolsService;
@ -35,7 +35,7 @@ class Index extends BasicAdmin {
* @return View * @return View
*/ */
public function index() { public function index() {
Node::applyAuthNode(); NodeModel::applyAuthNode();
$list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select(); $list = Db::name('SystemMenu')->where('status', '1')->order('sort asc,id asc')->select();
$menus = $this->_filterMenu(ToolsService::arr2tree($list)); $menus = $this->_filterMenu(ToolsService::arr2tree($list));
$this->assign('title', '后台管理'); $this->assign('title', '后台管理');

View File

@ -14,7 +14,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Node as NodeModal; use app\admin\model\NodeModel as NodeModal;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\LogService; use service\LogService;
use think\Db; use think\Db;

View File

@ -14,7 +14,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Node; use app\admin\model\NodeModel;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\DataService; use service\DataService;
use service\ToolsService; 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) { foreach ($nodes as $key => $_vo) {
if (empty($_vo['is_menu'])) { if (empty($_vo['is_menu'])) {
unset($nodes[$key]); unset($nodes[$key]);

View File

@ -14,7 +14,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\model\Node as NodeModel; use app\admin\model\NodeModel as NodeModel;
use controller\BasicAdmin; use controller\BasicAdmin;
use service\DataService; use service\DataService;
use service\ToolsService; use service\ToolsService;

View File

@ -47,7 +47,7 @@ class Plugs extends BasicAdmin {
$types = $this->request->get('type', 'jpg,png'); $types = $this->request->get('type', 'jpg,png');
$this->assign('mode', $mode); $this->assign('mode', $mode);
$this->assign('types', $types); $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('mimes', FileService::getFileMine($types));
$this->assign('field', $this->request->get('field', 'file')); $this->assign('field', $this->request->get('field', 'file'));
return view(); return view();
@ -61,16 +61,18 @@ class Plugs extends BasicAdmin {
if ($this->request->isPost()) { if ($this->request->isPost()) {
$md5s = str_split($this->request->post('md5'), 16); $md5s = str_split($this->request->post('md5'), 16);
if (($info = $this->request->file('file')->move('upload' . DS . $md5s[0], $md5s[1], true))) { if (($info = $this->request->file('file')->move('upload' . DS . $md5s[0], $md5s[1], true))) {
$site_url = FileService::getFileUrl(join('/', $md5s) . '.' . $info->getExtension()); $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(['data' => ['site_url' => $site_url], 'code' => 'SUCCESS']);
} }
} }
}
return json(['code' => 'ERROR']); return json(['code' => 'ERROR']);
} }
/** /**
* 文件状态检查 * 文件状态检查
* @return string
*/ */
public function upstate() { public function upstate() {
$post = $this->request->post(); $post = $this->request->post();
@ -81,7 +83,7 @@ class Plugs extends BasicAdmin {
} }
// 需要上传文件,生成上传配置参数 // 需要上传文件,生成上传配置参数
$config = ['uptype' => $post['uptype'], 'file_url' => $filename, 'server' => url('admin/plugs/upload')]; $config = ['uptype' => $post['uptype'], 'file_url' => $filename, 'server' => url('admin/plugs/upload')];
switch (strtolower(sysconf('storage_type'))) { switch (strtolower($post['uptype'])) {
case 'qiniu': case 'qiniu':
$config['server'] = sysconf('storage_qiniu_is_https') ? 'https://up.qbox.me' : 'http://upload.qiniu.com'; $config['server'] = sysconf('storage_qiniu_is_https') ? 'https://up.qbox.me' : 'http://upload.qiniu.com';
$config['token'] = $this->_getQiniuToken($filename); $config['token'] = $this->_getQiniuToken($filename);

View File

@ -24,7 +24,7 @@ use think\Db;
* @author Anyon <zoujingli@qq.com> * @author Anyon <zoujingli@qq.com>
* @date 2017/03/14 18:12 * @date 2017/03/14 18:12
*/ */
class Node { class NodeModel {
/** /**
* 应用用户权限节点 * 应用用户权限节点

View File

@ -13,7 +13,7 @@
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
use app\admin\model\Node as NodeModal; use app\admin\model\NodeModel as NodeModal;
use think\Config; use think\Config;
use think\Db; use think\Db;
use Wechat\Loader; use Wechat\Loader;

View File

@ -46,7 +46,7 @@ class Api extends Controller {
$this->wechat = &load_wechat('Receive'); $this->wechat = &load_wechat('Receive');
/* 验证接口请求 */ /* 验证接口请求 */
if ($this->wechat->valid() === false) { if ($this->wechat->valid() === false) {
$msg = "微信消息验证失败,{$this->wechat->errMsg}[{$this->wechat->errCode}]"; $msg = "{$this->wechat->errMsg}[{$this->wechat->errCode}]";
Log::error($msg); Log::error($msg);
exit($msg); exit($msg);
} }

View File

@ -58,6 +58,16 @@ class Config extends BasicAdmin {
return view(); return view();
} }
$data = $this->request->post(); $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) { foreach ($data as $key => $vo) {
DataService::save($this->table, ['name' => $key, 'value' => $vo], 'name'); DataService::save($this->table, ['name' => $key, 'value' => $vo], 'name');
} }

View File

@ -8,9 +8,10 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 col-xs-3 control-label">URL(服务器地址)</label> <label class="col-sm-2 col-xs-3 control-label">URL(服务器地址)</label>
<div class="col-sm-8"> <div class="col-sm-8">
<input readonly onmouseenter="this.select()" value="{:url('@wechat/api','',true,true)}" class="layui-input"> <input data-tips-text="请点鼠标右键复制URL地址" onmouseenter="this.select()" class="layui-input"
value="{:url('@wechat/api','',true,true)}" readonly/>
<p class="help-block"> <p class="help-block">
注意:接口链接的域名必需要备案,目前微信官方只支持80端口和443端口。 注意:服务器域名必需备案,微信官方只支持80端口和443端口。
</p> </p>
</div> </div>
</div> </div>
@ -30,7 +31,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 col-xs-3 control-label">AppSecret(应用密钥)</label> <label class="col-sm-2 col-xs-3 control-label">AppSecret(应用密钥)</label>
<div class='col-sm-8'> <div class='col-sm-8'>
<input type="text" name="wechat_appsecret" required="required" title="请输入公众号AppSecret" <input type="password" name="wechat_appsecret" required="required" title="请输入公众号AppSecret"
placeholder="公众号AppSecret必填" value="{:sysconf('wechat_appsecret')}" placeholder="公众号AppSecret必填" value="{:sysconf('wechat_appsecret')}"
class="layui-input"> class="layui-input">
</div> </div>

View File

@ -36,10 +36,9 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">支付证书</label> <label class="col-sm-2 control-label">支付证书</label>
<div class="col-sm-7"> <div class="col-sm-7">
<input onchange="$(this).next().html('已选择支付证书 (cert.zip)'), $('[data-pay-test]').remove()" <input type="hidden" name="cert_zip_md5" value="" onchange="this.value=$(this).attr('data-md5')"/>
type="hidden" name="cert_zip" value=""/> <div data-file="one" data-type="zip" data-field="cert_zip_md5" data-uptype="local"
<div class="well" style="text-align:center;cursor:pointer" data-file class="well" style="text-align:center;cursor:pointer">
data-type="zip" data-field="cert_zip" data-uptype="local" data-one="true">
<span class="fa fa-check-circle-o" style="color:#00B83F;font-size:16px"></span> <span class="fa fa-check-circle-o" style="color:#00B83F;font-size:16px"></span>
已设置支付证书 (cert.zip) 已设置支付证书 (cert.zip)
</div> </div>

38
composer.lock generated
View File

@ -9,16 +9,16 @@
"packages": [ "packages": [
{ {
"name": "endroid/qrcode", "name": "endroid/qrcode",
"version": "1.9.1", "version": "1.9.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/endroid/QrCode.git", "url": "https://github.com/endroid/QrCode.git",
"reference": "ab09b42778ad67cfe850f9c23165f8d08b756680" "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/endroid/QrCode/ab09b42778ad67cfe850f9c23165f8d08b756680.zip", "url": "https://files.phpcomposer.com/files/endroid/QrCode/c9644bec2a9cc9318e98d1437de3c628dcd1ef93.zip",
"reference": "ab09b42778ad67cfe850f9c23165f8d08b756680", "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -65,7 +65,7 @@
"qrcode", "qrcode",
"symfony" "symfony"
], ],
"time": "2017-01-03 11:02:14" "time": "2017-04-08 09:13:59"
}, },
{ {
"name": "pclzip/pclzip", "name": "pclzip/pclzip",
@ -157,16 +157,16 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.2.6", "version": "v3.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "56e3d0a41313f8a54326851f10690d591e62a24c" "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/symfony/options-resolver/56e3d0a41313f8a54326851f10690d591e62a24c.zip", "url": "https://files.phpcomposer.com/files/symfony/options-resolver/6a19be85237fe8bbd4975f86942b4763bb0da6ca.zip",
"reference": "56e3d0a41313f8a54326851f10690d591e62a24c", "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -207,7 +207,7 @@
"configuration", "configuration",
"options" "options"
], ],
"time": "2017-02-21 09:12:04" "time": "2017-03-21 21:44:32"
}, },
{ {
"name": "topthink/framework", "name": "topthink/framework",
@ -298,16 +298,16 @@
}, },
{ {
"name": "topthink/think-helper", "name": "topthink/think-helper",
"version": "v1.0.5", "version": "v1.0.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-helper.git", "url": "https://github.com/top-think/think-helper.git",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520" "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/top-think/think-helper/ed64408cdc4cdbd390365ba0906d208b987af520.zip", "url": "https://files.phpcomposer.com/files/top-think/think-helper/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f.zip",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520", "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f",
"shasum": "" "shasum": ""
}, },
"type": "library", "type": "library",
@ -330,7 +330,7 @@
} }
], ],
"description": "The ThinkPHP5 Helper Package", "description": "The ThinkPHP5 Helper Package",
"time": "2016-12-01 07:08:40" "time": "2017-04-05 07:15:37"
}, },
{ {
"name": "topthink/think-installer", "name": "topthink/think-installer",
@ -492,12 +492,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/wechat-php-sdk.git", "url": "https://github.com/zoujingli/wechat-php-sdk.git",
"reference": "a7590727eac59b918274399eea3c16eb01242087" "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/a7590727eac59b918274399eea3c16eb01242087.zip", "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/e04062d1c1cfb25e56bccb237e59382cfcc8facc.zip",
"reference": "a7590727eac59b918274399eea3c16eb01242087", "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -518,7 +518,7 @@
"keywords": [ "keywords": [
"wechat-php-sdk" "wechat-php-sdk"
], ],
"time": "2017-03-27 06:30:12" "time": "2017-04-07 03:34:14"
} }
], ],
"packages-dev": [], "packages-dev": [],

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82::getLoader(); return ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82 class ComposerAutoloaderInit42475d352d15c1c328bfca6e545ab2b5
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82
return self::$loader; 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(); 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'); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
if ($useStaticLoader) { if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php'; require_once __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::getInitializer($loader));
} else { } else {
$map = require __DIR__ . '/autoload_namespaces.php'; $map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) { foreach ($map as $namespace => $path) {
@ -48,19 +48,19 @@ class ComposerAutoloaderInit8520da1d36357c0d503d181bd00e9d82
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$files; $includeFiles = Composer\Autoload\ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$files;
} else { } else {
$includeFiles = require __DIR__ . '/autoload_files.php'; $includeFiles = require __DIR__ . '/autoload_files.php';
} }
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire8520da1d36357c0d503d181bd00e9d82($fileIdentifier, $file); composerRequire42475d352d15c1c328bfca6e545ab2b5($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequire8520da1d36357c0d503d181bd00e9d82($fileIdentifier, $file) function composerRequire42475d352d15c1c328bfca6e545ab2b5($fileIdentifier, $file)
{ {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file; require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit8520da1d36357c0d503d181bd00e9d82 class ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5
{ {
public static $files = array ( public static $files = array (
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
@ -314,9 +314,9 @@ class ComposerStaticInit8520da1d36357c0d503d181bd00e9d82
public static function getInitializer(ClassLoader $loader) public static function getInitializer(ClassLoader $loader)
{ {
return \Closure::bind(function () use ($loader) { return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit8520da1d36357c0d503d181bd00e9d82::$classMap; $loader->classMap = ComposerStaticInit42475d352d15c1c328bfca6e545ab2b5::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -88,18 +88,18 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/wechat-php-sdk.git", "url": "https://github.com/zoujingli/wechat-php-sdk.git",
"reference": "a7590727eac59b918274399eea3c16eb01242087" "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/a7590727eac59b918274399eea3c16eb01242087.zip", "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/e04062d1c1cfb25e56bccb237e59382cfcc8facc.zip",
"reference": "a7590727eac59b918274399eea3c16eb01242087", "reference": "e04062d1c1cfb25e56bccb237e59382cfcc8facc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"time": "2017-03-27 06:30:12", "time": "2017-04-07 03:34:14",
"type": "project", "type": "project",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -335,20 +335,20 @@
}, },
{ {
"name": "topthink/think-helper", "name": "topthink/think-helper",
"version": "v1.0.5", "version": "v1.0.6",
"version_normalized": "1.0.5.0", "version_normalized": "1.0.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/top-think/think-helper.git", "url": "https://github.com/top-think/think-helper.git",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520" "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/top-think/think-helper/ed64408cdc4cdbd390365ba0906d208b987af520.zip", "url": "https://files.phpcomposer.com/files/top-think/think-helper/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f.zip",
"reference": "ed64408cdc4cdbd390365ba0906d208b987af520", "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f",
"shasum": "" "shasum": ""
}, },
"time": "2016-12-01 07:08:40", "time": "2017-04-05 07:15:37",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -420,23 +420,23 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v3.2.6", "version": "v3.2.7",
"version_normalized": "3.2.6.0", "version_normalized": "3.2.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "56e3d0a41313f8a54326851f10690d591e62a24c" "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/symfony/options-resolver/56e3d0a41313f8a54326851f10690d591e62a24c.zip", "url": "https://files.phpcomposer.com/files/symfony/options-resolver/6a19be85237fe8bbd4975f86942b4763bb0da6ca.zip",
"reference": "56e3d0a41313f8a54326851f10690d591e62a24c", "reference": "6a19be85237fe8bbd4975f86942b4763bb0da6ca",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9" "php": ">=5.5.9"
}, },
"time": "2017-02-21 09:12:04", "time": "2017-03-21 21:44:32",
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
@ -476,17 +476,17 @@
}, },
{ {
"name": "endroid/qrcode", "name": "endroid/qrcode",
"version": "1.9.1", "version": "1.9.3",
"version_normalized": "1.9.1.0", "version_normalized": "1.9.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/endroid/QrCode.git", "url": "https://github.com/endroid/QrCode.git",
"reference": "ab09b42778ad67cfe850f9c23165f8d08b756680" "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/endroid/QrCode/ab09b42778ad67cfe850f9c23165f8d08b756680.zip", "url": "https://files.phpcomposer.com/files/endroid/QrCode/c9644bec2a9cc9318e98d1437de3c628dcd1ef93.zip",
"reference": "ab09b42778ad67cfe850f9c23165f8d08b756680", "reference": "c9644bec2a9cc9318e98d1437de3c628dcd1ef93",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -501,7 +501,7 @@
"symfony/framework-bundle": "^2.3|^3.0", "symfony/framework-bundle": "^2.3|^3.0",
"symfony/http-kernel": "^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", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {

View File

@ -1397,7 +1397,10 @@ class QrCode
++$i; ++$i;
} }
$mib = $max_modules_1side + 8; $mib = $max_modules_1side;
if ($this->draw_quiet_zone) {
$mib += 8;
}
if ($this->size == 0) { if ($this->size == 0) {
$this->size = $mib * $qrcode_module_size; $this->size = $mib * $qrcode_module_size;
@ -1458,7 +1461,7 @@ class QrCode
if ($this->draw_quiet_zone == true) { if ($this->draw_quiet_zone == true) {
imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 0, 0, $this->size, $this->size, $mib, $mib); imagecopyresampled($output_image, $base_image, $this->padding, $this->padding, 0, 0, $this->size, $this->size, $mib, $mib);
} else { } 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) { if ($this->draw_border == true) {
@ -1559,7 +1562,15 @@ class QrCode
$output_image = imagecreatetruecolor($image_width, $image_height); $output_image = imagecreatetruecolor($image_width, $image_height);
imagecopy($output_image, $output_image_org, 0, 0, 0, 0, $image_width, $image_height); imagecopy($output_image, $output_image_org, 0, 0, 0, 0, $image_width, $image_height);
$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); $logo_image = call_user_func('imagecreatefrom'.$this->image_type, $this->logo);
}
if (!$logo_image) { if (!$logo_image) {
throw new ImageFunctionFailedException('imagecreatefrom'.$this->image_type.' '.$this->logo.' failed'); throw new ImageFunctionFailedException('imagecreatefrom'.$this->image_type.' '.$this->logo.' failed');
} }

View File

@ -1102,7 +1102,7 @@ class OptionsResolverTest extends TestCase
$this->resolver->resolve(); $this->resolver->resolve();
} }
public function testCatchedExceptionFromNormalizerDoesNotCrashOptionResolver() public function testCaughtExceptionFromNormalizerDoesNotCrashOptionResolver()
{ {
$throw = true; $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) { if ($throw) {
$throw = false; $throw = false;
throw new \UnexpectedValueException('throwing'); throw new \UnexpectedValueException('throwing');
@ -1125,10 +1125,10 @@ class OptionsResolverTest extends TestCase
return true; return true;
}); });
$this->resolver->resolve(); $this->assertSame(array('catcher' => false, 'thrower' => true), $this->resolver->resolve());
} }
public function testCatchedExceptionFromLazyDoesNotCrashOptionResolver() public function testCaughtExceptionFromLazyDoesNotCrashOptionResolver()
{ {
$throw = true; $throw = true;
@ -1149,7 +1149,7 @@ class OptionsResolverTest extends TestCase
return true; return true;
}); });
$this->resolver->resolve(); $this->assertSame(array('catcher' => false, 'thrower' => true), $this->resolver->resolve());
} }
public function testInvokeEachNormalizerOnlyOnce() public function testInvokeEachNormalizerOnlyOnce()

View File

@ -65,3 +65,29 @@ if (!function_exists('trait_uses_recursive')) {
return $traits; 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));
}
}

View File

@ -12,15 +12,13 @@ class PKCS7Encoder {
/** /**
* 对需要加密的明文进行填充补位 * 对需要加密的明文进行填充补位
* @param $text 需要进行填充补位操作的明文 * @param string $text 需要进行填充补位操作的明文
* @return 补齐明文字符串 * @return string 补齐明文字符串
*/ */
function encode($text) { function encode($text) {
$block_size = PKCS7Encoder::$block_size; $amount_to_pad = PKCS7Encoder::$block_size - (strlen($text) % PKCS7Encoder::$block_size);
$text_length = strlen($text);
$amount_to_pad = PKCS7Encoder::$block_size - ($text_length % PKCS7Encoder::$block_size);
if ($amount_to_pad == 0) { if ($amount_to_pad == 0) {
$amount_to_pad = PKCS7Encoder::block_size; $amount_to_pad = PKCS7Encoder::$block_size;
} }
$pad_chr = chr($amount_to_pad); $pad_chr = chr($amount_to_pad);
$tmp = ""; $tmp = "";
@ -32,8 +30,8 @@ class PKCS7Encoder {
/** /**
* 对解密后的明文进行补位删除 * 对解密后的明文进行补位删除
* @param decrypted 解密后的明文 * @param string $text 解密后的明文
* @return 删除填充补位后的明文 * @return string 删除填充补位后的明文
*/ */
function decode($text) { function decode($text) {
$pad = ord(substr($text, -1)); $pad = ord(substr($text, -1));
@ -62,46 +60,39 @@ class Prpcrypt {
/** /**
* 对明文进行加密 * 对明文进行加密
* @param string $text 需要加密的明文 * @param string $text 需要加密的明文
* @param string $appid 公众号APPID
* @return string 加密后的密文 * @return string 加密后的密文
*/ */
public function encrypt($text, $appid) { public function encrypt($text, $appid) {
try { try {
$random = $this->getRandomStr(); //获得16位随机字符串填充到明文之前
$random = $this->getRandomStr();//"aaaabbbbccccdddd";
$text = $random . pack("N", strlen($text)) . $text . $appid; $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); $iv = substr($this->key, 0, 16);
$pkc_encoder = new PKCS7Encoder(); $pkc_encoder = new PKCS7Encoder;
$text = $pkc_encoder->encode($text); $text = $pkc_encoder->encode($text);
mcrypt_generic_init($module, $this->key, $iv); $encrypted = openssl_encrypt($text, 'AES-256-CBC', substr($this->key, 0, 32), OPENSSL_ZERO_PADDING, $iv);
$encrypted = mcrypt_generic($module, $text); return array(ErrorCode::$OK, $encrypted);
mcrypt_generic_deinit($module);
mcrypt_module_close($module);
return array(ErrorCode::$OK, base64_encode($encrypted));
} catch (Exception $e) { } catch (Exception $e) {
return array(ErrorCode::$EncryptAESError, ErrorCode::getErrText(ErrorCode::$EncryptAESError)); return array(ErrorCode::$EncryptAESError, null);
} }
} }
/** /**
* 对密文进行解密 * 对密文进行解密
* @param string $encrypted 需要解密的密文 * @param string $encrypted 需要解密的密文
* @param string $appid 公众号APPID
* @return string 解密得到的明文 * @return string 解密得到的明文
*/ */
public function decrypt($encrypted, $appid) { public function decrypt($encrypted, $appid) {
try { try {
$ciphertext_dec = base64_decode($encrypted);
$module = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
$iv = substr($this->key, 0, 16); $iv = substr($this->key, 0, 16);
mcrypt_generic_init($module, $this->key, $iv); $decrypted = openssl_decrypt($encrypted, 'AES-256-CBC', substr($this->key, 0, 32), OPENSSL_ZERO_PADDING, $iv);
$decrypted = mdecrypt_generic($module, $ciphertext_dec);
mcrypt_generic_deinit($module);
mcrypt_module_close($module);
} catch (Exception $e) { } catch (Exception $e) {
return array(ErrorCode::$DecryptAESError, ErrorCode::getErrText(ErrorCode::$DecryptAESError)); return array(ErrorCode::$DecryptAESError, null);
} }
try { try {
$pkc_encoder = new PKCS7Encoder(); $pkc_encoder = new PKCS7Encoder;
$result = $pkc_encoder->decode($decrypted); $result = $pkc_encoder->decode($decrypted);
if (strlen($result) < 16) { if (strlen($result) < 16) {
return ""; return "";
@ -115,7 +106,7 @@ class Prpcrypt {
$appid = $from_appid; $appid = $from_appid;
} }
} catch (Exception $e) { } catch (Exception $e) {
return array(ErrorCode::$IllegalBuffer, ErrorCode::getErrText(ErrorCode::$IllegalBuffer)); return array(ErrorCode::$IllegalBuffer, null);
} }
return array(0, $xml_content, $from_appid); return array(0, $xml_content, $from_appid);
} }
@ -137,10 +128,9 @@ class Prpcrypt {
} }
/** /**
* 仅用作类内部使用不用于官方API接口的errCode码 * 仅用作类内部使用
* @category WechatSDK * 不用于官方API接口的errCode码
* @subpackage library * Class ErrorCode
* @date 2016/06/28 11:59
*/ */
class ErrorCode { class ErrorCode {
@ -173,15 +163,14 @@ class ErrorCode {
/** /**
* 获取错误消息内容 * 获取错误消息内容
* @param type $err * @param string $err
* @return bool * @return bool
*/ */
public static function getErrText($err) { public static function getErrText($err) {
if (isset(self::$errCode[$err])) { if (isset(self::$errCode[$err])) {
return self::$errCode[$err]; return self::$errCode[$err];
} else {
return false;
} }
return false;
} }
} }

View File

@ -136,7 +136,7 @@ class Tools {
/** /**
* 以post方式提交请求 * 以post方式提交请求
* @param string $url * @param string $url
* @param array|string $postdata * @param array|string $data
* @return bool|mixed * @return bool|mixed
*/ */
static public function httpPost($url, $data) { static public function httpPost($url, $data) {

View File

@ -76,7 +76,7 @@ class Loader {
if (!isset(self::$cache[$index])) { if (!isset(self::$cache[$index])) {
$basicName = 'Wechat' . ucfirst(strtolower($type)); $basicName = 'Wechat' . ucfirst(strtolower($type));
$className = "\\Wechat\\{$basicName}"; $className = "\\Wechat\\{$basicName}";
/* 注册类的无命名空间别名兼容未带命名空间的老版本SDK */ // 注册类的无命名空间别名兼容未带命名空间的老版本SDK
!class_exists($basicName, FALSE) && class_alias($className, $basicName); !class_exists($basicName, FALSE) && class_alias($className, $basicName);
self::$cache[$index] = new $className(self::config($config)); self::$cache[$index] = new $className(self::config($config));
} }

View File

@ -46,6 +46,7 @@ class WechatCard extends Common {
const CARD_PAYCELL_SET = '/card/paycell/set?'; const CARD_PAYCELL_SET = '/card/paycell/set?';
/*设置开卡字段接口*/ /*设置开卡字段接口*/
const CARD_MEMBERCARD_ACTIVATEUSERFORM_SET = '/card/membercard/activateuserform/set?'; const CARD_MEMBERCARD_ACTIVATEUSERFORM_SET = '/card/membercard/activateuserform/set?';
/** /**
* 获取微信卡券 api_ticket * 获取微信卡券 api_ticket
* @param string $appid * @param string $appid
@ -722,11 +723,12 @@ class WechatCard extends Common {
} }
return false; return false;
} }
/** /**
* 设置买单接口 * 设置买单接口
* @DateTime 2016-12-02T19:19:45+0800 * @param string $card_id
* @param [type] $card_id [description] * @param bool $is_openid
* @param boolean $is_openid [description] * @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()) { if (!$this->access_token && !$this->getAccessToken()) {
@ -751,8 +753,8 @@ class WechatCard extends Common {
/** /**
* 设置开卡字段信息接口 * 设置开卡字段信息接口
* @DateTime 2016-12-02T20:31:43+0800 * @param array $data
* @param [type] $data [description] * @return bool|array
*/ */
public function setMembercardActivateuserform($data) { public function setMembercardActivateuserform($data) {
if (!$this->access_token && !$this->getAccessToken()) { if (!$this->access_token && !$this->getAccessToken()) {

View File

@ -70,9 +70,8 @@ class WechatReceive extends Common {
public function getRevFrom() { public function getRevFrom() {
if (isset($this->_receive['FromUserName'])) { if (isset($this->_receive['FromUserName'])) {
return $this->_receive['FromUserName']; return $this->_receive['FromUserName'];
} else {
return false;
} }
return false;
} }
/** /**
@ -82,9 +81,8 @@ class WechatReceive extends Common {
public function getRevTo() { public function getRevTo() {
if (isset($this->_receive['ToUserName'])) { if (isset($this->_receive['ToUserName'])) {
return $this->_receive['ToUserName']; return $this->_receive['ToUserName'];
} else {
return false;
} }
return false;
} }
/** /**
@ -94,9 +92,8 @@ class WechatReceive extends Common {
public function getRevType() { public function getRevType() {
if (isset($this->_receive['MsgType'])) { if (isset($this->_receive['MsgType'])) {
return $this->_receive['MsgType']; return $this->_receive['MsgType'];
} else {
return false;
} }
return false;
} }
/** /**
@ -106,9 +103,8 @@ class WechatReceive extends Common {
public function getRevID() { public function getRevID() {
if (isset($this->_receive['MsgId'])) { if (isset($this->_receive['MsgId'])) {
return $this->_receive['MsgId']; return $this->_receive['MsgId'];
} else {
return false;
} }
return false;
} }
/** /**
@ -118,9 +114,8 @@ class WechatReceive extends Common {
public function getRevCtime() { public function getRevCtime() {
if (isset($this->_receive['CreateTime'])) { if (isset($this->_receive['CreateTime'])) {
return $this->_receive['CreateTime']; return $this->_receive['CreateTime'];
} else {
return false;
} }
return false;
} }
/** /**
@ -131,9 +126,8 @@ class WechatReceive extends Common {
public function getRevCardPass() { public function getRevCardPass() {
if (isset($this->_receive['CardId'])) { if (isset($this->_receive['CardId'])) {
return $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) { if (isset($array) && count($array) > 0) {
return $array; return $array;
} else {
return false;
} }
return false;
} }
/** /**
@ -174,9 +167,8 @@ class WechatReceive extends Common {
} }
if (isset($array) && count($array) > 0) { if (isset($array) && count($array) > 0) {
return $array; return $array;
} else {
return false;
} }
return false;
} }
/** /**
@ -188,9 +180,8 @@ class WechatReceive extends Common {
return $this->_receive['Content']; return $this->_receive['Content'];
} else if (isset($this->_receive['Recognition'])) { //获取语音识别文字内容,需申请开通 } else if (isset($this->_receive['Recognition'])) { //获取语音识别文字内容,需申请开通
return $this->_receive['Recognition']; return $this->_receive['Recognition'];
} else {
return false;
} }
return false;
} }
/** /**
@ -203,9 +194,8 @@ class WechatReceive extends Common {
'mediaid' => $this->_receive['MediaId'], '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'], 'title' => $this->_receive['Title'],
'description' => $this->_receive['Description'] 'description' => $this->_receive['Description']
); );
} else {
return false;
} }
return false;
} }
/** /**
@ -236,9 +225,8 @@ class WechatReceive extends Common {
'scale' => $this->_receive['Scale'], 'scale' => $this->_receive['Scale'],
'label' => $this->_receive['Label'] 'label' => $this->_receive['Label']
); );
} else {
return false;
} }
return false;
} }
/** /**