This commit is contained in:
aozhiwei 2021-11-25 19:31:54 +08:00
parent 82a0e86fd5
commit b5a335cbc9

View File

@ -1,33 +0,0 @@
<?php
class VoiceController extends BaseAuthedController {
public function upload()
{
$raw_data = file_get_contents('php://input');
$data = base64_encode($raw_data);
$md5 = md5($data);
$r = $this->getRedis($md5);
$r->set('game2005:voice:' . $md5, $data);
$r -> pexpire('game2005:voice:' . $md5, 1000 * 600);
$url = '';
if (SERVER_ENV == _ONLINE) {
$url = "https://game2005api.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5;
} else {
$url = "https://game2005api-test.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5;
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'download_url' => $url
));
}
public function download()
{
$r = $this->getRedis($_REQUEST['res_id']);
$data = $r->get('game2005:voice:' . $_REQUEST['res_id']);
echo base64_decode($data);
}
}