Compare commits
80 Commits
4edc124d15
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 5754f71023 | |||
| 3d4465a5c6 | |||
| 5e132848bc | |||
| 4dfdcf325d | |||
| e2aea224c9 | |||
| 2814c8a7b7 | |||
| d6eacc53ce | |||
| 678f2f5cea | |||
| ddf8bbf387 | |||
| 81382c1591 | |||
| a832c1024b | |||
| 0f7cf82276 | |||
| 5b03fec4f6 | |||
| 47e02d8796 | |||
| 50ed633439 | |||
| 752fbece93 | |||
| 54efad0668 | |||
| bbb3f85fee | |||
| 590f5cb092 | |||
| 172beb8d34 | |||
| 3d7beb38fc | |||
| b2320cf92d | |||
| bd4b016586 | |||
| 4f917863e6 | |||
| 60b517312c | |||
| 60e2cde5e7 | |||
| 1bd790071c | |||
| f54302f22e | |||
| 7937998240 | |||
| 93e60d695b | |||
| 943921a352 | |||
| fc48e1f261 | |||
| 4effce28ef | |||
| 08bb57e5a3 | |||
| c4cfcb393f | |||
| 5b2c655be8 | |||
| 910717464f | |||
| bad85524ef | |||
| 8ad606a8dd | |||
| b7302fa213 | |||
| b4827f823b | |||
| 7e9c2b5138 | |||
| e7a17bb34e | |||
| 3b22f8d134 | |||
| de5ae479c9 | |||
| 8315eeae2d | |||
| 46d12d99b1 | |||
| 817da774ef | |||
| 0d734d092b | |||
| a6ae1d8c01 | |||
| 6ef84a2690 | |||
| 29ec30fd65 | |||
| c49abb572f | |||
| 24bb57f516 | |||
| 5ebcdb2a7e | |||
| 0451444b85 | |||
| 391a2481e9 | |||
| 0353bae8db | |||
| df976eebfe | |||
| 2a085baaa5 | |||
| 9038538ee8 | |||
| 8bba9f61ec | |||
| 59ba40a66a | |||
| dc3f0983da | |||
| 7ea48b8c9f | |||
| dbd4a43a15 | |||
| ca79d16c95 | |||
| c7a1864c65 | |||
| 396dfeaa07 | |||
| 6cca013d61 | |||
| c96d8750b6 | |||
| 287523fc88 | |||
| c46038cf5b | |||
| 747c2747b1 | |||
| eee56fc7eb | |||
| ee25111a0a | |||
| 20a8c4e8bf | |||
| d6c92bc150 | |||
| ea9fa85d46 | |||
| 7a703e3cfd |
@@ -424,6 +424,7 @@ class Activities extends adminApi
|
||||
'money' => $ext['money'],
|
||||
'money_str' => $ext['money_str'],
|
||||
'diamond' => $ext['diamond'],
|
||||
'activity_end_time' => $ext['activity_end_time'],
|
||||
];
|
||||
return V(1,"成功",$data);
|
||||
}
|
||||
|
||||
@@ -62,17 +62,14 @@ class BlindBox extends adminApi
|
||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||
$lists[$key]['gift_name'] = $value['name'];
|
||||
$gift_data = db::name('vs_gift')->where(['gid'=>$value['foreign_id']])->find();
|
||||
if(empty($gift_data)){
|
||||
continue;
|
||||
}
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'];
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
||||
$lists[$key]['quantity'] = $value['quantity'];
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'];
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'];
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'];
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'];
|
||||
$lists[$key]['weight'] = $value['weight'];
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'] ?? "";
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'] ?? 0;
|
||||
$lists[$key]['quantity'] = $value['quantity'] ?? 0;
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'] ?? 0;
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'] ?? 0;
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'] ?? 0;
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'] ?? 0;
|
||||
$lists[$key]['weight'] = $value['weight'] ?? 0;
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
|
||||
}
|
||||
@@ -354,6 +351,14 @@ class BlindBox extends adminApi
|
||||
foreach ($gift_bag_detail as $k=>$v){
|
||||
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
|
||||
}
|
||||
// 清除缓存
|
||||
Cache::rm("pan_gift_bag".$gift_bag_id);
|
||||
Cache::rm("pan_gift_bag_detail".$gift_bag_id);
|
||||
Cache::rm("pan_total_quantity".$gift_bag_id);
|
||||
Cache::rm("pan_total_remaining".$gift_bag_id);
|
||||
Cache::rm("pan_total_draw".$gift_bag_id);
|
||||
Cache::rm("pan_gift_info_map".$gift_bag_id);
|
||||
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
@@ -810,6 +815,7 @@ class BlindBox extends adminApi
|
||||
$platform_profit_loss = $total_money - $total_gift_money;
|
||||
if($profit_loss==0 || $total_money==0){
|
||||
$profit_loss_ratio = 0;
|
||||
$platform_profit_loss_ratio = 0;
|
||||
}else{
|
||||
// 盈亏比
|
||||
$profit_loss_ratio = round(($profit_loss / $total_money),3);
|
||||
|
||||
@@ -31,36 +31,46 @@ class GiveGift extends adminApi
|
||||
$end_time = input('end_time', '');
|
||||
|
||||
$where=[];
|
||||
$gwhere = [];
|
||||
if($send_user != ''){
|
||||
$user_id = db::name('user')->where('user_code', $send_user)->value('id');
|
||||
$where['user_id'] = $user_id;
|
||||
$gwhere['gg.user_id'] = $user_id;
|
||||
}
|
||||
if($gift_user != ''){
|
||||
$gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id');
|
||||
$where['gift_user'] = $gift_user_id;
|
||||
$gwhere['gg.gift_user'] = $gift_user_id;
|
||||
}
|
||||
if($from_id != ''){
|
||||
$room_id = db::name('vs_room')->where('room_number', $from_id)->value('id');
|
||||
if($room_id){
|
||||
$where['from_id'] = $room_id;
|
||||
$gwhere['gg.from_id'] = $room_id;
|
||||
}else{
|
||||
$where['from_id'] = $from_id;
|
||||
$gwhere['gg.from_id'] = $from_id;
|
||||
}
|
||||
}
|
||||
if($gift_id != ''){
|
||||
$where['gift_id'] = $gift_id;
|
||||
$gwhere['gg.gift_id'] = $gift_id;
|
||||
}
|
||||
if($from != ''){
|
||||
$where['from'] = $from;
|
||||
$gwhere['gg.from'] = $from;
|
||||
}
|
||||
// 时间筛选优化
|
||||
if (!empty($start_time) || !empty($end_time)) {
|
||||
if (!empty($start_time) && !empty($end_time)) {
|
||||
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
$gwhere['gg.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
} elseif (!empty($start_time)) {
|
||||
$where['createtime'] = ['>=', strtotime($start_time)];
|
||||
$gwhere['gg.createtime'] = ['>=', strtotime($start_time)];
|
||||
} elseif (!empty($end_time)) {
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
$gwhere['gg.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
}
|
||||
//礼物总数
|
||||
@@ -79,15 +89,12 @@ class GiveGift extends adminApi
|
||||
$count = db::name('vs_give_gift')->where($where)->count();
|
||||
$earning_list = [];
|
||||
if(!empty($where)){
|
||||
$gift_ids = db::name('vs_give_gift')->where($where)->column('id');
|
||||
if (!empty($gift_ids)) {
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
->field('app_earning,gift_user_earning,room_owner_earning')
|
||||
->where('give_gift_id', 'in', $gift_ids)
|
||||
->order('id', 'desc')
|
||||
->alias('egl')
|
||||
->join('vs_give_gift gg', 'egl.give_gift_id = gg.id')
|
||||
->where($gwhere) // 替换为实际的筛选条件
|
||||
->field('egl.app_earning,egl.gift_user_earning,egl.room_owner_earning')
|
||||
->select();
|
||||
}
|
||||
}else{
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
@@ -199,6 +206,8 @@ class GiveGift extends adminApi
|
||||
$value['gift_user_earning'] = $earning_info ? $earning_info['gift_user_earning'] : 0;
|
||||
$value['room_owner_earning'] = $earning_info ? $earning_info['room_owner_earning'] : 0;
|
||||
}
|
||||
//比例
|
||||
$config = get_system_config();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
@@ -209,7 +218,10 @@ class GiveGift extends adminApi
|
||||
'total_price' => $total_price,
|
||||
'app_earning' => round($app_earning,2) ,
|
||||
'receive_earning' => round($receive_earning,2),
|
||||
'room_owner_earning' => round($room_owner_earning,2)
|
||||
'room_owner_earning' => round($room_owner_earning,2),
|
||||
'app_earning_ratio' => 100 - $config['room_gift_ratio'] - $config['room_author_ratio'],
|
||||
'receive_earning_ratio' => $config['room_gift_ratio'] ?? 0,
|
||||
'room_owner_earning_ratio' => $config['room_author_ratio'] ?? 0,
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
|
||||
@@ -84,6 +84,7 @@ class Guild extends adminApi
|
||||
//当日流水
|
||||
$list[$k]['today_money'] = model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);
|
||||
$list[$k]['is_show'] = $v['is_show'];
|
||||
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
||||
$list[$k]['status'] = $v['status'];
|
||||
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
|
||||
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
@@ -102,6 +103,21 @@ class Guild extends adminApi
|
||||
$reslut['list'] = $list;
|
||||
return V(1,"成功", $reslut);
|
||||
}
|
||||
/*
|
||||
* 工会显示状态修改
|
||||
*/
|
||||
public function guild_show_status_edit(){
|
||||
$id = input('id',0);
|
||||
$guild = model('Guild')->getOne(['id'=>$id]);
|
||||
if (!$guild) {
|
||||
return V(0, "数据不存在");
|
||||
}
|
||||
if ($guild) {
|
||||
$status = $guild['is_show'] == 1 ? 0 : 1;
|
||||
}
|
||||
$res = db::name('vs_guild')->where('id',$id)->update(['is_show'=>$status]);;
|
||||
return V(1,"成功", $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工会添加
|
||||
@@ -379,8 +395,8 @@ class Guild extends adminApi
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$guild_id = input('guild_id', 0);
|
||||
$search_stime = input('search_stime','');
|
||||
$search_etime = input('search_etime','');
|
||||
$search_stime_str = input('search_stime','');
|
||||
$search_etime_str = input('search_etime','');
|
||||
$room_id = input('room_id', 0);
|
||||
$where=['a.status'=>1];
|
||||
$where=['a.room_id'=>['>',0]];
|
||||
@@ -396,15 +412,44 @@ class Guild extends adminApi
|
||||
}
|
||||
$count = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->count();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||
$list = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->page($page, $page_limit)->select();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)
|
||||
// ->page($page, $page_limit)
|
||||
->select();
|
||||
if(!$list){
|
||||
return V(0,"暂无数据");
|
||||
}
|
||||
$rum_lists = [];
|
||||
//总流水
|
||||
$total_consumption = 0;
|
||||
foreach ($list as $k=>$v){
|
||||
$search_stime = $search_stime_str;
|
||||
$search_etime = $search_etime_str;
|
||||
if($search_stime!=""){
|
||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
||||
$search_stime = $search_stime;
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
||||
}
|
||||
}else{
|
||||
$search_stime = $search_stime;
|
||||
}
|
||||
if($search_etime!=""){
|
||||
if($v['quit_time']){
|
||||
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
||||
$search_etime = $search_etime;
|
||||
}else{
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}
|
||||
}else{
|
||||
$search_etime = $search_etime;
|
||||
}
|
||||
}else{
|
||||
$search_etime = $search_etime;
|
||||
}
|
||||
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||
$rum_lists[$k]['id']=$v['id'];
|
||||
$rum_lists[$k]['room_id']=$v['room_id'];
|
||||
@@ -414,10 +459,18 @@ class Guild extends adminApi
|
||||
//房间流水
|
||||
$rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
||||
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$total_consumption += $rum_lists[$k]['consumption'];
|
||||
}
|
||||
usort($rum_lists, function($a, $b) {
|
||||
return $b['consumption'] - $a['consumption'];
|
||||
});
|
||||
//分页
|
||||
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'total_consumption' => $total_consumption,
|
||||
'count' => $count,
|
||||
'lists' => $rum_lists
|
||||
];
|
||||
@@ -648,7 +701,7 @@ class Guild extends adminApi
|
||||
$lists_data = db::name($this->table_guild_subsidy)->alias('a')
|
||||
->join('vs_guild b','a.guild_id = b.id')
|
||||
->where($where)
|
||||
->order('a.id desc')
|
||||
->order('a.total_transaction desc')
|
||||
->field('a.*,b.guild_name,b.user_id,b.guild_special_id')
|
||||
->page($page,$page_limit)
|
||||
->select();
|
||||
|
||||
@@ -425,6 +425,12 @@ class Room extends adminApi
|
||||
$search_room_id = input('search_room_id', '');
|
||||
$search_user_id = input('search_user_id', '');
|
||||
$search_status = input('search_status', '');
|
||||
$type_id = input('type_id', '');
|
||||
$label_id = input('label_id', '');
|
||||
$is_hot = input('is_hot', '');
|
||||
$is_top = input('is_top', '');
|
||||
$is_recommend = input('is_recommend', '');
|
||||
|
||||
$where=[];
|
||||
//房间号
|
||||
if($search_room_id!==''){
|
||||
@@ -437,9 +443,25 @@ class Room extends adminApi
|
||||
if($search_status!==''){
|
||||
$where['room_status'] = $search_status;
|
||||
}
|
||||
if($type_id!==''){
|
||||
$where['type_id'] = $type_id;
|
||||
}else{
|
||||
$where['type_id'] = ['<>',6];
|
||||
}
|
||||
if($label_id!==''){
|
||||
$where['label_id'] = $label_id;
|
||||
}
|
||||
if($is_hot!==''){
|
||||
$where['is_hot'] = $is_hot;
|
||||
}
|
||||
if($is_top!==''){
|
||||
$where['is_top'] = $is_top;
|
||||
}
|
||||
if($is_recommend!==''){
|
||||
$where['is_recommend'] = $is_recommend;
|
||||
}
|
||||
//房间列表只展示 审核通过的房间
|
||||
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||
$where['type_id'] = ['<>',6];
|
||||
$count = db::name($this->table)->where($where)->count();
|
||||
$room_lists = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
||||
$lists = [];
|
||||
|
||||
227
application/adminapi/controller/RoomEmoji.php
Normal file
227
application/adminapi/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 房间
|
||||
* @internal
|
||||
*/
|
||||
class RoomEmoji extends adminApi
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['emoji_list','add_emoji','edit_emoji','del_emoji','emoji_detail','emoji_type_list'];
|
||||
|
||||
protected $table = 'vs_room_emoji';
|
||||
protected $table_type = 'vs_room_emoji_type';
|
||||
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
|
||||
}
|
||||
//房间表情列表
|
||||
function emoji_list(){
|
||||
$id = input('id', '', 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$where = [];
|
||||
if ($id) {
|
||||
$where['id'] = $id;
|
||||
}
|
||||
if ($name) {
|
||||
$where['name'] = ['like', '%' . $name . '%'];
|
||||
}
|
||||
$total = Db::name($this->table)
|
||||
->where($where)
|
||||
->count();
|
||||
$list = Db::name($this->table)
|
||||
->where($where)
|
||||
->where(['deletetime' => 0])
|
||||
->order('sort desc,id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['type_str'] = Db::name($this->table_type)->where('id', $item['type_id'])->value('type_name');
|
||||
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||
$item['status_str'] = $item['status'] == 1 ? '显示' : '隐藏';
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $total,
|
||||
'list' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//添加房间表情
|
||||
function add_emoji(){
|
||||
$pid = input('pid', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$name) {
|
||||
return V(0, '请输入表情名称');
|
||||
}
|
||||
if (!$img) {
|
||||
return V(0, '请上传表情图片');
|
||||
}
|
||||
if (!$type_id) {
|
||||
return V(0, '请选择表情类型');
|
||||
}
|
||||
$data = [
|
||||
'pid' => $pid,
|
||||
'name' => $name,
|
||||
'image' => $img,
|
||||
'animate_image' => $animate_image,
|
||||
'sort' => $sort,
|
||||
'type_id' => $type_id,
|
||||
'status' => $status,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//房间表情修改
|
||||
function edit_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情');
|
||||
}
|
||||
if($name){
|
||||
$data['name'] = $name;
|
||||
}
|
||||
if($img){
|
||||
$data['image'] = $img;
|
||||
}
|
||||
if($animate_image){
|
||||
$data['animate_image'] = $animate_image;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($type_id){
|
||||
$data['type_id'] = $type_id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$res = Db::name($this->table)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
}
|
||||
//房间表情删除
|
||||
function del_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情');
|
||||
}
|
||||
$res = Db::name($this->table)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
}
|
||||
//表情详情
|
||||
function emoji_detail(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要查看的表情');
|
||||
}
|
||||
$detail = Db::name($this->table)->where('id',$id)->find();
|
||||
if (!$detail) {
|
||||
return V(0, '表情不存在');
|
||||
}
|
||||
return V(1,"成功", $detail);
|
||||
}
|
||||
|
||||
//表情类型列表
|
||||
function emoji_type_list(){
|
||||
$emoji_type = Db::name($this->table_type)
|
||||
->field('id,type_name')
|
||||
->where(['deletetime'=>0,'status'=>1])
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
return V(1,"成功", $emoji_type);
|
||||
}
|
||||
|
||||
//表情类型添加
|
||||
function add_emoji_type(){
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
if (!$type_name) {
|
||||
return V(0, '请输入表情类型名称');
|
||||
}
|
||||
$data = [
|
||||
'type_name' => $type_name,
|
||||
'sort' => 0,
|
||||
'status' => 1,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table_type)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//表情类型修改
|
||||
function edit_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情类型');
|
||||
}
|
||||
if($type_name){
|
||||
$data['type_name'] = $type_name;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($status){
|
||||
$data['status'] = $status;
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
return V(0, '修改失败');
|
||||
}
|
||||
//表情类型删除
|
||||
function del_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情类型');
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
return V(0, '删除失败');
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,9 @@ class SysSet extends adminApi
|
||||
'10' => '邀请奖励',
|
||||
'11' => '二级密码',
|
||||
];
|
||||
public $noAdminConfigType = [
|
||||
'1' => '基础设置',
|
||||
];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
@@ -45,7 +48,11 @@ class SysSet extends adminApi
|
||||
* 类型列表
|
||||
*/
|
||||
public function type_list(){
|
||||
if($this->auth->isSuperAdmin()){
|
||||
$configType = $this->configType;
|
||||
}else{
|
||||
$configType = $this->noAdminConfigType;
|
||||
}
|
||||
$list = [];
|
||||
$i=0;
|
||||
foreach ($configType as $k=>$v){
|
||||
|
||||
@@ -72,7 +72,9 @@ class User extends adminApi
|
||||
if($v=='coin1'){
|
||||
$where['c.coin'] = ['>=',$input_data];
|
||||
}elseif($v=='coin2'){
|
||||
if($input_data){
|
||||
$where['c.coin'] = ['<=',$input_data];
|
||||
}
|
||||
}elseif($v=='createtime'){
|
||||
$where['a.createtime'] = ['>=',strtotime($input_data)];
|
||||
$where['a.createtime'] = ['<=',strtotime($input_data)];
|
||||
@@ -436,7 +438,15 @@ class User extends adminApi
|
||||
$page = input('page',1);
|
||||
$page_limit = input('page_limit',10);
|
||||
$type = input('type','');
|
||||
$return = model('UserWallet')->money_change_log($user_id,$type,$page,$page_limit);
|
||||
$stime = input('stime','');
|
||||
$etime = input('etime','');
|
||||
$change_type = input('change_type','');
|
||||
$seach = [
|
||||
'stime' => $stime,
|
||||
'etime' => $etime,
|
||||
'change_type' => $change_type
|
||||
];
|
||||
$return = model('UserWallet')->money_change_log($user_id,$seach,$type,$page,$page_limit);
|
||||
$list = [];
|
||||
foreach($return['list'] as $k=>$v){
|
||||
$list[$k] = [
|
||||
@@ -456,6 +466,14 @@ class User extends adminApi
|
||||
return V(1,"操作成功", $return_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取用户资金类型
|
||||
*/
|
||||
public function get_money_type(){
|
||||
$reslut = model('UserWallet')->getChangeTypeLableList();
|
||||
return V(1,"操作成功", $reslut);
|
||||
}
|
||||
|
||||
/*
|
||||
* 相册列表
|
||||
*/
|
||||
|
||||
@@ -92,18 +92,18 @@ class Room extends Model
|
||||
* 房间绑定盘
|
||||
*/
|
||||
public function bindPan($room_id){
|
||||
db::name('vs_room_pan')->where(['room_id'=>$room_id])->delete();
|
||||
$gift_bag = db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>['in',[10,11,12,13]]])->select();
|
||||
foreach ($gift_bag as $k=>$v){
|
||||
$data = [
|
||||
'room_id'=>$room_id,
|
||||
'gift_bag_id'=>$v['gift_bag_id'],
|
||||
'gift_bag_detail_id'=>$v['id'],
|
||||
'remaining_number'=>$v['quantity'],
|
||||
'createtime'=>time()
|
||||
];
|
||||
db::name('vs_room_pan')->insert($data);
|
||||
}
|
||||
// db::name('vs_room_pan')->where(['room_id'=>$room_id])->delete();
|
||||
// $gift_bag = db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>['in',[10,11,12,13]]])->select();
|
||||
// foreach ($gift_bag as $k=>$v){
|
||||
// $data = [
|
||||
// 'room_id'=>$room_id,
|
||||
// 'gift_bag_id'=>$v['gift_bag_id'],
|
||||
// 'gift_bag_detail_id'=>$v['id'],
|
||||
// 'remaining_number'=>$v['quantity'],
|
||||
// 'createtime'=>time()
|
||||
// ];
|
||||
// db::name('vs_room_pan')->insert($data);
|
||||
// }
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ class Activities extends BaseCom
|
||||
$uid = input('uid',$this->uid);
|
||||
$permission_status = 1;
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
$system = request()->header('system');
|
||||
$app_version = request()->header('App-Version');
|
||||
if(!$app_version){
|
||||
@@ -200,7 +200,7 @@ class Activities extends BaseCom
|
||||
public function drop_gift_send()
|
||||
{
|
||||
$uid = input('uid',$this->uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid,16);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
@@ -313,14 +313,15 @@ class Activities extends BaseCom
|
||||
$uid = input('uid',$this->uid);
|
||||
$first_charge_permission = 1;
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
if($is_first_charge > 0){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
if($permission){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
|
||||
//天降好礼
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
|
||||
$day_drop_permission = 0;
|
||||
@@ -332,11 +333,19 @@ class Activities extends BaseCom
|
||||
}
|
||||
//新人充值好礼
|
||||
$activities = DB::name('vs_activities')->where(['id'=>7,'status'=>1,'delete_time'=>0])->find();
|
||||
if($activities){
|
||||
$effective_time = $activities['effective_time'];
|
||||
}else{
|
||||
$effective_time = 0;
|
||||
}
|
||||
$bag_data = DB::name('vs_gift_bag')->where(['activities_id'=>7,'status'=>1,'delete_time'=>0])->select();
|
||||
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>['in',array_column($bag_data,'id')],'user_id'=>$uid])->select();
|
||||
$new_permission = 0;
|
||||
$user_info = DB::name('user')->where(['id'=>$uid])->find();
|
||||
if($user_info['createtime'] + $activities['effective_time'] >= time()){
|
||||
if($user_info['createtime']<"1760666400"){
|
||||
$user_info['createtime'] = 1760666400;
|
||||
}
|
||||
if($user_info['createtime'] + $effective_time >= time()){
|
||||
$new_permission = 1;
|
||||
}
|
||||
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
|
||||
|
||||
@@ -40,7 +40,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$num = input('num',1);
|
||||
$heart_id = input('heart_id',0);
|
||||
$auction_id = input('auction_id',0);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -93,7 +93,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$user_id = $this->uid;
|
||||
$room_id = input('room_id',0);
|
||||
$num = input('num',1);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorld')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
|
||||
22
application/api/controller/RoomEmoji.php
Normal file
22
application/api/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class RoomEmoji extends BaseCom
|
||||
{
|
||||
//表情类型列表
|
||||
public function type_list(){
|
||||
$reslut = model('RoomEmoji')->getRoomEmojiType();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//表情列表
|
||||
public function emoji_list(){
|
||||
$type_id = input('type_id', "");
|
||||
$pid = input('pid', "");
|
||||
$reslut = model('RoomEmoji')->getRoomEmoji($type_id,$pid,true);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ class Activities extends Model
|
||||
public static function first_charge_gift_send($user_id,$money=0)
|
||||
{
|
||||
//礼包
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['>=',$money]])->order('money desc')->find();
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['<=',$money]])->order('money desc')->find();
|
||||
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||
if (!$gift_bag_id) {
|
||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||
|
||||
@@ -236,23 +236,26 @@ class BlindBoxTurntableGift extends Model
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['send_time'=>0,'end_time'=>['>',time()]])->order('id desc')->find();
|
||||
$xlh_periods_num = Cache::get("xlh_periods_num") ?? 0;
|
||||
if(empty($pan_xlh)){
|
||||
if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
|
||||
$xlh_periods = Cache::get("this_xlh_periods") ?? 0;
|
||||
$pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||
'room_id' => $room_id,
|
||||
'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
|
||||
'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
|
||||
'periods' => $xlh_periods+1,
|
||||
'num' => 0,
|
||||
'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
|
||||
'createtime' => time()
|
||||
]);
|
||||
Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数
|
||||
$pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
|
||||
}else{
|
||||
return ['code' => 0, 'msg' => '巡乐会已结束', 'data' => null];
|
||||
}
|
||||
}
|
||||
// if(empty($pan_xlh)){
|
||||
// if($xlh_periods_num >= $xlh_ext['open_condition']['start_num']){
|
||||
// $xlh_periods = Cache::get("this_xlh_periods") ?? 0;
|
||||
// $pan_xlh_id = db::name('vs_room_pan_xlh')->insertGetId([
|
||||
// 'room_id' => $room_id,
|
||||
// 'gift_id' => $xlh_ext['locking_condition']['locking_gift_id'],
|
||||
// 'homeowner_gift_id' => $xlh_ext['locking_condition']['give_homeowner_gift_id'],
|
||||
// 'periods' => $xlh_periods+1,
|
||||
// 'num' => 0,
|
||||
// 'end_time' => time() + $xlh_ext['locking_time']['end_time'] * 60,
|
||||
// 'createtime' => time()
|
||||
// ]);
|
||||
// Cache::set("this_xlh_periods", $xlh_periods+1, 0);//修改巡乐会期数
|
||||
// $pan_xlh = db::name('vs_room_pan_xlh')->where(['id'=>$pan_xlh_id])->find();
|
||||
// }else{
|
||||
// return ['code' => 0, 'msg' => '巡乐会已结束', 'data' => null];
|
||||
// }
|
||||
// }
|
||||
$xlh_user_data= null;
|
||||
$room_user_data = null;
|
||||
if($pan_xlh && $pan_xlh['user_id']){
|
||||
|
||||
@@ -8,6 +8,7 @@ use think\Model;
|
||||
use think\Db;
|
||||
use think\Session;
|
||||
use Redis;
|
||||
use think\queue;
|
||||
/*
|
||||
* 盲盒转盘优化后方法
|
||||
*
|
||||
@@ -37,9 +38,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0,$auction_id = 0)
|
||||
{
|
||||
// 最大重试次数
|
||||
// $maxRetries = 3;
|
||||
// for ($attempt = 0; $attempt < $maxRetries; $attempt++) {
|
||||
// try {
|
||||
try {
|
||||
// 1. 验证参数并提前处理错误
|
||||
$validationResult = $this->validateDrawParameters($gift_bag_id, $user_id, $gift_user_ids);
|
||||
if ($validationResult !== true) {
|
||||
@@ -75,6 +74,33 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
$this->recordDrawErrorToRedis($expectedCount, count($precomputedResults), $room_id, $user_id, $gift_bag_id, $num, $gift_user_ids, $precomputedResults);
|
||||
return ['code' => 0, 'msg' => '网络加载失败,请重试!', 'data' => null];
|
||||
}
|
||||
foreach ($precomputedResults as $result) {
|
||||
$key = $result['gift_user_id'] . '_' . $result['gift_bag_detail']['foreign_id'];
|
||||
if (!isset($giftUserCountsJianCha[$key])) {
|
||||
$giftUserCountsJianCha[$key] = [
|
||||
'gift_user_id' => $result['gift_user_id'],
|
||||
'gift_id' => $result['gift_bag_detail']['foreign_id'],
|
||||
'count' => 0,
|
||||
'gift_price' => $result['gift']['gift_price'],
|
||||
'quantity' => $result['gift_bag_detail']['quantity'],
|
||||
];
|
||||
}
|
||||
$giftUserCountsJianCha[$key]['count']++;
|
||||
if($giftUserCountsJianCha[$key]['count'] > $result['gift_bag_detail']['quantity']){
|
||||
// 记录错误到Redis
|
||||
// 使用正确的Redis方法存储数据
|
||||
$key = 'blind_box_draw_world_errors_' . date('Y-m-d-H-i-s');
|
||||
$errorData = [
|
||||
'gift_bag_id' => $gift_bag_id,
|
||||
'user_id' => $user_id,
|
||||
'gift_user_ids' => $gift_user_ids,
|
||||
'num' => $num,
|
||||
'giftUserCountsJianCha' => $giftUserCountsJianCha,
|
||||
];
|
||||
$this->redis->setex($key, 86400 * 7, "礼物数量超出限制 ".json_encode($errorData));
|
||||
return ['code' => 0, 'msg' => '网络加载失败,请重试!', 'data' => null];
|
||||
}
|
||||
}
|
||||
// 4. 执行抽奖事务(核心操作)
|
||||
$transactionResult = $this->executeDrawTransaction(
|
||||
$bag_data,
|
||||
@@ -107,30 +133,135 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
// 6. 构建并返回结果
|
||||
return $this->buildDrawResult($boxTurntableLog, $giftCounts);
|
||||
|
||||
// } catch (\Exception $e) {
|
||||
// $key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
|
||||
// $errorData = [
|
||||
// 'gift_bag_id' => $gift_bag_id,
|
||||
// 'user_id' => $user_id,
|
||||
// 'gift_user_ids' => $gift_user_ids,
|
||||
// 'num' => $num,
|
||||
// 'room_id' => $room_id,
|
||||
// 'heart_id' => $heart_id,
|
||||
// 'auction_id' => $auction_id,
|
||||
// ];
|
||||
// if ($this->redis) {
|
||||
// $this->redis->setex($key, 86400 * 7, $e->getMessage() . ' ' . json_encode($errorData));
|
||||
// }
|
||||
// // 如果是死锁且还有重试机会
|
||||
// if (strpos($e->getMessage(), 'Deadlock') !== false && $attempt < $maxRetries - 1) {
|
||||
// // 随机延迟后重试
|
||||
// usleep(rand(50000, 200000)); // 50-200ms
|
||||
// continue;
|
||||
// }
|
||||
// return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
|
||||
// }
|
||||
// }
|
||||
} catch (\Exception $e) {
|
||||
$key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
|
||||
$errorData = [
|
||||
'gift_bag_id' => $gift_bag_id,
|
||||
'user_id' => $user_id,
|
||||
'gift_user_ids' => $gift_user_ids,
|
||||
'num' => $num,
|
||||
'room_id' => $room_id,
|
||||
'heart_id' => $heart_id,
|
||||
'auction_id' => $auction_id,
|
||||
];
|
||||
if ($this->redis) {
|
||||
$this->redis->setex($key, 86400 * 7, $e->getMessage() . ' ' . json_encode($errorData));
|
||||
}
|
||||
return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成奖池并存入Redis
|
||||
*/
|
||||
public function generateGiftPool($gift_bag_id)
|
||||
{
|
||||
try {
|
||||
// 获取奖池基本信息
|
||||
$poolKey = "blind_box_pool:{$gift_bag_id}";
|
||||
$poolInfoKey = "blind_box_pool_info:{$gift_bag_id}";
|
||||
|
||||
// 检查Redis连接
|
||||
if (!$this->redis) {
|
||||
throw new \Exception('Redis连接不可用');
|
||||
}
|
||||
|
||||
// 获取数据库中的期数信息
|
||||
$dbPeriods = db::name("vs_gift_bag")
|
||||
->where(['id' => $gift_bag_id])
|
||||
->value('periods');
|
||||
|
||||
// 获取奖池详细信息
|
||||
$gift_bag_detail_data = $this->getCachedGiftBagDetail($gift_bag_id);
|
||||
|
||||
// 获取可用礼物列表
|
||||
$availableGifts = [];
|
||||
foreach ($gift_bag_detail_data as $gift) {
|
||||
if ($gift['remaining_number'] > 0) {
|
||||
// 根据权重添加礼物到可选列表
|
||||
for ($i = 0; $i < $gift['weight']; $i++) {
|
||||
$availableGifts[] = $gift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($availableGifts)) {
|
||||
throw new \Exception('没有可用的礼物');
|
||||
}
|
||||
|
||||
// 生成大量抽奖结果(例如1000个)
|
||||
$results = [];
|
||||
for ($i = 0; $i < 1000; $i++) {
|
||||
$randomIndex = array_rand($availableGifts);
|
||||
$selectedGift = $availableGifts[$randomIndex];
|
||||
|
||||
// 获取礼物详细信息
|
||||
$giftInfo = db::name("vs_gift")
|
||||
->where(['gid' => $selectedGift['foreign_id']])
|
||||
->find();
|
||||
|
||||
$results[] = [
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $giftInfo ?? []
|
||||
];
|
||||
}
|
||||
|
||||
// 使用事务确保原子操作
|
||||
$this->redis->watch($poolKey, $poolInfoKey);
|
||||
$this->redis->multi();
|
||||
|
||||
// 清空现有奖池
|
||||
$this->redis->del($poolKey);
|
||||
|
||||
// 添加新结果到奖池
|
||||
foreach ($results as $result) {
|
||||
$this->redis->rPush($poolKey, json_encode($result));
|
||||
}
|
||||
|
||||
// 更新奖池信息
|
||||
$this->redis->hMSet($poolInfoKey, [
|
||||
'periods' => $dbPeriods,
|
||||
'draw_times' => 0,
|
||||
'total_count' => count($results),
|
||||
'last_update' => time()
|
||||
]);
|
||||
|
||||
$this->redis->exec();
|
||||
|
||||
Log::record("奖池生成成功,gift_bag_id: {$gift_bag_id}", 'info');
|
||||
return true;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::record('生成奖池失败: ' . $e->getMessage(), 'error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从奖池中获取一个礼物
|
||||
*/
|
||||
public function getGiftFromPool($gift_bag_id)
|
||||
{
|
||||
try {
|
||||
$poolKey = "blind_box_pool:{$gift_bag_id}";
|
||||
|
||||
// 从Redis奖池中取出一个结果
|
||||
$result = $this->redis->lPop($poolKey);
|
||||
|
||||
if (!$result) {
|
||||
// 奖池为空,重新生成
|
||||
$this->generateGiftPool($gift_bag_id);
|
||||
$result = $this->redis->lPop($poolKey);
|
||||
}
|
||||
|
||||
return $result ? json_decode($result, true) : null;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
Log::record('从奖池获取礼物失败: ' . $e->getMessage(), 'error');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证抽奖参数
|
||||
*/
|
||||
@@ -327,14 +458,14 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$precomputedResultss[] = [
|
||||
'gift_user_id' => $giftUserId,
|
||||
'gift_bag_detail' => $selectedGift,
|
||||
'gift' => $gift,
|
||||
'draw_times' => $totalDrawTimes,
|
||||
'periods' => $periods,
|
||||
];
|
||||
$totalDrawTimes++;
|
||||
// $precomputedResultss[] = [
|
||||
// 'gift_user_id' => $giftUserId,
|
||||
// 'gift_bag_detail' => $selectedGift,
|
||||
// 'gift' => $gift,
|
||||
// 'draw_times' => $totalDrawTimes,
|
||||
// 'periods' => $periods,
|
||||
// ];
|
||||
// $totalDrawTimes++;
|
||||
$currentXlhPeriodsNum++;
|
||||
$addcurrentXlhPeriodsNum++;
|
||||
|
||||
@@ -343,6 +474,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
}
|
||||
}
|
||||
}
|
||||
$totalDrawTimes = 0;
|
||||
}
|
||||
|
||||
// 再从新奖池中分配剩余所需礼物
|
||||
@@ -495,9 +627,7 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
$bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num;
|
||||
|
||||
// 增加重试机制
|
||||
// $maxRetries = 3;
|
||||
// for ($retry = 0; $retry < $maxRetries; $retry++) {
|
||||
// try {
|
||||
try {
|
||||
db::startTrans();
|
||||
// 按照固定顺序处理事务步骤
|
||||
// 1. 扣除用户金币(优先处理)
|
||||
@@ -542,18 +672,10 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
'gift_counts' => $giftCounts
|
||||
]
|
||||
];
|
||||
// } catch (\Exception $e) {
|
||||
// db::rollback();
|
||||
// // 检查是否是死锁错误
|
||||
// if (strpos($e->getMessage(), 'Deadlock') !== false && $retry < $maxRetries - 1) {
|
||||
// // 等待随机时间后重试
|
||||
// usleep(rand(10000, 100000)); // 10-100ms
|
||||
// continue;
|
||||
// }
|
||||
// return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
|
||||
// }
|
||||
// }
|
||||
return ['code' => 0, 'msg' => '操作超时,请重试', 'data' => null];
|
||||
} catch (\Exception $e) {
|
||||
db::rollback();
|
||||
throw new \Exception($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -573,12 +695,25 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
|
||||
// 批量更新
|
||||
foreach ($inventoryUpdates as $giftId => $count) {
|
||||
$giftBagDetail = Db::name("vs_gift_bag_detail")
|
||||
->where('id', $giftId)
|
||||
->find();
|
||||
if (!$giftBagDetail) {
|
||||
throw new \Exception("礼物详情不存在,ID: " . $giftId);
|
||||
}
|
||||
// 检查库存是否足够
|
||||
if ($giftBagDetail['remaining_number'] < $count) {
|
||||
throw new \Exception("礼物库存不足,ID: " . $giftId);
|
||||
}
|
||||
$ret = db::name("vs_gift_bag_detail")->where('id',$giftId)
|
||||
->setDec('remaining_number', $count);
|
||||
if (!$ret) {
|
||||
Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info");
|
||||
throw new \Exception('更新礼物剩余数量失败');
|
||||
}
|
||||
|
||||
// 同时更新缓存中的库存信息
|
||||
$this->updateCachedGiftBagDetail($giftBagDetail['gift_bag_id'], $giftId, $count);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -692,7 +827,6 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
}
|
||||
$giftUserCounts[$key]['count']++;
|
||||
}
|
||||
|
||||
// 批量插入
|
||||
$batchInsertData = [];
|
||||
foreach ($giftUserCounts as $userGift) {
|
||||
@@ -1525,4 +1659,70 @@ class BlindBoxTurntableGiftDrawWorld extends Model
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取转盘礼包详细信息【缓存】
|
||||
*/
|
||||
private function getCachedGiftBag($gift_bag_id,$is_cache = true) {
|
||||
$cacheKey = "pan_gift_bag".$gift_bag_id;
|
||||
$gift_bag_data = Cache::get($cacheKey);
|
||||
if (!$gift_bag_data || !$is_cache) {
|
||||
$bag_data = db::name("vs_gift_bag")
|
||||
->field('id,name,ext,periods')
|
||||
->where('id', $gift_bag_id)
|
||||
->find();
|
||||
if (!$bag_data) {
|
||||
return [];
|
||||
}
|
||||
$gift_bag_data = json_decode($bag_data['ext'], true);
|
||||
$gift_bag_data['gift_bag_id'] = $gift_bag_id;
|
||||
$gift_bag_data['gift_bag_name'] = $bag_data['name'];
|
||||
$gift_bag_data['periods'] = $bag_data['periods'];
|
||||
$gift_bag_data['gift_price'] = DB::name("vs_gift") ->where(['gid' => $gift_bag_data['gift_id']])->value('gift_price');
|
||||
Cache::set($cacheKey, $gift_bag_data, $this->cache_time);
|
||||
}
|
||||
return $gift_bag_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取奖池详细信息【缓存】
|
||||
*/
|
||||
private function getCachedGiftBagDetail($gift_bag_id,$is_cache = true) {
|
||||
$cacheKey = "pan_gift_bag_detail".$gift_bag_id;
|
||||
$gift_bag_detail_data = Cache::get($cacheKey);
|
||||
if (!$gift_bag_detail_data || !$is_cache) {
|
||||
$gift_bag_detail_data = db::name("vs_gift_bag_detail")
|
||||
->field('id,quantity,remaining_number,weight,foreign_id,gift_bag_id')
|
||||
->where(['gift_bag_id' => $gift_bag_id])
|
||||
->select();
|
||||
if (!$gift_bag_detail_data) {
|
||||
return [];
|
||||
}
|
||||
$gift_bag_detail_data['total_quantity'] = 0;
|
||||
$gift_bag_detail_data['total_remaining'] = 0;
|
||||
foreach ($gift_bag_detail_data as &$item) {
|
||||
$item['total_quantity'] += $item['quantity'];
|
||||
$item['total_remaining'] += $item['remaining_number'];
|
||||
}
|
||||
Cache::set($cacheKey, $gift_bag_detail_data, $this->cache_time);
|
||||
}
|
||||
return $gift_bag_detail_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新缓存中的奖池信息
|
||||
*/
|
||||
private function updateCachedGiftBagDetail($gift_bag_id, $detail_id, $decrement = 1) {
|
||||
$cacheKey = "pan_gift_bag_detail".$gift_bag_id;
|
||||
$gift_bag_detail_data = Cache::get($cacheKey);
|
||||
|
||||
if ($gift_bag_detail_data) {
|
||||
foreach ($gift_bag_detail_data as &$item) {
|
||||
if ($item['id'] == $detail_id) {
|
||||
$item['remaining_number'] -= $decrement;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Cache::set($cacheKey, $gift_bag_detail_data, $this->cache_time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1391
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
1391
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ class Decorate extends Model
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
|
||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
|
||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号',9=>'聊天气泡'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼'];
|
||||
public function __construct($data = [])
|
||||
{
|
||||
@@ -206,6 +206,9 @@ class Decorate extends Model
|
||||
if($decorate_price_info['price']<=0 && $user_decorate_data['end_time'] > $now_time + $change_time){
|
||||
return ['code' => 0, 'msg' => '您已购买过此装扮,请勿重复购买', 'data' => null];
|
||||
}
|
||||
if($user_decorate_data['end_time'] < $now_time){
|
||||
$user_decorate_data['end_time'] = 0;
|
||||
}
|
||||
$change_time = $day * 24 * 3600;
|
||||
$update['is_using'] = 2;
|
||||
$update['end_time'] = $user_decorate_data['end_time'] + $change_time;
|
||||
@@ -408,10 +411,14 @@ class Decorate extends Model
|
||||
$did = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('did');
|
||||
if(empty($did)){
|
||||
$reslut = '';//返回数据
|
||||
}else{
|
||||
if($type == 9){
|
||||
$reslut = db::name('vs_decorate')->where('did', $did)->value('base_image');
|
||||
}else{
|
||||
$reslut = db::name('vs_decorate')->where('did', $did)->value('play_image');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $reslut;
|
||||
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ class GiveGift extends Model
|
||||
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($uid,9);//聊天气泡
|
||||
|
||||
//送给一人礼物的总价格(扣除用户的数额)
|
||||
$gift_price = $gift_info['gift_price'] * $num;
|
||||
@@ -449,7 +450,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_inf,
|
||||
'GiftNum' => $count,
|
||||
'gift_num' => $count,
|
||||
'text' => null
|
||||
];
|
||||
|
||||
@@ -503,7 +504,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_info,
|
||||
'GiftNum' => $num,
|
||||
'gift_num' => $num,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
@@ -616,6 +617,7 @@ class GiveGift extends Model
|
||||
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($uid,9);//聊天气泡
|
||||
|
||||
//送给一人礼物的总价格(扣除用户的数额)
|
||||
$gift_price = $gift_info['gift_price'] * $num;
|
||||
@@ -887,7 +889,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_info,
|
||||
'GiftNum' => $num,
|
||||
'gift_num' => $num,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
|
||||
@@ -29,6 +29,7 @@ class Guild extends Model
|
||||
->where(['is_show'=>1,'delete_time'=>0])
|
||||
->where($where)
|
||||
->page($page, $page_limit)
|
||||
->order('num desc')
|
||||
->select();
|
||||
$count = Db::name('vs_guild')
|
||||
->where(['is_show'=>1,'delete_time'=>0])
|
||||
@@ -757,7 +758,7 @@ class Guild extends Model
|
||||
* 工会流水查询
|
||||
* @return array
|
||||
*/
|
||||
public function get_guild_transaction($guild_id,$start_time=0,$end_time=0,$page=1,$page_limit=20){
|
||||
public function get_guild_transaction($guild_id,$seach_start_time,$seach_end_time,$page,$page_limit){
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find();
|
||||
if(empty($guild_info)){
|
||||
return ['code' => 0, 'msg' => '公会不存在!', 'data' => null];
|
||||
@@ -766,6 +767,8 @@ class Guild extends Model
|
||||
$all_guild_room = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>0])->select();
|
||||
$total_transaction = 0;
|
||||
foreach ($all_guild_room as $key => $value) {
|
||||
$start_time = $seach_start_time;
|
||||
$end_time = $seach_end_time;
|
||||
if(!$start_time){
|
||||
$start_time_all = $value['createtime'];
|
||||
$end_time_all = time();
|
||||
@@ -787,7 +790,7 @@ class Guild extends Model
|
||||
}
|
||||
//查询工会所有房间流水
|
||||
$list = db::name('vs_guild_user')->where(['guild_id'=>$guild_id,'delete_time'=>0,'status'=>1,'room_id'=>['<>',0]])
|
||||
->order('coin desc')
|
||||
->order('id asc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
|
||||
@@ -795,6 +798,8 @@ class Guild extends Model
|
||||
$room_data = [];
|
||||
$i=0;
|
||||
foreach ($list as $k=>$v){
|
||||
$start_time = $seach_start_time;
|
||||
$end_time = $seach_end_time;
|
||||
if(!$start_time){
|
||||
$start_time_seach = $value['createtime'];
|
||||
$end_time_seach = time();
|
||||
|
||||
@@ -202,6 +202,7 @@ class Login extends Model
|
||||
$return_res[0]['mobile'] = $user_info['mobile'];
|
||||
$return_res[0]['icon'][0] = model('UserData')->user_wealth_icon($user_info['id']);//财富图标
|
||||
$return_res[0]['icon'][1] = model('UserData')->user_charm_icon($user_info['id']);//魅力图标
|
||||
$return_res[0]['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
|
||||
$isAuth = 0;
|
||||
if($user_info['mobile']){
|
||||
@@ -364,21 +365,21 @@ class Login extends Model
|
||||
$openid = $userinfo['openid'];
|
||||
$user_info_data = model('UserData')->where(['wx_openid' => $openid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ali'){
|
||||
$ali_userid = $userinfo['open_id'];
|
||||
$user_info_data = model('UserData')->where(['ali_userid' => $ali_userid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ios'){
|
||||
$apple_id = $userinfo;
|
||||
$user_info_data = model('UserData')->where(['apple_id' => $userinfo,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ class Room extends Model
|
||||
$friend = null;
|
||||
}
|
||||
|
||||
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$xlh_info['xlh_info'] = model('api/BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
|
||||
if($open_time > 0){
|
||||
if($open_time <= time()){
|
||||
@@ -1815,7 +1815,7 @@ class Room extends Model
|
||||
$user_in_room = db::name('vs_room_visitor')->where(['room_id' => $room_id,'user_id' => $user_id])->find();
|
||||
if(!$user_in_room){
|
||||
// return ['code' => 0, 'msg' => '您已不在此房间', 'data' => null];
|
||||
return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
// return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
}
|
||||
$room = db::name('vs_room')->where(['id' => $room_id])->find();
|
||||
$song_list = null;
|
||||
@@ -2023,7 +2023,7 @@ class Room extends Model
|
||||
$friend = null;
|
||||
}
|
||||
|
||||
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$xlh_info['xlh_info'] = model('api/BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
|
||||
if($open_time > 0){
|
||||
if($open_time <= time()){
|
||||
|
||||
67
application/api/model/RoomEmoji.php
Normal file
67
application/api/model/RoomEmoji.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\controller\Push;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class RoomEmoji extends Model
|
||||
{
|
||||
protected $table = 'vs_room_emoji';
|
||||
protected $table_type = 'vs_room_emoji_type';
|
||||
private $redis;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->redis = \think\Cache::store('redis')->handler();
|
||||
}
|
||||
//获取房间表情包类型
|
||||
public function getRoomEmojiType(){
|
||||
$list = db($this->table_type)->field('id,type_name')->where(['status'=>1,'deletetime'=>0])->select();
|
||||
return ['code' => 1, 'msg' => '创建成功', 'data' => $list];
|
||||
}
|
||||
|
||||
//获取房间表情包
|
||||
public function getRoomEmoji($type_id=0,$pid=0, $isTree = false){
|
||||
$where = [];
|
||||
if($type_id){
|
||||
$where['type_id'] = $type_id;
|
||||
}
|
||||
if($pid!=""){
|
||||
$where['pid'] = $pid;
|
||||
}
|
||||
$list = db($this->table)
|
||||
->field('id,pid,type_id,name,image,animate_image')
|
||||
->where(['status'=>1,'deletetime'=>0])
|
||||
->where($where)
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
if ($isTree && !empty($list) && empty($pid)) {
|
||||
$list = $this->buildTree($list);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将扁平数据转换为树状结构
|
||||
* @param array $data 数据列表
|
||||
* @param int $pid 父级ID
|
||||
* @return array
|
||||
*/
|
||||
private function buildTree($data, $pid = 0)
|
||||
{
|
||||
$tree = [];
|
||||
foreach ($data as $item) {
|
||||
if ($item['pid'] == $pid) {
|
||||
$children = $this->buildTree($data, $item['id']);
|
||||
if (!empty($children)) {
|
||||
$item['children'] = $children;
|
||||
}
|
||||
$tree[] = $item;
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class RoomHourRanking extends Model
|
||||
foreach ($profit as &$v) {
|
||||
$v['total_price'] = $v['total_price'] * get_system_config_value('coin_charm_exp');
|
||||
if($v['room_id'] > 0 && $is_open_xlh == 1){
|
||||
$xlh_status = model('BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']);
|
||||
$xlh_status = model('api/BlindBoxTurntableGift')->get_user_xlh_info($v['room_id']);
|
||||
$v['xlh_status'] = $xlh_status['xlh_status'];
|
||||
}else{
|
||||
$v['xlh_status'] = 0;
|
||||
|
||||
@@ -287,7 +287,7 @@ class RoomPk extends Model
|
||||
'a.is_show_room' => 1,
|
||||
'b.pit_number' => 9,
|
||||
'b.user_id' => ['<>',0],
|
||||
'a.type_id' => ['in',[1,3,4]],
|
||||
'a.type_id' => ['in',[1,3,4,8]],
|
||||
'a.label_id' => 1,
|
||||
];
|
||||
|
||||
|
||||
@@ -147,6 +147,7 @@ class User extends Model
|
||||
}
|
||||
//头像装扮
|
||||
$user_info['dress'] = model('Decorate')->user_decorate_detail($user_info['user_id'],1);
|
||||
$user_info['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
$user_info['auth'] = db::name('user_auth')->where(['mobile' => $user_info['mobile'],'is_real' => 1])->find() ? 1 : 0;
|
||||
|
||||
//是否可以发布动态
|
||||
@@ -326,6 +327,8 @@ class User extends Model
|
||||
$user_info['age'] = getAge($user_info['birthday']);
|
||||
//头像装扮
|
||||
$user_info['dress'] = model('Decorate')->user_decorate_detail($user_info['user_id'],1);
|
||||
//聊天泡
|
||||
$user_info['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
|
||||
//记录用户访问记录
|
||||
if($from_uid != $uid){
|
||||
|
||||
@@ -107,6 +107,7 @@ class UserGiftPack extends Model
|
||||
self::DRAW_GIFT,
|
||||
self::XLH_DRAW_GIFT_GET
|
||||
,self::HOUR_RANK_GET
|
||||
,self::NEW_CHARGE_GIFT
|
||||
];
|
||||
//获取背包日志列表
|
||||
$log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type)
|
||||
@@ -121,7 +122,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "X".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." X ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
@@ -148,7 +149,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "-".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." - ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@ class UserWithdrawal extends Model
|
||||
$withdraw_list = db::name('vs_user_withdrawal')
|
||||
->where($where)
|
||||
->page($page,$page_limit)
|
||||
->order('createtime desc')
|
||||
->select();
|
||||
$return_data = [];
|
||||
foreach ($withdraw_list as $key=>$value){
|
||||
|
||||
@@ -1170,7 +1170,7 @@ function handelCharge($where,$data){
|
||||
return 0;
|
||||
}
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->count();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
//添加充值记录
|
||||
$res2 = db::name('vs_user_money_log')->insert([
|
||||
'user_id' => $orderModel['user_id'],
|
||||
@@ -1203,6 +1203,12 @@ function handelCharge($where,$data){
|
||||
if($is_first_charge == 0){
|
||||
model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
|
||||
}
|
||||
//活动
|
||||
if($orderModel['type_id'] == 6){
|
||||
$orderModel['type_params'] = 2;
|
||||
}elseif(in_array($orderModel['type_id'],[14,15,16])){
|
||||
$orderModel['type_params'] = 3;
|
||||
}
|
||||
switch ($orderModel['type_params']){
|
||||
case 2:
|
||||
//天降好礼
|
||||
|
||||
@@ -125,7 +125,7 @@ class UserWallet extends Model
|
||||
return isset($status[$value]) ? $status[$value] : '';
|
||||
|
||||
}
|
||||
public static function ChangeTypeLable($type)
|
||||
public static function ChangeTypeLable($type="")
|
||||
{
|
||||
$status = [
|
||||
self::OPERATION_SYSTEM => '系统调节',
|
||||
@@ -163,7 +163,12 @@ class UserWallet extends Model
|
||||
self::RED_PACKET_LEFT_COIN => '红包剩余退回(金币)',
|
||||
self::RED_PACKET_LEFT_DIAMOND => '红包剩余退回(钻石)',
|
||||
];
|
||||
if($type){
|
||||
return $status[$type] ?? '';
|
||||
}else{
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -269,10 +274,19 @@ class UserWallet extends Model
|
||||
/*
|
||||
* 用户资金变动日志
|
||||
*/
|
||||
public function money_change_log($user_id, $money_type=0, $page=0,$page_limit=30){
|
||||
public function money_change_log($user_id,$seach, $money_type=0, $page=0,$page_limit=30){
|
||||
if($money_type){
|
||||
$where['money_type'] =$money_type;
|
||||
}
|
||||
if($seach['stime']){
|
||||
$where['createtime'] = ['>=',strtotime($seach['stime'])];
|
||||
}
|
||||
if($seach['etime']){
|
||||
$where['createtime'] = ['<=',strtotime($seach['etime'])];
|
||||
}
|
||||
if($seach['change_type']){
|
||||
$where['change_type'] =$seach['change_type'];
|
||||
}
|
||||
$log['count'] = Db::name('vs_user_money_log')->where($where)->where('user_id',$user_id)->count();
|
||||
$log_select = Db::name('vs_user_money_log')
|
||||
->where($where)
|
||||
@@ -306,4 +320,11 @@ class UserWallet extends Model
|
||||
}
|
||||
return $log;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取用户资金类型
|
||||
*/
|
||||
public function getChangeTypeLableList(){
|
||||
return $this->ChangeTypeLable();
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,9 @@ class PerformPerSecond
|
||||
// echo "房间火热值更新:\n";
|
||||
// $this->room_hot_update();
|
||||
// echo "\n";
|
||||
// echo "提现云账号订单状态查询:\n";
|
||||
// $this->withdraw_order_status();
|
||||
// echo "\n";
|
||||
echo "提现云账号订单状态查询:\n";
|
||||
$this->withdraw_order_status();
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ class PerformPerSecond
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if($value['yun_order_status'] == 5077){
|
||||
if(in_array($value['yun_order_status'],[261,5077])){
|
||||
continue;
|
||||
}
|
||||
echo "提现订单查询:".$value['order_sn']."\n";
|
||||
@@ -160,7 +160,7 @@ class PerformPerSecond
|
||||
'updatetime' => time(),
|
||||
'yun_order_status' => $result['data']['code'],
|
||||
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
|
||||
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
|
||||
'received_tax_amount' => $result['data']['received_tax_amount'] ?? 0,
|
||||
]);
|
||||
}else{
|
||||
db::name('vs_user_withdrawal')->where('order_sn',$value['order_sn'])->update([
|
||||
@@ -170,7 +170,7 @@ class PerformPerSecond
|
||||
'updatetime' => time(),
|
||||
'yun_order_status' => $result['data']['code'],
|
||||
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
|
||||
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
|
||||
'received_tax_amount' => $result['data']['received_tax_amount'] ?? 0,
|
||||
]);
|
||||
if(in_array($result['data']['code'],[5077,261]) && $value['yun_order_status'] == null){
|
||||
// if($result['data']['code']==5077 && $value['yun_order_status'] == null){
|
||||
|
||||
@@ -205,6 +205,7 @@ class YunPay
|
||||
$request->setRequestID($request_id);
|
||||
$response = $this->paymentClient->getOrder($request);
|
||||
if ($response->isSuccess()) {
|
||||
$tax_detail = $response->getData()->getTaxDetail();//获取税详情
|
||||
// if(!empty($response->getData()->getTaxDetail())){
|
||||
// $personal_tax_rate = $response->getData()->getTaxDetail()->getPersonalTaxRate();
|
||||
// }else{
|
||||
@@ -216,7 +217,7 @@ class YunPay
|
||||
'code' => $response->getData()->getStatusDetail(),
|
||||
'msg' => $response->getData()->getStatusMessage(),
|
||||
// 'personal_tax_rate' => $personal_tax_rate,
|
||||
'received_tax_amount' => $response->getData()->getReceivedTaxAmount()
|
||||
'received_tax_amount' => $tax_detail['user_received_personal_tax'] ?? 0
|
||||
|
||||
]];
|
||||
}else{
|
||||
@@ -224,7 +225,7 @@ class YunPay
|
||||
'code' => $response->getData()->getStatusDetail(),
|
||||
'msg' => $response->getData()->getStatusDetailMessage(),
|
||||
// 'personal_tax_rate' => $personal_tax_rate,
|
||||
'received_tax_amount' => $response->getData()->getReceivedTaxAmount()
|
||||
'received_tax_amount' => $tax_detail['user_received_personal_tax'] ?? 0
|
||||
]];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user