[更新]修改微信模块

This commit is contained in:
邹景立 2017-04-21 14:33:39 +08:00
parent 5281569ff5
commit d628e54ef9
10 changed files with 49 additions and 35 deletions

View File

@ -66,6 +66,17 @@ class Keys extends BasicAdmin {
return $this->_form($this->table, 'form', 'id'); return $this->_form($this->table, 'form', 'id');
} }
protected function _form_filter($data) {
if ($this->request->isPost() && isset($data['keys'])) {
$db = Db::name($this->table)->where('keys', $data['keys']);
!empty($data['id']) && $db->where('id', 'neq', $data['id']);
if ($db->count() > 0) {
$this->error('关键字已经存在,请使用其它关键字!');
}
}
}
/** /**
* 删除关键字 * 删除关键字
*/ */

View File

@ -51,7 +51,7 @@
<div class="nowrap"> <div class="nowrap">
<input title="apiclient_key.pem" type="hidden" name="wechat_cert_key_md5"> <input title="apiclient_key.pem" type="hidden" name="wechat_cert_key_md5">
<input title="apiclient_cert.pem" type="hidden" name="wechat_cert_cert_md5"> <input title="apiclient_cert.pem" type="hidden" name="wechat_cert_cert_md5">
<button data-file="one" data-type="pem" data-field="wechat_cert_key_md5" <button data-file="one" data-type="pem" data-field="wechat_cert_key_md5" data-uptype="local"
type="button" class="layui-btn layui-btn-primary"> type="button" class="layui-btn layui-btn-primary">
{if file_exists(sysconf('wechat_cert_key'))} {if file_exists(sysconf('wechat_cert_key'))}
已上传 apiclient_key.pem 已上传 apiclient_key.pem
@ -59,7 +59,7 @@
请上传 apiclient_key.pem 请上传 apiclient_key.pem
{/if} {/if}
</button> </button>
<button data-file="one" data-type="pem" data-field="wechat_cert_cert_md5" <button data-file="one" data-type="pem" data-field="wechat_cert_cert_md5" data-uptype="local"
type="button" class="layui-btn layui-btn-primary"> type="button" class="layui-btn layui-btn-primary">
{if file_exists(sysconf('wechat_cert_cert'))} {if file_exists(sysconf('wechat_cert_cert'))}
已上传 apiclient_cert.pem 已上传 apiclient_cert.pem

View File

@ -26,19 +26,20 @@
<td class="text-center">{$vo.type}</td> <td class="text-center">{$vo.type}</td>
<td class="text-center"> <td class="text-center">
{if $vo.type eq '音乐'} {if $vo.type eq '音乐'}
<a class="btn btn-link" data-tips-text="预览" data-tips-placement="bottom" <a data-phone-view='{:url("@wechat/review")}?type=music&title={$vo.music_title}&desc={$vo.music_desc}'
data-phone-view='{:url("@wechat/review")}&type=music&title={$vo.music_title}&desc={$vo.music_desc}'> class="btn btn-link"><i class="fa fa-eye"></i> 预览
<i class="fa fa-eye"></i> 预览 </a>
{elseif $vo.type eq '图片'}
<a data-phone-view='{:url("@wechat/review")}?type=image&title={$vo.image_url}'
class="btn btn-link"><i class="fa fa-eye"></i> 预览
</a> </a>
{elseif $vo.type eq '图文'} {elseif $vo.type eq '图文'}
<a class="btn btn-link" data-tips-text="预览" data-tips-placement="bottom" <a data-phone-view='{:url("@wechat/review")}?type=news&content={$vo.news_id}'
data-phone-view='{:url("@wechat/review")}&type=news&content={$vo.news_id}'> class="btn btn-link"><i class="fa fa-eye"></i> 预览
<i class="fa fa-eye"></i> 预览
</a> </a>
{elseif $vo.type eq '视频'} {elseif $vo.type eq '视频'}
<a class="btn btn-link" data-tips-text="预览" data-tips-placement="bottom" <a data-phone-view='{:url("@wechat/review")}?type=video&title={$vo.video_title}&desc={$vo.video_desc}&url={$vo.video_url}'
data-phone-view='{:url("@wechat/review")}&type=video&title={$vo.video_title}&desc={$vo.video_desc}&url={$vo.video_url}'> class="btn btn-link"><i class="fa fa-eye"></i> 预览
<i class="fa fa-eye"></i> 预览
</a> </a>
{else} {else}
{$vo.content} {$vo.content}
@ -46,14 +47,18 @@
</td> </td>
<td class="text-center">{$vo.create_at}</td> <td class="text-center">{$vo.create_at}</td>
<td class='text-center nowrap'> <td class='text-center nowrap'>
{if auth("$classuri/edit")} {if auth("$classuri/edit")}
<span class="text-explode">|</span> <span class="text-explode">|</span>
<a data-open='{:url("@wechat/keys/edit")}?id={$vo.id}'>编辑</a> <a data-open='{:url("edit")}?id={$vo.id}'>编辑</a>
{/if} {/if}
{if auth("$classuri/del")} {if auth("$classuri/del")}
<span class="text-explode">|</span> <span class="text-explode">|</span>
<a data-delete='{$vo.id}' data-action='{:url("@wechat/keys/del")}' href="javascript:void(0)">删除</a> <a data-update="{$vo.id}" data-field='delete' data-action='{:url("del")}'
href="javascript:void(0)">删除</a>
{/if} {/if}
</td> </td>
</tr> </tr>
{/foreach} {/foreach}

