mirror of
https://github.com/fghrsh/live2d_api.git
synced 2024-11-24 11:40:32 +08:00
24 lines
672 B
PHP
24 lines
672 B
PHP
<?php
|
|
isset($_GET['id']) ? $modelId = (int)$_GET['id'] : exit('error');
|
|
|
|
require '../tools/modelList.php';
|
|
require '../tools/jsonCompatible.php';
|
|
|
|
$modelList = new modelList();
|
|
$jsonCompatible = new jsonCompatible();
|
|
|
|
$modelList = $modelList->get_list();
|
|
|
|
$modelRandNewId = true;
|
|
while ($modelRandNewId) {
|
|
$modelRandId = rand(0, count($modelList['models'])-1)+1;
|
|
$modelRandNewId = $modelRandId == $modelId ? true : false;
|
|
}
|
|
|
|
header("Content-type: application/json");
|
|
echo $jsonCompatible->json_encode(array('model' => array(
|
|
'id' => $modelRandId,
|
|
'name' => $modelList['models'][$modelRandId-1],
|
|
'message' => $modelList['messages'][$modelRandId-1]
|
|
)));
|