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

38 lines
1.1 KiB

8 months ago
<?php
8 months ago
declare (strict_types=1);
8 months ago
namespace app\api\controller;
use cores\BaseController;
8 months ago
use think\facade\Db;
8 months ago
use think\response\Json;
8 months ago
class Wxserver extends BaseController
8 months ago
{
public function index(): Json
{
8 months ago
$obj = new \app\common\library\wxserver\Server();
$url = $this->request->domain(true) . '/api/wxserver/redirect';
$jumUrl = $obj->jumpH5Url($url);
return $this->renderSuccess(compact('jumUrl'));
8 months ago
}
public function verifyTicket()
{
8 months ago
$xmlData = file_get_contents("php://input");
$obj = new \app\common\library\wxserver\Server();
$obj->getVerifyTicket($xmlData);
8 months ago
echo 'success';
}
8 months ago
public function redirect()
{
8 months ago
$authorization_code = $this->request->get('authorization_code');
$expires_in = $this->request->get('expires_in');
Db::table('yoshop_wx_server')->insertGetId(['content' => '回调授权地址' . $authorization_code, 'created_at' => date('Y-m-d H:i:s')]);
8 months ago
if ($authorization_code) {
$obj = new \app\common\library\wxserver\Server();
$obj->authorizationInfo($authorization_code);
}
}
8 months ago
}