139 lines
4.6 KiB
PHP
139 lines
4.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
use think\Session;
|
|
use think\Request;
|
|
|
|
class Index extends Common{
|
|
public function __construct(){
|
|
parent::__construct();
|
|
}
|
|
public function check_cashout(){
|
|
if(Request::instance()->isPost()){
|
|
$receivables_record = Db::name('receivables_record')->where(array('record_type' => 2, 'status' => 0))->order('id DESC')->find();
|
|
if($receivables_record){
|
|
return json(array('code' => 1));
|
|
}else{
|
|
return json(array('code' => 0));
|
|
}
|
|
}else{
|
|
die('请求错误,请退出页面');
|
|
}
|
|
}
|
|
public function index(){
|
|
$user_info = Session::get('user_info');
|
|
$this->assign('user_info',$user_info);
|
|
$this->assign('admin',$user_info['admin']);
|
|
return $this->fetch();
|
|
}
|
|
|
|
// 关系链
|
|
public function relation(){
|
|
// 接收要修改的下属ID
|
|
$user_id = Request::instance()->get('id');
|
|
$user_info = Db::name('user')->where('id',$user_id)->find();
|
|
|
|
// 查询代理路径
|
|
$agentParentPath = explode(',',$user_info['agent_parent_id_path']);
|
|
$relation = array();
|
|
foreach($agentParentPath as $k => $v){
|
|
$user = Db::name('user')->where('id',$v)->find();
|
|
$data = array();
|
|
$data['username'] = $user['username'];
|
|
$data['nickname'] = $user['nickname'];
|
|
$data['reg_time'] = date('Y-m-d H:i:s',$user['reg_time']);
|
|
if($user['agent'] == 1){
|
|
$data['agent'] = '代理';
|
|
$data['color'] = '#FF5722';
|
|
}else{
|
|
$data['agent'] = '会员';
|
|
$data['color'] = '#008dfd';
|
|
}
|
|
$relation[] = $data;
|
|
}
|
|
|
|
// 渲染参数和模板
|
|
$this->assign('relation',$relation);
|
|
return $this->fetch();
|
|
}
|
|
public function print_user_bet(){
|
|
$user_id = intval(Request::instance()->get('user_id'));
|
|
$all_bet = DB::name('bet')->alias('b')->join('cg_number_tab n','b.number_tab_id=n.id')->where(array('b.user_id' => $user_id, 'b.status' => 1))->where('game_id','>',0)->where('game_id','<',3)->order('b.create_time DESC')->field('b.*,n.bet_end_time')->select();
|
|
if($all_bet){
|
|
//重新组合
|
|
$excelData = array();
|
|
foreach($all_bet AS $k => $v){
|
|
$excelData[$k][0] = $v['username'];
|
|
$excelData[$k][1] = $v['table_name'];
|
|
$excelData[$k][2] = $v['boot_num'];
|
|
$excelData[$k][3] = $v['number'];
|
|
if($v['game_id'] == 1){
|
|
if($v['result'] == 1){
|
|
if($v['pair'] == 1){
|
|
$excelData[$k][4] = '庄-庄对';
|
|
}elseif($v['pair'] == 2){
|
|
$excelData[$k][4] = '庄-闲对';
|
|
}elseif($v['pair'] == 3){
|
|
$excelData[$k][4] = '庄-庄闲对';
|
|
}else{
|
|
$excelData[$k][4] = '庄';
|
|
}
|
|
}elseif($v['result'] == 2){
|
|
if($v['pair'] == 1){
|
|
$excelData[$k][4] = '闲-庄对';
|
|
}elseif($v['pair'] == 2){
|
|
$excelData[$k][4] = '闲-闲对';
|
|
}elseif($v['pair'] == 3){
|
|
$excelData[$k][4] = '闲-庄闲对';
|
|
}else{
|
|
$excelData[$k][4] = '闲';
|
|
}
|
|
}elseif($v['result'] == 3){
|
|
if($v['pair'] == 1){
|
|
$excelData[$k][4] = '和-庄对';
|
|
}elseif($v['pair'] == 2){
|
|
$excelData[$k][4] = '和-闲对';
|
|
}elseif($v['pair'] == 3){
|
|
$excelData[$k][4] = '和-庄闲对';
|
|
}else{
|
|
$excelData[$k][4] = '和';
|
|
}
|
|
}else{
|
|
$excelData[$k][4] = '';
|
|
}
|
|
}else{
|
|
if($v['result'] == 1){
|
|
$excelData[$k][4] = '龙';
|
|
}elseif($v['result'] == 2){
|
|
$excelData[$k][4] = '虎';
|
|
}elseif($v['result'] == 3){
|
|
$excelData[$k][4] = '和';
|
|
}else{
|
|
$excelData[$k][4] = '';
|
|
}
|
|
}
|
|
$excelData[$k][5] = $v['money_before_bet'];
|
|
$excelData[$k][6] = $v['money'];
|
|
$excelData[$k][7] = $v['end_money'];
|
|
$excelData[$k][8] = $v['win_total'];
|
|
$excelData[$k][9] = $v['banker_amount'];
|
|
$excelData[$k][10] = $v['player_amount'];
|
|
$excelData[$k][11] = $v['tie_amount'];
|
|
if($v['game_id'] == 1){
|
|
$excelData[$k][12] = $v['banker_pair_amount'];
|
|
$excelData[$k][13] = $v['player_pair_amount'];
|
|
}else{
|
|
$excelData[$k][12] = '';
|
|
$excelData[$k][13] = '';
|
|
}
|
|
$excelData[$k][14] = date('Y-m-d H:i:s',$v['create_time']);
|
|
$excelData[$k][15] = date('Y-m-d H:i:s',$v['bet_end_time']);
|
|
}
|
|
$title = array('用户名','下注桌子','靴号','铺号','结果','下注前余额','下注后余额','开结果后余额','总赢','庄下注额','闲下注额','和下注额','庄对下注额','闲对下注额','下注时间','封盘时间');
|
|
$this->exportExcelCore($excelData, '下注明细', $title);
|
|
exit('已导出支持列表,请不要重复刷新该页面!');
|
|
}
|
|
}
|
|
} |