[更新]微信关键字管理

This commit is contained in:
邹景立 2017-04-21 12:37:26 +08:00
parent d21d4fa4d1
commit 20a613dbcb
2 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ function & load_wechat($type = '') {
'ssl_key' => sysconf('wechat_cert_key'), 'ssl_key' => sysconf('wechat_cert_key'),
'cachepath' => CACHE_PATH . 'wxpay' . DS, 'cachepath' => CACHE_PATH . 'wxpay' . DS,
]; ];
$wechat[$index] = &Loader::get($type, $config); $wechat[$index] = Loader::get($type, $config);
} }
return $wechat[$index]; return $wechat[$index];
} }

View File

@ -18,8 +18,8 @@ use service\DataService;
use service\WechatService; use service\WechatService;
use Wechat\WechatReceive; use Wechat\WechatReceive;
use think\Controller; use think\Controller;
use think\Db;
use think\Log; use think\Log;
use think\Db;
/** /**
* 微信接口控制器 * 微信接口控制器
@ -151,18 +151,18 @@ class Api extends Controller {
protected function _event() { protected function _event() {
$event = $this->wechat->getRevEvent(); $event = $this->wechat->getRevEvent();
switch (strtolower($event['event'])) { switch (strtolower($event['event'])) {
/* 关注事件 */ /* 粉丝关注事件 */
case 'subscribe': case 'subscribe':
$this->_syncFans(true); $this->_syncFans(true);
if (!empty($event['key']) && stripos($event['key'], 'qrscene_') !== false) { if (!empty($event['key']) && stripos($event['key'], 'qrscene_') !== false) {
$this->_spread(preg_replace('|^.*?(\d+).*?$|', '$1', $event['key'])); $this->_spread(preg_replace('|^.*?(\d+).*?$|', '$1', $event['key']));
} }
return $this->_keys('wechat_keys#keys#subscribe'); return $this->_keys('wechat_keys#keys#subscribe');
/* 取消关注 */ /* 粉丝取消关注 */
case 'unsubscribe': case 'unsubscribe':
$this->_syncFans(false); $this->_syncFans(false);
exit('success'); exit('success');
/* 点击菜单 */ /* 点击菜单事件 */
case 'click': case 'click':
return $this->_keys($event['key']); return $this->_keys($event['key']);
/* 扫码推事件 */ /* 扫码推事件 */