合并代码

This commit is contained in:
zpc 2025-04-25 02:31:33 +08:00
commit 267c81173b
6 changed files with 30 additions and 16 deletions

6
.env
View File

@ -6,9 +6,9 @@ DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = youda
USERNAME = youda
PASSWORD = youda
DATABASE = youda_neice
USERNAME = youda_neice
PASSWORD = youda_neice
HOSTPORT = 3306
CHARSET = utf8
DEBUG = false

View File

@ -811,6 +811,7 @@ class Goods extends Base
if (empty($user['mobile'])) {
return $this->renderError('请先绑定手机号', [], -9);
}
return $this->renderError('正在维护中', []);
$prize_num = request()->param('prize_num/d', 0); #抽几发
$goods_id = request()->param('goods_id/d', 0); #盒子ID
$num = request()->param('goods_num/d', 0); #第几箱

View File

@ -41,7 +41,7 @@ class Index extends Base
// // unset($tuijian[$key]);
// continue;
// }
$tuijian_list[] = $advert_value;
// $tuijian_list[] = $advert_value;
}
}
$tuijian = $tuijian_list;
@ -304,12 +304,30 @@ class Index extends Base
if (!in_array($type, $validTypes)) {
return $this->renderError('无效的排行榜类型');
}
// 设置分页参数
$page = request()->param('page/d', 1);
$limit = request()->param('limit/d', 10);
// 初始化排行榜服务类
// 获取Redis实例
$redis = (new \app\common\server\RedisHelper())->getRedis();
// 构建缓存键名
$cacheKey = "rank_list:{$type}:page_{$page}:limit_{$limit}";
// 检查缓存中是否有数据
$cachedData = $redis->get($cacheKey);
if ($cachedData) {
return $this->renderSuccess('请求成功', json_decode($cachedData, true));
}
// 缓存中没有数据,从服务获取
$rankService = new \app\common\service\RankService();
$data = $rankService->getRankList($type, $page, $limit);
// 将数据存入Redis缓存无过期时间
$redis->set($cacheKey, json_encode($data));
// 返回数据
return $this->renderSuccess('请求成功', $data);
}

View File

@ -507,6 +507,7 @@ class Infinite extends Base
if (empty($user['mobile'])) {
return $this->renderError('请先绑定手机号', [], -9);
}
return $this->renderError('正在维护中', []);
$ad_id = request()->header('adid');
$goods_id = request()->param('goods_id/d', 0); #盒子ID
$prize_num = request()->param('prize_num/d', 0); #抽几发

View File

@ -10,7 +10,7 @@ return [
// OPTIONS预检请求处理中间件
\app\api\middleware\OptionsRequestMiddleware::class,
// GET请求签名验证中间件
//请求签名验证中间件
\app\api\middleware\SignatureVerifyMiddleware::class,
// 注意原来的Allow中间件已被拆分为上面三个专门的中间件不再需要
// \app\api\middleware\Allow::class,

View File

@ -231,15 +231,7 @@ class RankService
->select()
->toArray();
// // 查询数据
// $list = Order::where($where)
// ->field('user_id, sum(use_money2) as use_money')
// ->group('user_id')
// ->order('use_money desc')
// ->page($page, $limit)
// ->select()
// ->toArray();
// 处理用户信息
$rankList = [];
foreach ($list as $index => $item) {
@ -284,7 +276,9 @@ class RankService
if ($endTime > 0) {
$where[] = ['addtime', '<=', $endTime];
}
if($limit==10){
$limit=50;
}
// 查询数据
$list = User::where($where)
->field('pid, COUNT(1) as invite_count')