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.
41 lines
977 B
41 lines
977 B
<?php
|
|
|
|
namespace App\Controller\v3;
|
|
|
|
use App\Controller\BaseController;
|
|
use App\Service\v3\Interfaces\ParamsTokenServiceInterface;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
|
|
/**
|
|
* 参数token控制器
|
|
* Class ParamsTokenController
|
|
* @package App\Controller
|
|
*/
|
|
class ParamsTokenController extends BaseController
|
|
{
|
|
/**
|
|
* @Inject
|
|
* @var ParamsTokenServiceInterface
|
|
*/
|
|
protected $paramsTokenService;
|
|
|
|
/**
|
|
* 生成token存储对应参数数据
|
|
* @return \Psr\Http\Message\ResponseInterface
|
|
*/
|
|
public function generate()
|
|
{
|
|
$token = $this->paramsTokenService->generate($this->request->all());
|
|
return $this->success(['token' => $token]);
|
|
}
|
|
|
|
/**
|
|
* 解析token获取对应参数数据
|
|
* @return \Psr\Http\Message\ResponseInterface
|
|
*/
|
|
public function analyze()
|
|
{
|
|
$params = $this->paramsTokenService->analyze($this->request->input('token'));
|
|
return $this->success($params);
|
|
}
|
|
}
|