Update Push.php

This commit is contained in:
Anyon 2020-10-13 10:17:45 +08:00
parent 1f57ec6e39
commit d244e6c7c8

View File

@ -155,6 +155,8 @@ class Push extends Controller
protected function event() protected function event()
{ {
switch (strtolower($this->receive['event'])) { switch (strtolower($this->receive['event'])) {
case 'unsubscribe':
return $this->_setUserInfo(false);
case 'subscribe': case 'subscribe':
$this->_setUserInfo(true); $this->_setUserInfo(true);
if (isset($this->receive['eventkey']) && is_string($this->receive['eventkey'])) { if (isset($this->receive['eventkey']) && is_string($this->receive['eventkey'])) {
@ -163,18 +165,16 @@ class Push extends Controller
} }
} }
return $this->_keys('WechatKeys#keys#subscribe', true, $this->forceCustom); return $this->_keys('WechatKeys#keys#subscribe', true, $this->forceCustom);
case 'unsubscribe': case 'scan':
return $this->_setUserInfo(false);
case 'click': case 'click':
if (empty($this->receive['eventkey'])) return false;
return $this->_keys("WechatKeys#keys#{$this->receive['eventkey']}", false, $this->forceCustom); return $this->_keys("WechatKeys#keys#{$this->receive['eventkey']}", false, $this->forceCustom);
case 'scancode_push': case 'scancode_push':
case 'scancode_waitmsg': case 'scancode_waitmsg':
if (empty($this->receive['scancodeinfo'])) return false;
if (empty($this->receive['scancodeinfo']['scanresult'])) return false; if (empty($this->receive['scancodeinfo']['scanresult'])) return false;
return $this->_keys("WechatKeys#keys#{$this->receive['scancodeinfo']['scanresult']}", false, $this->forceCustom); return $this->_keys("WechatKeys#keys#{$this->receive['scancodeinfo']['scanresult']}", false, $this->forceCustom);
case 'scan': case 'view':
if (empty($this->receive['eventkey'])) return false; case 'location':
return $this->_keys("WechatKeys#keys#{$this->receive['eventkey']}", false, $this->forceCustom);
default: default:
return false; return false;
} }