42 lines
1.1 KiB
PHP
Executable File
42 lines
1.1 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Api\ai;
|
|
|
|
use App\BaseApp\BaseController;
|
|
use App\Service\common\ai\xunfei\XunFeiAiService;
|
|
use App\Service\RoleService;
|
|
use Exception;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Psr\Container\ContainerExceptionInterface;
|
|
use Psr\Container\NotFoundExceptionInterface;
|
|
|
|
class AiController extends BaseController
|
|
{
|
|
//
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->insertField = ['name', 'value', 'desc'];
|
|
$this->updateField = ['id', 'name', 'value', 'desc'];
|
|
$this->service = XunFeiAiService::getInstance();
|
|
}
|
|
|
|
public function genSingV1()
|
|
{
|
|
$this->insertField = ['time', 'term', 'version'];
|
|
$param = $this->checkRequiredFields(request()->post());
|
|
|
|
$versionMap = [
|
|
'fortune' => 1,
|
|
'wellness' => 2
|
|
];
|
|
if (!isset($versionMap[$param['version']])) {
|
|
return jerr('版本号错误');
|
|
}
|
|
return jok(
|
|
$this->service->genSign($param['time'], $param['term'], $versionMap[$param['version']]),
|
|
'生成成功'
|
|
);
|
|
}
|
|
}
|