8
composer.lock generated
View File

@ -455,12 +455,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": "bb509f17ad860322b39a607731c37adbd8f21e75" "reference": "38f86a42b1c0058d889a0969190540037629606a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/bb509f17ad860322b39a607731c37adbd8f21e75.zip", "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/38f86a42b1c0058d889a0969190540037629606a.zip",
"reference": "bb509f17ad860322b39a607731c37adbd8f21e75", "reference": "38f86a42b1c0058d889a0969190540037629606a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -481,7 +481,7 @@
"keywords": [ "keywords": [
"wechat-php-sdk" "wechat-php-sdk"
], ],
"time": "2017-04-17 09:22:40" "time": "2017-04-19 13:34:58"
} }
], ],
"packages-dev": [], "packages-dev": [],

View File

@ -72,7 +72,6 @@ class WechatService {
# 上传图片素材 # 上传图片素材
$result = $wechat->uploadForeverMedia(array('media' => "@{$upload['file']}"), $type, $is_video, $video_info); $result = $wechat->uploadForeverMedia(array('media' => "@{$upload['file']}"), $type, $is_video, $video_info);
# 删除本地文件 # 删除本地文件
@unlink($filename);
if (false !== $result) { if (false !== $result) {
$data = ['md5' => $md5, 'type' => $type, 'appid' => $wechat->appid, 'media_id' => $result['media_id'], 'local_url' => $local_url,]; $data = ['md5' => $md5, 'type' => $type, 'appid' => $wechat->appid, 'media_id' => $result['media_id'], 'local_url' => $local_url,];
isset($result['url']) && $data['media_url'] = $result['url']; isset($result['url']) && $data['media_url'] = $result['url'];

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 ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea::getLoader(); return ComposerAutoloaderInitf55cea7455d6b0f7edeb2950251d39c5::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea class ComposerAutoloaderInitf55cea7455d6b0f7edeb2950251d39c5
{ {
private static $loader; private static $loader;
@ -19,15 +19,15 @@ class ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInitf55cea7455d6b0f7edeb2950251d39c5', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitf55cea7455d6b0f7edeb2950251d39c5', '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\ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5::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 ComposerAutoloaderInita5b88035fa8b1d8f6696f1aa3e286eea
$loader->register(true); $loader->register(true);
if ($useStaticLoader) { if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea::$files; $includeFiles = Composer\Autoload\ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5::$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) {
composerRequirea5b88035fa8b1d8f6696f1aa3e286eea($fileIdentifier, $file); composerRequiref55cea7455d6b0f7edeb2950251d39c5($fileIdentifier, $file);
} }
return $loader; return $loader;
} }
} }
function composerRequirea5b88035fa8b1d8f6696f1aa3e286eea($fileIdentifier, $file) function composerRequiref55cea7455d6b0f7edeb2950251d39c5($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 ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea class ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5
{ {
public static $files = array ( public static $files = array (
'9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php',
@ -313,9 +313,9 @@ class ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea
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 = ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita5b88035fa8b1d8f6696f1aa3e286eea::$classMap; $loader->classMap = ComposerStaticInitf55cea7455d6b0f7edeb2950251d39c5::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }

View File

@ -49,18 +49,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": "bb509f17ad860322b39a607731c37adbd8f21e75" "reference": "38f86a42b1c0058d889a0969190540037629606a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/bb509f17ad860322b39a607731c37adbd8f21e75.zip", "url": "https://files.phpcomposer.com/files/zoujingli/wechat-php-sdk/38f86a42b1c0058d889a0969190540037629606a.zip",
"reference": "bb509f17ad860322b39a607731c37adbd8f21e75", "reference": "38f86a42b1c0058d889a0969190540037629606a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"time": "2017-04-17 09:22:40", "time": "2017-04-19 13:34:58",
"type": "project", "type": "project",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {

View File

@ -153,7 +153,6 @@ class Tools {
$value = new CURLFile(realpath(trim($value, '@'))); $value = new CURLFile(realpath(trim($value, '@')));
} }
} }
$data = http_build_query($data);
} }
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$data = curl_exec($ch); $data = curl_exec($ch);