340 lines
12 KiB
PHP
340 lines
12 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Controller;
|
|
use think\facade\Request;
|
|
|
|
class Box extends Common
|
|
{
|
|
|
|
|
|
//获取宝箱列表
|
|
public function get_box_type_list()
|
|
{
|
|
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_box_type_list($page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
|
|
public function get_box_count_type_list()
|
|
{
|
|
$reslut = model('Box')->get_box_count_type_list();
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
|
|
public function get_box_person_type_list()
|
|
{
|
|
$reslut = model('Box')->get_box_person_type_list();
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
|
|
public function get_box_common_type_list()
|
|
{
|
|
$reslut = model('Box')->get_box_common_type_list();
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
|
|
//获取房间信息
|
|
public function get_box_type_info()
|
|
{
|
|
$tid = input('tid', 0);
|
|
$reslut = model('Box')->get_box_type_info($tid);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//添加类型
|
|
public function add_box_type()
|
|
{
|
|
$data = Request::only(['type_name', 'show_name', 'open_price', 'consume', 'open_status']);
|
|
$reslut = model('Box')->add_box_type($data);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
//编辑类型
|
|
public function edit_box_type()
|
|
{
|
|
$data = Request::only(['tid', 'type_name', 'show_name', 'open_price', 'consume', 'rate', 'open_status']);
|
|
$reslut = model('Box')->edit_box_type($data);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
//获取宝箱列表
|
|
public function get_box_config_list()
|
|
{
|
|
|
|
$tid = input('tid', 0);
|
|
$gid = input('gid', 0);
|
|
$gift_name = input('gift_name', '');
|
|
$gift_price = input('gift_price', 0);
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_box_config_list($tid, $gid, $gift_name, $gift_price, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
$data['totalData'] = $reslut['data']['totalData'];
|
|
return json($data);
|
|
}
|
|
//获取礼物列表
|
|
public function get_gift_list()
|
|
{
|
|
$reslut = model('Gift')->gift_list(0, "", 0, 0, 0, 1, 2, 'gift_price', 'asc', 1, 99999, 1);
|
|
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']['list']);
|
|
}
|
|
|
|
//添加宝箱信息
|
|
public function add_box_config()
|
|
{
|
|
$tid = input('tid', 0);
|
|
$gid = input('gid', 0);
|
|
$num = input('num', 0);
|
|
$open_num_obtain = input('open_num_obtain',0);
|
|
$is_public_screen = input('is_public_screen');
|
|
$is_public_server = input('is_public_server');
|
|
//二级密码
|
|
$pass = input('secondary_password', '');
|
|
$check_pass = model('admin/admin')->check_secondary_password($pass);
|
|
if($check_pass['code'] == 201){
|
|
return ajaxReturn($check_pass['code'], $check_pass['msg'], $check_pass['data']);
|
|
}
|
|
$reslut = model('box')->add_box_config($tid, $gid, $num, $open_num_obtain, $is_public_screen, $is_public_server);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
//获取详情
|
|
public function get_box_config_info()
|
|
{
|
|
$bid = input('bid');
|
|
$reslut = model('box')->get_box_config_info($bid);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
//修改宝箱信息
|
|
public function edit_box_config()
|
|
{
|
|
$bid = input('bid');
|
|
$gid = input('gid');
|
|
$num = input('num');
|
|
$accumulate_price = input('accumulate_price',0);
|
|
$accumulate_rate = input('accumulate_rate',0);
|
|
$open_num_obtain = input('open_num_obtain',0);
|
|
$is_public_screen = input('is_public_screen');
|
|
$is_public_server = input('is_public_server');
|
|
//二级密码
|
|
$pass = input('secondary_password', '');
|
|
$check_pass = model('admin/admin')->check_secondary_password($pass);
|
|
if($check_pass['code'] == 201){
|
|
return ajaxReturn($check_pass['code'], $check_pass['msg'], $check_pass['data']);
|
|
}
|
|
$reslut = model('box')->edit_box_config($bid, $gid, $num, $open_num_obtain, $accumulate_price, $accumulate_rate, $is_public_screen, $is_public_server);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
//删除宝箱信息
|
|
public function delete_box_config()
|
|
{
|
|
$bid = input('bid');
|
|
//二级密码
|
|
$pass = input('pass', '');
|
|
$check_pass = model('admin/admin')->check_secondary_password($pass);
|
|
if($check_pass['code'] == 201){
|
|
return ajaxReturn($check_pass['code'], $check_pass['msg'], $check_pass['data']);
|
|
}
|
|
$reslut = model('box')->delete_box_config($bid);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//批量删除宝箱信息
|
|
public function batch_delete_box_config(){
|
|
//二级密码
|
|
$pass = input('pass', '');
|
|
$check_pass = model('admin/admin')->check_secondary_password($pass);
|
|
if($check_pass['code'] == 201){
|
|
return ajaxReturn($check_pass['code'], $check_pass['msg'], $check_pass['data']);
|
|
}
|
|
$data = input('info');
|
|
$reslut = model('box')->batch_delete_box_config($data);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
//查看每期奖池列表
|
|
public function get_box_log_list()
|
|
{
|
|
$tid = input('tid', 0);
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_box_log_list($tid, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
//获取用户开奖记录
|
|
public function get_user_box_log_list()
|
|
{
|
|
$uid = input('uid', 0);
|
|
$bl_id = input('bl_id', 0);
|
|
$gid = input('gid', 0);
|
|
$tid = input('tid', 0);
|
|
$start = input('start', '');
|
|
$end = input('end', '');
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_user_box_log_list($uid, $bl_id, $gid, $tid, $start, $end, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
$data['totalRow'] = $reslut['data']['totalRow'];
|
|
return json($data);
|
|
}
|
|
|
|
|
|
//获取用户开奖记录
|
|
public function get_user_box_count_list()
|
|
{
|
|
$uid = input('uid', 0);
|
|
$out_amount = input('out_amount', 0);
|
|
$last_login_device = input('last_login_device','');
|
|
$profit = input('profit',0);
|
|
$tid = input('tid',0);
|
|
$add_time = input('add_time','');
|
|
$order = input('order', 'a.update_time');
|
|
$sort = input('sort', 'desc');
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_user_box_count_list($uid, $out_amount, $last_login_device, $profit, $tid, $add_time, $order, $sort, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
$data['totalRow'] = $reslut['data']['totalRow'];
|
|
return json($data);
|
|
}
|
|
|
|
//获取用户开奖记录
|
|
public function get_box_give_gift_list()
|
|
{
|
|
$uid = input('uid', 0);
|
|
$gid = input('gid', 0);
|
|
$gift_name = input('gift_name', '');
|
|
$give_status = input('give_status',0);
|
|
$deduction_status = input('deduction_status',0);
|
|
$start = input('start', '');
|
|
$give = input('give', '');
|
|
$deduction = input('deduction', '');
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('BoxGiveGift')->get_box_give_gift_list($uid, $gid, $gift_name, $give_status, $deduction_status, $start, $give, $deduction, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
//添加
|
|
public function add_give_gift()
|
|
{
|
|
$data = Request::only(['uid', 'tid', 'gid']);
|
|
//二级密码
|
|
$pass = input('secondary_password', '');
|
|
$check_pass = model('admin/admin')->check_secondary_password($pass);
|
|
if($check_pass['code'] == 201){
|
|
return ajaxReturn($check_pass['code'], $check_pass['msg'], $check_pass['data']);
|
|
}
|
|
$reslut = model('BoxGiveGift')->add_give_gift($data);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
public function cancel_give_gift()
|
|
{
|
|
$id = input('id', 0);
|
|
$reslut = model('BoxGiveGift')->cancel_give_gift($id);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//用户个池统计
|
|
public function get_box_person_log_list() {
|
|
$uid = input('user_id', 0);
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$box_type = input('tid',0);
|
|
$reslut = model('Box')->get_box_person_log_list($box_type, $uid, $page, $limit);
|
|
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
return json($data);
|
|
}
|
|
|
|
//清空积攒金额
|
|
public function accumulate_del(){
|
|
$reslut = model('Box')->accumulate_del();
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//获取房间开奖统计
|
|
public function get_room_box_count_list(){
|
|
$uid = input('uid',0);
|
|
$out_amount = input('out_amount','');
|
|
$tid = input('tid',0);
|
|
$add_time = input('add_time','');
|
|
$order = input('order', 'a.update_time');
|
|
$sort = input('sort', 'desc');
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_room_box_count_list($uid, $out_amount, $tid, $add_time, $order, $sort, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
$data['totalRow'] = $reslut['data']['totalRow'];
|
|
return json($data);
|
|
}
|
|
|
|
//获取房间开奖统计
|
|
public function get_room_box_counts_list(){
|
|
$uid = input('uid',0);
|
|
$out_amount = input('out_amount','');
|
|
$order = input('order', 'a.profit');
|
|
$sort = input('sort', 'desc');
|
|
$page = input('page', 1);
|
|
$limit = input('limit', 20);
|
|
$reslut = model('Box')->get_room_box_counts_list($uid, $out_amount, $order, $sort, $page, $limit);
|
|
$data = [];
|
|
$data['code'] = 0;
|
|
$data['msg'] = '获取成功';
|
|
$data['count'] = $reslut['data']['count'];
|
|
$data['data'] = $reslut['data']['list'];
|
|
$data['totalRow'] = $reslut['data']['totalRow'];
|
|
return json($data);
|
|
}
|
|
|
|
}
|