Files
yusheng-php/application/api/controller/Lottery.php

43 lines
1.1 KiB
PHP
Raw Normal View History

2025-12-21 16:04:34 +08:00
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use app\common\service\LotteryService;
use think\Db;
use think\Exception;
use think\Log;
class Lottery extends BaseCom
{
/**
* 中奖统计接口
* @return json
*/
public function stat()
{
try {
$where = [
'uid' => $this->request->param('uid/d', 0),
'prize_type' => $this->request->param('prize_type/d', 0),
'start_time' => $this->request->param('start_time/d', 0),
'end_time' => $this->request->param('end_time/d', time())
];
$service = new LotteryService();
$stat = $service->statWinner($where);
return json([
'code' => 0,
'msg' => '统计成功',
'data' => $stat
]);
} catch (Exception $e) {
Log::error('中奖统计失败:' . $e->getMessage());
return json([
'code' => 1,
'msg' => $e->getMessage(),
'data' => []
]);
}
}
}