初始化代码
This commit is contained in:
132
application/api/controller/Gift.php
Normal file
132
application/api/controller/Gift.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class Gift extends Common
|
||||
{
|
||||
//获取礼物列表
|
||||
public function get_gift_list()
|
||||
{
|
||||
$reslut = model('Gift')->get_gift_list();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//购买礼物打赏
|
||||
public function send_gift()
|
||||
{
|
||||
$to_uid_list = input('to_uid_list', '');
|
||||
$rid = input('rid', 0);
|
||||
$gid = input('gid', 0);
|
||||
$num = input('num', 0);
|
||||
$pack = input('pack', 1); //1购买 2背包
|
||||
$help_uid = input('help_uid', 0);
|
||||
$key_name = "api:gift:send_gift:" . $this->uid;
|
||||
// redis_locks_exit($key_name, 1, 1);
|
||||
$reslut = model('Gift')->send_gift($this->uid, $to_uid_list, $rid, $gid, $num, $pack, $help_uid);
|
||||
// redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
public function send_all_pack_gift()
|
||||
{
|
||||
$rid = input('rid', 0);
|
||||
$recived_uid = input('recived_uid', 0);
|
||||
$help_uid = input('help_uid', 0);
|
||||
$key_name = "api:gift:send_gift:" . $this->uid; //强制和 单独赠送礼物使用同一个锁
|
||||
redis_locks_exit($key_name, 1, 1);
|
||||
$reslut = model('Gift')->send_all_pack_gift($this->uid, $recived_uid, $rid, $help_uid);
|
||||
redis_unlock($key_name);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//获取背包 礼物列表
|
||||
public function get_gift_pack_list()
|
||||
{
|
||||
$reslut = model('Gift')->get_gift_list();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//是否显示砸蛋奖池
|
||||
public function is_open_box(){
|
||||
$reslut = model('Gift')->is_open_box($this->uid);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//礼物列表
|
||||
public function get_room_gift_list(){
|
||||
$uid = $this->uid;
|
||||
$type = input('type', 1);
|
||||
$reslut = model('GiftWall')->get_room_gift_list($uid, $type);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//本周排行榜
|
||||
public function week_star_gift_list(){
|
||||
$reslut = model('gift')->week_star_gift_list();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
public function last_week_rank(){
|
||||
$reslut = model('gift')->last_week_rank1();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//本周排行榜
|
||||
public function now_week_rank(){
|
||||
$gid = input('gid', 0);
|
||||
$reslut = model('gift')->now_week_rank($gid,$this->uid);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//获取本周周星榜前4
|
||||
public function now_week_rank_four(){
|
||||
$reslut = model('gift')->now_week_rank_four();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
//获取最高cp
|
||||
public function top_cp(){
|
||||
$reslut = model('gift')->top_cp();
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
public function my_cp(){
|
||||
$reslut = model('gift')->my_cp($this->uid);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//cp头像框
|
||||
public function my_cp_txk(){
|
||||
$type = input('type', 0);
|
||||
$reslut = model('gift')->my_cp_txk($this->uid,$type);
|
||||
return ajaxReturn($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user