You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yanzong/app/api/controller/WxServer.php

33 lines
971 B

<?php
namespace app\api\controller;
use cores\BaseController;
use think\facade\Db;
use think\response\Json;
class WxServer extends BaseController
{
public function index(): Json
{
return $this->renderSuccess('访问成功');
}
public function verifyTicket()
{
$data = $this->request->post();
$xmlData = file_get_contents("php://input"); // 获取原始的XML数据
// 解析XML数据
// $xml = simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_NOCDATA);
// $fromUser = $xml->FromUserName;
// $toUser = $xml->ToUserName;
// $content = $xml->Content;
if ($xmlData) {
Db::table('yoshop_wx_server')->insertGetId(['content' => $xmlData, 'created_at' => date('Y-m-d H:i:s')]);
}
if ($data) {
Db::table('yoshop_wx_server')->insertGetId(['content' => $data, 'created_at' => date('Y-m-d H:i:s')]);
}
echo 'success';
}
}