|
|
|
@ -8,6 +8,7 @@ use cores\BaseController; |
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
use think\facade\Db; |
|
|
|
|
|
|
|
|
|
class Wxserver extends BaseController |
|
|
|
|
{ |
|
|
|
@ -45,12 +46,16 @@ class Wxserver extends BaseController |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
$xmlData = file_get_contents("php://input"); |
|
|
|
|
if ($query) { |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => $query, 'created_at' => $time]); |
|
|
|
|
$arr = explode('/', $query); |
|
|
|
|
$appid = end($arr); |
|
|
|
|
if ($xmlData && $appid) { |
|
|
|
|
Db::table('yoshop_wx_server')->insertGetId(['content' => $xmlData, 'created_at' => $time]); |
|
|
|
|
$obj = new \app\common\library\wxserver\Server(); |
|
|
|
|
$data = $obj->decryptXml($xmlData); |
|
|
|
|
if (!empty($data['MsgType']) && $data['MsgType'] == 'event' && !empty($data['Event'])) { |
|
|
|
|