wang hou sheng 7 months ago
parent 30a3f4155b
commit 099cb6011e
  1. 8
      app/api/controller/Wxserver.php

@ -9,7 +9,6 @@ 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;
use think\response\Json; use think\response\Json;
class Wxserver extends BaseController class Wxserver extends BaseController
@ -26,7 +25,7 @@ class Wxserver extends BaseController
public function verifyTicket() public function verifyTicket()
{ {
$xmlData = file_get_contents("php://input"); $xmlData = file_get_contents("php://input");
$obj = new \app\common\library\wxserver\Server(); $obj = new Server();
$obj->getVerifyTicket($xmlData); $obj->getVerifyTicket($xmlData);
echo 'success'; echo 'success';
} }
@ -42,7 +41,7 @@ class Wxserver extends BaseController
{ {
$authorization_code = $this->request->get('auth_code'); $authorization_code = $this->request->get('auth_code');
if ($authorization_code) { if ($authorization_code) {
$obj = new \app\common\library\wxserver\Server(); $obj = new Server();
$obj->authorizationInfo($authorization_code, $this->request->domain(true)); $obj->authorizationInfo($authorization_code, $this->request->domain(true));
} }
echo 'success'; echo 'success';
@ -51,7 +50,7 @@ class Wxserver extends BaseController
public function callback($appid) public function callback($appid)
{ {
$time = date('Y-m-d H:i:s'); $time = date('Y-m-d H:i:s');
$obj = new \app\common\library\wxserver\Server(); $obj = new Server();
$signature = $this->request->get('signature'); $signature = $this->request->get('signature');
$timestamp = $this->request->get('timestamp'); $timestamp = $this->request->get('timestamp');
$nonce = $this->request->get('nonce'); $nonce = $this->request->get('nonce');
@ -60,7 +59,6 @@ class Wxserver extends BaseController
$xmlData = file_get_contents("php://input"); $xmlData = file_get_contents("php://input");
if ($xmlData) { if ($xmlData) {
$data = $obj->decryptXml($xmlData); $data = $obj->decryptXml($xmlData);
Db::table('yoshop_wx_server')->insertGetId(['content' => json_encode($data), 'created_at' => $time]);
if (!empty($data['MsgType'])) { if (!empty($data['MsgType'])) {
if ($data['MsgType'] == 'event' && !empty($data['Event'])) { if ($data['MsgType'] == 'event' && !empty($data['Event'])) {
$up = []; $up = [];

Loading…
Cancel
Save