|
|
@ -8,6 +8,7 @@ use cores\BaseController; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\DbException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
|
|
class Wxserver extends BaseController |
|
|
|
class Wxserver extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
@ -45,12 +46,16 @@ class Wxserver extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
public function callback() |
|
|
|
public function callback() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
$time = date('Y-m-d H:i:s'); |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => '推送开始', 'created_at' => $time]); |
|
|
|
$query = $this->request->query(); |
|
|
|
$query = $this->request->query(); |
|
|
|
$xmlData = file_get_contents("php://input"); |
|
|
|
$xmlData = file_get_contents("php://input"); |
|
|
|
if ($query) { |
|
|
|
if ($query) { |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => $query, 'created_at' => $time]); |
|
|
|
$arr = explode('/', $query); |
|
|
|
$arr = explode('/', $query); |
|
|
|
$appid = end($arr); |
|
|
|
$appid = end($arr); |
|
|
|
if ($xmlData && $appid) { |
|
|
|
if ($xmlData && $appid) { |
|
|
|
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => $xmlData, 'created_at' => $time]); |
|
|
|
$obj = new \app\common\library\wxserver\Server(); |
|
|
|
$obj = new \app\common\library\wxserver\Server(); |
|
|
|
$data = $obj->decryptXml($xmlData); |
|
|
|
$data = $obj->decryptXml($xmlData); |
|
|
|
if (!empty($data['MsgType']) && $data['MsgType'] == 'event' && !empty($data['Event'])) { |
|
|
|
if (!empty($data['MsgType']) && $data['MsgType'] == 'event' && !empty($data['Event'])) { |
|
|
|