爆币
This commit is contained in:
43
application/api/controller/Lottery.php
Normal file
43
application/api/controller/Lottery.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?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' => []
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user