This commit is contained in:
你的名字
2025-10-15 14:53:54 +08:00
commit ac0f12b21a
864 changed files with 200931 additions and 0 deletions

View File

@ -0,0 +1,64 @@
<?php
namespace app\index\controller;
use app\admin\model\BlackIp;
use app\admin\model\MallOrder;
use app\BaseController;
use Kaadon\Uuid\Uuids;
use think\Exception;
use think\facade\Env;
use think\response\Redirect;
class Index extends BaseController
{
/**
* @throws \think\Exception
*/
public function index()
{
if ($this->request->isPost()){
$param = $this->request->post();
$ip = $this->request->ip();
$black = BlackIp::where('ip',$ip)->find();
if (!empty($black)){
throw new Exception();
exit();
return error('您的IP已被禁止充值如有疑问请联系管理员');
}
$rid = Uuids::getUuid4();
$data = [
'money'=>$param['amount'],
'rid'=>$rid,
'start_time'=>time(),
'end_time'=>time()+180,
'ip'=> $ip,
];
(new MallOrder())->save($data);
return redirect('index/index/reloads?rid='.$rid);
}else{
return view();
}
}
public function reloads()
{
return view();
}
public function status()
{
$rid = $this->request->param('rid');
$data = MallOrder::where('rid',$rid)->find();
if (empty($data))
return error();
$status = match ($data['status']) {
1 => 'yellow',
2 => 'red',
default => 'blue',
};
return success([
'status'=>$status,
'color'=>$status,
'url'=>$data['url']
]);
}
}