爆币
This commit is contained in:
@@ -4,6 +4,7 @@ namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
@@ -16,12 +17,14 @@ use think\Validate;
|
||||
*/
|
||||
class Lottery extends adminApi
|
||||
{
|
||||
|
||||
// Redis实例
|
||||
private $redis;
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = [];
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
$this->redis = Cache::store('redis')->handler();
|
||||
}
|
||||
/*
|
||||
* 配置列表
|
||||
@@ -50,6 +53,24 @@ class Lottery extends adminApi
|
||||
];
|
||||
db::name("bb_lottery_config")->where(['key'=>$k])->update($data);
|
||||
}
|
||||
|
||||
$prize_amount = $this->redis->get('lottery:small_pool:total_gold');
|
||||
|
||||
Db::name('bb_lottery_winner_record')->insert([
|
||||
'uid' => 0,
|
||||
'prize_type' => 1,
|
||||
'prize_amount' => $prize_amount,
|
||||
'pool_amount' => $prize_amount,
|
||||
'ratio' => 100,
|
||||
'release_amount' => $prize_amount,
|
||||
'create_time' => time(),
|
||||
'status' => 0 // 未发放
|
||||
]);
|
||||
//清除缓存
|
||||
$this->redis->rm('lottery:small_pool:round');
|
||||
$this->redis->rm('lottery:small_pool:total_times');
|
||||
$this->redis->rm('lottery:small_pool:total_gold');
|
||||
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
@@ -74,9 +95,15 @@ class Lottery extends adminApi
|
||||
$count = db::name('bb_lottery_winner_record')->where($where)->count();
|
||||
$lists_data = db::name('bb_lottery_winner_record')->field('id,uid as user_id,prize_type,prize_amount,pool_amount,ratio,release_amount,status,create_time as createtime')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||
foreach ($lists_data as $k=>$v){
|
||||
$user_info = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||
$lists_data[$k]['user_code'] = $user_info['user_code']??"";
|
||||
$lists_data[$k]['nickname'] = $user_info['user_code']."-".$user_info['nickname'];
|
||||
if($v['user_id'] > 0){
|
||||
$user_info = db::name('user')->where(['id'=>$v['user_id']])->find();
|
||||
$lists_data[$k]['user_code'] = $user_info['user_code']??"";
|
||||
$lists_data[$k]['nickname'] = $user_info['user_code']."-".$user_info['nickname'];
|
||||
}else{
|
||||
$lists_data[$k]['user_code'] = "";
|
||||
$lists_data[$k]['nickname'] = "后台重置,全部释放";
|
||||
}
|
||||
|
||||
//奖项类型:1-小奖 2-大奖
|
||||
$lists_data[$k]['prize_type_str'] = $v['prize_type']==1?"小奖":"大奖";
|
||||
//状态:1-已发放 0-未发放'
|
||||
|
||||
Reference in New Issue
Block a user