101 lines
3.2 KiB
PHP
101 lines
3.2 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use think\Controller;
|
|
|
|
class Monster extends Common
|
|
{
|
|
|
|
//选择金币列表
|
|
public function choice_gold_list(){
|
|
$reslut = model('Monster')->choice_gold_list();
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//当前打怪兽详情
|
|
public function get_monster_info(){
|
|
$uid = $this->uid;
|
|
$reslut = model('Monster')->get_monster_info($uid);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//生成/结算喂养怪兽
|
|
public function create_monster_log(){
|
|
$uid = $this->uid;
|
|
$key_name = "api:Monster:create_monster_log";
|
|
redis_lock_exit($key_name);
|
|
$reslut = model('Monster')->create_monster_log();
|
|
redis_unlock($key_name);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//喂养怪兽
|
|
public function open_beat_monster(){
|
|
$uid = $this->uid;
|
|
$rid = input('rid', 0);
|
|
$type = input('type', 0);
|
|
$num = input('num', 0);
|
|
$key_name = "api:Monster:open_beat_monster:uid:".$uid;
|
|
redis_lock_exit($key_name);
|
|
$reslut = model('Monster')->open_beat_monster($uid, $rid, $type, $num);
|
|
redis_unlock($key_name);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//规则
|
|
public function get_monster_note(){
|
|
$reslut = model('Monster')->get_monster_note();
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//奖池
|
|
public function get_monster_box_list(){
|
|
$reslut = model('Monster')->get_monster_box_list();
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//开奖记录
|
|
public function get_monster_log(){
|
|
$uid = $this->uid;
|
|
$page = input('page', 1);
|
|
$page_limit = input('page_limit', 20);
|
|
$reslut = model('Monster')->get_monster_log($uid, $page, $page_limit);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
//我的记录
|
|
public function get_user_monster_log(){
|
|
$uid = $this->uid;
|
|
$page = input('page', 1);
|
|
$page_limit = input('page_limit', 20);
|
|
$reslut = model('Monster')->get_user_monster_log($uid, $page, $page_limit);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//中奖次数榜单
|
|
public function get_monster_winner_num_list(){
|
|
$uid = $this->uid;
|
|
$time = input('time', 1);
|
|
$reslut = model('Monster')->get_monster_winner_num_list($uid, $time);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
|
|
}
|
|
|
|
//设置房间期数开关
|
|
public function operate_room_monster_show_status(){
|
|
$uid = $this->uid;
|
|
$rid = input('rid', 0);
|
|
$is_show_monster_push = input('is_show_monster_push', 1);
|
|
$reslut = model('Monster')->operate_room_monster_show_status($uid, $rid, $is_show_monster_push);
|
|
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
|
}
|
|
|
|
|
|
}
|