This commit is contained in:
2026-01-26 19:26:36 +08:00
parent 7eeffdce65
commit cbf3eaf788

View File

@@ -17,8 +17,7 @@ use think\Validate;
*/ */
class Lottery extends adminApi class Lottery extends adminApi
{ {
// Redis实例
private $redis;
protected $noNeedLogin = []; protected $noNeedLogin = [];
protected $noNeedRight = []; protected $noNeedRight = [];
public function _initialize() public function _initialize()
@@ -53,8 +52,8 @@ class Lottery extends adminApi
]; ];
db::name("bb_lottery_config")->where(['key'=>$k])->update($data); db::name("bb_lottery_config")->where(['key'=>$k])->update($data);
} }
$this->redis = Cache::store('redis')->handler();
$prize_amount = $this->redis->get('lottery:small_pool:total_gold'); $prize_amount = Cache::get('lottery:small_pool:total_gold');
Db::name('bb_lottery_winner_record')->insert([ Db::name('bb_lottery_winner_record')->insert([
'uid' => 0, 'uid' => 0,
@@ -67,9 +66,9 @@ class Lottery extends adminApi
'status' => 0 // 未发放 'status' => 0 // 未发放
]); ]);
//清除缓存 //清除缓存
$this->redis->rm('lottery:small_pool:round'); Cache::rm('lottery:small_pool:round');
$this->redis->rm('lottery:small_pool:total_times'); Cache::rm('lottery:small_pool:total_times');
$this->redis->rm('lottery:small_pool:total_gold'); Cache::rm('lottery:small_pool:total_gold');
return V(1,"成功"); return V(1,"成功");
} }