Files
webman_duanju/app/czg/app/controller/DiscSpinningRecordController.php
2025-08-16 09:02:41 +08:00

39 lines
1.3 KiB
PHP

<?php
namespace app\czg\app\controller;
use app\api\model\CommonInfo;
use app\api\model\Orders;
use app\api\model\TbUser;
use app\common\controller\Frontend;
use app\common\library\DatabaseRoute;
use app\exception\CzgException;
use think\facade\Db;
class DiscSpinningRecordController extends Frontend
{
// 查询大转盘抽奖记录
public function selectDiscSpinningRecord()
{
$get = $this->request->get();
if(empty($get['source']) || empty($get['page']) || empty($get['limit'])) {
$this->error('参数不完整');
}
$user = $this->auth->getUser();
$db = Db::connect(DatabaseRoute::getConnection('disc_spinning_record', ['user_id' => $user['user_id']]));
$list = $db->name('disc_spinning_record')
->where(['user_id' => $user['user_id']]);
$count = $list->count();
$list = $list->order('create_time', 'desc')
->limit(page($get['page'], $get['limit']), $get['limit'])
->select()->toArray();
$this->success('ok', [
'currPage' => $get['page'],
'pageSize' => $get['limit'],
'records' => convertToCamelCase($list),
'totalCount' => $count,
'totalPage' => ceil($count / $get['limit']),
]);
}
}