ai寻方
This commit is contained in:
41
app/Http/Controllers/Api/ai/AiController.php
Executable file
41
app/Http/Controllers/Api/ai/AiController.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?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']]),
|
||||
'生成成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user