20 Commits

Author SHA1 Message Date
3710d8c475 支付回调 2025-10-10 19:24:31 +08:00
228e11b3bb 送礼bug 修改 2025-10-10 16:31:26 +08:00
f3ac784215 西来喜页面支付 2025-10-09 22:00:18 +08:00
de96e4497a 西来喜页面支付 2025-10-09 21:57:49 +08:00
c7dc3fb1a6 西来喜支付 2025-10-09 20:32:18 +08:00
02f56a0de5 西来喜支付 2025-10-09 20:08:02 +08:00
0770d1a172 去除麦圈 2025-09-25 16:20:16 +08:00
7eecd59aab Merge remote-tracking branch 'origin/my_yuliao' into my_yuliao 2025-09-25 16:18:47 +08:00
4fd83d4275 重新连接 2025-09-25 01:28:45 +08:00
2e97678b9f 重新连接 2025-09-25 00:11:41 +08:00
8ea06cd81d 注销流程改变 2025-09-25 00:05:02 +08:00
2bdafc7308 Merge branch 'develop' into my_yuliao 2025-09-24 18:24:16 +08:00
2a1ca7299a 注销流程改变 2025-09-24 17:16:37 +08:00
4e5e97dfe9 重新连接处理没有在房间是的情况 2025-09-24 17:06:30 +08:00
1740dd76d3 后端 房间标签删除 2025-09-24 16:39:44 +08:00
38b8af4e25 进入房间状态 2025-09-24 15:14:58 +08:00
eed29ecb0f 进入房间状态 2025-09-24 15:13:22 +08:00
3f7d0cb826 实名处理 2025-09-24 15:01:54 +08:00
f2bc971a32 Merge branch 'develop' into my_yuliao 2025-09-24 09:32:09 +08:00
27a50e2853 实名认证二要素 2025-09-23 19:26:18 +08:00
136 changed files with 2614 additions and 14984 deletions

10
.env
View File

@@ -10,21 +10,13 @@ trace = false
; hostport = 3306
; prefix = fa_
hostname = 1.13.181.248
database = midi
username = midi
password = 5B2zwShhTi5L7t2w
password = YWbCxwkZKJ36nnDx
hostport = 3306
prefix = fa_
#hostname = 62.234.12.147
#database = midi
#username = midi
#password = EC6cak6fzXdXnERz
#hostport = 3306
#prefix = fa_
[mqtt]
mqtt_server = 1.13.181.248
mqtt_port = 1883

View File

@@ -40,9 +40,8 @@ class Activities extends adminApi
public function first_charge_lists(){
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$activities_id = input('activities_id', 1);
$where = [];
$where['activities_id'] = $activities_id;
$where['activities_id'] = 1;
$where['delete_time'] = 0;
$count = db($this->table)->where($where)->count();
$lists = db($this->table)->where($where)->page($page, $page_limit)->select();
@@ -77,12 +76,11 @@ class Activities extends adminApi
$title1 = input('title1', '');
$title2 = input('title2', '');
$money = input('money', '');
$activities_id = input('activities_id', 1);
$return_data = [
'name' => $name,
'title' => $title,
'status' => $status,
'activities_id' => $activities_id,
'activities_id' => 1,
];
$ext = [
'title1' => $title1,
@@ -169,12 +167,11 @@ class Activities extends adminApi
$page_limit = input('page_limit', 30);
$user_id = input('user_id', '');
$gift_bag_id = input('gift_bag_id', '');
$activities_id = input('activities_id', 1);
$where = [];
if($user_id){
$where['user_id'] = $user_id;
}
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>$activities_id,'delete_time'=>0])->select();
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>1,'delete_time'=>0])->select();
if($gift_bag_id){
$where['gift_bag_id'] = $gift_bag_id;
@@ -363,7 +360,6 @@ class Activities extends adminApi
'foreign_id' => $gift_id,
'name' => $gift['gift_name'],
'quantity' => $num,
'gold' => $gift['gift_price'],
];
} elseif($type == 3){
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$gift_id])->find();
@@ -377,7 +373,6 @@ class Activities extends adminApi
'foreign_id' => $gift_id,
'name' => $gift['title'],
'days' => $decorate_price['day'],
'gold' => $decorate_price['price'],
];
} elseif($type == 4){
$data = [
@@ -438,20 +433,17 @@ class Activities extends adminApi
$money = input('money', '');
$money_str = input('money_str', '');
$diamond = input('diamond', '');
$activity_end_time = input('activity_end_time', '');
$id = input('id', 6);
$data = [
'name' => $name,
'title' => $title,
'status' => $status,
'money' => $money,
'status' => $status
];
$ext = [
'counter' => $counter,
'money_str' => $money_str,
'diamond' => $diamond,
'money' => $money,
'activity_end_time' => $activity_end_time
'money' => $money
];
$data['ext'] = json_encode($ext);
$res = db::name($this->table)->where(['id'=>$id])->update($data);

View File

@@ -168,7 +168,7 @@ class Admin extends adminApi
{
if ($this->request->isPost()) {
$params = $this->request->post();
$group = $params['group']?? [];
$group = $params['group'];
unset($params['group']);
unset($params['__token__']);
if ($params) {
@@ -196,9 +196,10 @@ class Admin extends adminApi
return V(0,"失败", []);
}
if(!empty($group)){
// 先移除所有权限
model('admin/AuthGroupAccess')->where('uid', $params['id'])->delete();
// 过滤不允许的组别,避免越权
$group = array_intersect($this->childrenGroupIds, $group);
if (!$group) {
@@ -210,7 +211,6 @@ class Admin extends adminApi
$dataset[] = ['uid' => $params['id'], 'group_id' => $value];
}
model('admin/AuthGroupAccess')->saveAll($dataset);
}
Db::commit();
return V(1,"成功", []);
} catch (\Exception $e) {

View File

@@ -52,10 +52,10 @@ class Adminlog extends adminApi
$where['createtime'] = ['>=', strtotime($search_stime)];
}
if ($search_etime) {
$where['createtime'] = ['<=', strtotime($search_etime)];
$where['createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
}
if(!empty($search_stime) && !empty($search_etime)){
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
}
$list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]);

View File

@@ -9,7 +9,6 @@ use think\Db;
use think\Hook;
use think\Session;
use think\Validate;
use think\Cache;
/**
* 盲盒
@@ -261,95 +260,95 @@ class BlindBox extends adminApi
return V(0,"请选择盲盒类型");
}
$gift_bag_detail = db::name($this->table)->where(['gift_bag_id'=>$gift_bag_id])->select();
// if(in_array($gift_bag_id,[10,11,12,13])){
// $periods = 1;
// $target_room_ids = [];
// if(!empty($room_id)){
// // 处理单个房间
// $room_pan_detail = db::name('vs_room_pan')
// ->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
// ->order('id desc')
// ->find();
//
// if($room_pan_detail){
// $periods = $room_pan_detail['periods'];
// }
// // 删除指定房间的数据
// db::name('vs_room_pan')
// ->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
// ->delete();
//
// $target_room_ids = [$room_id];
// }else{
// // 处理所有房间
// db::name('vs_room_pan')
// ->where(['gift_bag_id'=>$gift_bag_id])
// ->delete();
//
// $target_room_ids = db::name('vs_room')
// ->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
// ->column('id');
// }
// // 批量插入数据
// $insert_data = [];
// $update_data = [];
// foreach ($gift_bag_detail as $v){
// if(!empty($room_id)) {
// // 单个房间更新或插入
// $existing = db::name('vs_room_pan')
// ->where([
// 'room_id' => $room_id,
// 'gift_bag_detail_id' => $v['id']
// ])
// ->find();
//
// if($existing) {
// $update_data[] = [
// 'id' => $existing['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods
// ];
// } else {
// $insert_data[] = [
// 'room_id' => $room_id,
// 'gift_bag_id' => $gift_bag_id,
// 'gift_bag_detail_id' => $v['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods,
// 'createtime' => time(),
// ];
// }
// } else {
// // 多个房间批量插入
// foreach ($target_room_ids as $mid){
// $insert_data[] = [
// 'room_id' => $mid,
// 'gift_bag_id' => $gift_bag_id,
// 'gift_bag_detail_id' => $v['id'],
// 'remaining_number' => $v['quantity'],
// 'periods' => $periods,
// 'createtime' => time(),
// ];
// }
// }
// }
//
// // 执行批量插入
// if(!empty($insert_data)) {
// db::name('vs_room_pan')->insertAll($insert_data);
// }
// // 执行批量更新
// if(!empty($update_data)) {
// foreach($update_data as $update_item) {
// db::name('vs_room_pan')
// ->where(['id' => $update_item['id']])
// ->update([
// 'remaining_number' => $update_item['remaining_number'],
// 'periods' => $update_item['periods']
// ]);
// }
// }
// }
if(in_array($gift_bag_id,[10,11,12,13])){
$periods = 1;
$target_room_ids = [];
if(!empty($room_id)){
// 处理单个房间
$room_pan_detail = db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id,'room_id'=>$room_id])
->order('id desc')
->find();
if($room_pan_detail){
$periods = $room_pan_detail['periods'];
}
// 删除指定房间的数据
db::name('vs_room_pan')
->where(['room_id'=>$room_id,'gift_bag_id'=>$gift_bag_id])
->delete();
$target_room_ids = [$room_id];
}else{
// 处理所有房间
db::name('vs_room_pan')
->where(['gift_bag_id'=>$gift_bag_id])
->delete();
$target_room_ids = db::name('vs_room')
->where(['is_open_blind_box_turntable'=>1,'room_status'=>1])
->column('id');
}
// 批量插入数据
$insert_data = [];
$update_data = [];
foreach ($gift_bag_detail as $v){
if(!empty($room_id)) {
// 单个房间更新或插入
$existing = db::name('vs_room_pan')
->where([
'room_id' => $room_id,
'gift_bag_detail_id' => $v['id']
])
->find();
if($existing) {
$update_data[] = [
'id' => $existing['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods
];
} else {
$insert_data[] = [
'room_id' => $room_id,
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
];
}
} else {
// 多个房间批量插入
foreach ($target_room_ids as $mid){
$insert_data[] = [
'room_id' => $mid,
'gift_bag_id' => $gift_bag_id,
'gift_bag_detail_id' => $v['id'],
'remaining_number' => $v['quantity'],
'periods' => $periods,
'createtime' => time(),
];
}
}
}
// 执行批量插入
if(!empty($insert_data)) {
db::name('vs_room_pan')->insertAll($insert_data);
}
// 执行批量更新
if(!empty($update_data)) {
foreach($update_data as $update_item) {
db::name('vs_room_pan')
->where(['id' => $update_item['id']])
->update([
'remaining_number' => $update_item['remaining_number'],
'periods' => $update_item['periods']
]);
}
}
}
// 更新盲盒详情的剩余数量
foreach ($gift_bag_detail as $k=>$v){
$bag_data = db::name($this->table)->where(['id'=>$v['id']])->update(['remaining_number'=>$v['quantity']]);
@@ -595,9 +594,6 @@ class BlindBox extends adminApi
$ext = json_encode($ext);
$res = db::name('vs_gift_bag')->where(['id'=>$gift_bag_id])->update(['ext'=>$ext]);
if($res){
//删除缓存
$cacheKey = "xlh_config_13";
cache::rm($cacheKey);
return V(1,"成功");
}else{
return V(0,"失败");
@@ -730,9 +726,7 @@ class BlindBox extends adminApi
$stime = input('stime', '');
$etime = input('etime', '');
$where = [];
if($room_id){
$where['room_id'] = $room_id;
}
if($gift_id){
$where['gift_id'] = $gift_id;
}
@@ -757,8 +751,8 @@ class BlindBox extends adminApi
if($stime!=="" && $etime!==""){
$where['createtime'] = ['between', [strtotime($stime), strtotime($etime.'23:59:59')]];
}
$count = db::name('vs_gift_bag_receive_pan_log')->where($where)->count();
$lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
$count = db::name('vs_gift_bag_receive_log')->where($where)->count();
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
$lists = [];
foreach ($lists_data as $key => $value) {
$lists[$key]['id'] = $value['id'];
@@ -789,7 +783,7 @@ class BlindBox extends adminApi
$lists[$key]['gift_num'] = $value['num'];
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
}
$all_lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->order("id desc")->select();
$all_lists_data = db::name('vs_gift_bag_receive_log')->where($where)->order("id desc")->select();
$total =0;
$total_gift_money = 0;
$total_money = 0;
@@ -804,17 +798,13 @@ class BlindBox extends adminApi
}else{
$ratio =round(($total_gift_money / $total_money),3);
}
//用户盈亏
//盈亏
$profit_loss = $total_gift_money - $total_money;
//平台盈亏
$platform_profit_loss = $total_money - $total_gift_money;
if($profit_loss==0 || $total_money==0){
$profit_loss_ratio = 0;
}else{
// 盈亏比
$profit_loss_ratio = round(($profit_loss / $total_money),3);
//平台盈亏比
$platform_profit_loss_ratio = round(($platform_profit_loss / $total_money),3);
}
$return_data = [
'page' =>$page,
@@ -828,8 +818,6 @@ class BlindBox extends adminApi
'ratio' => $ratio,
'profit_loss' => $profit_loss,
'profit_loss_ratio' => $profit_loss_ratio,
'platform_profit_loss' => $platform_profit_loss,
'platform_profit_loss_ratio' => $platform_profit_loss_ratio,
]
];
return V(1,"成功", $return_data);
@@ -846,9 +834,7 @@ class BlindBox extends adminApi
$room_id = input('room_id', 0);
$periods = input('periods', '');
$where = [];
if($room_id){
$where['b.room_id'] = $room_id;
}
if($gift_id){
$where['b.gift_id'] = $gift_id;
}
@@ -886,11 +872,6 @@ class BlindBox extends adminApi
$lists[$key]['is_send'] = $value['is_send'];
$lists[$key]['is_send_str'] = $value['is_send']==1?"":"";
$lists[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
$room = db::name('vs_room')->where('id',$value['room_id'])->find();
$lists[$key]['room_name'] = "";
if($room){
$lists[$key]['room_name'] = $room['room_number']."-".$room['room_name'];
}
}
//今日锁定礼物数量
$today = strtotime(date('Y-m-d'));

View File

@@ -327,7 +327,6 @@ class Decorate extends adminApi
$type = input('type', '');
$where = [];
if($user_id!=""){
$user_id = db::name('user')->where('user_code', $user_id)->value('id');
$where['user_id'] = $user_id;
}
if($did!=""){
@@ -341,8 +340,7 @@ class Decorate extends adminApi
$return_list = [];
foreach ($lists as $k=>$v){
$return_list[$k]['id'] = $v['udid'];
$user_data = db::name('user')->where(['id'=>$v['user_id']])->find();
$return_list[$k]['user_name'] = $user_data['user_code']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
$return_list[$k]['user_name'] = $v['user_id']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
$return_list[$k]['type'] = model('api/Decorate')->TypeArray[$v['type']];
if($v['type'] >= 6){
$return_list[$k]['name'] = $v['special_num'];

View File

@@ -56,11 +56,11 @@ class GiveGift extends adminApi
// 时间筛选优化
if (!empty($start_time) || !empty($end_time)) {
if (!empty($start_time) && !empty($end_time)) {
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
} elseif (!empty($start_time)) {
$where['createtime'] = ['>=', strtotime($start_time)];
} elseif (!empty($end_time)) {
$where['createtime'] = ['<=', strtotime($end_time)];
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
}
//礼物总数

View File

@@ -88,7 +88,7 @@ class Guild extends adminApi
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
$list[$k]['updatetime'] = date('Y-m-d H:i:s',$v['updatetime']);
$list[$k]['user_id'] = $user['user_code']??"";
$list[$k]['user_id'] = $user['user_code'];
$list[$k]['intro'] = $v['intro'];
}
// 数组按today_money 排序
@@ -342,9 +342,9 @@ class Guild extends adminApi
$rum_lists[$k]['id']=$v['id'];
$rum_lists[$k]['user_id']=$v['user_id'];
$rum_lists[$k]['user_code']=model('api/Decorate')->user_decorate_detail($v['user_id'],6);
$rum_lists[$k]['nickname']=$user_info['nickname']?? '';
$rum_lists[$k]['charm_level']=$user_info['charm_level']??0;
$rum_lists[$k]['wealth_level']=$user_info['wealth_level']??0;
$rum_lists[$k]['nickname']=$user_info['nickname'];
$rum_lists[$k]['charm_level']=$user_info['charm_level'];
$rum_lists[$k]['wealth_level']=$user_info['wealth_level'];
//用户流水
$consumption_sql = db::name('vs_user_money_log')
->whereIn('change_type',$coin_consumption_type_array)
@@ -623,14 +623,12 @@ class Guild extends adminApi
$search_status_time = input('search_status_time', '');
$search_end_time = input('search_end_time', '');
$search_status = input('search_status', '');
// $where = ['b.delete_time'=>0];
$where = [];
$where = ['b.delete_time'=>0];
if($search_user_id){
$where['b.user_id'] = $search_user_id;
}
if($search_guild_id){
//$where['a.guild_id'] = $search_guild_id;
$where['b.guild_special_id'] = $search_guild_id;
$where['a.guild_id'] = $search_guild_id;
}
if($search_status_time){
$where['a.start_time'] = ['>=', $search_status_time];

View File

@@ -54,15 +54,6 @@ class Index extends adminApi
//总待付款笔数
$return_data['all_wait_pay_num'] = db::name('vs_user_recharge')->where('pay_status',1)->count();
//周实时收入金额
$return_data['week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'week')->sum('money');
//上周收入金额
$return_data['last_week_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last week')->sum('money');
//月收入金额
$return_data['month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'month')->sum('money');
//上月收入金额
$return_data['last_month_money'] = db::name('vs_user_recharge')->where('pay_status',2)->whereTime('pay_time', 'last month')->sum('money');
//待办事项
//房间审核数
$return_data['room_audit_num'] = db::name('vs_room')->where('apply_status',1)->count();

View File

@@ -656,8 +656,8 @@ class Room extends adminApi
}
elseif ($type == 3){
//周流水
//周一
$begin_time = strtotime(date('Y-m-d 00:00:00', strtotime('this week')));
//周一
$begin_time = strtotime(date('Y-m-d 24:00:00',strtotime('-'.date('w').'days')));
$end_time = time();
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
}
@@ -992,10 +992,6 @@ class Room extends adminApi
$search_room_number = input('search_room_number', '');
$search_onwer_number = input('search_onwer_number', '');
$room_status = input('room_status', '');
//开始 时间
$start_time = input('start_time', '');
//结束 时间
$end_time = input('end_time', '');
if($search_room_number!==''){
$where['room_number'] = $search_room_number;
@@ -1006,36 +1002,12 @@ class Room extends adminApi
if($room_status!==''){
$where['room_status'] = $room_status;
}
// 检查并转换时间格式为时间戳
if($start_time !== '' && $end_time !== ''){
// 同时有开始和结束时间
$startTime = strtotime($start_time);
$endTime = strtotime($end_time);
if($startTime !== false && $endTime !== false){
$where['createtime'] = ['between', [$startTime, $endTime]];
}
}elseif($start_time !== ''){
// 只有开始时间
$startTime = strtotime($start_time);
if($startTime !== false){
$where['createtime'] = ['>=', $startTime];
}
}elseif($end_time !== ''){
// 只有结束时间
$endTime = strtotime($end_time);
if($endTime !== false){
$where['createtime'] = ['<=', $endTime];
}
}
$where['type_id'] = 6;
$count = db::name('vs_room')->where($where)->count();
$lists = db::name('vs_room')->field('id,room_name,room_cover,room_number,user_id,room_status,createtime')
->where($where)
->order('id desc')
->page($page, $page_limit)->select();
foreach ($lists as &$value) {
$guild = model('Guild')->getGuildByUserId($value['user_id']);
$value['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
@@ -1046,27 +1018,7 @@ class Room extends adminApi
$value['room_code'] = model('api/Decorate')->user_decorate_detail($value['id'], 7);
//房间状态1正常2封禁3关闭
$value['room_status_str'] = $value['room_status'] ==1 ? "正常" : ($value['room_status'] ==2 ? "封禁" : "关闭");
$cpRoom = db::name('vs_room_cp_movie')->where('room_id',$value['id'])->find();
if($cpRoom){
if($cpRoom['user_id'] == $value['user_id']){
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('nickname');
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id1'])->value('user_code');
}
if($cpRoom['user_id1'] == $value['user_id']){
$value['cp_nickname'] = db::name('user')->where('id', $cpRoom['user_id'])->value('nickname');
$value['cp_user_id'] = db::name('user')->where('id', $cpRoom['user_id'])->value('user_code');
}
}
// 流水计算也应使用相同的时间范围
$liushuiWhere = ['from_id' => $value['id']];
if(isset($where['createtime'])){
$liushuiWhere['createtime'] = $where['createtime'];
}
$value['liushui'] = db::name('vs_give_gift')->where($liushuiWhere)->sum('total_price') * get_system_config_value('coin_charm_exp');
}
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,
@@ -1076,7 +1028,6 @@ class Room extends adminApi
return V(1,"成功", $return_data);
}
//Cp电影房封禁
public function cp_movie_room_forbid()
{
@@ -1514,10 +1465,10 @@ class Room extends adminApi
$where['createtime'] = ['>=',strtotime($stime)];
}
if(!empty($etime)){
$where['createtime'] = ['<=',strtotime($etime)];
$where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
}
if(!empty($stime) && !empty($etime)){
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime.' 23:59:59')]];
}
$room_log_lists = db::name($this->table_room_log)->where($where)->order('id desc')->page($page, $page_limit)->select();
$count = db::name($this->table_room_log)->where($where)->count();
@@ -1685,183 +1636,4 @@ class Room extends adminApi
return V(1,"成功", $result);
}
// 房间红包列表
public function room_redpacket_list(){
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$room_id = input('room_id', '');
//红包状态
$status = input('status', '');
//发红包的时间
$stime = input('stime', '');
$etime = input('etime', '');
$where = [];
if($room_id){
$where['room_id'] = $room_id;
}
if($status){
$where['status'] = $status;
}
if($stime){
$where['createtime'] = ['>=',strtotime($stime)];
}
if($etime){
$where['createtime'] = ['<=',strtotime($etime)];
}
$count = db::name("redpacket")->where($where)->count();
$room_redpacket_lists = db::name("redpacket")->where($where)->page($page, $page_limit)->order('id desc')->select();
//循环数据 获取发红的昵称和头像 时间格式化 状态:0=未开始,1=进行中,2=已结束,3=已退回' 币种(coin_type):1=金币,2=钻石',红包类型(type):1=普通红包,2=口令红包'
//多选条件逗号分隔存值conditions) 0=无1=收藏2=在麦上
if($room_redpacket_lists){
foreach ($room_redpacket_lists as $key => $value){
$room_redpacket_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
$room_redpacket_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
$room_redpacket_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
$room_redpacket_lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$room_redpacket_lists[$key]['status_text'] = $value['status'] == 0 ? '未开始' : ($value['status'] == 1 ? '进行中' : ($value['status'] == 2 ? '已结束' : '已退回'));
$room_redpacket_lists[$key]['coin_type_text'] = $value['coin_type'] == 1 ? '金币' : ($value['coin_type'] == 2 ? '钻石' : '未知');
$room_redpacket_lists[$key]['type_text'] = $value['type'] == 1 ? '普通红包' : ($value['type'] == 2 ? '口令红包' : '未知');
// 多选条件处理0=无不能和其他条件共存1=收藏2=在麦上
// 可以同时存在,也可以单独存在,同时存在时用逗号分隔
$conditions = explode(',',$value['conditions']);
// 过滤掉空值元素
$conditions = array_filter($conditions, function($item) {
return $item !== '' && $item !== null;
});
// 去除重复的条件
$conditions = array_unique($conditions);
// 重新索引数组,确保索引连续
$conditions = array_values($conditions);
// 特殊处理如果包含条件0无条件则只保留这一项
if (in_array('0', $conditions)) {
$room_redpacket_lists[$key]['conditions'] = ['无条件'];
} else {
// 将数字条件转换为对应的中文描述
$conditions_text = array_map(function($item){
// 0=无条件1=收藏2=在麦上
switch($item) {
case '0':
return '无条件';
case '1':
return '收藏';
case '2':
return '在麦上';
default:
return '未知';
}
}, $conditions);
$room_redpacket_lists[$key]['conditions'] = $conditions_text;
}
//房间名称
$room_redpacket_lists[$key]['room_name'] = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
}
}
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,
'count' => $count,
'lists' => $room_redpacket_lists
];
return V(1,"成功", $return_data);
}
// 获取房间红包详情
public function room_redpacket_detail(){
// 红包ID
$redpacket_id = input('redpacket_id', '');
if(empty($redpacket_id)){
return V(0, "红包ID不能为空");
}
// 获取红包基本信息
$redpacket_info = db::name("redpacket")->where(['id'=>$redpacket_id])->find();
if(!$redpacket_info){
return V(0, "红包不存在");
}
// 获取发红包用户信息
$redpacket_info['nickname'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('nickname');
$redpacket_info['avatar'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('avatar');
$redpacket_info['user_code'] = db::name('user')->where(['id'=>$redpacket_info['user_id']])->value('user_code');
$redpacket_info['createtime_text'] = date('Y-m-d H:i:s', $redpacket_info['createtime']);
$redpacket_info['start_time_text'] = date('Y-m-d H:i:s', $redpacket_info['start_time']);
$redpacket_info['end_time_text'] = date('Y-m-d H:i:s', $redpacket_info['end_time']);
//房间名称
$redpacket_info['room_name'] = db::name('vs_room')->where(['id'=>$redpacket_info['room_id']])->value('room_name');
// 红包状态文字描述
$status_map = [
0 => '未开始',
1 => '进行中',
2 => '已结束',
3 => '已退回'
];
$redpacket_info['status_text'] = $status_map[$redpacket_info['status']] ?? '未知';
// 币种文字描述
$coin_type_map = [
1 => '金币',
2 => '钻石'
];
$redpacket_info['coin_type_text'] = $coin_type_map[$redpacket_info['coin_type']] ?? '未知';
// 红包类型文字描述
$type_map = [
1 => '普通红包',
2 => '口令红包'
];
$redpacket_info['type_text'] = $type_map[$redpacket_info['type']] ?? '未知';
// 领取条件处理
$conditions = explode(',',$redpacket_info['conditions']);
$conditions = array_filter($conditions, function($item) {
return $item !== '' && $item !== null;
});
$conditions = array_unique($conditions);
$conditions = array_values($conditions);
// 特殊处理如果包含条件0无条件则只保留这一项
if (in_array('0', $conditions)) {
$redpacket_info['conditions_text'] = ['无条件'];
} else {
// 将数字条件转换为对应的中文描述
$conditions_text = array_map(function($item){
switch($item) {
case '0':
return '无条件';
case '1':
return '收藏';
case '2':
return '在麦上';
default:
return '未知';
}
}, $conditions);
$redpacket_info['conditions_text'] = $conditions_text;
}
// 领取详情 redpacket_record 表里面的数据
// 外键redpacket_id redpacket表的IDuser_id 外键user表的ID amount 抢到的金额 createtime抢红包的时间
// 红包领取详情 谁在什么时候 抢红包 抢了多少钱
$redpacket_record_lists = db::name("redpacket_record")->where(['redpacket_id'=>$redpacket_id])->order('createtime asc')->select();
if($redpacket_record_lists){
foreach ($redpacket_record_lists as $key => $value){
$redpacket_record_lists[$key]['nickname'] = db::name('user')->where(['id'=>$value['user_id']])->value('nickname');
$redpacket_record_lists[$key]['avatar'] = db::name('user')->where(['id'=>$value['user_id']])->value('avatar');
$redpacket_record_lists[$key]['user_code'] = db::name('user')->where(['id'=>$value['user_id']])->value('user_code');
$redpacket_record_lists[$key]['createtime_text'] = date('Y-m-d H:i:s', $value['createtime']);
}
}
$return_data = [
'redpacket_info' => $redpacket_info,
'record_lists' => $redpacket_record_lists
];
return V(1, "成功", $return_data);
}
}

View File

@@ -1,371 +0,0 @@
<?php
namespace app\adminapi\controller;
use think\Db;
class RoomHourRanking
{
public static function withdraw_status (){
return [
// [25 => '全时段'],
[0 => '00:00-01:00'],
[1 => '01:00-02:00'],
[2 => '02:00-03:00'],
[3 => '03:00-04:00'],
[4 => '04:00-05:00'],
[5 => '05:00-06:00'],
[6 => '06:00-07:00'],
[7 => '07:00-08:00'],
[8 => '08:00-09:00'],
[9 => '09:00-10:00'],
[10 => '10:00-11:00'],
[11 => '11:00-12:00'],
[12 => '12:00-13:00'],
[13 => '13:00-14:00'],
[14 => '14:00-15:00'],
[15 => '15:00-16:00'],
[16 => '16:00-17:00'],
[17 => '17:00-18:00'],
[18 => '18:00-19:00'],
[19 => '19:00-20:00'],
[20 => '20:00-21:00'],
[21 => '21:00-22:00'],
[22 => '22:00-23:00'],
[23 => '23:00-00:00'],
];
}
//房间小时榜列表
public function room_hour_ranking()
{
$page = input('page', 1);
$page_limit = input('page_limit', 20);
$search_ranking = input('search_ranking', '');
$search_stime = input('search_stime', '');
$search_etime = input('search_etime', '');
$where = [];
if ($search_ranking) {
$where[] = ['room_name', 'like', '%' . $search_ranking . '%'];
}
if ($search_stime) {
$where[] = ['stime', '>=', $search_stime];
}
if ($search_etime) {
$where[] = ['etime', '<=', $search_etime];
}
$count = db::name('vs_hour_ranking')->where($where)->count();
$list = db::name('vs_hour_ranking')->where($where)->page($page, $page_limit)->order('id desc')->select();
if($list){
foreach ($list as &$v){
$v['room_name'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('room_name');
$v['user_id'] = db::name('vs_room')->where(['id'=>$v['room_id']])->value('user_id');
if($v['user_id']){
$v['nickname'] = db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
}
$v['stime'] = date('Y-m-d H:i', $v['stime']);
$v['etime'] = date('Y-m-d H:i', $v['etime']);
}
}
$return_data = [
'page' =>$page,
'page_limit' => $page_limit,
'count' => $count,
'lists' => $list
];
return V(1,"成功", $return_data);
}
//房间小时榜配置
public function room_hour_ranking_config()
{
$list = db::name('vs_hour_ranking_config')->where('id', '1')->find();
if($list){
//open_time 字段转化为2025-09-30 07:00 的格式
$list['open_time'] = $list['open_time'] ? date('Y-m-d H:i', $list['open_time']) : 0;
}
return V(1,"成功", $list);
}
//房间小时榜配置修改
public function room_hour_ranking_config_edit()
{
$id = input('id');
$data['is_open_red_pack'] = 0;//暂时不开启
$data['is_public_server'] = input('is_public_server');
$data['broadcast_times'] = input('broadcast_times');
$data['is_open_xlh'] = input('is_open_xlh');
$data['min_price'] = input('min_price');
$open_time = input('open_time');
$data['open_time'] = $open_time ? strtotime($open_time) : 0;
$data['createtime'] = time();
$data['updatetime'] = time();
$timeSlots = json_decode(input('timeJson'), true);
$timePeriods = $this->withdraw_status();
// 构建正确的时间映射关系
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
//$timeMap 里面 键值互换
$timeMap = array_flip($timeMap);
//开启事务
db::startTrans();
if($timeSlots){
$insertData = [];
foreach ($timeSlots as $timeSlot) {
// $timeRange = ;
$timeRange = $timeMap[$timeSlot['time']] ?? '99';
foreach ($timeSlot['reward'] as $rewardItem) {
$hasReward = !empty($rewardItem['content']);
if ($hasReward) {
// 有奖励内容:为每个奖励内容创建一条记录
foreach ($rewardItem['content'] as $rewardContent) {
if($rewardContent['type'] == 0){
$coin = $rewardContent['value'];
$gift_id = 0;
$gift_name = '';
}else{
$coin = 0;
$gift_id = $rewardContent['value'];
$gift_name = $rewardContent['name'];
}
$insertData[] = [
'time_id' => $timeRange,
'ranking' => $rewardItem['index'],
// 'rank_name' => $rewardItem['name'],
'gift_type' => $rewardContent['type'],
'gift_id' => $gift_id,
'coin' => $coin,
'name' => $gift_name,
'createtime' => time()
];
}
} else {
// 无奖励内容:插入一条空奖励记录
$insertData[] = [
'time_id' => $timeRange,
'ranking' => $rewardItem['index'],
// 'rank_name' => $rewardItem['name'],
'gift_type' => 0,
'gift_id' => 0,
'coin' => 0,
'name' => '',
'createtime' => time(),
];
}
}
}
// 批量插入
if (!empty($insertData)) {
$del = db::name('vs_hour_ranking_gift_config')->where('id','>',0)->delete();
$ins = db::name('vs_hour_ranking_gift_config')->insertAll($insertData);
}else{
$ins = false;
$del = false;
}
}else{
$del = true;
$ins = true;
}
// $res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
$res = db::name('vs_hour_ranking_config')->where('id', $id)->update($data);
// if ($del && $ins && $res) {
if ($ins) {
db::commit();
return V(1, "成功");
} else {
db::rollback();
return V(0, "失败");
}
}
//时间段对应关系
public function time_period_correspondence()
{
$list = $this->withdraw_status();
$timePeriods = $this->withdraw_status();
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
return V(1,"成功", $timeMap);
}
//添加核心配置
public function add_core_config()
{
$data['is_public_server'] = input('is_public_server');
$data['createtime'] = time();
$data['updatetime'] = time();
$res = db::name('vs_hour_ranking_config')->insert($data);
}
//核心配置列表
public function core_config_list()
{
$timePeriods = $this->withdraw_status();
// 构建正确的时间映射关系
$timeMap = [];
foreach($timePeriods as $period) {
foreach($period as $key => $value) {
$timeMap[$key] = $value;
}
}
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeMap[$timeRange],
'reward' => array_values($rewardMap)
];
}
return V(1, "成功", $result);
}
// public function core_config_lists()
// {
// $list = db::name('vs_hour_ranking_gift_config')->select();
// $data = [];
//
// // 按 time_id 和 ranking 重组数据
// $reorganizedData = [];
// $timePeriods = $this->withdraw_status();
//
// // 构建正确的时间映射关系
// $timeMap = [];
// foreach($timePeriods as $period) {
// foreach($period as $key => $value) {
// $timeMap[$key] = $value;
// }
// }
//
// foreach ($list as $item) {
//// $timeId = $item['time_id'];
// $timeId = $timeMap[$item['time_id']] ?? '未知时间段';
// $ranking = $item['ranking'];
//
// $gift_name = '';
// if (!isset($reorganizedData[$timeId])) {
// $reorganizedData[$timeId] = [];
// }
// if (!isset($reorganizedData[$timeId][$ranking])) {
// $reorganizedData[$timeId][$ranking] = [];
// }
// if($item['gift_id']){
// if($item['gift_type'] == 2){
// $gift_name = db::name('vs_gift')->where(['gid'=>$item['gift_id']])->value('gift_name');
// }
// if($item['gift_type'] == 3 || $item['gift_type'] == 4){
// $gift_name = db::name('vs_decorate')->where(['did'=>$item['gift_id']])->value('title');
// }
//
// }else{
// $gift_name = '';
// }
// $reorganizedData[$timeId][$ranking][] = [
// 'gift_type' => $item['gift_type'],
// 'gift_id' => $item['gift_id'],
// 'gift_name' => $gift_name,
// 'coin' => $item['coin']
// ];
// }
//
// // 输出重组后的数据
// print_r($reorganizedData);
// return V(1, "成功", $data);
// }
}

View File

@@ -37,10 +37,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time)];
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
}
$where['pay_status'] = 2;//1待支付,2已支付
@@ -112,10 +112,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time)];
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
}
$count = db::name('vs_give_gift')
->where($where)
@@ -177,10 +177,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time)];
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
}
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
@@ -239,10 +239,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($begin_time)];
}
if($end_time !== ''){
$where['createtime'] = ['<=', strtotime($end_time)];
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if(!empty($begin_time) && !empty($end_time)){
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
}
//不为空
$where['from'] = 2;
@@ -259,14 +259,9 @@ class Statistical extends adminApi
->select();
foreach ($lists as $key => $value) {
$room = db::name('vs_room')->where('id', $value['from_id'])->find();
if($room){
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$lists[$key]['room_name'] = $room['room_name'].'-'.$room['room_number'];
$lists[$key]['room_number'] = $room['room_number'];
}else{
$lists[$key]['room_name'] = "--";
$lists[$key]['room_number'] = "--";
}
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
$lists[$key]['room_cover'] = db::name('vs_room')->where('id', $value['from_id'])->value('room_cover');
$label = db::name('vs_room')->where('id', $value['from_id'])->value('label_id');
$lists[$key]['label'] = db::name('vs_room_label')->where('id', $label)->value('label_name');
@@ -307,10 +302,10 @@ class Statistical extends adminApi
$where['createtime'] = ['>=', strtotime($pay_stime)];
}
if($pay_etime !== ''){
$where['createtime'] = ['<=', strtotime($pay_etime)];
$where['createtime'] = ['<=', strtotime($pay_etime.' 23:59:59')];
}
if(!empty($pay_stime) && !empty($pay_etime)){
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime)]];
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime.' 23:59:59')]];
}
if($pay_status !== ''){
$where['pay_status'] = $pay_status;
@@ -351,21 +346,19 @@ class Statistical extends adminApi
];
//总收入
$wherew=[];
unset($where['pay_status']);
unset($where['pay_type']);
$return_data['total_money'] = db::name('vs_user_recharge')->where($where)->sum('money');
$return_data['total_money'] = db::name('vs_user_recharge')->sum('money');
//未支付
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',1)->sum('money');
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where('pay_status',1)->sum('money');
//已支付
$return_data['paid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('money');
$return_data['paid_money'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('money');
//微信支付
$wherew['pay_type'] = ['in', [1,4]];
$return_data['wx_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherew)->sum('money');
$return_data['wx_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherew)->sum('money');
//支付宝支付
$wherez['pay_type'] = ['in', [2,3]];
$return_data['ali_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherez)->sum('money');
$return_data['ali_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherez)->sum('money');
//金币数量
$return_data['gold_num'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('coin');
$return_data['gold_num'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('coin');
return V(1,"成功", $return_data);
}
@@ -390,10 +383,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)];
}
if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time)];
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if($start_time !== '' && $end_time !== ''){
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
}
$count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count();
@@ -436,10 +429,10 @@ class Statistical extends adminApi
$where['a.createtime'] = ['>=', strtotime($start_time)];
}
if($end_time !== ''){
$where['a.createtime'] = ['<=', strtotime($end_time)];
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
}
if($start_time !== '' && $end_time !== ''){
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
}
$count = db::name('vs_admin_recharge_log')
->alias('a')->join('user b', 'a.user_id = b.id')

View File

@@ -33,7 +33,6 @@ class SysSet extends adminApi
'8' => '房间配置',
'9' => '弹窗内容设置',
'10' => '邀请奖励',
'11' => '二级密码',
];
public function _initialize()

View File

@@ -74,8 +74,8 @@ class User extends adminApi
}elseif($v=='coin2'){
$where['c.coin'] = ['<=',$input_data];
}elseif($v=='createtime'){
$where['a.createtime'] = ['>=',strtotime($input_data)];
$where['a.createtime'] = ['<=',strtotime($input_data)];
$where['a.createtime'] = ['>=',strtotime($input_data.' 00:00:00')];
$where['a.createtime'] = ['<=',strtotime($input_data.' 23:59:59')];
}else{
$where['a.'.$v] = $input_data;
}
@@ -231,8 +231,7 @@ class User extends adminApi
'type' => $type,
'type_text' => $type_text,
];
Db::name('block')->where($map)->delete();
Db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
$res = Db::name('block')->where($map)->delete();
}
return V(1,"成功", null);
}
@@ -736,12 +735,7 @@ class User extends adminApi
* 用户列表
*/
public function get_user_list(){
$user_code = input('user_code', 0);
$where = [];
if($user_code){
$where['user_code'] = $user_code;
}
$user = db::name('user')->field('id,nickname,avatar')->where($where)->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
$user = db::name('user')->field('id,nickname,avatar')->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
return V(1,"操作成功", $user);
}
}

View File

@@ -69,7 +69,7 @@ class Version extends adminApi
$version = input('version', '');
$type = input('type', '');
$downloadurl = input('downloadurl', '');
$content = $_POST['content'] ?? '';
$content = input('content', '');
$enforce = input('enforce', '');
$version_code = input('version_code', '');
$status = input('status', 1);
@@ -101,7 +101,7 @@ class Version extends adminApi
$version = input('version', '');
$type = input('type', '');
$downloadurl = input('downloadurl', '');
$content = $_POST['content'] ?? '';
$content = input('content', '');
$enforce = input('enforce', '');
$version_code = input('version_code', '');
$status = input('status', 1);

View File

@@ -60,10 +60,10 @@ class Withdrawal extends adminApi
$where['a.createtime'] = ['>=', strtotime($search_stime)];
}
if($search_etime !== ''){
$where['a.createtime'] = ['<=', strtotime($search_etime)];
$where['a.createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
}
if(!empty($search_stime) && !empty($search_etime)){
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
}
$count = db::name('vs_user_withdrawal')->alias('a')
->join('user b', 'a.user_id = b.id', 'left')
@@ -75,7 +75,6 @@ class Withdrawal extends adminApi
->field('a.*,b.nickname,b.user_code')
->order('a.createtime desc')
->where($where)
->page($page, $page_limit)
->select();
$data_lists = [];
foreach ($lists as $key => $value) {
@@ -256,23 +255,19 @@ class Withdrawal extends adminApi
//查询该用户云账户提现金额
$had_money = db::name('vs_user_withdrawal')->where(['user_id'=>$withdraw_info['user_id'],'deal_type'=>2,'status'=>6])->where('pay_time','month')->sum('general_money');
$max_month_money = 98000;
if(($had_money+$withdraw_info['general_money']) >= $max_month_money){
if(($had_money+$withdraw_info['general_money']) >= 98000){
return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null];
}
//查询该用户信息
$user_info = model('api/user')->get_user_info($withdraw_info['user_id'], ['user','user_auth']);
$user_info = model('api/user')->get_user_info($withdraw_info['user_id']);
if(empty($user_info)){
return ['code' => 0, 'msg' => '用户信息错误!', 'data' => null];
}
$real_name = $user_info['real_name'];
$id_card = $user_info['card_id'];
$order_id = $withdraw_info['order_sn'];
$order_amount = $withdraw_info['general_money'];
$phone = $user_info['mobile'];
if(empty($phone)) {
return ['code' => 0, 'msg' => '请先绑定手机号', 'data' => null];
}
if (empty($real_name) || empty($id_card)) {
return ['code' => 0, 'msg' => '请先实名认证', 'data' => null];
}
@@ -286,11 +281,7 @@ class Withdrawal extends adminApi
}
$card_no = $user_info['alipay_account'];
$yun_pay = new YunPay($order_id, $real_name, $id_card, $card_no, $order_amount,$phone);
$user_data = [
'nickname' => $user_info['nickname'],
'user_id' => $withdraw_info['user_id'],
];
$result = $yun_pay->alipay($user_data);
$result = $yun_pay->alipay();
} elseif ($withdraw_info['type'] == 3) {
if(empty($user_info['bank_card_number'])){
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];

View File

@@ -85,7 +85,7 @@ class Guild extends Model
->alias('g')
->join('vs_guild gg','g.guild_id = gg.id')
->field('gg.*')
->where(['g.user_id' => $user_id,'g.status' => 1,'g.delete_time' => 0])
->where(['g.user_id' => $user_id])
->find();
return $guild;
}
@@ -95,29 +95,31 @@ class Guild extends Model
*工会当日流水
*/
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
//获取所有工会房间ID
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id,createtime,quit_time')->select();
$transaction = 0;
foreach ($guild_user_data as $k => $v) {
$where = [];
if(empty($stoday) && empty($etoday)){
$stoday_seach = strtotime(date('Y-m-d 00:00:00',time()));
$etoday_seach = strtotime(date('Y-m-d 23:59:59',time()));
$stoday = strtotime(date('Y-m-d 00:00:00'));
$etoday = strtotime(date('Y-m-d 23:59:59'));
$where['createtime'] = ['between', [$stoday, $etoday]];
}else{
$stoday_seach = strtotime($stoday);
$etoday_seach = strtotime($etoday);
if(!empty($stoday)){
$where['createtime'] = ['>=', strtotime($stoday."00:00:00")];
}
if($v['createtime'] && $stoday_seach < $v['createtime']){
$stoday_seach = $v['createtime'];
if(!empty($etoday)){
$where['createtime'] = ['<=', strtotime($etoday." 23:59:59")];
}
if($v['quit_time'] && ($etoday > $v['quit_time'])){
$etoday_seach = $v['quit_time'];
if(!empty($stoday) && !empty($etoday)){
$where['createtime'] = ['between', [strtotime($stoday." 00:00:00"), strtotime($etoday." 23:59:59")]];
}
$transaction_one = db::name('vs_give_gift')
->where('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$stoday_seach, $etoday_seach]]])
}
//获取所有工会房间ID
$room_ids = db::name('vs_guild_user')->where('guild_id', $guild_id)->field('room_id')->select();
$room_ids = array_column($room_ids, 'room_id');
$transaction = db::name('vs_give_gift')
->whereIn('from_id',$room_ids)
->where(['from'=>['in',[2,3,6]]])
->where($where)
->sum('total_price');
$transaction += $transaction_one;
}
return $transaction;
}

View File

@@ -75,13 +75,13 @@ class Room extends Model
$give_where['from_id'] = $room_id;
$give_where['from'] = ["in",[2,3,6]];
if(!empty($stime)){
$give_where['createtime'] = ['>=',strtotime($stime)];
$give_where['createtime'] = ['>=',strtotime($stime.' 00:00:00')];
}
if(!empty($etime)){
$give_where['createtime'] = ['<=',strtotime($etime)];
$give_where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
}
if(!empty($stime) && !empty($etime)){
$give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
$give_where['createtime'] = ['between',[strtotime($stime.' 00:00:00'),strtotime($etime.' 23:59:59')]];
}
$total_price = db::name('vs_give_gift')->where($give_where)
->sum('total_price');

View File

@@ -32,7 +32,6 @@ class Activities extends BaseCom
$data['name'] = $activities_title??"";
$data['gift_bag'] = [];
foreach ($gift_bag as $k=>$v){
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
$data['gift_bag'][$k]['name'] = $v['title']??"";
$ext = json_decode($v['ext'],true);
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
@@ -130,51 +129,46 @@ class Activities extends BaseCom
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
$data = [];
$data['gift_bag_id'] = $gift_bag['id']??0;
$data['name'] = $activities['title']??"";
$data['bag_name'] = $gift_bag['title']??"";
$data['effective_time'] = $activities['effective_time']??"";
//规则
$data['rule'] = get_system_config_value('web_site')."/api/Page/page_show?id=13";
$ext = json_decode($gift_bag['ext'],true);
$data['money'] = $gift_bag['money'];
$data['counter'] = $ext['counter'];
$data['money_str'] = $ext['money_str'];
$data['diamond'] = $ext['diamond'];
$data['effective_time'] = $ext['activity_end_time']??"";
if(strtotime($ext['activity_end_time']) < time()){
return V(0,'活动已结束!',null);
}
$data['money'] = $ext['money'];
$data['counter']['counter'] = $ext['counter'];
$data['counter']['money'] = $ext['money_str'];
$data['counter']['diamond'] = $ext['diamond'];
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag['id']])->select();
$data['gift_list'] = [];
foreach ($detail as $k=>$v){
if($v['type'] == 1){
$list[$k]['gift_name'] = "金币";
$list[$k]['name'] = "金币";
$list[$k]['num'] = $v['gold'];
$list[$k]['gift_price'] = $v['gold'];
$list[$k]['gold'] = $v['gold'];
$list[$k]['type'] = 1;
$list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
}elseif($v['type'] == 2) {
$gift = DB::name('vs_gift')->where(['gid'=>$v['foreign_id']])->find();
$list[$k]['gift_name'] = $gift['gift_name'];
$list[$k]['name'] = $gift['gift_name'];
$list[$k]['num'] = $v['quantity'];
$list[$k]['gift_price'] = $gift['gift_price'];
$list[$k]['gold'] = $gift['gift_price'];
$list[$k]['type'] =2;
$list[$k]['base_image'] = $gift['base_image'];
$list[$k]['icon'] = $gift['play_image'];
} elseif($v['type'] == 3) {
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
$list[$k]['gift_name'] = $gift['title']; //装扮名称
$list[$k]['name'] = $gift['title']; //装扮名称
$list[$k]['num'] = $decorate_price['day']; //天数
$list[$k]['gift_price'] = $decorate_price['price']; //价格
$list[$k]['gold'] = $decorate_price['price']; //价格
$list[$k]['type'] =3;
$list[$k]['base_image'] = $gift['base_image'];
$list[$k]['icon'] = $gift['base_image'];
}elseif($v['type'] == 4) {
$list[$k]['gift_name'] = "钻石";
$list[$k]['name'] = "钻石";
$list[$k]['num'] = $v['quantity'];
$list[$k]['gift_price'] = $v['gold'];
$list[$k]['gold'] = $v['gold'];
$list[$k]['type'] = 4;
$list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
}
}
$data['gift_list'] = $list;
@@ -185,16 +179,13 @@ class Activities extends BaseCom
{
$activities_id = 3;//天降好礼
$uid = input('uid',$this->uid);
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
$permission = 0;
if($gift_bag){
$ext = json_decode($gift_bag['ext'],true);
if($ext['activity_end_time'] <= time()){
$permission = 1;
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
if($permission){
return V(1,'操作成功', ['permission'=>0]);
}else{
return V(1,'操作成功', ['permission'=>1]);
}
}
return V(1,'操作成功', ['permission'=>$permission]);
}
//天降好礼发放
public function drop_gift_send()
@@ -204,155 +195,4 @@ class Activities extends BaseCom
return V($reslut['code'],$reslut['msg'], $reslut['data']);
}
//新人好礼
public function new_charge_gift()
{
//活动信息
$activities_id = 7;
$activities_title = DB::name('vs_activities')->where(['id'=>$activities_id,'status'=>1,'delete_time'=>0])->value('title');
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->select();
$data = [];
$data['name'] = $activities_title??"";
$data['gift_bag'] = [];
//一键领取
$bag_receive_all = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>17,'user_id'=>$this->uid])->find();
foreach ($gift_bag as $k=>$v){
$data['gift_bag'][$k]['gift_bag_id'] = $v['id']??0;
$data['gift_bag'][$k]['name'] = $v['title']??"";
$ext = json_decode($v['ext'],true);
$data['gift_bag'][$k]['title1'] = $ext['title1']??"";
$data['gift_bag'][$k]['title2'] = $ext['title2']??"";
$data['gift_bag'][$k]['money'] = $ext['money'];
$data['gift_bag'][$k]['gift_list'] = [];
$detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$v['id']])->select();
$list = [];
foreach ($detail as $kk=>$vv){
if($vv['type'] == 1){
$list[$kk]['gift_name'] = "金币";
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $vv['gold'];
$list[$kk]['type'] = 1;
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
}elseif ($vv['type'] == 2) {
$gift = DB::name('vs_gift')->where(['gid'=>$vv['foreign_id']])->find();
if($gift){
$list[$kk]['gift_name'] = $gift['gift_name'];
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $gift['gift_price'];
$list[$kk]['type'] =2;
$list[$kk]['base_image'] = $gift['base_image'];
}
} elseif ($vv['type'] == 3) {
$decorate_price = DB::name('vs_decorate_price')->where(['id'=>$vv['foreign_id']])->find();
if($decorate_price){
$gift = DB::name('vs_decorate')->where(['did'=>$decorate_price['did']])->find();
$list[$kk]['gift_name'] = $gift['title']??""; //装扮名称
$list[$kk]['num'] = $decorate_price['day']??0; //天数
$list[$kk]['gift_price'] = $decorate_price['price']??0; //价格
$list[$kk]['type'] =3;
$list[$kk]['base_image'] = $gift['base_image'] ?? "";
}
}elseif ($vv['type'] == 4) {
$list[$kk]['gift_name'] = "钻石";
$list[$kk]['num'] = $vv['quantity'];
$list[$kk]['gift_price'] = $vv['gold'];
$list[$kk]['type'] = 4;
$list[$kk]['base_image'] = localpath_to_netpath("static/image/icon/diamond.png");
}
}
$data['gift_bag'][$k]['gift_list'] = array_values($list);
if($bag_receive_all){
$data['gift_bag'][$k]['status'] = 0;
}else{
if($v['id']!=17){
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>$v['id'],'user_id'=>$this->uid])->find();
if($bag_receive_log){
$data['gift_bag'][$k]['status'] = 0;
} else {
$data['gift_bag'][$k]['status'] = 1;
}
}
}
}
return V(1,'操作成功', $data);
}
//新人好礼发放
public function new_charge_gift_receive()
{
$uid = input('uid',$this->uid);
$money = input('money',0);
$reslut = model('Activities')->new_charge_gift_send($uid,$money);
return V($reslut['code'],$reslut['msg'], $reslut['data']);
}
/*
* 活动权限
*/
public function activities_permission(){
$system = request()->header('system');
$app_version = request()->header('App-Version');
if(!$app_version){
$app_version = input('App-Version');
}
$api_version = 0;
if ($system == 'iOS') {
$api_versions = db::name('version')->where(['type' => 2, 'status' => 1])->order('id', 'desc')->find();
$result = version_compare($api_versions['oldversion'],$app_version);
if ($result < 0) {
$api_version = 1;
}
}
//首充
$activities_id = 1;
$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();
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;
if($gift_bag){
$ext = json_decode($gift_bag['ext'],true);
if(strtotime($ext['activity_end_time']) >= time()){
$day_drop_permission = 1;
}
}
//新人充值好礼
$activities = DB::name('vs_activities')->where(['id'=>7,'status'=>1,'delete_time'=>0])->find();
$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()){
$new_permission = 1;
}
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
if(in_array(17,$gift_bag_log_ids)){
$new_permission = 0;
}else{
$gift_bag_log_ids = array_intersect([14,15,16],$gift_bag_log_ids);
if(count($gift_bag_log_ids) == 3){
$new_permission = 0;
}
}
return V(1,'操作成功',[
'first_charge_permission'=>$first_charge_permission,
'day_drop_permission'=>$day_drop_permission,
'n_people_permission'=>$new_permission
],$api_version);
}
}

View File

@@ -39,8 +39,7 @@ class BlindBoxTurntable extends BaseCom
$gift_user_ids = input('gift_user_ids',0);
$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('BlindBoxTurntableGiftDraw')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
/*
@@ -93,7 +92,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('BlindBoxTurntableGiftDraw')->xlh_draw_gift($user_id,$num,$room_id);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
/*
@@ -117,15 +116,4 @@ class BlindBoxTurntable extends BaseCom
$reslut = model('BlindBoxTurntableGift')->xlh_ranking($room_id,$page,$page_size);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
/*
* 巡乐会榜单 (以期数显示)
*/
public function get_xlh_ranking(){
$page = input('page',1);
$page_size = input('page_size',12);
$room_id = input('room_id',0);
$reslut = model('BlindBoxTurntableGift')->xlh_ranking_list($room_id,$page,$page_size);
return v($reslut['code'], $reslut['msg'], $reslut['data']);
}
}

View File

@@ -6,7 +6,7 @@ use think\Controller;
use think\Db;
use think\Log;
class Ceshi extends Controllers
class Ceshi extends Controller
{
//设置白名单ip访问本类接口
protected $allowIp = [
@@ -211,17 +211,17 @@ class Ceshi extends Controllers
$user = db::name('user')->where('id','>', 0)->select();
// if($user){
// foreach ($user as &$v){
// if($v['id']){
// $j = 0;
// $data[$j] = [
// 'UserID' => 'u'.$v['id'],
// ];
// }
// // model('Tencent')->account_deletes($data);
// }
// }
if($user){
foreach ($user as &$v){
if($v['id']){
$j = 0;
$data[$j] = [
'UserID' => 'u'.$v['id'],
];
}
model('Tencent')->account_deletes($data);
}
}
$reslut9 = db::name('user')->where('id','>', 0)->delete();
if($reslut9){
@@ -458,9 +458,9 @@ class Ceshi extends Controllers
//删除腾讯房间
$room = db::name('vs_room')->select();
// foreach ($room as &$value){
// // model('Tencent')->delete_group('room'.$value['id']);
// }
foreach ($room as &$value){
model('Tencent')->delete_group('room'.$value['id']);
}
$reslut35 = db::name('vs_room')->where('id','>', 0)->delete();
if($reslut35){
$i++ ;

View File

@@ -43,10 +43,4 @@ class Cron
$cron = new \app\cron\controller\FriendEnd();
$cron->index();
}
//房间小时榜发礼物(每小时执行一次)
public function RoomHourRanking(){
$cron = new \app\cron\controller\RoomHourRanking();
$cron->index();
}
}

View File

@@ -22,6 +22,7 @@ class Guild extends BaseCom
public function guild_list()
{
$page = input('page',1);
$page = $page > 0 ? $page : 1;
$limit = input('limit',10);
$search = input('search_id','');
$reslut = model('Guild')->get_guild_list($page,$limit,$search,$this->uid);

View File

@@ -22,13 +22,10 @@ class Payment extends Controller
* APP支付
*/
public function app_pay() {
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信
$type = input('type', 0); //1-微信 2-支付宝 4-通联支付宝 5-通联微信 6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
$user_id = input('user_id', 0);
$money = input('money', 0);
$coin = input('coin', 0);
$type_params = input('type_params', 0);
$type_id = input('type_id', 0);
if(!$coin){
$coin = $money * get_system_config_value('rmb_coin_ratio');
}
@@ -63,9 +60,7 @@ class Payment extends Controller
$data['user_id'] = $user_id;
$data['pay_type'] = $type;
$data['createtime'] = time();
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";
$data['type_params'] = $type_params;
$data['type_id'] = $type_id;
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";;
$re = db::name('vs_user_recharge')->insert($data);
if (!$re) {
@@ -87,6 +82,11 @@ class Payment extends Controller
Loader::import('TongLian.TongLian', EXTEND_PATH, '.php');
$tonglian = new \TongLian();
$result['tl'] = $tonglian->TongLianPay($data, $type);
}elseif ($type == 6 || $type == 7 || $type == 8 || $type == 9){
//引用西来喜
Loader::import('Xilaixi.Xilaixi', EXTEND_PATH, '.php');
$xilaixi = new \Xilaixi();
$result['xlx'] = $xilaixi->XilaixiPay($data, $type);
}
return V(1, 'app支付', $result);
@@ -233,16 +233,11 @@ class Payment extends Controller
* 云账户回调(提现)
*/
public function yun_callback(){
// $data = input("data", "");
// $mess = input("mess", "");
// $timestamp = input("timestamp", "");
// $sign = input("sign", "");
$data = $_POST['data']??"";
$mess = $_POST['mess']??"";
$timestamp = $_POST['timestamp']?? "";
$sign = $_POST['sign']??"";
write_log_redis("yunzhanghu_huidiao_原始数据",$_POST);
$data = input("data", "");
$mess = input("mess", "");
$timestamp = input("timestamp", "");
$sign = input("sign", "");
Log::record("云账户回调信息".json_encode($_POST),"info");
$yun_pay = new YunPay();
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
if($result['code']==1){
@@ -327,4 +322,76 @@ class Payment extends Controller
echo "fail";
}
}
//西来喜支付回调
public function XilaixiPayNotify(){
//引用西来喜
Loader::import('Xilaixi.Xilaixi', EXTEND_PATH, '.php');
$xilaixi = new \Xilaixi();
$verify_result = $xilaixi->verifyNotify();
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//彩虹易支付交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
//6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
if($type == 'wxpay'){
$pay_type = 6;
}elseif ($type == 'alipay'){
$pay_type = 7;
}elseif ($type == 'qqpay'){
$pay_type = 8;
}elseif ($type == 'bank'){
$pay_type = 9;
}else{
$pay_type = 0;
}
//支付金额
$money = $_GET['money'];
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
Log::record("通联支付回调信息验签成功".json_encode($_GET),"info");
//此处进行业务逻辑处理
//成功后的业务逻辑处理
$where['order_sn']=$out_trade_no;
$where['order_type']=1;//1 充值
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信 //6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
$where['pay_status']=1;
$data=[
'trade_no'=>$trade_no
];
$res = handelCharge($where,$data);
if($res==0){
echo "fail";
return;
}
//验证成功返回
echo "success";
}else{
echo "fail";
}
}
else {
//验证失败
echo "fail";
}
}
}

View File

@@ -1,119 +0,0 @@
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use app\common\service\RedpacketService;
use think\Db;
/**
* 红包接口
*/
class Redpacket extends BaseCom
{
/**
* 发红包
*/
public function create()
{
$data = $this->request->post();
$data['user_id'] = $this->uid;
$service = new RedpacketService();
$reslut = $service->create($data);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
/**
* 抢红包
*/
public function grab()
{
$redpacketId = input('redpacket_id', 0);
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
// 在抢红包前确保状态正确
$service->checkAndUpdateRedpacketStatus($redpacketId);
$reslut = $service->grabWithResult($redpacketId, $this->uid);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
/**
* 获取抢红包结果
*/
public function grabResult()
{
$redpacketId = $this->request->get('redpacket_id');
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
$result = $service->getGrabResult($redpacketId, $this->uid);
if (!$result) {
return V(0, '红包不存在');
}
return V(1, '获取成功', $result);
}
/**
* 红包详情
*/
public function detail()
{
$redpacketId = input('redpacket_id', 0);
if (empty($redpacketId)) {
return V(0, '红包ID不能为空');
}
$service = new RedpacketService();
// 在获取详情前确保状态正确
$service->checkAndUpdateRedpacketStatus($redpacketId);
$detail = $service->getDetail($redpacketId, $this->uid);
if (!$detail) {
return V(0, '红包不存在');
}
return V(1, '获取成功', $detail);
}
/**
* 获取倒计时选项
*/
public function countdownOptions()
{
$options = \app\common\model\Redpacket::$countdownOptions;
$this->success('获取成功', $options);
}
// 获取房间内红包列表
public function roomRedPackets()
{
$roomId = $this->request->get('room_id');
$result = Db::name('redpacket')->where(['room_id' => $roomId, 'status' => ['<=',1]])->select();
if($result){
foreach ($result as &$item) {
$item['redpacket_id'] = $item['id'];
$item['redpacket_time'] = get_system_config_value('red_packet_time');//展示时间
$item['nickname'] = Db::name('user')->where('id', $item['user_id'])->value('nickname');
$item['avatar'] = Db::name('user')->where('id', $item['user_id'])->value('avatar');
$is_qiang = Db::name('redpacket_record')->where(['redpacket_id' => $item['id'], 'user_id' => $this->uid])->find();
$item['is_qiang'] = $is_qiang ? 1 : 0;
}
}
return V(1, '获取成功', $result);
}
}

View File

@@ -451,13 +451,4 @@ class Room extends BaseCom
$reslut = model('Room')->user_reconnect($this->uid, $room_id);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//用户在房间内切后台保留机制
public function user_in_room_background()
{
$room_id = input('room_id', 0);
$type = input('type', 1);//1-切后台2-切前台
$reslut = model('Room')->user_in_room_background($this->uid, $room_id,$type);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
}

View File

@@ -1,34 +0,0 @@
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use think\Db;
class RoomHourRanking extends BaseCom
{
//房间小时榜是否开启
public function room_hour_ranking_is_open()
{
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
return V(1, '获取成功', ['open_time' => $open_time]);
}
//房间小时榜玩法
public function room_hour_ranking_play()
{
$introd = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('introd');
return V(1, '获取成功', ['introd' => $introd]);
}
//房间小时榜
public function room_hour_ranking()
{
$page = input('page', 1);
$page_limit = input('page_limit', 20);
$reslut = model('RoomHourRanking')->room_hour_ranking($page, $page_limit);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
}

View File

@@ -10,8 +10,6 @@ class RoomPit extends BaseCom
//申请上麦
public function apply_pit()
{
$key_name = "api:room:apply_pit:" . $this->uid;
$room_id = input('room_id', 0);
$pit_number = input('pit_number', 0);
if($room_id == 0){
@@ -21,19 +19,27 @@ class RoomPit extends BaseCom
if($res['code'] != 1){
return V(0, '房间不存在', null);
}
// //查询房间主持麦有人吗
// $room_host_info = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
// //房主,管理,主持不受此限制
// $room_owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $this->uid])->find();
// //管理
// $room_manager = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 2,'delete_time' => null])->find();
// //主持
// $room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $this->uid,'type' => 1,'delete_time' => null])->find();
// if($room_host_info == 0 && !$room_owner && !$room_manager && !$room_host){
// return V(0, '上麦请联系主持', null);
// }
$room_label = $res['data']['label_id'];
$room_type = $res['data']['type_id'];
redis_lock_exits($key_name);
if(($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8))|| $room_type == 2 || $room_type == 7){
$reslut = model('RoomPit')->apply_pit($this->uid, $room_id,$pit_number);
}elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$reslut = model('RoomSong')->apply_kpit($this->uid, $room_id,$pit_number);
}else{
redis_unlocks($key_name);
return V(0, '房间不存在', null);
}
redis_unlocks($key_name);
//1-禁麦位2-清空消息3-清空魅力值4-加入黑名单5-踢出房间6-关闭麦克风7-申请上麦8-同意上麦9-拒绝上麦10-点歌11-开启PK',
model('Room')->room_operation_record($this->uid,$room_id,7,0,$pit_number);

View File

@@ -100,59 +100,4 @@ class Search extends BaseCom
return V(1, '获取成功', $lists);
}
//搜索
public function search_list()
{
$search = input('search', '');
if(is_numeric($search)){
$where = [
'user_code' => $search,
'status' => 1
];
$where1 = [
'room_number' => $search,
'apply_status' => 2,
'type_id' => ['<>',6],
'room_status' => 1
];
}else{
$where = [
'nickname' => ['like', '%'.$search . '%'],
'status' => 1
];
$where1 = [
'room_name' => ['like', '%'.$search . '%'],
'apply_status' => 2,
'type_id' => ['<>',6],
'room_status' => 1
];
}
$users = db::name('user')->field('id as user_id,nickname,avatar,user_code,sex')->where($where)->select();
if(isset($users)){
foreach ($users as &$v){
$v['room_id'] = 0;
//是否在房间
$is_room = db::name('vs_room_visitor')->where(['user_id' => $v['user_id'], 'is_delete' => 1])->order('id desc')->value('room_id');
if ($is_room) {
$v['room_id'] = $is_room;
}
$v['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
$v['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
}
}
$rooms = db::name('vs_room')->field('id as room_id,room_name,room_cover,room_number,label_id,today_hot_value')->where($where1)->select();
if(isset($rooms)){
foreach ($rooms as $vv){
$vv['label_icon'] = db::name('vs_room_label')->where('id', $vv['label_id'])->value('label_icon');
$vv['hot_value'] = $vv['today_hot_value'];
}
}
return V(1, '获取成功', ['users' => $users, 'rooms' => $rooms]);
}
}

View File

@@ -234,15 +234,6 @@ class User extends BaseCom
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//关注房间(红包专用)
public function follow_room()
{
$room_id = input('room_id', 0);
$type = input('type', 1);//1-收藏0-取消收藏
$reslut = model('user')->follow_room($this->uid, $room_id,$type);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//用户关系卡(亲密拍)、关系位(真爱拍)
public function user_cp_list()
{

View File

@@ -1,39 +0,0 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\BaseCom;
class Xintiao extends BaseCom
{
public function keep_xintiao()
{
$user_id = $this->uid;
$is_xintiao = db::name('vs_xintiao')->where('user_id' , $user_id)->find();
if($is_xintiao){
db::name('vs_xintiao')->where('user_id' , $user_id)->update(['updatetime' => time()]);
}else{
db::name('vs_xintiao')->insert([
'user_id' => $user_id,
'createtime' => time(),
'updatetime' => time()
]);
}
return true;
}
}

View File

@@ -1,434 +0,0 @@
<?php
namespace app\api\controller;
use think\Controller;
use think\Db;
use think\Log;
use app\common\controller\Push;
class Xxiaoshi extends Controller
{
public function send_gift()
{
//获取上一个小时的开始时间和结束时间
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00'));
echo "开始时间:" .$start_time."\n";
echo "结束时间:" .$end_time."\n";
//当前小时的前一个小时24小时计时法0-23
$pre_hour = date('H', strtotime('-1 hour'));
echo "上个时间段:" .$pre_hour."\n";
$is_open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($is_open_time == 0) {
echo "未开启时间段:" .$is_open_time."\n";
return;
}
//是否全局飘瓶
$is_public_server = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_public_server');
if ($is_public_server == 1) {
//全局飘瓶时间段
$xlh_time_range = db::name('vs_hour_ranking_config')->where('id', 1)->value('broadcast_times');
if($xlh_time_range){
if($xlh_time_range == 25){
$is_piao = 1;
}else{
//当前的前一个小时是否在 $xlh_time_range中
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
$is_piao = 1;
} else {
$is_piao = 0;
}
}
}else{
$is_piao = 0;
}
}else{
$is_piao = 0;
}
//获取上一个时间段的配置
// $gift_list = db::name('vs_hour_ranking_gift_config')->where('time_id',$pre_hour)->group('ranking')->order('id', 'desc')->select();
$gift_list = $this->get_hour_ranking($pre_hour);
// echo "上个时间段的配置:" .json_encode($gift_list)."\n";
// 提取所有有奖励的内容
$allRewards = $this->extractAllRewards($gift_list);
// 按index分组
$groupedRewards = $this->groupRewardsByIndex($allRewards);
// 按名次顺序分配奖励
$distributionResult = $this->distributeByRank($groupedRewards);
//获取上个数组的个数,从而获取配置了多少个名次
$count = count($distributionResult);
echo "上个时间段的配置总数:" .$count."\n";
//获取前一个小时的 前$count名房间排行
$room_list = model('api/RoomHourRanking')->room_hour_ranking(1, $count, $start_time, $end_time);
$room_owner = [];
if ($room_list['code'] == 1) {
//获取房间排行奖励最低值
$min_price = db::name('vs_hour_ranking_config')->where('id', 1)->value('min_price');
if ($room_list['data']['lists']) {
echo "房间列表:" .json_encode($room_list['data']['lists'])."\n";
foreach ($room_list['data']['lists'] as $v){
if ($v['total_price'] >= $min_price) {
$room_owner[] = [
'user_id' => $v['user_id'],
'room_name' => $v['room_name'],
'room_id' => $v['room_id'],
'total_price' => $v['total_price']
];
}
}
}
}
if ($distributionResult && $room_owner) {
$text_list_new = [];
echo "礼物数:" .json_encode($distributionResult)."\n";
echo "房主:" .json_encode($room_owner)."\n";
foreach ($distributionResult as $k => $value) {
//礼物全部给他偷偷放在装扮表及金额 中
//有几个用户就发几个
if(count($room_owner) > $k){
// 为每个房间添加一个标志,表示是否已处理推送信息
$hasProcessedPush = false;
foreach ($value['rewards'] as $v){
// if($v['type'] == 0){//1金币2礼物3头像4坐骑
// echo "发金币:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
// $res = $this->add_coin($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
// }elseif ($v['type'] == 1){
// echo "发礼物:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
// $res = $this->add_gift($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
// }elseif ($v['type'] == 2){
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,3);
// }elseif ($v['type'] == 3){
// $res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,4);
// }
// 只有在第一次处理奖励时添加推送信息,避免重复推送
if(!$hasProcessedPush && $is_piao == 1) {
$room_name = $room_owner[$k]['room_name'];
//推送礼物横幅
if ($k == 0) {
$text = '新科状元!【' . $room_name . '】独占鳌头!';
} elseif ($k == 1) {
$text = '金榜榜眼!【' . $room_name . '】才气逼人!';
} elseif ($k == 2) {
$text = '风采探花!【' . $room_name . '】实力绽放!';
}
$text_list_new[] = [
'text' => $text ?? '恭喜【' . $room_name . '】获得礼物!',
'room_id' => $room_owner[$k]['room_id'],
'room_name' => $room_name,
'rank_number' => $k + 1,
];
$hasProcessedPush = true; // 标记已处理推送
}
}
}
}
if(!empty($text_list_new)){
$push = new Push();
$push->hourRankingcs($text_list_new);
Log::record("小时榜推送:".json_encode($text_list_new),"infos");
}
}
echo "送礼-共" . count($room_owner) . "个房间房主获益\n";
}
//添加金币到钱包
// public function add_coin($coin,$user_id,$ranking,$room_id,$total_price,$is_piao){
// if($coin > 0){
// $data = [
// 'user_id' => $user_id,
// 'change_value' => $coin,
// // 'room_id' => $room_ids,
// 'money_type' => 1,
// 'change_type' => 27,
// 'from_id' => 0,
// 'remarks' => '小时榜获得',
// 'createtime' => time()
// ];
// //开启事务
// Db::startTrans();
// $res = Db::name('vs_user_money_log')->insert($data);
// if(!$res){
// Db::rollback();
// }
// //增加用户金币
// $res1 = Db::name('user_wallet')->where(['user_id'=>$user_id])->setInc('coin',$coin);
// if(!$res1){
// Db::rollback();
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'coin' => $coin,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao
// ]);
// if(!$res2){
// Db::rollback();
// }
// Db::commit();
// }
// return true;
// }
// //添加礼物到背包
// public function add_gift($gift_id,$user_id,$ranking,$room_id,$total_price,$is_piao){
// $res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$gift_id,1,model('UserGiftPack')::HOUR_RANK_GET,"小时榜获得");
// if($res['code'] == 0){
// Log::record("小时榜获取礼物失败:".$res['msg'],"info");
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'gift_id' => $gift_id,
// 'gift_type' => 2,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao
// ]);
// if(!$res2){
// Log::record("小时榜礼物锁定失败","info");
// }
// return true;
// }
// //添加装扮到背包
// public function add_decorate($avatar_id,$user_id,$ranking,$room_id,$total_price,$is_piao,$type){
// $decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$avatar_id])->find();
// if(empty($decorate_price_info)){
// Log::record("小时榜获取装扮失败:没有找到装扮!".$avatar_id,"info");
// }
// $res = model('api/Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],2);
// if($res['code'] == 0){
// Log::record("小时榜获取装扮失败:".$res['msg']."-".$avatar_id,"info");
// }
// //添加到排行表
// $start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
// $end_time = strtotime(date('Y-m-d H:00:00')) - 1;
// $res2 = db::name('vs_hour_ranking')->insert([
// 'ranking' => $ranking,
// 'room_id' => $room_id,
// 'flowing_water' => $total_price,
// 'gift_id' => $avatar_id,
// 'gift_type' => $type,
// 'time_id' => date('H', strtotime('-1 hour')),
// 'stime' => $start_time,
// 'etime' => $end_time,
// 'createtime' => time(),
// 'updatetime' => time(),
// 'is_public_server' => $is_piao,
// ]);
// if(!$res2){
// Log::record("小时榜咋装扮锁定失败","info");
// }
// return true;
// }
/**
* 提取所有有奖励的内容
*/
private function extractAllRewards($responseData)
{
$allRewards = [];
foreach ($responseData as $timeSlot) {
foreach ($timeSlot['reward'] as $rewardItem) {
$index = $rewardItem['index'];
$content = $rewardItem['content'];
// 只处理有奖励内容的数据
if (!empty($content)) {
foreach ($content as $rewardContent) {
$allRewards[] = [
'index' => $index,
'type' => $rewardContent['type'],
'value' => $rewardContent['value'],
'name' => $rewardContent['name'] ?? ''
];
}
}
}
}
return $allRewards;
}
/**
* 按index分组奖励
*/
private function groupRewardsByIndex($allRewards)
{
$grouped = [];
foreach ($allRewards as $reward) {
$index = $reward['index'];
if (!isset($grouped[$index])) {
$grouped[$index] = [];
}
$grouped[$index][] = $reward;
}
// 按index排序
ksort($grouped);
return $grouped;
}
/**
* 按名次顺序分配奖励
*/
private function distributeByRank($groupedRewards)
{
$distribution = [];
$currentRank = 0; // 从第1名开始
// 按index顺序分配index 0 = 第1名index 1 = 第2名以此类推
foreach ($groupedRewards as $index => $rewards) {
// 确保名次连续,如果有空缺则填充空名次
while ($currentRank < $index) {
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => []
];
$currentRank++;
}
// 分配当前名次的奖励
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => $rewards
];
$currentRank++;
}
return $distribution;
}
public function get_hour_ranking($time){
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->where('time_id', '=', $time)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeRange,
'reward' => array_values($rewardMap)
];
}
return $result;
}
public function give_gifts(){
$data = db::name('vs_give_gift')->where('from_id',5483)->select();
$num = 0;
$i=0;
$j = 0;
foreach($data as $v){
$j += $v['total_price'];
$nuu = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('room_owner_earning');
$id = db::name('vs_give_gift_ratio_log')->where('give_gift_id',$v['id'])->value('id');
// echo $id."--".$nuu."\n";
$num += $nuu;
$i++;
}
echo $num;
echo "==".$i."==".$j;
// echo db::name()->where(['user_id' => 10857,'money_type' =>2,'change_type' =>18])-sum('change_value');
}
public function room_liushui(){
// $room = db::name('vs_give_gift')->where(['from_id' => ['<>',5418],'from' => 2])->group('from_id');
$dd = db::name('vs_user_gift_pack')->alias('a')->join('vs_gift b','a.gid = b.gid')->field('a.gid,a.num,b.gift_price')->where(['a.num' =>['>',0]])->select();
$count = 0;
foreach ($dd as $v){
$count += $v['gift_price'] * $v['num'];
}
echo $count;
}
}

View File

@@ -25,8 +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_id = $gift_bag['id'] ?? 0;
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'money'=>$money])->value('id');
if (!$gift_bag_id) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
}
@@ -99,19 +98,14 @@ class Activities extends Model
/*
* 天降好礼发放
*/
public static function drop_gift_send($user_id,$money=0)
public static function drop_gift_send($user_id)
{
$activities_id = 3;
//礼包
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
$gift_bag_id = $gift_bag['id'] ?? 0;
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->value('id');
if (!$gift_bag_id) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
}
if($money != $gift_bag['money']){
return ['code' => 0, 'msg' => '充值金额未命中天降好礼礼包','data' => null];
}
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
if (!$gift_bag_detail) {
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
@@ -142,20 +136,15 @@ class Activities extends Model
Db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
}
}
// 记录日志
//添加礼盒记录
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'parent_id' => $v['id'],
'gift_id'=> $v['foreign_id'],
'num' => $v['quantity'],
'bag_price' => $gift_bag['money'],
'gift_price' => $v['gold'],
'createtime' => time(),
'updatetime' => time()
]);
}
// 添加活动记录
$reslut = Db::name('vs_activities_receive')->insert([
'user_id' => $user_id,
@@ -171,85 +160,4 @@ class Activities extends Model
return ['code' => 0, 'msg' => "请重试", 'data' => null];
}
}
/*
* 新人好礼发放
*/
public static function new_charge_gift_send($user_id,$money=0)
{
//礼包
$activities_id = 7;
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'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];
}
$gift_bag_detail = DB::name('vs_gift_bag_detail')->where(['gift_bag_id'=>$gift_bag_id])->select();
if (!$gift_bag_detail) {
return ['code' => 0, 'msg' => '礼包未配置','data' => null];
}
Db::startTrans();
try {
foreach ($gift_bag_detail as $k=>$v){
$gift_id =0;
$gift_price = 0;
$gift_num = $v['quantity'];
switch ($v['type']) {
case 1: //金币 方法1直接添加到用户钱包
$gift_price = $v['quantity'];
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPECOIN, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
break;
case 2: //礼物 方法2添加到用户礼物背包
$gift_id = $v['foreign_id'];
$res = model('UserGiftPack')->change_user_gift_pack($user_id,$v['foreign_id'],$v['quantity'],model('UserGiftPack')::NEW_CHARGE_GIFT,"新人好礼获得礼物");
break;
case 3: //坐骑 方法3添加到用户装扮
$gift_id = $v['foreign_id'];
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$v['foreign_id']])->find();
if(empty($decorate_price_info)){
break;
}
$gift_price = $decorate_price_info['price'];
$res = model('Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],8);
break;
case 4: //道具 方法5钻石
$gift_price = $v['quantity'];
$res = model('common/UserWallet')->change_user_money($user_id, $v['quantity'], model('common/UserWallet')::MONEYTYPEARNINGS, model('common/UserWallet')::NEW_USER_CHARGE_GIFT,model('common/UserWallet')::ChangeTypeLable(model('common/UserWallet')::NEW_USER_CHARGE_GIFT));
default:
break;
}
if ($res['code'] != 1) {
Db::rollback();
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
}
// 记录日志
//添加礼盒记录
$reslut = Db::name('vs_gift_bag_receive_log')->insert([
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'parent_id' => $v['id'],
'gift_id'=> $v['foreign_id'],
'num' => $v['quantity'],
'bag_price' => $gift_bag['money'],
'gift_price' => $v['gold'],
'createtime' => time(),
'updatetime' => time()
]);
}
// 添加活动记录
$reslut = Db::name('vs_activities_receive')->insert([
'user_id' => $user_id,
'activities_id' => 1,
'createtime' => time(),
'updatetime' => time()
]);
Db::commit();
return ['code' => 1, 'msg' => '操作成功','data' => null];
}catch (\Exception $e) {
// 回滚事务
Db::rollback();
return ['code' => 0, 'msg' => "请重试", 'data' => null];
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,34 +7,16 @@ use think\Log;
use think\Model;
use think\Db;
use think\Session;
use Redis;
/*
* 盲盒转盘优化后方法
*
*/
class BlindBoxTurntableGiftDraw extends Model
{
private $redis;
public function __construct()
{
parent::__construct();
try {
$this->redis = new Redis();
// 连接到Redis服务器
$this->redis->connect(config('redis.host'), config('redis.port')); // 根据实际配置调整主机和端口
// 选择数据库1
$this->redis->select(1);
} catch (\Exception $e) {
Log::record('Redis连接失败: ' . $e->getMessage(), 'error');
$this->redis = null;
}
}
/**
* 重构后的抽奖方法 - 优化响应速度
*/
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0, $auction_id = 0)
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0)
{
try {
// 1. 验证参数并提前处理错误
@@ -44,7 +26,7 @@ class BlindBoxTurntableGiftDraw extends Model
}
// 2. 预加载必要数据
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids);
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id);
if ($loadResult['code'] !== 1) {
return $loadResult;
}
@@ -65,12 +47,7 @@ class BlindBoxTurntableGiftDraw extends Model
$availableGiftss = $precomputeResult['data']['availableGifts'];
$currentXlhPeriodsNum = $precomputeResult['data']['current_xlh_periods_num'];
$xlhIsPiaoPing = $precomputeResult['data']['xlh_is_piao_ping'];
$expectedCount = count(explode(',', $gift_user_ids)) * $num;
if(count($precomputedResults) != $expectedCount){
// 记录错误到Redis
$this->recordDrawErrorToRedis($expectedCount, count($precomputedResults), $room_id, $user_id, $gift_bag_id, $num, $gift_user_ids, $precomputedResults);
return ['code' => 0, 'msg' => '网络加载失败,请重试!', 'data' => null];
}
// 4. 执行抽奖事务(核心操作)
$transactionResult = $this->executeDrawTransaction(
$bag_data,
@@ -78,10 +55,7 @@ class BlindBoxTurntableGiftDraw extends Model
$room_id,
$num,
$precomputedResults,
$availableGiftss,
$gift_user_ids,
$heart_id,
$auction_id
$availableGiftss
);
if ($transactionResult['code'] !== 1) {
return $transactionResult;
@@ -105,9 +79,7 @@ class BlindBoxTurntableGiftDraw extends Model
return $this->buildDrawResult($boxTurntableLog, $giftCounts);
} catch (\Exception $e) {
$key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
$this->redis->setex($key, 86400 * 7, $e->getMessage());
return ['code' => 0, 'msg' => "网络加载失败,请重试!", 'data' => null];
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null];
}
}
@@ -142,7 +114,7 @@ class BlindBoxTurntableGiftDraw extends Model
/**
* 预加载必要数据
*/
private function loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids)
private function loadDrawData($gift_bag_id, $user_id, $room_id)
{
// 1. 合并查询盲盒配置和礼物信息
$bag_data = db::name("vs_gift_bag")
@@ -178,9 +150,7 @@ class BlindBoxTurntableGiftDraw extends Model
if (!$user_waller) {
return ['code' => 0, 'msg' => '用户钱包不存在', 'data' => null];
}
if ($user_waller['coin'] < $bag_data['gift_price'] * $num * count(explode(',', $gift_user_ids))) {
return ['code' => 0, 'msg' => '用户金币不足', 'data' => null];
}
// 4. 获取巡乐会配置(使用缓存)
$xlh_ext = $this->getCachedXlhConfig();
@@ -221,7 +191,7 @@ class BlindBoxTurntableGiftDraw extends Model
if (empty($availableGifts)) {
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
if (empty($availableGifts)) {
throw new \Exception('重置奖池后仍无可用礼物');
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null];
}
}
@@ -235,7 +205,7 @@ class BlindBoxTurntableGiftDraw extends Model
$remaining_available_gifts = $availableGifts;
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
if (empty($availableGifts)) {
throw new \Exception('重置奖池后仍无可用礼物');
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null];
}
$totalDrawTimes = 0;
$num = abs($totalRemaining - $num);
@@ -256,7 +226,7 @@ class BlindBoxTurntableGiftDraw extends Model
$remaining_available_gifts
);
if (empty($precomputedResults['precomputedResults'])) {
throw new \Exception('预计算抽奖结果失败');
return ['code' => 0, 'msg' => '预计算抽奖结果失败', 'data' => null];
}
return [
@@ -287,15 +257,6 @@ class BlindBoxTurntableGiftDraw extends Model
$roomId,
$remaining_available_gifts
) {
//计算$remaining_available_gifts 里面 remaining_number 的累加
$remaining_num = 0;
foreach ($remaining_available_gifts as $key=>$value) {
$remaining_num += $value['remaining_number'];
}
if($remaining_num > $num){
$availableGifts = $remaining_available_gifts;
$remaining_available_gifts = [];
}
$precomputedResults = [];
$precomputedResultss = [];
$giftBagIdToGift = [];
@@ -324,10 +285,13 @@ class BlindBoxTurntableGiftDraw extends Model
unset($remaining_available_gifts[$key]);
}
$numm = $num;
// echo "好好玩";
}else{
$numm = $num+$remaining_num;
}
// echo $numm."---";
for ($i = 0; $i < $numm; $i++) {
// echo "好好呀";
// 使用Alias Method选择礼物O(1)复杂度)
$selectedGift = $this->selectGiftWithAliasMethod($aliasTable);
if (!$selectedGift) {
@@ -475,10 +439,9 @@ class BlindBoxTurntableGiftDraw extends Model
/**
* 执行抽奖事务(核心操作)
*/
private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss,$gift_user_ids,$heart_id,$auction_id)
private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss)
{
$gift_user_num = count(explode(',', $gift_user_ids)); //人数
$bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num;
$bagGiftPrice = $bag_data['gift_price'] * $num;
db::startTrans();
try {
@@ -505,12 +468,6 @@ class BlindBoxTurntableGiftDraw extends Model
// 4. 扣除用户金币
$this->deductUserCoins($user_id, $bagGiftPrice, $room_id);
//发送礼物
$result = $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id);
if (isset($result['code']) && $result['code'] !== 1) {
throw new \Exception($result['msg']);
}
db::commit();
// 5. 统计礼物数量
@@ -554,7 +511,7 @@ class BlindBoxTurntableGiftDraw extends Model
if (!$ret) {
Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info");
throw new \Exception('更新礼物剩余数量失败');
// throw new \Exception('更新礼物剩余数量失败');
}
}
}
@@ -634,8 +591,8 @@ class BlindBoxTurntableGiftDraw extends Model
// 1. 批量插入盲盒转盘结果记录
$this->batchInsertBlindBoxResults($precomputedResults, $boxTurntableLog, $room_id);
// 2. 发送礼物给接收者 (已前置)
// $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id);
// 2. 发送礼物给接收者
$this->sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id);
// 3. 处理巡乐会相关操作
if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) {
@@ -686,7 +643,7 @@ class BlindBoxTurntableGiftDraw extends Model
/**
* 发送礼物给接收者
*/
private function sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id)
private function sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id)
{
// 统计每个用户每个礼物的数量
$giftUserCounts = [];
@@ -705,9 +662,6 @@ class BlindBoxTurntableGiftDraw extends Model
// 批量发送礼物
foreach ($giftUserCounts as $userGift) {
if($userGift['count'] > 9){ //防止礼物超发礼物超10个则不发送
continue;
}
$giveGiftExt = [
'gift_id' => $userGift['gift_id'],
'count' => $userGift['count'],
@@ -715,9 +669,7 @@ class BlindBoxTurntableGiftDraw extends Model
'all_gift_price' => $userGift['gift_price'] * $userGift['count'],
'is_draw_gift' => 1
];
if(!empty($auction_id)){
model('RoomAuction')->room_auction_join($auction_id,$user_id,$userGift['gift_id'],$userGift['count'],2,$giveGiftExt);
}else{
$res = model('Room')->room_gift(
$user_id,
$userGift['gift_user_id'],
@@ -726,17 +678,16 @@ class BlindBoxTurntableGiftDraw extends Model
1,
$room_id,
0,
$heart_id,
0,
$giveGiftExt
);
}
if (isset($res) && $res['code'] != 1) {
Log::record('发送礼物失败: ' . $res['msg'].$userGift['gift_user_id'],"info");
return ['code' => 0, 'msg' => $res['msg'], 'data' => null];
// \think\facade\Log::error('发送礼物失败: ' . $res['msg']);
}
}
return ['code' => 1, 'msg' => '发送礼物成功', 'data' => null];
}
/**
@@ -1348,10 +1299,7 @@ class BlindBoxTurntableGiftDraw extends Model
// 7. 批量处理结果记录
try {
db::startTrans();
if(count($drawn_gifts) > $num){
Log::record('巡乐会抽奖失败-数量超限: ' . count($drawn_gifts),"infos");
return ['code' => 0, 'msg' => "抽奖中,请稍等...", 'data' => null];
}
// 批量插入礼包发放记录
$gift_records = [];
$periods = $room_pan_data[0]['periods'] ?? 0;
@@ -1566,38 +1514,5 @@ class BlindBoxTurntableGiftDraw extends Model
return ['code' => 1, 'msg' => '成功', 'data' => $result_list];
}
//错误日志记录-------------------------------------------------------
/**
* 记录抽奖错误日志到Redis
*/
private function recordDrawErrorToRedis($expectedCount, $actualCount, $room_id, $user_id, $gift_bag_id, $num, $gift_user_ids, $precomputedResults)
{
// 检查Redis连接是否可用
if (!$this->redis) {
Log::record('Redis连接不可用无法记录错误日志', 'error');
return;
}
try {
$errorData = [
'timestamp' => time(),
'expected_count' => $expectedCount,
'actual_count' => $actualCount,
'room_id' => $room_id,
'user_id' => $user_id,
'gift_bag_id' => $gift_bag_id,
'num' => $num,
'gift_user_ids' => $gift_user_ids,
'precomputed_results_count' => count($precomputedResults),
'precomputed_results' => $precomputedResults,
'error_type' => 'draw_count_mismatch'
];
// 使用正确的Redis方法存储数据
$key = 'blind_box_draw_errors_' . date('Y-m-d-H-i-s');
$this->redis->setex($key, 86400 * 7, json_encode($errorData));
} catch (\Exception $e) {
Log::record('Redis操作失败: ' . $e->getMessage(), 'error');
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -119,10 +119,6 @@ class Chat extends Model
//清空个人魅力
// ClearUserCharm = 1059,
//发红包
// RedPacket = 1060,
//红包领完推送
// RedPacketComplete = 1061,

View File

@@ -135,13 +135,13 @@ class DailyTasks extends Model
$v['processing_type'] = 2;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
//跳转的房间路径
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
$v['target_quantity'] = $v['target_quantity'] * 60;
$v['is_time'] = 1;
}elseif(in_array($v['task_id'],[10])){
$v['processing_type'] = 7;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6],'apply_status'=>2])->orderRaw('rand()')->value('id');
$v['from_id'] = db::name('vs_room')->where(['delete_time'=>0,'room_status'=>1,'type_id'=>['<>',6]])->orderRaw('rand()')->value('id');
} else{
$v['processing_type'] = 9;
$v['processing_type_str'] = $this->processing_type_str[$v['processing_type']];

View File

@@ -16,8 +16,8 @@ class Decorate extends Model
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 定义字段类型 1头像框 2坐骑 3麦圈 6个人靓号 7房间靓号 8公会靓号
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼'];
public $TypeArray = [1=>'头像框',2=>'坐骑',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号'];
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送'];
public function __construct($data = [])
{
parent::__construct($data);

View File

@@ -17,9 +17,9 @@ class Guild extends Model
* @param $page
* @param $limit
*/
public function get_guild_list($page,$page_limit,$search='',$user_id=0)
public function get_guild_list($page,$limit=10,$search='',$user_id=0)
{
$where =[];
$where ="1=1";
if ($search) {
$where = ['guild_special_id'=>['like',$search.'%']]; //通过工会ID搜索
}
@@ -28,7 +28,8 @@ class Guild extends Model
->field('id,guild_special_id,user_id,guild_name,cover,num,intro,createtime,income')
->where(['is_show'=>1,'delete_time'=>0])
->where($where)
->page($page, $page_limit)
->order('income desc')
->page($page,$limit)
->select();
$count = Db::name('vs_guild')
->where(['is_show'=>1,'delete_time'=>0])
@@ -61,7 +62,7 @@ class Guild extends Model
}
$data =[
'page' => $page,
'limit' => $page_limit,
'limit' => $limit,
'count' => $count,
'list' => $list
];
@@ -609,8 +610,8 @@ class Guild extends Model
//规则
$data['rule'] = get_system_config_value('web_site').'/api/Page/page_show?id=15';
//上周流水
$week_start = date('Y-m-d 00:00:00', strtotime('last week Monday'));
$week_end = date('Y-m-d 23:59:59', strtotime('last week Monday +6 days'));
$week_start = date('Y-m-d', strtotime('last monday'));
$week_end = date('Y-m-d', strtotime('last monday +6 days'));
$guild_subsidy = db::name('vs_guild_subsidy')
->where(["guild_id"=>$guild_id,'start_time' => $week_start, 'end_time' => $week_end])
->find();
@@ -621,38 +622,18 @@ class Guild extends Model
$data['list'][0]['status_str'] = isset( $guild_subsidy['status'])&& $guild_subsidy['status']==1 ? "已发放" : "未发放";
//本周流水
//本周的第一天
$week = strtotime(date('Y-m-d 00:00:00', strtotime('this week Monday')));
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id])->select();
$transaction = 0;
foreach ($guild_user as $k => $v){
$week_start_time_seach = $week;
$week_end_time_seach = time();
if($v['createtime'] && $week_start_time_seach < $v['createtime']){
$week_start_time_seach = $v['createtime'];
}
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
$week_end_time_seach = $v['quit_time'];
}
$transaction_one = db::name('vs_give_gift')
->whereIn('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
$week = strtotime(date('Y-m-d', strtotime('this week Monday')));
$guild_user = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>null])->select();
$guild_user_ids = array_column($guild_user,'room_id');
$total_transaction = db::name('vs_give_gift')
->where(['from'=>2,'from_id' => ['in',$guild_user_ids],'createtime' => ['between', [$week, time()]]])
->sum('total_price');
$transaction += $transaction_one;
}
$total_transaction = $transaction;
$ss = 0;
if($total_transaction){
//根据工会流水 获取补贴比例 单位%
//获取补贴配置
$config = db::name('vs_guild_subsidy_config')->where(['status' => 1])->order('end_amount desc')->select(); //配置查询
foreach ($config as $k => $v) {
if ($total_transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio'];
$ss = ($total_transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石
break; // 找到匹配项后提前退出循环
}
}
$subsidy_config = db::name('vs_guild_subsidy_config')->where('start_amount <= '. $total_transaction)
->where('end_amount > '. $total_transaction)->getField('subsidy_ratio');
$ss = $total_transaction * ($subsidy_config / 100);
}
//待开发
$data['list'][1]['name'] = "本周流水";
@@ -773,15 +754,9 @@ class Guild extends Model
$start_time_all = strtotime($start_time." 00:00:00");
$end_time_all = strtotime($end_time." 23:59:59");
}
if($value['createtime'] && $start_time_all < $value['createtime']){
$start_time_all = $value['createtime'];
}
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
$end_time_all = $value['quit_time'];
}
$transaction = db::name('vs_give_gift')
->where('from_id',$value['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_all, $end_time_all]]])
->where(['from'=>2,'createtime' => ['between', [$start_time_all, $end_time_all]]])
->sum('total_price');
$total_transaction = $total_transaction+$transaction;
}
@@ -796,17 +771,11 @@ class Guild extends Model
$i=0;
foreach ($list as $k=>$v){
if(!$start_time){
$start_time_seach = $value['createtime'];
$end_time_seach = time();
$start_time = $v['createtime'];
$end_time = time();
}else{
$start_time_seach = strtotime($start_time." 00:00:00");
$end_time_seach = strtotime($end_time." 23:59:59");
}
if($value['createtime'] && $start_time_all < $value['createtime']){
$start_time_seach = $value['createtime'];
}
if($value['quit_time'] && ($end_time_all > $value['quit_time'])){
$end_time_seach = $value['quit_time'];
$start_time = strtotime($start_time." 00:00:00");
$end_time = strtotime($end_time." 23:59:59");
}
$room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find();
if($room_info){
@@ -816,7 +785,7 @@ class Guild extends Model
$room_data[$i]['room_cover'] = localpath_to_netpath($room_info['room_cover']);
$room_data[$i]['total_price'] = db::name('vs_give_gift')
->where('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_seach, $end_time_seach]]])
->where(['from'=>2,'createtime' => ['between', [$start_time, $end_time]]])
->sum('total_price');
$i++;
}

View File

@@ -109,10 +109,6 @@ class Login extends Model
if ($block) {
if($block['block_time'] != 0 && $block['block_time'] <= time()){
db('block')->where(['id' => $block['id']])->delete();
$sms_error = db::name('sms_error')->where(['mobile' => $user_info['mobile']])->find();
if($sms_error){
db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
}
}else{
if($block['block_time'] == 0){
return ['code' => 301, 'msg' => '用户已被永久封禁', 'data' => null];
@@ -297,48 +293,24 @@ class Login extends Model
if (empty($user_info)) {
return ['code' => 0, 'msg' => '用户不存在', 'data' => null];
}
//今天误次数
$sms_count = db::name('sms_error')->where(['mobile' => $user_name,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
if ($sms_count >= 5) {
$user_id = db::name('user')->where('mobile', $user_name)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){
//封禁账号
$error_data = [
'type' => 1,
'type_text' => $user_id,
'block_time' => time() + 60 * 60 * 24,
'block_note' => '账号登录异常被封禁24小时',
'createtime'=> time(),
];
db::name('block')->insert($error_data);
db::name('user')->where('id', $user_id)->update(['status' => 2]);
}
return ['code' => 0, 'msg' => '登录错误次数过多,账号已被封禁,请联系管理员处理','data' =>null];
}
$count_sms = max(5 - $sms_count, 0);
if (md5($password) != $user_info['password']) {
$data = [
'mobile' => $user_name,
'type' => 2,
'sms' => $password,
'createtime'=> time(),
];
db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '密码错误,'.$count_sms.'次后账号将被封禁24小时', 'data' => null];
return ['code' => 0, 'msg' => '密码错误', 'data' => null];
}
// $multi_user = [];
// //查询手机号绑定的账号
// $phone_user = $this->phone_login_query($user_name);
// if($phone_user['code'] == 1){
// //获取返回数据的长度
// if(count($phone_user['data']) >= 2){
// $multi_user = $phone_user['data'];
// }
// }
$login = $this->login($user_info,$system,$login_device);
if($login['code'] != 1){
return $login;
}
//登陆成功后 把所有的登录错误删除掉
db::name('sms_error')->where(['mobile' => $user_name])->delete();
return ['code' => 1, 'msg' => '登录成功', 'data' => $login['data']];
}

View File

@@ -691,7 +691,7 @@ class Room extends Model
if (!$is_join) {
db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time()]);
}
db::name('user_data')->where('user_id', $user_id)->update(['room_id' => $room_id]);
// db::name('user_data')->where('user_id', $user_id)->update(['room_id' => $room_id]);
$room['is_use_code'] = 0;
$liang = model('api/Decorate')->user_decorate_detail($room['id'],7);
@@ -850,16 +850,7 @@ class Room extends Model
}
$xlh_info['xlh_info'] = model('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()){
$hour_open = 1;//开启
}else{
$hour_open = 0;//关闭
}
}else{
$hour_open = 0;//关闭
}
return ['code' => 1,
'msg' => '成功',
'data' => ['room_info' => $room_info,
@@ -873,7 +864,6 @@ class Room extends Model
'song_pit_list' => $song_pit_list,
'friend_info' => $friend,
'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
]
];
}
@@ -1078,9 +1068,14 @@ class Room extends Model
db::name('vs_room_visitor')->where(['room_id' => $room_id, 'user_id' => $user_id])->delete();
//房间的模式
$res = model('api/Room')->get_room_label($room_id);
if($res['code'] != 1){
$room_label = 1;
$room_type = 1;
}else{
$room_label = $res['data']['label_id'];
$room_type = $res['data']['type_id'];
}
$apply_type = 0;
if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4 || $room_type == 8)){
$apply_type = 1;
@@ -1157,7 +1152,7 @@ class Room extends Model
}else{
$room_typer = '管理员';
}
db::name('vs_room_black')->insert(['room_id' => $room_id, 'user_id' => $uid,'black_id' => $user_id,'type' => 1,'kick_time' => time()+600,'createtime' => time()]);
db::name('vs_room_black')->insert(['room_id' => $room_id, 'user_id' => $uid,'black_id' => $user_id,'type' => 1,'kick_time' => time()+300,'createtime' => time()]);
//发送消息
$text['text'] = '用户 ' . $nickname . ' 被 '. $room_typer .' 踢出房间';
@@ -1302,18 +1297,10 @@ class Room extends Model
$room_user = db::name('vs_room_visitor')->where(['room_id' => $room_id])->select();
if($room_user){
foreach ($room_user as $vv){
if(($label_type['data']['type_id'] == 1 || $label_type['data']['type_id'] == 8) && $label_type['data']['label_id'] == 1){
//不做处理
}else{
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $room_id,'user_id' => $vv['user_id']])->find();
if(Db::name('user')->where('id', $vv['user_id'])->value('is_online') == 0 && !$bg_room){
if(Db::name('user')->where('id', $vv['user_id'])->value('is_online') == 0){
model('Room')->quit_room($vv['user_id'], $room_id,$vv['user_id'],2);
}
}
}
}
$list = db::name('vs_room_visitor')->alias('a')
@@ -1614,9 +1601,6 @@ class Room extends Model
if(!$is_host){
return ['code' => 0, 'msg' => '用户不是主持人,不能设置收益', 'data' => null];
}
if($profit < 0 || $profit > 100){
return ['code' => 0, 'msg' => '请输入正确的比例 0-100', 'data' => null];
}
$res = db::name('vs_room_host')->where(['room_id' => $room_id,'user_id' => $user_id,'type' => 1,'delete_time' => null])
->update(['ratio' => $profit]);
if(!$res){
@@ -2024,16 +2008,6 @@ class Room extends Model
}
$xlh_info['xlh_info'] = model('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()){
$hour_open = 1;//开启
}else{
$hour_open = 0;//关闭
}
}else{
$hour_open = 0;//关闭
}
return ['code' => 1,
'msg' => '成功',
@@ -2048,7 +2022,6 @@ class Room extends Model
'song_pit_list'=>$song_pit_list,
'friend_info' => $friend,
'gift_cycle' => $xlh_info,
'hour_ranking_open' => $hour_open
]
];
}
@@ -2254,7 +2227,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.id','left')
->join('vs_relation d','a.relation_id = d.id','left')//关系
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'d.id' => ['>',0]])
->order('a.updatetime desc')
->select();
$room_auction2 = db::name('vs_room_auction_relation')->alias('a')
@@ -2262,7 +2235,7 @@ class Room extends Model
->join('user c','a.user_id2 = c.id','left')
->join('vs_relation d','a.relation_id = d.id','left')//关系
->field('a.relation_id,a.cp_room_id,a.id,a.user_id1,a.user_id2,a.updatetime,a.time_day,a.end_time,b.nickname as nickname1,b.avatar as avatar1,c.nickname as nickname2,c.avatar as avatar2,d.name as relation_name,d.icon as image')
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0])
->order('a.updatetime desc')
->select();
@@ -2555,80 +2528,15 @@ class Room extends Model
public function user_reconnect($user_id,$room_id)
{
if(!$room_id){
// $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
$room_id = Db::name('vs_room_visitor')->where('user_id', $user_id)->order('id desc')->value('room_id');
}
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
//查询用户在几个房间
$room = db::name('vs_room_visitor')->where('user_id', $user_id)->select();
if($room){
$userinroom = 0;
foreach ($room as $v){
if($v['room_id'] == $room_id){
$userinroom = $room_id;
break;
}
}
if($userinroom == $room_id){
$room_info = db::name('vs_room_visitor')->where(['id' => $room_id])->update(['room_id' => $room_id, 'user_id' => $user_id, 'updatetime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '更新加入房间失败', 'data' => null];
}
}else
{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
}
}
}else{
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time(),'remarks' =>'断线后重连']);
$room = db::name('vs_room_visitor')->where(['user_id' => $user_id,'room_id' => $room_id])->find();
if(!$room){
$room_info = db::name('vs_room_visitor')->insert(['room_id' => $room_id, 'user_id' => $user_id, 'createtime' => time()]);
if(!$room_info){
return ['code' => 0, 'msg' => '加入房间失败', 'data' => null];
}
}
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}
//用户在房间内切后台保留机制
public function user_in_room_background($user_id,$room_id,$type)
{
if(!$room_id){
return ['code' => 0, 'msg' => '参数错误', 'data' => null];
}
$room_t = db::name('vs_room')->field('type_id,label_id')->where('id',$room_id)->find();
if(!(($room_t['type_id'] == 1 || $room_t['type_id'] == 8) && $room_t['label_id'] == 1)){
if($type == 1){//1-切后台2-切前台
$is_bg = db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->find();
if($is_bg){
$up_bg = [
'updatetime' => time(),
];
db::name('vs_user_in_room_bg')->where('id',$is_bg['id'])->update($up_bg);
}else{
$data = [
'user_id' => $user_id,
'room_id' => $room_id,
'createtime' => time(),
'updatetime' => time(),
];
$room_background = db::name('vs_user_in_room_bg')->insert($data);
if(!$room_background){
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
}
}
}else{
db::name('vs_user_in_room_bg')->where(['user_id' => $user_id,'room_id' => $room_id])->delete();
}
}
return ['code' => 1, 'msg' => '操作成功', 'data' => null];
}
}

View File

@@ -109,7 +109,7 @@ class RoomAuction extends Model
//参与竞拍
public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type,$ext=[])
public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type)
{
if(!$auction_id){
return ['code' => 0, 'msg' => '拍卖已经结束','data' => null];
@@ -127,7 +127,7 @@ class RoomAuction extends Model
}
//走送礼流程
$ree = model('GiveGift')->give_gift($user_id,$auction['user_id'],$gift_id,$num,2,$type,$auction['room_id'],0,0,$ext);
$ree = model('GiveGift')->give_gift($user_id,$auction['user_id'],$gift_id,$num,2,$type,$auction['room_id'],0,0);
if($ree['code'] != 1){
return ['code' => $ree['code'], 'msg' => $ree['msg'],'data' => null];
}

View File

@@ -1,73 +0,0 @@
<?php
namespace app\api\model;
use think\Db;
use think\Model;
class RoomHourRanking extends Model
{
//房间小时榜
public function room_hour_ranking($page, $page_limit,$start_time = null, $end_time = null)
{
//当前小时开始时间
if($start_time == null){
$start_time = strtotime(date('Y-m-d H:00:00'));
}
//结束时间
if($end_time == null){
$end_time = strtotime(date('Y-m-d H:59:59'));
}
//判断是否开启
$open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($open_time == 0) {
return ['code' => 0, 'msg' => '排行榜暂未开启', 'data' => null];
}
//是否开启巡乐会
$is_open_xlh = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_open_xlh');
// 更进一步的优化版本:
$subQuery = Db::name('vs_give_gift')
->where('from', 2)
->whereBetween('createtime', [$start_time, $end_time])
->buildSql();
$profit = db::name('vs_room')->alias('a')
->join([$subQuery => 'b'], 'a.id = b.from_id', 'left')
->join('vs_room_label c', 'a.label_id = c.id','left')
->field('a.id as room_id,a.user_id,a.room_name,a.label_id,a.room_cover,IFNULL(SUM(b.total_price), 0) as total_price,c.label_icon')
->where('a.room_status', 1)
->where('a.apply_status', 2)
->where('a.type_id', '<>', 6)
->group('a.id')
->order('total_price', 'desc')
->page($page, $page_limit)
->select();
if($profit){
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']);
$v['xlh_status'] = $xlh_status['xlh_status'];
}else{
$v['xlh_status'] = 0;
}
//查询房间是否有红包
if($v['room_id'] > 0){
$red_pack_status = Db::name('redpacket')->where(['room_id' => $v['room_id'], 'status' => ['<=',1]])->count();
$v['redpacket_status'] = $red_pack_status;
}else{
$v['redpacket_status'] = 0;
}
}
}
//当前小时开始时间 和结束时间 00:00-00:59 这样的格式
$time_range = date('H:') . '00-' . date('H:'). '59';
return ['code' => 1, 'msg' => '获取成功', 'data' => ['time_range' => $time_range, 'lists' =>$profit]];
}
}

View File

@@ -192,30 +192,24 @@ class RoomPit extends Model
return ['code' => 0, 'msg' => '房间违规或关闭', 'data' => null];
}
if($pit_number == 9){
//检查用户是否是房主或主持
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
if(!$is_room_owner && !$is_room_host){
return ['code' => 0, 'msg' => '没有权限', 'data' => null];
}
}
if($pit_number == 10){
return ['code' => 0, 'msg' => '请等待主持抱麦', 'data' => null];
}
//检查是否在坑位上
$pit_infos = db::name('vs_room_pit')->where(['room_id' => $room_id, 'user_id' => $user_id])->field('id,pit_number')->find();
// if($pit_infos){
// return ['code' => 0, 'msg' => '您已上麦', 'data' => null];
// }
if($room_info['label_id'] == 5 && $room_info['step'] != 1 && $pit_number < 9){
return ['code' => 0, 'msg' => '互娱房 此阶段不可操作', 'data' => null];
return ['code' => 0, 'msg' => '交友房 此阶段不可操作', 'data' => null];
}
//自由麦
if($room_info['room_up_pit_type'] == 2){
if($pit_number > 0){
if($room_info['label_id'] == 5){//交友(互娱)
if($room_info['label_id'] == 5){//交友
if($pit_number == 7 || $pit_number == 8){
return ['code' => 0, 'msg' => '该麦位已锁定了', 'data' => null];
}
@@ -234,6 +228,15 @@ class RoomPit extends Model
if($pit_info['is_lock'] == 1){
return ['code' => 0, 'msg' => '该麦位被锁定', 'data' => null];
}
if($pit_number ==9){
//检查用户是否是房主或主持
$is_room_owner =db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
if(!$is_room_owner && !$is_room_host){
return ['code' => 0, 'msg' => '您还不是房间主持人', 'data' => null];
}
}
}else{
if($room_info['label_id'] == 5){//交友
$pit_number = $this->getRoomNullPitWithout($room_id, [7,8,9,10]);
@@ -245,9 +248,13 @@ class RoomPit extends Model
return ['code' => 0, 'msg' => '当前房间没有空麦位', 'data' => null];
}
}
//换麦使用
if(isset($pit_infos) && $pit_infos['pit_number'] > 0){
// //下麦
// $dow = $this ->DownPit($user_id,$room_id,$pit_infos['pit_number']);
// if($dow['code'] != 1){
// return ['code' => 0, 'msg' => '操作失败', 'data' => null];
// }
$exchange1 = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_infos['pit_number']])->update([ 'user_id' => 0]);
$exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]);
if(!$exchange || !$exchange1){
@@ -271,51 +278,50 @@ class RoomPit extends Model
$text['to_pit_number'] = $pit_number;
model('Chat')->sendMsg(1039,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}else{
}
$ompit = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
if($ompit['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}
}else{//排麦
}else{
if($pit_number == 9){
//检查用户是否是房主或主持
$is_room_owner = db::name('vs_room')->where(['id' => $room_id, 'user_id' => $user_id])->field('id')->find();
$is_room_host = db::name('vs_room_host')->where(['room_id' => $room_id, 'user_id' => $user_id,'delete_time' => null])->field('id')->find();
//查看主持坑9坑
$host_pit = $this->where(['room_id' => $room_id, 'pit_number' => 9])->value('user_id');
if ($host_pit > 0) {
if ($host_pit == $user_id) {
return ['code' => 0, 'msg' => '您已在主持麦位', 'data' => null];
} else {
return ['code' => 0, 'msg' => '该麦位有人', 'data' => null];
if(($is_room_owner || $is_room_host) && $host_pit == 0){
//查询用户是否在麦位上
$is_on = $this->where(['room_id' => $room_id, 'user_id' => $user_id])->value('pit_number');
if($is_on){
//下麦
$dow = $this ->DownPit($user_id,$room_id,$is_on);
if($dow['code'] != 1){
return ['code' => 0, 'msg' => '操作失败', 'data' => null];
}
}else{
if(isset($pit_infos) && $pit_infos['pit_number'] > 0){
$exchange1 = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_infos['pit_number']])->update([ 'user_id' => 0]);
$exchange = db::name('vs_room_pit')->where(['room_id' => $room_id, 'pit_number' => $pit_number])->update([ 'user_id' => $user_id]);
if(!$exchange || !$exchange1){
return ['code' => 0, 'msg' => '换麦失败', 'data' => null];
}
$FromUserInfo = db::name('user')->where('id',$user_id)->field('id as user_id,nickname,avatar,sex')->find();
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($user_id);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($user_id);//魅力图标
$FromUserInfo['dress'] = model('Decorate')->user_decorate_detail($user_id,1);
$FromUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $user_id,'room_id' => $room_id])->value('charm');
$text['text'] = $FromUserInfo['nickname'].' 换到主持麦 ';
$text['FromUserInfo'] = $FromUserInfo;
$text['from_pit_number'] = $pit_infos['pit_number'];
$text['to_pit_number'] = $pit_number;
model('Chat')->sendMsg(1039,$room_id,$text);
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}else{
//直接上主持麦
$ont = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
$ont = $this->OnPit($user_id,$room_id,9);//用户上了这个房间的几号麦位
if($ont['code'] != 1){
return ['code' => 0, 'msg' => '上麦失败', 'data' => null];
}
//查找是否在申请列表里
$apply_pit = db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id])->find();
if($apply_pit){
$this->clear_apply_pit_list($user_id, $room_id, $user_id);
// db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id])->delete();
// $count = db::name('vs_room_pit_apply')->where(['room_id' => $room_id,'status' => 0])->count();
// //申请上麦推送消息
// $text = [
// 'text' => '申请上麦',
// 'count' => $count
// ];
// model('Chat')->sendMsg(1034,$room_id,$text);
}
return ['code' => 1, 'msg' => '上麦成功', 'data' => null];
}
}
}else{
//检查用户是否已经申请
$apply_pit_info = db::name('vs_room_pit_apply')->where(['room_id' => $room_id, 'user_id' => $user_id,'apply_type' =>1])->field('id')->find();
if($apply_pit_info){
@@ -347,7 +353,6 @@ class RoomPit extends Model
return ['code' => 1, 'msg' => '申请成功,请等待房主审核', 'data' => null];
}
}
}
//申请上麦列表
public function apply_pit_list($userId,$room_id)
@@ -361,6 +366,15 @@ class RoomPit extends Model
'a.status' => 0,
];
// $res = model('Room')->get_room_label($room_id);
// $room_label = $res['data']['label_id'];
// $room_type = $res['data']['type_id'];
// if($room_label == 1 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
// $where['a.apply_type'] = 1;
// }elseif ($room_label == 2 && ($room_type == 1 || $room_type == 3 || $room_type == 4)){
// $where['a.apply_type'] = 2;
// }
$list['regular'] = db::name('vs_room_pit_apply')->alias('a')->join('user b','a.user_id = b.id')
->where($where)->where('a.type',0)->field('a.user_id,a.rank_value,b.nickname,b.avatar')
->order('a.rank_value desc')->select();

View File

@@ -20,28 +20,6 @@ class Sms extends Model
if (!checkMobile($mobile)) {
return ['code' => 0, 'msg' => '手机号不正确','data' =>null];
}
//今天验证码错误次数
$sms_count = db::name('sms_error')->where(['mobile' => $mobile,'createtime' => ['between', [strtotime(date('Y-m-d')), time()]]])->count();
if ($sms_count >= 5) {
$user_id = db::name('user')->where('mobile', $mobile)->value('id');
$block_num = db::name('block')->where(['type' => 1, 'type_text' => $user_id])->find();
if(!$block_num){
//封禁账号
$error_data = [
'type' => 1,
'type_text' => $user_id,
'block_time' => time() + 60 * 60 * 24,
'block_note' => '账号登录异常被封禁24小时',
'createtime'=> time(),
];
db::name('block')->insert($error_data);
db::name('user')->where('id', $user_id)->update(['status' => 2]);
}
return ['code' => 0, 'msg' => '验证码错误次数过多,账号已被封禁,请联系管理员处理','data' =>null];
}
$is_code = db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->order('id desc')->find();
if ($is_code && $is_code['code'] == $code) {
//验证码正确
@@ -56,19 +34,9 @@ class Sms extends Model
}
}
db::name('sms')->where(['mobile' => $mobile, 'event' => $type])->delete();
//登陆成功后 把所有的登录错误删除掉
db::name('sms_error')->where(['mobile' => $mobile])->delete();
return ['code' =>1, 'msg' =>'验证码正确','data' =>null];
} else {
//验证码错误次数
$count_sms = max(5 - $sms_count, 0);
$data = [
'mobile' => $mobile,
'sms' => $code,
'createtime'=> time(),
];
db::name('sms_error')->insert($data);
return ['code' => 0, 'msg' => '验证码错误,'.$count_sms.'次后账号将被封禁24小时','data' =>null];
return ['code' => 0, 'msg' => '验证码错误','data' =>null];
}
}

View File

@@ -914,148 +914,28 @@ class Tencent extends Model
return ['ActionStatus' => 'OK', 'ErrorInfo' => '', 'ErrorCode' => 0];
}
//腾讯IM监控在线状态更新
public function tencent_member_status_changeee($info){
$uid = substr($info['To_Account'],1);
$action = $info['Action'];
if($action == 'Disconnect') {
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
if($quit_room) {
foreach ($quit_room as &$v){
if(isset($v['room_id'])){
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
Log::record("腾讯离线推送,我是二卡八","infos");
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else {
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
if(!$bg_room){
Log::record("腾讯离线推送,要踢你","infos");
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}
$room_type = null;
}
}
} elseif ($action == 'Login') {
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
$text['text'] = '重新上线!';
$text['user_id'] = $uid;
$text['type'] = 1;
model('Chat')->sendMsg(1058,$room,$text);
}elseif ($action == 'Logout'){
// Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
// $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
// $text['text'] = '掉线!';
// $text['user_id'] = $uid;
// $text['type'] = 2;
// model('Chat')->sendMsg(1058,$room,$text);
}
return true;
}
//腾讯IM监控在线状态更新
public function tencent_member_status_change($info){
$uid = substr($info['To_Account'],1);
$action = $info['Action'];
if($action == 'Disconnect') {
$is_keep = 1;
$keep = db::name('vs_xintiao')->where('user_id' , $uid)->find();
if(isset($keep)){
if(time() - $keep['updatetime'] >= 60){
$is_keep = 0;
}
}
//判断保活用户是否安卓用户
$user_system = db::name('user')->where('id' , $uid)->value('system');
if($user_system == 'android'){
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
Log::record("腾讯离线推送,用户安卓所在房间信息".json_encode($quit_room),"infos");
if($quit_room) {
foreach ($quit_room as &$v){
if(isset($v['room_id'])){
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
// Log::record("腾讯离线推送,我是二卡八","infos");
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{
foreach ($quit_room as $v){
$room_type = db::name('vs_room')->where(['id' => $v['room_id'],'room_status' => 1])->field('step,type_id')->find();
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else{
//查询是否有切后台的操作
// $bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
// if(!$bg_room){
// // Log::record("腾讯离线推送,要踢你","infos");
// model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
// }
Log::record("腾讯离线推送,判断心跳".$is_keep,"infos");
if($is_keep == 0){
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}
$room_type = null;
}
}
}else{
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$quit_room = Db::name('vs_room_visitor')->where('user_id', $uid)->select();
// Log::record("腾讯离线推送,房间信息".json_encode($quit_room),"infos");
if($quit_room) {
foreach ($quit_room as &$v){
if(isset($v['room_id'])){
$room_type = db::name('vs_room')->where(['id' => $v['room_id']])->field('step,type_id,label_id')->find();
// Log::record("腾讯离线推送,房间类型".json_encode($room_type),"infos");
if($room_type['label_id'] == 1 && ($room_type['type_id'] == 1 || $room_type['type_id'] == 8)){
// Log::record("腾讯离线推送,我是二卡八","infos");
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
}else{
if(isset($room_type) && ($room_type['type_id'] == 7 && ($room_type['step'] == 2 ||$room_type['step'] == 3)) || $room_type == 2){
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$v['room_id'],$text);
}else {
//查询是否有切后台的操作
$bg_room = db::name('vs_user_in_room_bg')->where(['room_id' => $v['room_id'],'user_id' => $v['user_id']])->find();
if(!$bg_room){
// Log::record("腾讯离线推送,要踢你","infos");
model('Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}
$room_type = null;
}
}
}
} elseif ($action == 'Login') {
Db::name('user')->where('id', $uid)->update(['is_online' => 1, 'updatetime' => time()]);
@@ -1066,12 +946,12 @@ class Tencent extends Model
$text['type'] = 1;
model('Chat')->sendMsg(1058,$room,$text);
}elseif ($action == 'Logout'){
// Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
// $room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
// $text['text'] = '掉线!';
// $text['user_id'] = $uid;
// $text['type'] = 2;
// model('Chat')->sendMsg(1058,$room,$text);
Db::name('user')->where('id', $uid)->update(['is_online' => 0, 'updatetime' => time()]);
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
$text['text'] = '掉线!';
$text['user_id'] = $uid;
$text['type'] = 2;
model('Chat')->sendMsg(1058,$room,$text);
}
return true;
}

View File

@@ -841,35 +841,6 @@ class User extends Model
}
//关注房间(红包专用)
public function follow_room($user_id,$room_id,$type){
if(empty($room_id)){
return ['code' => 0, 'msg' => '房间ID不能为空', 'data' => null];
}
if($type == 0){
//取消关注
$re = db::name('user_follow')->where(['user_id' => $user_id,'follow_id' => $room_id,'type' => 2])->delete();
if(!$re){
return ['code' => 0, 'msg' => '取消关注失败', 'data' => null];
}
return ['code' => 1, 'msg' => '取消关注成功', 'data' => null];
}else{
//关注
$data = [
'user_id' => $user_id,
'follow_id' => $room_id,
'type' => 2,
'createtime' => time()
];
$re = db::name('user_follow')->insert($data);
if(!$re){
return ['code' => 0, 'msg' => '关注失败', 'data' => null];
}
return ['code' => 1, 'msg' => '关注成功', 'data' => null];
}
}
//更新用户ip
public function update_user_ip($user_id,$ip){
//判断$ip是否是汉字

View File

@@ -313,47 +313,56 @@ class UserData extends Model
];
db::name('user_auth')->insert($auth);
$config = get_system_config();
//获取Access Token
$access_token = $this->redis->get('access_token_'.$config['tencent_app_id']);
//判断是否过期
if(empty($access_token)){
$access_token = model('Tencent')->getAccessToken($config['tencent_app_id'],$config['tencent_app_secret']);
$this->redis->set('access_token_'.$config['tencent_app_id'],$access_token,1000);
sleep(1);
//获取SignTicket
$sign_ticket = model('Tencent')->getSignTicket($access_token,$config['tencent_app_id']);
$this->redis->set('sign_ticket_'.$config['tencent_app_id'],$sign_ticket,1100);
}
$sign_ticket = $this->redis->get('sign_ticket_'.$config['tencent_app_id']);
//获取NONCE Ticket
$nonce_ticket = model('Tencent')->getNonceTicket($access_token,$user_id,$config['tencent_app_id']);
//获取随机字符串
$nonceStr = generateRandom(32);
//生成一个订单号 并保存在redis
$orderNo = generateRandom(12);
//保存在redis
$this->redis->set('order_no_tencent_'.$user_id,$orderNo,3600);
//生成签名
$sign = model('Tencent')->getSign($user_id,$nonceStr,$sign_ticket,$config['tencent_app_id']);
//生成faceId
$faceId = model('Tencent')->getFaceId($orderNo,$real_name,$id_card,$sign,$user_id,$config['tencent_app_id'],$nonceStr);
if(isset($faceId['code'])){
return ['code' => 0, 'msg' => $faceId['msg'],'data' =>null];
$res = $this->real_name_verify($real_name,$id_card);
if($res['code'] == 200){
//修改状态
db::name('user_auth')->where(['real_name' => $real_name,'card_id' => $id_card])->update(['is_real' => 1]);
return ['code' => 1, 'msg' => '验证通过!','data' =>null];
}else{
return ['code' => 0, 'msg' => $res['msg'],'data' =>null];
}
$data = [
'userid' => 'u'.$user_id,
'nonce' => $nonceStr,
'sign' => $sign,
'appid' => $config['tencent_app_id'],
'orderNo' => $orderNo,
'apiVersion'=>'1.0.0',
'licence'=>$config['tencent_licence'],
'faceId' => $faceId
];
return ['code' => 1, 'msg' => '获取成功','data' =>$data];
// $config = get_system_config();
// //获取Access Token
// $access_token = $this->redis->get('access_token_'.$config['tencent_app_id']);
// //判断是否过期
// if(empty($access_token)){
// $access_token = model('Tencent')->getAccessToken($config['tencent_app_id'],$config['tencent_app_secret']);
// $this->redis->set('access_token_'.$config['tencent_app_id'],$access_token,1000);
// sleep(1);
// //获取SignTicket
// $sign_ticket = model('Tencent')->getSignTicket($access_token,$config['tencent_app_id']);
// $this->redis->set('sign_ticket_'.$config['tencent_app_id'],$sign_ticket,1100);
// }
// $sign_ticket = $this->redis->get('sign_ticket_'.$config['tencent_app_id']);
//
// //获取NONCE Ticket
// $nonce_ticket = model('Tencent')->getNonceTicket($access_token,$user_id,$config['tencent_app_id']);
// //获取随机字符串
// $nonceStr = generateRandom(32);
// //生成一个订单号 并保存在redis
// $orderNo = generateRandom(12);
// //保存在redis
// $this->redis->set('order_no_tencent_'.$user_id,$orderNo,3600);
// //生成签名
// $sign = model('Tencent')->getSign($user_id,$nonceStr,$sign_ticket,$config['tencent_app_id']);
// //生成faceId
// $faceId = model('Tencent')->getFaceId($orderNo,$real_name,$id_card,$sign,$user_id,$config['tencent_app_id'],$nonceStr);
// if(isset($faceId['code'])){
// return ['code' => 0, 'msg' => $faceId['msg'],'data' =>null];
// }
//
// $data = [
// 'userid' => 'u'.$user_id,
// 'nonce' => $nonceStr,
// 'sign' => $sign,
// 'appid' => $config['tencent_app_id'],
// 'orderNo' => $orderNo,
// 'apiVersion'=>'1.0.0',
// 'licence'=>$config['tencent_licence'],
// 'faceId' => $faceId
// ];
// return ['code' => 1, 'msg' => '获取成功','data' =>$data];
}
//实名认证结果
@@ -477,28 +486,60 @@ class UserData extends Model
$lists['ali']['name'] = "支付宝";
$lists['wx']['name'] = "微信";
$lists['bank']['name'] = "银行卡";
$lists['ali_tl']['name'] = "支付宝(通联)";
$lists['wx_tl']['name'] = "微信(通联)";
$lists['xlx_wx']['name'] = "微信(西来喜)";
$lists['xlx_ali']['name'] = "支付宝(西来喜)";
$lists['xlx_bank']['name'] = "云闪付(西来喜)";
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['xlx_ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['xlx_wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['xlx_bank']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
$lists['ali_tl']['is_with_draw_open'] = 0;
$lists['wx_tl']['is_with_draw_open'] = 0;
$lists['xlx_ali']['is_with_draw_open'] = 0;
$lists['xlx_wx']['is_with_draw_open'] = 0;
$lists['xlx_bank']['is_with_draw_open'] = 0;
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
$lists['wx']['is_bind'] = 0;
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
$lists['ali_tl']['is_bind'] = 0;
$lists['wx_tl']['is_bind'] = 0;
$lists['xlx_ali']['is_bind'] =0;
$lists['xlx_wx']['is_bind'] = 0;
$lists['xlx_bank']['is_bind'] = 0;
$lists['ali']['type'] = 2;
$lists['wx']['type'] = 1;
$lists['bank']['type'] = 3;
$lists['ali_tl']['type'] = 4;
$lists['wx_tl']['type'] = 5;
//6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
$lists['xlx_ali']['type'] = 7;
$lists['xlx_wx']['type'] = 6;
$lists['xlx_bank']['type'] = 9;
// $lists['ali']['is_pay_open'] = 0;
// $lists['wx']['is_pay_open'] = 0;
// $lists['bank']['is_pay_open'] = 0;
@@ -507,39 +548,63 @@ class UserData extends Model
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
$lists['xlx_ali']['is_pay_open'] = get_system_config_value('pay_open_xlx_ali');
$lists['xlx_wx']['is_pay_open'] = get_system_config_value('pay_open_xlx_wx');
$lists['xlx_bank']['is_pay_open'] = get_system_config_value('pay_open_xlx_bank');
}else{
$lists['ali']['name'] = "支付宝";
$lists['wx']['name'] = "微信";
$lists['bank']['name'] = "银行卡";
$lists['ali_tl']['name'] = "支付宝(通联)";
$lists['wx_tl']['name'] = "微信(通联)";
$lists['xlx_wx']['name'] = "微信(西来喜)";
$lists['xlx_ali']['name'] = "支付宝(西来喜)";
$lists['xlx_bank']['name'] = "云闪付(西来喜)";
$lists['ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['bank']['icon'] = localpath_to_netpath('data/default/bankpay.png');
$lists['ali_tl']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['wx_tl']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['xlx_ali']['icon'] = localpath_to_netpath('data/default/alipay.png');
$lists['xlx_wx']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['xlx_bank']['icon'] = localpath_to_netpath('data/default/wxpay.png');
$lists['ali']['is_with_draw_open'] = get_system_config_value('withdraw_ali');
$lists['wx']['is_with_draw_open'] = get_system_config_value('withdraw_wx');
$lists['bank']['is_with_draw_open'] = get_system_config_value('withdraw_bank');
$lists['ali_tl']['is_with_draw_open'] = 0;
$lists['wx_tl']['is_with_draw_open'] = 0;
$lists['xlx_ali']['is_with_draw_open'] = 0;
$lists['xlx_wx']['is_with_draw_open'] = 0;
$lists['xlx_bank']['is_with_draw_open'] = 0;
$lists['ali']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('alipay_account') ? 1 : 0;
$lists['wx']['is_bind'] = 0;
$lists['bank']['is_bind'] = db::name('user_data')->where('user_id',$user_id)->value('bank_card_number') ? 1 : 0;
$lists['ali_tl']['is_bind'] = 0;
$lists['wx_tl']['is_bind'] = 0;
$lists['xlx_ali']['is_bind'] =0;
$lists['xlx_wx']['is_bind'] = 0;
$lists['xlx_bank']['is_bind'] = 0;
$lists['ali']['type'] = 2;
$lists['wx']['type'] = 1;
$lists['bank']['type'] = 3;
$lists['ali_tl']['type'] = 4;
$lists['wx_tl']['type'] = 5;
//6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
$lists['xlx_ali']['type'] = 7;
$lists['xlx_wx']['type'] = 6;
$lists['xlx_bank']['type'] = 9;
$lists['ali']['is_pay_open'] = get_system_config_value('pay_open_ali');
$lists['wx']['is_pay_open'] = get_system_config_value('pay_open_wx');
$lists['bank']['is_pay_open'] = get_system_config_value('pay_open_bank');
$lists['ali_tl']['is_pay_open'] = get_system_config_value('pay_open_ali_tl');
$lists['wx_tl']['is_pay_open'] = get_system_config_value('pay_open_wx_tl');
$lists['xlx_ali']['is_pay_open'] = get_system_config_value('pay_open_xlx_ali');
$lists['xlx_wx']['is_pay_open'] = get_system_config_value('pay_open_xlx_wx');
$lists['xlx_bank']['is_pay_open'] = get_system_config_value('pay_open_xlx_bank');
}
return ['code' => 1, 'msg' => '获取成功','data' =>$lists];
@@ -594,16 +659,73 @@ class UserData extends Model
if($type == 3){
$data = db::name('user_data')->where('user_id',$user_id)->field('id,bank_card_number,bank_user_name,bank_card,open_bank')->find();
}
if($data['bank_card_number']==0){
$data['bank_card_number'] = '';
}
if($data['bank_card']==0){
$data['bank_card'] = '';
}
if($data['open_bank']==0){
$data['open_bank'] = '';
}
return ['code' => 1, 'msg' => '获取成功','data' =>$data];
}
//身份证二要素认证
public function real_name_verify($real_name, $card_id)
{
// 云市场分配的密钥Id
$secretId = '1QMATmzeRHC7Auz8';
// 云市场分配的密钥Key
$secretKey = 'FKeTuxiKC76DrdPMAu4nhsppLZ1mI93l';
// 签名
$datetime = gmdate('D, d M Y H:i:s T');
$signStr = sprintf("x-date: %s", $datetime);
$sign = base64_encode(hash_hmac('sha1', $signStr, $secretKey, true));
$auth = sprintf('{"id": "%s", "x-date": "%s" , "signature": "%s"}', $secretId, $datetime, $sign);
// 请求方法
$method = 'GET';
// 请求头
$headers = array(
'Authorization' => $auth,
);
// 查询参数
$queryParams = array (
'cardNo' => $card_id,
'realName' => $real_name,
);
// body参数POST方法下
$bodyParams = array (
);
$sendData = http_build_query($bodyParams);
// url参数拼接
$url = 'https://ap-beijing.cloudmarket-apigw.com/service-hcgajsa5/idcard/VerifyIdcardv2';
if (count($queryParams) > 0) {
$url .= '?' . http_build_query($queryParams);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
if (in_array($method, array('POST', 'PUT', 'PATCH'), true)) {
$headers['Content-Type'] = 'application/x-www-form-urlencoded';
curl_setopt($ch, CURLOPT_POSTFIELDS, $sendData);
}
curl_setopt($ch, CURLOPT_HTTPHEADER, array_map(function ($v, $k) {
return $k . ': ' . $v;
}, array_values($headers), array_keys($headers)));
// $data = json_decode(curl_exec($ch), true);
$result = curl_exec($ch);
if($result) {
$data = json_decode($result, true);
// var_dump($data);exit;
if ($data['error_code'] == 0) {
if ($data['result']['isok']) {
return ['code' => 200, 'msg' => '验证成功', 'data' => null];
} else {
return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null];
}
} else {
return ['code' => 201, 'msg' => '信息有误' . json_encode($data), 'data' => null];
}
}
return ['code' => 201, 'msg' => '信息有误', 'data' => null];
}
}

View File

@@ -34,10 +34,6 @@ class UserGiftPack extends Model
const DRAW_GIFT = 7;
//巡乐会抽奖所得
const XLH_DRAW_GIFT_GET = 8;
//小时榜获得
const HOUR_RANK_GET = 9;
//新人充值好礼
const NEW_CHARGE_GIFT = 10;
public static function init()
{
@@ -55,9 +51,7 @@ class UserGiftPack extends Model
self::GIFT_USE => '礼物使用',
self::FIRST_CHARGE => '首充获得',
self::DRAW_GIFT => '天降好礼获得',
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得',
self::HOUR_RANK_GET => '小时榜获得',
self::NEW_CHARGE_GIFT => '新人充值好礼'
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得'
];
}
@@ -106,7 +100,6 @@ class UserGiftPack extends Model
self::FIRST_CHARGE,
self::DRAW_GIFT,
self::XLH_DRAW_GIFT_GET
,self::HOUR_RANK_GET
];
//获取背包日志列表
$log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type)

View File

@@ -50,18 +50,17 @@ class UserWallet extends Model
// 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
// 15.首充 16.天降好礼充值 17.退出工会扣款 18.房主收益 19.主持人收益20.发布头条扣除余额,21.公会长收益,22.提现驳回或提现失败返还,23.财富等级奖励金币领取,24.删除关系扣金币
//27.小时榜获得28-新人充值好礼,32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石) 33-红包剩余退回金币34-红包剩余退回(钻石)
if($gift_type == 1){ //1金币2收益钻石
if($in_out_type == 1){//1收入
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26,27,30,28,33];
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26];
}elseif($in_out_type == 2){//2支出
$in_out_types = [4,7,10,17,20,24,25,32];
$in_out_types = [4,7,10,17,20,24,25];
}
}elseif($gift_type == 2){ //1金币2收益钻石
if($in_out_type == 1){//1收入
$in_out_types = [6,9,11,12,18,19,21,22,31,28,34];
$in_out_types = [6,9,11,12,18,19,21];
}elseif($in_out_type == 2){//2支出
$in_out_types = [3,14,29];
$in_out_types = [3,14];
}
}

View File

@@ -43,13 +43,6 @@ class UserWithdrawal extends Model
if(!$age){
return ['code' => 0, 'msg' => '该身份证号未满18岁', 'data' => null];
}
if(empty($type)){
return ['code' => 0, 'msg' => '请选择提现方式', 'data' => null];
}
//提现不能有小数
if($number != floor($number)){
return ['code' => 0, 'msg' => '提现不能有小数!', 'data' => null];
}
//判断用户是否签约云账户
$yun_pay = new YunPay();
$sign_status = $yun_pay->getApiUserSignStatus($user_info['real_name'],$user_info['card_id']);
@@ -199,10 +192,10 @@ class UserWithdrawal extends Model
$where['createtime'] = ['>=',strtotime($search_stime)];
}
if($search_etime){
$where['createtime'] = ['<=',strtotime($search_etime)];
$where['createtime'] = ['<=',strtotime($search_etime.' 23:59:59')];
}
if(!empty($search_stime) && !empty($search_etime)){
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
}
$withdraw_list = db::name('vs_user_withdrawal')
->where($where)
@@ -214,26 +207,6 @@ class UserWithdrawal extends Model
$return_data[$key]['money'] = $value['money'];
$return_data[$key]['status'] = $value['status'];
$return_data[$key]['status_str'] = $this->withdraw_status[$value['status']];
//手续费
$return_data[$key]['withdraw_fee'] = $value['server_money'] ?? 0;
$return_data[$key]['personal_tax_rate'] = $value['personal_tax_rate'] ?? 0; //税率
$return_data[$key]['received_tax_amount'] = $value['received_tax_amount'] ?? 0; //税费
//预计到账金额
//1待处理2已通过3已拒绝 4打款中[云账户]5打款失败[云账户]6已打款[云账户]
if($value['status'] == 1 || $value['status'] == 2 || $value['status'] ==4){
$surplus_money = $value['money'] - $value['server_money'];
$return_data[$key]['received_tax_amount'] = 0;
}elseif($value['status'] == 3 || $value['status'] ==5){
$surplus_money = $value['money'];
$return_data[$key]['withdraw_fee'] = 0;
$return_data[$key]['received_tax_amount'] = 0;
}elseif($value['status'] == 6){
$surplus_money = $value['money'] - $value['server_money'] - $value['received_tax_amount'];
}else{
$surplus_money = $value['money'];
}
$return_data[$key]['surplus_money'] = round($surplus_money,2);
$return_data[$key]['createtime'] = date('Y-m-d H:i:s',$value['createtime']);
}
return ['code' => 1, 'msg' => '成功', 'data' => $return_data];

View File

@@ -880,7 +880,7 @@ function generateRandom($num = 0)
}
return $str;
}
function generateRandoms($length = 6)
function generateRandoms($length = 4)
{
$min = pow(10, $length - 1);
$max = pow(10, $length) - 1;
@@ -1185,6 +1185,14 @@ function handelCharge($where,$data){
db::rollback();
return 0;
}
//首充
if($is_first_charge == 0){
$first_recharge = model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
// if($first_recharge['code'] != 1){
// db::rollback();
// return 0;
// }
}
//给上级返佣
//获取上级
@@ -1196,23 +1204,9 @@ function handelCharge($where,$data){
return 0;
}
}
db::commit();
//活动
//首充
if($is_first_charge == 0){
model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
}
switch ($orderModel['type_params']){
case 2:
//天降好礼
model('Activities')->drop_gift_send($orderModel['user_id'],$orderModel['money']);
break;
case 3:
//新人好礼
model('Activities')->new_charge_gift_send($orderModel['user_id'],$orderModel['money']);
}
return 1;
} catch (\Exception $e){
db::rollback();
@@ -1287,22 +1281,6 @@ function getMillisecond() {
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
}
/*
* 写入日志到redis
* @param string $key 日志key
* @param array $logData 日志数据
*/
function write_log_redis($key = 'log',$logData = [],$time = 7){
$redis = new \Redis();
// 连接到Redis服务器
$redis->connect(config('redis.host'), config('redis.port')); // 根据实际配置调整主机和端口
// 选择数据库2
$redis->select(2);
$key = $key.'_'.date('Y-m-d-H-i-s');
$expire = 86400 * $time;
$redis->setex($key, $expire, json_encode($logData));
}

View File

@@ -22,7 +22,7 @@ class BaseCom extends Controller
//检测系统是否维护中
$is_maintenance = get_system_config_value('is_maintenance');
if($is_maintenance == 2){
return V(0, '系统维护中');
return V(203, '系统维护中');
}
//检测是什么系统
$system = input('system','');

View File

@@ -73,10 +73,6 @@ class Push
//房间盘推送
//巡乐会推送开启进度推送
const PUSH_ROOM_PAN_XLH_PROGRESS = 8000;
//小时榜
const PUSH_ROOM_PAN_HOUR_PROGRESS = 8001;
//红包
const PUSH_ROOM_PAN_RED_PROGRESS = 8002;
public $user_id, $room_id, $topic_room, $topic_client;
@@ -303,17 +299,6 @@ class Push
$this->push(self::PUSH_ROOM_PAN_XLH_PROGRESS, $topic, $data);
}
//小时榜推送
public function hourRanking($data){
$topic = 'qx_hour_ranking';
$this->push(self::PUSH_ROOM_PAN_HOUR_PROGRESS, $topic, $data);
}
//红包来了
public function redpacketArrive($data){
$topic = 'qx_redpacket_arrive';
$this->push(self::PUSH_ROOM_PAN_RED_PROGRESS, $topic, $data);
}

View File

@@ -163,10 +163,10 @@ class adminApi extends Controller
// 判断是否需要验证权限
if (!$this->auth->match($this->noNeedRight)) {
// 判断控制器和方法是否有对应权限
// if (!$this->auth->check($path)) {
// Hook::listen('admin_nopermission', $this);
// return V(302,"你没有权限访问", url('index/login', []));
// }
if (!$this->auth->check($path)) {
Hook::listen('admin_nopermission', $this);
return V(302,"你没有权限访问", url('index/login', []));
}
}
}

View File

@@ -1,114 +0,0 @@
<?php
namespace app\common\library;
class RedpacketLua
{
/**
* 抢红包Lua脚本
* 保证原子性操作,防止超抢
*/
public static function grabRedpacketScript()
{
return <<<LUA
-- KEYS[1]: 红包key, KEYS[2]: 用户集合key, KEYS[3]: 用户ID
-- ARGV[1]: 当前时间
local redpacketKey = KEYS[1]
local userSetKey = KEYS[2]
local userId = KEYS[3]
local currentTime = tonumber(ARGV[1])
-- 检查红包是否存在
local redpacketData = redis.call('HGETALL', redpacketKey)
if not redpacketData or #redpacketData == 0 then
return {0, "红包不存在", 0}
end
-- 将哈希数据转为table
local redpacket = {}
for i = 1, #redpacketData, 2 do
redpacket[redpacketData[i]] = redpacketData[i + 1]
end
-- 检查红包状态
local status = tonumber(redpacket['status'])
local startTime = tonumber(redpacket['start_time'])
local endTime = tonumber(redpacket['end_time'])
if status == 0 then
if currentTime < startTime then
return {0, "红包还未开始", 0}
else
-- 更新状态为进行中(1)
redis.call('HSET', redpacketKey, 'status', 1)
status = 1
end
end
if status ~= 1 then
return {0, "红包已结束", 0}
end
if currentTime > endTime then
redis.call('HSET', redpacketKey, 'status', 2)
return {0, "红包已结束", 0}
end
-- 检查是否已经抢过
local hasGrabbed = redis.call('SISMEMBER', userSetKey, userId)
if hasGrabbed == 1 then
return {0, "已经抢过该红包", 0}
end
-- 检查是否还有剩余
local leftAmount = tonumber(redpacket['left_amount'])
local leftCount = tonumber(redpacket['left_count'])
if leftCount <= 0 or leftAmount <= 0 then
return {0, "红包已抢完", 0}
end
-- 计算红包金额
local amount = 0
local isFinished = 0
if leftCount == 1 then
-- 最后一个红包,获得剩余所有金额
amount = leftAmount
isFinished = 1
else
-- 随机算法:二倍均值法,保证公平性
local maxAmount = leftAmount / leftCount * 2
amount = math.random(1, math.floor(maxAmount))
-- 确保金额不会超过剩余金额
if amount > leftAmount then
amount = leftAmount
end
-- 检查是否是最后一个(由于浮点数计算可能有误差)
if leftCount == 1 or (leftAmount - amount) < 0.01 then
isFinished = 1
end
end
-- 更新红包数据
local newLeftAmount = leftAmount - amount
local newLeftCount = leftCount - 1
redis.call('HSET', redpacketKey, 'left_amount', newLeftAmount)
redis.call('HSET', redpacketKey, 'left_count', newLeftCount)
-- 标记用户已抢
redis.call('SADD', userSetKey, userId)
-- 如果抢完了,更新状态为已结束(2)
if isFinished == 1 then
redis.call('HSET', redpacketKey, 'status', 2)
end
return {1, tostring(amount), isFinished}
LUA;
}
}

View File

@@ -1,171 +0,0 @@
<?php
namespace app\common\model;
use app\common\controller\Push;
use think\Model;
use think\Db;
class Redpacket extends Model
{
// 红包状态
const STATUS_PENDING = 0; // 未开始
const STATUS_ACTIVE = 1; // 进行中
const STATUS_FINISHED = 2; // 已结束
const STATUS_REFUNDED = 3; // 已退回
// 红包类型
const TYPE_NORMAL = 1; // 普通红包
const TYPE_PASSWORD = 2; // 口令红包
// 币种类型
const COIN_GOLD = 1; // 金币
const COIN_DIAMOND = 2; // 钻石
// 倒计时选项
public static $countdownOptions = [
0 => '立刻',
60 => '1分钟',
120 => '2分钟',
300 => '5分钟',
600 => '10分钟'
];
// 领取条件
const CONDITION_NONE = 0;
const CONDITION_COLLECT_ROOM = 1;
const CONDITION_MIC_USER = 2;
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
/**
* 发红包
*/
public function createRedpacket($data)
{
// var_dump($data);exit;
Db::startTrans();
try {
// 验证用户余额
$wallet = Db::name('user_wallet')->where('user_id', $data['user_id'])->find();
$coinField = $data['coin_type'] == self::COIN_GOLD ? 'coin' : 'earnings';
if ($wallet[$coinField] < $data['total_amount']) {
return ['code' => 0, 'msg' => '余额不足', 'data' => null];
}
// 扣除余额
$delres = Db::name('user_wallet')
->where('user_id', $data['user_id'])
->dec($coinField, $data['total_amount'])
->update();
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石)
//记录用户金币日志
$data_log = [
'user_id' => $data['user_id'],
'change_value' => $data['total_amount'],
'room_id' => $data['room_id'],
'money_type' => $data['coin_type'],
'change_type' => $data['coin_type'] == self::COIN_GOLD ? 32 : 29,
'from_id' => $data['room_id'],
'remarks' => $data['coin_type'] == self::COIN_GOLD ? '金币(发红包)' : '钻石(发红包)',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data_log);
if(!$res || !$delres){
Db::rollback();
}
// 计算开始时间
$startTime = $data['countdown'] > 0 ? (time() + $data['countdown']) : time();
//获取配置项 红包没有抢完所展示时间
$endTime = $startTime + get_system_config_value('red_packet_time') ?? 120; // 默认2分钟后结束
// 创建红包
$redpacketData = [
'user_id' => $data['user_id'],
'room_id' => $data['room_id'],
'type' => $data['type'],
'password' => $data['password'] ?? '',
'countdown' => $data['countdown'],
'coin_type' => $data['coin_type'],
'total_amount' => $data['total_amount'],
'total_count' => $data['total_count'],
'left_amount' => $data['total_amount'],
'left_count' => $data['total_count'],
'conditions' => $data['conditions'] ?? '',
'status' => $data['countdown'] > 0 ? self::STATUS_PENDING : self::STATUS_ACTIVE,
'start_time' => $startTime,
'end_time' => $endTime,
'createtime' => time(),
'remark' => (!empty($data['remark']) && trim($data['remark']) !== '') ? trim($data['remark']) : '大吉大利,红包拿来啦!'
];
$redpacketId = $this->insertGetId($redpacketData);
// 设置Redis缓存
$redis = \think\Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacketId}";
$redis->hMSet($redisKey, [
'total_amount' => $data['total_amount'],
'left_amount' => $data['total_amount'],
'total_count' => $data['total_count'],
'left_count' => $data['total_count'],
'status' => $redpacketData['status'],
'start_time' => $startTime,
'end_time' => $endTime
]);
// 设置过期时间
$redis->expireAt($redisKey, $endTime + 3600); // 结束后保留1小时
Db::commit();
//给前端推送信息
$data['nickname'] = Db::name('user')->where('id', $data['user_id'])->value('nickname');
$data['avatar'] = Db::name('user')->where('id', $data['user_id'])->value('avatar');
$data['redpacket_id'] = $redpacketId;
$data['start_time'] = $startTime;//红包开抢时间
$data['redpacket_time'] = get_system_config_value('red_packet_time');//展示时间
$data['room_name'] = Db::name('vs_room')->where('id', $data['room_id'])->value('room_name');
$text = [
'redpacketInfo' => $data,
'text' => ''
];
model('api/Chat')->sendMsg(1060,$data['room_id'],$text);
$push = new Push(UID, $data['room_id']);
$texts = [
'room_id' => $data['room_id'],
'text' => $data['nickname'].'在'.$data['room_name'].'房间发了一个红包!',
'room_name' => $data['room_name'],
'nickname' => $data['nickname']
];
$push->redpacketArrive($texts);
return ['code' => 1, 'msg' => '发红包成功', 'data' => $redpacketId];
} catch (\Exception $e) {
Db::rollback();
return ['code' => 0, 'msg' => $e->getMessage(), 'data' => null];
}
}
/**
* 获取红包信息
*/
public function getRedpacketInfo($id)
{
$redpacket = $this->find($id);
if (!$redpacket) {
return null;
}
$redpacket = $redpacket->toArray();
$redpacket['nickname'] = Db::name('user')->where('id', $redpacket['user_id'])->value('nickname');
$redpacket['avatar'] = Db::name('user')->where('id', $redpacket['user_id'])->value('avatar');
$redpacket['redpacket_id'] = $redpacket['id'];
return $redpacket;
}
}

View File

@@ -1,12 +0,0 @@
<?php
namespace app\common\model;
use think\Model;
class RedpacketRecord extends Model
{
protected $autoWriteTimestamp = true;
protected $createTime = 'createtime';
protected $updateTime = false;
}

View File

@@ -73,23 +73,7 @@ class UserWallet extends Model
const TRANSFER_COIN = 25;
//好友转赠所得金币
const RECEIVE_COIN = 26;
//小时榜获得金币
const HOUR_RANK_COIN = 27;
//新人充值好礼
const NEW_USER_CHARGE_GIFT = 28;
//发红包(金币)
const RED_PACKET_COIN = 32;
//发红包(钻石)
const RED_PACKET_DIAMOND = 29;
//抢红包(金币)
const RED_PACKET_COIN_RECEIVE = 30;
//抢红包(钻石)
const RED_PACKET_DIAMOND_RECEIVE = 31;
//红包剩余退回金币34-红包剩余退回(钻石)
const RED_PACKET_LEFT_COIN = 33;
//红包剩余退回(钻石)
const RED_PACKET_LEFT_DIAMOND = 34;
//金币支出类型数组
public $coin_consumption_type_array = [
@@ -98,14 +82,12 @@ class UserWallet extends Model
self::OPERATION_GIFT,
self::GUILD_EXIT,
self::HEADLINE_REWARD,
self::TRANSFER_COIN,
self::RED_PACKET_COIN,
self::TRANSFER_COIN
];
//钻石支出类型数组
public $diamond_consumption_type_array = [
self::OPERATION_WITHDRAW,
self::MONEY_CONVERSION,
self::RED_PACKET_DIAMOND
self::MONEY_CONVERSION
];
@@ -153,15 +135,7 @@ class UserWallet extends Model
self::FINANCE_LEVEL_REWARD => '财富等级奖励金币领取',
self::DELETE_RELATION_COIN => '删除关系扣金币',
self::TRANSFER_COIN => '赠送好友金币',
self::RECEIVE_COIN => '好友转赠所得金币',
self::HOUR_RANK_COIN => '小时榜获得金币',
self::NEW_USER_CHARGE_GIFT => '新人充值好礼',
self::RED_PACKET_COIN => '发红包(金币)',
self::RED_PACKET_DIAMOND => '发红包(钻石)',
self::RED_PACKET_COIN_RECEIVE => '抢红包(金币)',
self::RED_PACKET_DIAMOND_RECEIVE => '抢红包(钻石)',
self::RED_PACKET_LEFT_COIN => '红包剩余退回(金币)',
self::RED_PACKET_LEFT_DIAMOND => '红包剩余退回(钻石)',
self::RECEIVE_COIN => '好友转赠所得金币'
];
return $status[$type] ?? '';
}

View File

@@ -1,707 +0,0 @@
<?php
namespace app\common\service;
use think\Db;
use think\Cache;
use app\common\model\Redpacket;
use app\common\model\RedpacketRecord;
use app\common\model\UserWallet;
use app\common\library\RedpacketLua;
class RedpacketService
{
/**
* 发红包
*/
public function create($data)
{
// 验证数据
$res = $this->validateCreateData($data);
if ($res['code'] == 0) {
return $res;
}
$redpacketModel = new Redpacket();
return $redpacketModel->createRedpacket($data);
}
/**
* 抢红包并返回详细结果
*/
public function grabWithResult($redpacketId, $userId)
{
$redpacketModel = new Redpacket();
$redpacket = $redpacketModel->getRedpacketInfo($redpacketId);
if (!$redpacket) {
return [
'code' => 0,
'msg' => '红包不存在',
'data' => null
];
}
// 验证领取条件
$conditionCheck = $this->checkConditionsWithResult($redpacket, $userId);
if ($conditionCheck['code'] != 1) {
return $conditionCheck;
}
// 检查红包状态
$statusCheck = $this->checkRedpacketStatus($redpacket);
if ($statusCheck['code'] != 1) {
return $statusCheck;
}
// 检查是否已经抢过
if ($this->hasUserGrabbed($redpacketId, $userId)) {
// $detail = $this->getGrabResult($redpacketId, $userId);
return [
'code' => 1,
'msg' => '已经抢过该红包',
'data' => ['code' => 2] //1-抢到了2-已经抢过红包3-没有抢到
];
}
// 使用Redis+Lua保证原子性操作
$redis = Cache::store('redis')->handler();
$script = RedpacketLua::grabRedpacketScript();
$redpacketKey = "redpacket:{$redpacketId}";
$userSetKey = "redpacket_users:{$redpacketId}";
$result = $redis->eval($script, [
$redpacketKey,
$userSetKey,
$userId,
time()
], 3);
if ($result[0] == 0) {
$message = $result[1];
if ($message == '红包已抢完') {
return [
'code' => 1,
'msg' => '手慢了,红包已抢完',
'data' => ['code' => 3] //1-抢到了2-已经抢过红包3-没有抢到
];
} elseif ($message == '已经抢过该红包') {
return [
'code' => 1,
'msg' => '已经抢过该红包',
'data' => ['code' => 2] //1-抢到了2-已经抢过红包3-没有抢到
];
}elseif ($message == '红包已结束') {
return [
'code' => 1,
'msg' => '手慢了,红包已抢完',
'data' => ['code' => 3] //1-抢到了2-已经抢过红包3-没有抢到
];
}
else{
return [
'code' => 0,
'msg' => $message,
'data' => null
];
}
}
$amount = floatval($result[1]);
$isFinished = $result[2] == 1; // Lua脚本返回是否抢完
//给前端推送销毁这个红包
// redis 记录该红包是否已经推送过了 只推送一次
if($isFinished){
$redisKey = "redpacket:{$redpacketId}:is_finished";
if (!Cache::get($redisKey)) {
Cache::set($redisKey, 1, $redpacket['countdown']+get_system_config_value('red_packet_time')+60);
$text = [
'redpacket_id' => $redpacketId,
'text' => '抢完了,请销毁该红包'
];
model('api/Chat')->sendMsg(1061,$redpacket['room_id'],$text);
}
}
// Lua脚本执行成功记录到数据库
Db::startTrans();
try {
// 创建领取记录
$recordData = [
'redpacket_id' => $redpacketId,
'user_id' => $userId,
'amount' => $amount
];
$recordModel = new RedpacketRecord();
$recordModel->save($recordData);
// 更新用户钱包
$coinField = $redpacket['coin_type'] == 1 ? 'coin' : 'earnings';
//增加余额
$addres = Db::name('user_wallet')
->where('user_id', $userId)
->inc($coinField, $amount)
->update();
//记录用户金币日志
$data = [
'user_id' => $userId,
'change_value' => $amount,
'room_id' => $redpacket['room_id'],
'money_type' => $redpacket['coin_type'],
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包(钻石)
'change_type' => $redpacket['coin_type'] == 1 ? 30 : 31,
'from_id' => $redpacket['room_id'],
'remarks' => '抢红包收入',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res || !$addres){
Db::rollback();
}
// 更新红包剩余数量和金额,如果抢完了更新状态
$updateData = [
'left_amount' => Db::raw('left_amount - ' . $amount),
'left_count' => Db::raw('left_count - 1'),
'updatetime' => time()
];
if ($isFinished) {
$updateData['status'] = Redpacket::STATUS_FINISHED;
}
Db::name('redpacket')
->where('id', $redpacketId)
->update($updateData);
Db::commit();
// 获取抢红包结果详情
$grabResult = $this->getGrabResult($redpacketId, $userId);
unset($grabResult['previous_records']);//前端不要
unset($grabResult['all_records']);//前端不要
unset($grabResult['statistics']);//前端不要
return [
'code' => 1,
'msg' => '抢红包成功',
// 'data' => $grabResult
// 'data' => null
'data' => ['code' => 1] //1-抢到了2-已经抢过红包3-没有抢到
];
} catch (\Exception $e) {
Db::rollback();
// 回滚Redis操作
$redis->hIncrByFloat($redpacketKey, 'left_amount', $amount);
$redis->hIncrBy($redpacketKey, 'left_count', 1);
$redis->sRem($userSetKey, $userId);
return [
'code' => 0,
'msg' => '系统错误,请重试'.$e->getMessage(),
'data' => null
];
}
}
/**
* 获取抢红包结果详情
*/
public function getGrabResult($redpacketId, $userId)
{
// 获取红包基本信息
$redpacket = Db::name('redpacket')
->where('id', $redpacketId)
->find();
if (!$redpacket) {
return null;
}
// 获取当前用户的领取记录
$myRecord = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->where('r.user_id', $userId)
->find();
// 获取在我之前抢到的用户记录
$previousRecords = [];
if ($myRecord) {
$previousRecords = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->where('r.createtime', '<', $myRecord['createtime'])
->order('r.createtime ASC')
->select();
}
// 获取所有记录用于统计
$allRecords = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->order('r.createtime ASC')
->select();
// 统计信息
$totalGrabbed = count($allRecords);
$totalAmount = array_sum(array_column($allRecords, 'amount'));
// 手气最佳
$bestRecord = null;
if ($allRecords) {
$maxAmount = max(array_column($allRecords, 'amount'));
foreach ($allRecords as $record) {
if ($record['amount'] == $maxAmount) {
$bestRecord = $record;
break;
}
}
}
return [
'redpacket_info' => [
'id' => $redpacket['id'],
'total_amount' => $redpacket['total_amount'],
'total_count' => $redpacket['total_count'],
'left_amount' => $redpacket['left_amount'],
'left_count' => $redpacket['left_count'],
'coin_type' => $redpacket['coin_type'],
'status' => $redpacket['status'],
'nickname' => Db::name('user')->where('id', $redpacket['user_id'])->value('nickname')
],
'my_record' => $myRecord ? [
'amount' => $myRecord['amount'],
'createtime' => $myRecord['createtime'],
'nickname' => $myRecord['nickname'],
'avatar' => $myRecord['avatar']
] : null,
'previous_records' => $previousRecords,
'all_records' => $allRecords,
'statistics' => [
'total_grabbed' => $totalGrabbed,
'total_amount_grabbed' => $totalAmount,
'best_luck' => $bestRecord ? [
'nickname' => $bestRecord['nickname'],
'avatar' => $bestRecord['avatar'],
'amount' => $bestRecord['amount']
] : null
]
];
}
/**
* 检查红包状态
*/
private function checkRedpacketStatus($redpacket)
{
$now = time();
if ($redpacket['status'] == Redpacket::STATUS_PENDING) {
if ($now < $redpacket['start_time']) {
return [
'code' => 0,
'msg' => '红包还未开始',
'data' => null
];
}
}
// if ($redpacket['status'] == Redpacket::STATUS_FINISHED ||
// $redpacket['status'] == Redpacket::STATUS_REFUNDED) {
// return [
// 'code' => 0,
// 'msg' => '红包已结束',
// 'data' => null
// ];
// }
//
// if ($now > $redpacket['end_time']) {
// return [
// 'code' => 0,
// 'msg' => '红包已结束',
// 'data' => null
// ];
// }
return ['code' => 1];
}
/**
* 检查用户是否已经抢过
*/
private function hasUserGrabbed($redpacketId, $userId)
{
$record = Db::name('redpacket_record')
->where('redpacket_id', $redpacketId)
->where('user_id', $userId)
->find();
return !empty($record);
}
/**
* 检查领取条件(返回结果格式)
*/
private function checkConditionsWithResult($redpacket, $userId)
{
$conditions = $redpacket['conditions'] ? explode(',', $redpacket['conditions']): [];
if (empty($conditions)) {
return ['code' => 1];
}
if (in_array(Redpacket::CONDITION_NONE, $conditions)) {
return ['code' => 1];
}
foreach ($conditions as $condition) {
switch ($condition) {
case Redpacket::CONDITION_COLLECT_ROOM:
if (!$this->checkUserCollectedRoom($userId, $redpacket['room_id'])) {
return [
'code' => 0,
'msg' => '不满足收藏房间条件',
'data' => null
];
}
break;
case Redpacket::CONDITION_MIC_USER:
if (!$this->checkUserOnMic($userId, $redpacket['room_id'])) {
return [
'code' => 0,
'msg' => '您不是麦上用户',
'data' => null
];
}
break;
}
}
return ['code' => 1];
}
/**
* 获取红包详情和领取记录
*/
public function getDetail($redpacketId, $currentUserId = 0)
{
$redpacketModel = new Redpacket();
$redpacket['redpacket_info'] = $redpacketModel->getRedpacketInfo($redpacketId);
if (!$redpacket) {
return null;
}
// 获取领取记录
$records = Db::name('redpacket_record')
->alias('r')
->field('r.*, u.nickname, u.avatar')
->join('user u', 'u.id = r.user_id')
->where('r.redpacket_id', $redpacketId)
->order('r.createtime ASC')
->select();
//处理createtime 字段
$records = array_map(function ($record) {
$record['createtime'] = date('Y-m-d H:i:s', $record['createtime']);
return $record;
}, $records);
$redpacket['records'] = $records;
// 检查当前用户是否已抢
$redpacket['has_grabbed'] = false;
$redpacket['my_record'] = null;
if ($currentUserId > 0) {
foreach ($records as $record) {
if ($record['user_id'] == $currentUserId) {
$redpacket['has_grabbed'] = true;
$redpacket['my_record'] = $record;
break;
}
}
}
return $redpacket;
}
/**
* 处理过期红包退款
*/
public function processExpiredRedpackets()
{
$now = time();
$redpacketModel = new Redpacket();
// 查找已结束但未退款的红包
$expiredRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_ACTIVE)
->where('end_time', '<', $now)
->where('left_count', '>', 0)
->select();
foreach ($expiredRedpackets as $redpacket) {
Db::startTrans();
try {
// 退款给发红包用户
if ($redpacket['left_amount'] > 0) {
$walletModel = new UserWallet();
$walletModel->increaseBalance(
$redpacket['user_id'],
$redpacket['coin_type'],
$redpacket['left_amount']
);
}
// 更新红包状态
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_REFUNDED,
'updatetime' => $now
]);
// 清理Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->del($redisKey);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
// 记录日志
\think\Log::error("红包退款失败: {$redpacket['id']}, 错误: " . $e->getMessage());
}
}
}
/**
* 验证创建红包数据
*/
private function validateCreateData($data)
{
if (empty($data['user_id'])) {
return ['code' => 0, 'msg' => '用户ID不能为空', 'data' => null];
}
if (empty($data['room_id'])) {
return ['code' => 0, 'msg' => '房间ID不能为空', 'data' => null];
}
if (!in_array($data['type'], [Redpacket::TYPE_NORMAL, Redpacket::TYPE_PASSWORD])) {
return ['code' => 0, 'msg' => '红包类型错误', 'data' => null];
}
if ($data['type'] == Redpacket::TYPE_PASSWORD && empty($data['password'])) {
return ['code' => 0, 'msg' => '口令红包必须设置口令', 'data' => null];
}
if (!in_array($data['coin_type'], [Redpacket::COIN_GOLD, Redpacket::COIN_DIAMOND])) {
return ['code' => 0, 'msg' => '币种类型错误', 'data' => null];
}
if ($data['total_amount'] <= 0 || $data['total_count'] <= 0) {
return ['code' => 0, 'msg' => '金额和数量必须大于0', 'data' => null];
}
if ($data['total_amount'] < $data['total_count']) {
return ['code' => 0, 'msg' => '总金额不能小于总个数', 'data' => null];
}
// 验证领取条件
if (isset($data['conditions'])) {
$res_con = $this->validateConditions($data['conditions']);
if ($res_con !== true) {
return $res_con;
}
}
return ['code' => 1, 'msg' => '验证成功', 'data' => null];
}
/**
* 验证领取条件
*/
private function validateConditions($conditions)
{
if (empty($conditions)) {
return true;
}
//字符串转为数组
$conditions = explode(',', $conditions);
if (in_array(Redpacket::CONDITION_NONE, $conditions) && count($conditions) > 1) {
return V(0, '选择"无"条件时不能选择其他条件');
}
return true;
}
/**
* 检查用户是否满足领取条件
*/
private function checkConditions($redpacket, $userId)
{
$conditions = $redpacket['conditions'] ?: [];
if (empty($conditions)) {
return true;
}
if (in_array(Redpacket::CONDITION_NONE, $conditions)) {
return true;
}
foreach ($conditions as $condition) {
switch ($condition) {
case Redpacket::CONDITION_COLLECT_ROOM:
// 检查用户是否收藏了房间
if (!$this->checkUserCollectedRoom($userId)) {
throw new \Exception('不满足收藏房间条件');
}
break;
case Redpacket::CONDITION_MIC_USER:
// 检查用户是否在麦位上
if (!$this->checkUserOnMic($userId)) {
throw new \Exception('不满足麦位用户条件');
}
break;
}
}
return true;
}
/**
* 检查用户是否收藏了房间(需要根据实际业务实现)
*/
private function checkUserCollectedRoom($userId,$roomId)
{
$collect = Db::name('user_follow')->where(['user_id' => $userId,'type' => 2,'follow_id' => $roomId])->find();
if (!$collect) {
return false;
}
return true;
}
/**
* 检查用户是否在麦位上(需要根据实际业务实现)
*/
private function checkUserOnMic($userId,$roomId)
{
$room_type = Db::name('vs_room')->where('id',$roomId)->field('type_id,label_id')->find();
//实际麦位
if($room_type['type_id'] == 1 || $room_type['type_id'] == 7 || $room_type['type_id'] == 8){
$onPit = Db::name('vs_room_pit')->where(['user_id' => $userId,'room_id' => $roomId])->value('pit_number');
if ($onPit <= 0){
return false;
}
}elseif($room_type['type_id'] ==2){//拍卖
//获取房间的当前拍卖ID
$auctionId = Db::name('vs_room_auction')->where(['room_id' => $roomId,'status' => 2])->value('auction_id');
$onPit = [];
if($auctionId){
$onPits = model('api/RoomAuction')->room_auction_list_on($auctionId);
//提取数组里面的user_id的值 来判断用户是否在里面
$onPit = array_column($onPits,'user_id');
//拍卖位 从缓存中取 Cache::get('auction_user_'.$room_id)
$onpitNumber_10 = Cache::get('auction_user_'.$roomId);
if($onpitNumber_10){
$onPit[] = $onpitNumber_10;
}
}
$onpitNumber_9 = Db::name('vs_room_pit')->where(['pit_number' => 9,'room_id' => $roomId])->value('user_id');
if($onpitNumber_9){
$onPit[] = $onpitNumber_9;
}
if (!in_array($userId,$onPit)){
return false;
}
}
return true;
}
/**
* 检查并更新红包状态
* 在抢红包前调用,确保状态正确
*/
public function checkAndUpdateRedpacketStatus($redpacketId)
{
$redpacket = Db::name('redpacket')->where('id', $redpacketId)->find();
if (!$redpacket) {
return false;
}
$now = time();
$redis = Cache::store('redis')->handler();
$redpacketKey = "redpacket:{$redpacketId}";
// 如果红包状态为未开始(0),但当前时间已超过开始时间,则更新为进行中(1)
if ($redpacket['status'] == Redpacket::STATUS_PENDING && $now >= $redpacket['start_time']) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_ACTIVE,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_ACTIVE);
return true;
}
// 如果红包状态为进行中(1),但已抢完,则更新为已结束(2)
if ($redpacket['status'] == Redpacket::STATUS_ACTIVE && $redpacket['left_count'] <= 0) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_FINISHED);
return true;
}
// 如果红包状态为进行中(1),但已超过结束时间,则更新为已结束(2)
if ($redpacket['status'] == Redpacket::STATUS_ACTIVE && $now > $redpacket['end_time']) {
Db::name('redpacket')
->where('id', $redpacketId)
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis中的状态
$redis->hSet($redpacketKey, 'status', Redpacket::STATUS_FINISHED);
return true;
}
return false;
}
}

View File

@@ -2,9 +2,6 @@
namespace app\cron\controller;
use app\common\model\Redpacket;
use app\common\model\UserWallet;
use think\Cache;
use think\Db;
use Yzh\YunPay;
@@ -33,14 +30,8 @@ class PerformPerSecond
echo "pk发起10秒后无应答拒绝\n";
$this->pk_start_refuse();
echo "\n";
echo "房间红包清退:\n";
$this->processExpiredRedpackets();
echo "\n";
// echo "房间火热值更新:\n";
// $this->room_hot_update();
// echo "\n";
// echo "提现云账号订单状态查询:\n";
// $this->withdraw_order_status();
// echo "\n";
}
@@ -145,9 +136,6 @@ class PerformPerSecond
continue;
}
}
if($value['yun_order_status'] == 5077){
continue;
}
echo "提现订单查询:".$value['order_sn']."\n";
$yun_pay = new YunPay($value['order_sn'], "", "", "", "","");
$result = $yun_pay->queryOrder($value['type']);
@@ -157,32 +145,15 @@ class PerformPerSecond
'status' => 6,
'pay_time' => time(),
'pay_message' => $result['data']['msg'],
'updatetime' => time(),
'yun_order_status' => $result['data']['code'],
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
'updatetime' => time()
]);
}else{
db::name('vs_user_withdrawal')->where('order_sn',$value['order_sn'])->update([
'status' => 5,
'pay_time' => time(),
'pay_message' => $result['data']['msg'],
'updatetime' => time(),
'yun_order_status' => $result['data']['code'],
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
'received_tax_amount' => $result['received_tax_amount'] ?? 0,
'updatetime' => time()
]);
if(in_array($result['data']['code'],[5077,261]) && $value['yun_order_status'] == null){
// if($result['data']['code']==5077 && $value['yun_order_status'] == null){
//该支付宝账户不存在或未开通手机号转账功能。如有疑问,请收款用户联系支付宝客服咨询。
//退还金币
$res = model('api/UserWithdrawal')->withdrawal_fail($value['order_sn']);
if($res){
echo "提现订单失败,退回金币成功\n";
}else{
echo "提现订单失败,退回金币失败:".$res['msg']."\n";
}
}
}
echo "提现订单查询成功:".$result['msg']."\n";
@@ -234,97 +205,4 @@ class PerformPerSecond
}
}
/**
* 处理过期红包退款
*/
public function processExpiredRedpackets()
{
$now = time();
$processedCount = 0;
// 1. 处理到时间的未开始红包,更新为进行中
$pendingRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_PENDING)
->where('start_time', '<=', $now)
->select();
foreach ($pendingRedpackets as $redpacket) {
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_ACTIVE,
'updatetime' => $now
]);
// 更新Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->hSet($redisKey, 'status', Redpacket::STATUS_ACTIVE);
$processedCount++;
}
// 2. 处理已过期的进行中红包,更新为已结束并退款
$expiredRedpackets = Db::name('redpacket')
->where('status', Redpacket::STATUS_ACTIVE)
->where('end_time', '<', $now)
->where('left_count', '>', 0)
->select();
foreach ($expiredRedpackets as $redpacket) {
Db::startTrans();
try {
// 退款给发红包用户
if ($redpacket['left_amount'] > 0) {
// 更新用户钱包
$coinField = $redpacket['coin_type'] == 1 ? 'coin' : 'earnings';
//增加余额
$addres = Db::name('user_wallet')
->where('user_id', $redpacket['user_id'])
->inc($coinField, $redpacket['left_amount'])
->update();
//记录用户金币日志
$data = [
'user_id' => $redpacket['user_id'],
'change_value' => $redpacket['left_amount'],
'room_id' => $redpacket['room_id'],
'money_type' => $redpacket['coin_type'],
//记录日志 32-发红包金币29-发红包钻石30-抢红包金币31-抢红包钻石33-红包剩余退回金币34-红包剩余退回(钻石)
'change_type' => $redpacket['coin_type'] == 1 ? 33 : 34,
'from_id' => $redpacket['room_id'],
'remarks' => '红包剩余退回',
'createtime' => time()
];
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res || !$addres){
Db::rollback();
}
}
// 更新红包状态为已结束
Db::name('redpacket')
->where('id', $redpacket['id'])
->update([
'status' => Redpacket::STATUS_FINISHED,
'updatetime' => $now
]);
// 更新Redis缓存
$redis = Cache::store('redis')->handler();
$redisKey = "redpacket:{$redpacket['id']}";
$redis->hSet($redisKey, 'status', Redpacket::STATUS_FINISHED);
Db::commit();
$processedCount++;
} catch (\Exception $e) {
Db::rollback();
// 记录日志
\think\Log::error("红包退款失败: {$redpacket['id']}, 错误: " . $e->getMessage());
}
}
echo "处理过期红包-共". $processedCount . "条数据\n";
}
}

View File

@@ -1,405 +0,0 @@
<?php
namespace app\cron\controller;
use app\common\controller\Push;
use think\Db;
use think\Log;
class RoomHourRanking
{
/*
* 运行函数
*/
function index()
{
echo "小时榜 开始发礼物:\n";
$this->send_gift();//小时榜 送礼物
echo "发礼物结束 \n";
}
public function send_gift()
{
//获取上一个小时的开始时间和结束时间
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00'));
echo "开始时间:" .$start_time."\n";
echo "结束时间:" .$end_time."\n";
//当前小时的前一个小时24小时计时法0-23
$pre_hour = date('H', strtotime('-1 hour'));
echo "上个时间段:" .$pre_hour."\n";
$is_open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
if ($is_open_time == 0) {
echo "未开启时间段:" .$is_open_time."\n";
return;
}
//是否全局飘瓶
$is_public_server = db::name('vs_hour_ranking_config')->where('id', 1)->value('is_public_server');
if ($is_public_server == 1) {
//全局飘瓶时间段
$xlh_time_range = db::name('vs_hour_ranking_config')->where('id', 1)->value('broadcast_times');
if($xlh_time_range){
if($xlh_time_range == 25){
$is_piao = 1;
}else{
//当前的前一个小时是否在 $xlh_time_range中
if (in_array($pre_hour, explode(',', $xlh_time_range))) {
$is_piao = 1;
} else {
$is_piao = 0;
}
}
}else{
$is_piao = 0;
}
}else{
$is_piao = 0;
}
//获取上一个时间段的配置
// $gift_list = db::name('vs_hour_ranking_gift_config')->where('time_id',$pre_hour)->group('ranking')->order('id', 'desc')->select();
$gift_list = $this->get_hour_ranking($pre_hour);
// echo "上个时间段的配置:" .json_encode($gift_list)."\n";
// 提取所有有奖励的内容
$allRewards = $this->extractAllRewards($gift_list);
// 按index分组
$groupedRewards = $this->groupRewardsByIndex($allRewards);
// 按名次顺序分配奖励
$distributionResult = $this->distributeByRank($groupedRewards);
//获取上个数组的个数,从而获取配置了多少个名次
$count = count($distributionResult);
echo "上个时间段的配置总数:" .$count."\n";
//获取前一个小时的 前$count名房间排行
$room_list = model('api/RoomHourRanking')->room_hour_ranking(1, $count, $start_time, $end_time);
$room_owner = [];
if ($room_list['code'] == 1) {
//获取房间排行奖励最低值
$min_price = db::name('vs_hour_ranking_config')->where('id', 1)->value('min_price');
if ($room_list['data']['lists']) {
echo "房间列表:" .json_encode($room_list['data']['lists'])."\n";
foreach ($room_list['data']['lists'] as $v){
if ($v['total_price'] >= $min_price) {
$room_owner[] = [
'user_id' => $v['user_id'],
'room_name' => $v['room_name'],
'room_id' => $v['room_id'],
'total_price' => $v['total_price']
];
}
}
}
}
if ($distributionResult && $room_owner) {
$text_list_new = [];
echo "礼物数:" .json_encode($distributionResult)."\n";
echo "房主:" .json_encode($room_owner)."\n";
foreach ($distributionResult as $k => $value) {
//礼物全部给他偷偷放在装扮表及金额 中
//有几个用户就发几个
if(count($room_owner) > $k){
// 为每个房间添加一个标志,表示是否已处理推送信息
$hasProcessedPush = false;
foreach ($value['rewards'] as $v){
if($v['type'] == 0){//1金币2礼物3头像4坐骑
echo "发金币:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
$res = $this->add_coin($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
}elseif ($v['type'] == 1){
echo "发礼物:" .$v['value'].'==>'.$room_owner[$k]['user_id']."\n";
$res = $this->add_gift($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao);
}elseif ($v['type'] == 2){
$res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,3);
}elseif ($v['type'] == 3){
$res = $this->add_decorate($v['value'], $room_owner[$k]['user_id'],$k + 1,$room_owner[$k]['room_id'],$room_owner[$k]['total_price'],$is_piao,4);
}
// 只有在第一次处理奖励时添加推送信息,避免重复推送
if(!$hasProcessedPush && $is_piao == 1) {
$room_name = $room_owner[$k]['room_name'];
//推送礼物横幅
if ($k == 0) {
$text = '新科状元!【' . $room_name . '】独占鳌头!';
} elseif ($k == 1) {
$text = '金榜榜眼!【' . $room_name . '】才气逼人!';
} elseif ($k == 2) {
$text = '风采探花!【' . $room_name . '】实力绽放!';
}
$text_list_new[] = [
'text' => $text ?? '恭喜【' . $room_name . '】获得礼物!',
'room_id' => $room_owner[$k]['room_id'],
'room_name' => $room_name,
'rank_number' => $k + 1,
];
$hasProcessedPush = true; // 标记已处理推送
}
}
}
}
if(!empty($text_list_new)){
$push = new Push();
$push->hourRanking($text_list_new);
}
}
echo "送礼-共" . count($room_owner) . "个房间房主获益\n";
}
//添加金币到钱包
public function add_coin($coin,$user_id,$ranking,$room_id,$total_price,$is_piao){
if($coin > 0){
$data = [
'user_id' => $user_id,
'change_value' => $coin,
// 'room_id' => $room_ids,
'money_type' => 1,
'change_type' => 27,
'from_id' => 0,
'remarks' => '小时榜获得',
'createtime' => time()
];
//开启事务
Db::startTrans();
$res = Db::name('vs_user_money_log')->insert($data);
if(!$res){
Db::rollback();
}
//增加用户金币
$res1 = Db::name('user_wallet')->where(['user_id'=>$user_id])->setInc('coin',$coin);
if(!$res1){
Db::rollback();
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'coin' => $coin,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao
]);
if(!$res2){
Db::rollback();
}
Db::commit();
}
return true;
}
//添加礼物到背包
public function add_gift($gift_id,$user_id,$ranking,$room_id,$total_price,$is_piao){
$res = model('api/UserGiftPack')->change_user_gift_pack($user_id,$gift_id,1,model('UserGiftPack')::HOUR_RANK_GET,"小时榜获得");
if($res['code'] == 0){
Log::record("小时榜获取礼物失败:".$res['msg'],"info");
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'gift_id' => $gift_id,
'gift_type' => 2,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao
]);
if(!$res2){
Log::record("小时榜礼物锁定失败","info");
}
return true;
}
//添加装扮到背包
public function add_decorate($avatar_id,$user_id,$ranking,$room_id,$total_price,$is_piao,$type){
$decorate_price_info = db::name('vs_decorate_price')->where(['id'=>$avatar_id])->find();
if(empty($decorate_price_info)){
Log::record("小时榜获取装扮失败:没有找到装扮!".$avatar_id,"info");
}
$res = model('api/Decorate')->pay_decorate($user_id,$decorate_price_info['did'],$decorate_price_info['day'],2);
if($res['code'] == 0){
Log::record("小时榜获取装扮失败:".$res['msg']."-".$avatar_id,"info");
}
//添加到排行表
$start_time = strtotime(date('Y-m-d H:00:00', strtotime('-1 hour')));
$end_time = strtotime(date('Y-m-d H:00:00')) - 1;
$res2 = db::name('vs_hour_ranking')->insert([
'ranking' => $ranking,
'room_id' => $room_id,
'flowing_water' => $total_price,
'gift_id' => $avatar_id,
'gift_type' => $type,
'time_id' => date('H', strtotime('-1 hour')),
'stime' => $start_time,
'etime' => $end_time,
'createtime' => time(),
'updatetime' => time(),
'is_public_server' => $is_piao,
]);
if(!$res2){
Log::record("小时榜咋装扮锁定失败","info");
}
return true;
}
/**
* 提取所有有奖励的内容
*/
private function extractAllRewards($responseData)
{
$allRewards = [];
foreach ($responseData as $timeSlot) {
foreach ($timeSlot['reward'] as $rewardItem) {
$index = $rewardItem['index'];
$content = $rewardItem['content'];
// 只处理有奖励内容的数据
if (!empty($content)) {
foreach ($content as $rewardContent) {
$allRewards[] = [
'index' => $index,
'type' => $rewardContent['type'],
'value' => $rewardContent['value'],
'name' => $rewardContent['name'] ?? ''
];
}
}
}
}
return $allRewards;
}
/**
* 按index分组奖励
*/
private function groupRewardsByIndex($allRewards)
{
$grouped = [];
foreach ($allRewards as $reward) {
$index = $reward['index'];
if (!isset($grouped[$index])) {
$grouped[$index] = [];
}
$grouped[$index][] = $reward;
}
// 按index排序
ksort($grouped);
return $grouped;
}
/**
* 按名次顺序分配奖励
*/
private function distributeByRank($groupedRewards)
{
$distribution = [];
$currentRank = 0; // 从第1名开始
// 按index顺序分配index 0 = 第1名index 1 = 第2名以此类推
foreach ($groupedRewards as $index => $rewards) {
// 确保名次连续,如果有空缺则填充空名次
while ($currentRank < $index) {
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => []
];
$currentRank++;
}
// 分配当前名次的奖励
$distribution[] = [
'rank' => $currentRank + 1,
'rewards' => $rewards
];
$currentRank++;
}
return $distribution;
}
public function get_hour_ranking($time){
// 先按时间段和排名索引分组查询
$timeRanges = db::name('vs_hour_ranking_gift_config')->distinct(true)
->where('time_id', '=', $time)
->order('time_id')
->column('time_id');
$result = [];
foreach ($timeRanges as $timeRange) {
// 查询该时间段的所有数据
$rewards = db::name('vs_hour_ranking_gift_config')->where('time_id', $timeRange)
->field('ranking, gift_type, gift_id,coin,name')
->order('ranking')
->select();
$rewardMap = [];
foreach ($rewards as $reward) {
$rankIndex = $reward['ranking'];
if (!isset($rewardMap[$rankIndex])) {
$rewardMap[$rankIndex] = [
'index' => $rankIndex,
// 'name' => $reward['rank_name'],
'content' => []
];
}
// 添加奖励内容到content数组
if ($reward['gift_id'] != 0 || $reward['coin'] != 0) {
if($reward['gift_id'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['gift_id'],
// 'coin' => $reward['coin'],
'name' => $reward['name'],
];
}
if($reward['coin'] != 0){
$rewardMap[$rankIndex]['content'][] = [
'type' => $reward['gift_type'],
'value' => $reward['coin'],
'name' => $reward['name'],
];
}
}
}
// 按index排序
ksort($rewardMap);
$result[] = [
'time' => $timeRange,
'reward' => array_values($rewardMap)
];
}
return $result;
}
}

View File

@@ -3,7 +3,6 @@
namespace app\cron\controller;
use app\common\controller\Push;
use think\Cache;
use think\Db;
@@ -44,7 +43,6 @@ class RoomPan
$room_id = $v['room_id'];
$room_name = Db::name('vs_room')->where(['id' => $room_id, 'apply_status' => 2])->value('room_name');
$FromUserInfo = Db::name('user')->where(['id'=>$v['user_id']])->find();
$FromUserInfo['user_id'] = $FromUserInfo['id'];
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($v['user_id']);//财富图标
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($v['user_id']);//魅力图标
$user_nickname = $FromUserInfo['nickname'];
@@ -127,17 +125,16 @@ class RoomPan
$res = db::name('vs_room_pan_xlh')->where('id',$value['id'])->update([
'send_time' => time()
]);
// db::name("vs_room")->where('id',$value['room_id'])->update([
// 'xlh_periods_num' => 0
// ]);
Cache::set("xlh_periods_num", 0, 0);
db::name("vs_room")->where('id',$value['room_id'])->update([
'xlh_periods_num' => 0
]);
//推送礼物横幅
$text = "本轮巡乐会已结束,请大家重新开始下一轮巡乐会";
$push = new Push(0, $value['room_id']);
$text_list_new = [
'text' => $text,
'room_id' => $value['room_id'],
'from_type' => 104
'from_type' => 3
];
$push->xunlehui($text_list_new);
continue;
@@ -174,17 +171,20 @@ class RoomPan
echo "处理发放记录失败 \n";
continue;
}
Cache::set("xlh_periods_num", 0, 0);
db::name("vs_room")->where('id',$value['room_id'])->update([
'xlh_periods_num' => 0
]);
//推送
$FromUserInfo = db::name('user')->field('nickname,avatar')->where(['id'=>$value['user_id']])->find();
$room_name = db::name('vs_room')->where(['id'=>$value['room_id']])->value('room_name');
$gift_name = db::name('vs_gift')->where(['gid'=>$value['gift_id']])->value('gift_name');
$text = $FromUserInfo['nickname'] . ' 用户在巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
$text = $FromUserInfo['nickname'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
//推送礼物横幅
$push = new Push(0, $value['room_id']);
$text_list_new = [
'text' => $text,
'room_id' => $value['room_id'],
'from_type' => 104
'from_type' => 3
];
$push->xunlehui($text_list_new);
}catch (\Exception $e){

View File

@@ -30,10 +30,10 @@ class Subsidy
*/
public function createGuildSubsidyData(){
//获取上周第一天时间
$week_start_time = strtotime('last week Monday');
$week_end_time = strtotime(date('Y-m-d 23:59:59',strtotime('last week Sunday')));
// $week_start_time = strtotime('2025-09-29');
// $week_end_time = strtotime('2025-09-29 23:59:59');
$week_start_time = strtotime('last monday');
$week_end_time = strtotime(date('Y-m-d 23:59:59',strtotime('last sunday')));
// $week_start_time = strtotime('2025-08-11');
// $week_end_time = strtotime('2025-08-17 23:59:59');
//获取上周时间
$time_value = date('o-W', $week_start_time);
@@ -43,24 +43,12 @@ class Subsidy
$data_count = 0;
foreach ($guild_list as $key => $value) {
//获取所有工会房间ID
$guild_user_data = db::name('vs_guild_user')->where('guild_id', $value['id'])->field('room_id,createtime,quit_time')->select();
$transaction = 0;
foreach ($guild_user_data as $k => $v) {
$week_start_time_seach = $week_start_time;
$week_end_time_seach = $week_end_time;
if($v['createtime'] && $week_start_time_seach < $v['createtime']){
$week_start_time_seach = $v['createtime'];
}
if($v['quit_time'] && ($week_end_time_seach > $v['quit_time'])){
$week_end_time_seach = $v['quit_time'];
}
$transaction_one = db::name('vs_give_gift')
->whereIn('from_id',$v['room_id'])
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time_seach, $week_end_time_seach]]])
$room_ids = db::name('vs_guild_user')->where('guild_id', $value['id'])->field('room_id')->select();
$room_ids = array_column($room_ids, 'room_id');
$transaction = db::name('vs_give_gift')
->whereIn('from_id',$room_ids)
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$week_start_time, $week_end_time]]])
->sum('total_price');
$transaction += $transaction_one;
}
if($transaction > 0){
//判断是否已经生成过
if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) {
@@ -77,7 +65,7 @@ class Subsidy
foreach ($config as $k => $v) {
if ($transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio'];
$subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石
$subsidy_amount = $transaction * ($subsidy_ratio / 100);
break; // 找到匹配项后提前退出循环
}
}
@@ -93,7 +81,6 @@ class Subsidy
'status' => 0,
'createtime' => time(),
];
// echo "工会".$value['id']."生成数据:流水金额:{$transaction} 补贴比例:{$subsidy_ratio}% 补贴金额:{$subsidy_amount}\n";
$subsidy_id = Db::name('vs_guild_subsidy')->insertGetId($data);
if ($subsidy_id) {
echo "工会".$value['id']."生成成功(补贴ID".$subsidy_id." 补贴金额:".$subsidy_amount.")\n";
@@ -143,7 +130,7 @@ class Subsidy
foreach ($config as $k => $v) {
if ($transaction >= $v['end_amount']) {
$subsidy_ratio = $v['subsidy_ratio'];
$subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石;
$subsidy_amount = $transaction * ($subsidy_ratio / 100);
break; // 找到匹配项后提前退出循环
}
}

View File

@@ -18,14 +18,9 @@ class TenSeconds
echo "房间在线人数:\n";
$this->auction_end_notice();//拍卖房结束提醒
echo "\n";
//清理切后台超过5分钟的用户
echo "清理切后台超过5分钟的用户\n";
$this->clear_offline_user();
echo "\n";
}
//在线人数
protected function auction_end_notice()
{
$auction_list = db::name('vs_room')->field('id')->where(['room_status'=>1,'apply_status' => 2,'type_id' =>['<>',6]])->select();
@@ -45,6 +40,17 @@ class TenSeconds
$data_number++;
}
}
// else{
// if($on_pit_num > 0){
// $text = [
// 'online_number' => $on_pit_num,
// 'room_id' => $value['id'],//接受房间id
// ];
// model('api/Chat')->sendMsg(1036,$value['id'],$text);
// $data_number++;
// }
// }
$data_count++;
}
}
@@ -52,18 +58,4 @@ class TenSeconds
echo "房间在线人数>0 的总共" . $data_number . "条数据\n";
}
//清理切后台超过5分钟的用户
protected function clear_offline_user()
{
$time = time() - 300;
$user_list = db::name('vs_user_in_room_bg')->where('updatetime', '<=', $time)->select();
if($user_list){
foreach ($user_list as $v){
//删除
db::name('vs_user_in_room_bg')->delete($v['id']);
model('api/Room')->quit_room($v['user_id'], $v['room_id'],$v['user_id'],2);
}
}
}
}

View File

@@ -1,158 +0,0 @@
<?php
namespace app\cron\controller;
use think\Db;
use Yzh\YunPay;
/*
* 定时任务,每秒执行的方法
*/
class Test
{
/*
* 运行函数
*/
function index()
{
// 设置脚本执行时间无限
set_time_limit(0);
echo "统计盲盒转盘错误数据\n";
$this->blind_box_error();
echo "\n";
}
//统计盲盒转盘错误数据
public function blind_box_error()
{
die("暂停");
// 设置数据库查询超时时间
Db::query("SET SESSION wait_timeout=600");
Db::query("SET SESSION interactive_timeout=600");
// 使用连表查询,直接找出送给多人的数据
echo "开始查询送给多人的数据...\n";
// 先查询所有有多个不同 gift_user_id 的 tid
$multipleGiftRecords = Db::name('vs_blind_box_turntable_results_log')
->group('tid')
->having('COUNT(DISTINCT gift_user_id) > 1')
->field('tid, COUNT(DISTINCT gift_user_id) as user_count,gift_user_id')
->select();
echo "找到 " . count($multipleGiftRecords) . " 条送给多人的记录\n";
// 输出详细信息
foreach ($multipleGiftRecords as $record) {
echo "转盘ID: {$record['tid']}, 接收人数: {$record['user_count']}\n";
// 获取该转盘的详细信息
$turntableInfo = Db::name('vs_blind_box_turntable_log')
->where('id', $record['tid'])
->find();
if ($turntableInfo) {
echo " 开奖用户ID: {$turntableInfo['user_id']}, 礼包ID: {$turntableInfo['gift_bag_id']}\n";
}
}
echo "统计盲盒转盘错误数据完成\n";
}
//统计盲盒转盘错误数据
public function blind_box_error1()
{
die("暂停");
// 设置数据库查询超时时间
Db::query("SET SESSION wait_timeout=600");
Db::query("SET SESSION interactive_timeout=600");
// 分批处理数据,避免一次性加载大量数据到内存
$batchSize = 1000;
$offset = 0;
$data_multiple = [];
$totalProcessed = 0;
do {
// 分批获取数据
$turntable_log = Db::name('vs_blind_box_turntable_log')
->limit($offset, $batchSize)
->select();
// 如果没有更多数据,退出循环
if (empty($turntable_log)) {
break;
}
foreach ($turntable_log as $key => $value) {
//查询本轮是否有多个接收礼物的人
$turntable_results_log = Db::name('vs_blind_box_turntable_results_log')
->where('tid', $value['id'])
->group('gift_user_id')
->select();
// 统计送给多人的数据
if (count($turntable_results_log) > 1) {
$data_multiple[] = [
'turntable_id' => $value['id'],
'recipient_count' => count($turntable_results_log),
'data' => $value
];
}
$totalProcessed++;
// 每处理100条记录输出一次进度
if ($totalProcessed % 100 == 0) {
echo "已处理 {$totalProcessed} 条记录...\n";
// 每100条记录后清理内存
gc_collect_cycles();
}
}
// 更新偏移量
$offset += $batchSize;
// 释放内存
unset($turntable_log);
unset($turntable_results_log);
} while ($totalProcessed <= 1400);
echo "送给多人的数据共 " . count($data_multiple) . " 条记录\n";
echo "统计盲盒转盘错误数据完成-共处理 " . $totalProcessed . " 条数据\n";
// 输出详细信息
foreach ($data_multiple as $item) {
echo "转盘ID: {$item['turntable_id']}, 接收人数: {$item['recipient_count']}\n";
}
}
public function RoomOwners()
{
$room = Db::name('vs_room')->where(['room_status' => 1,'apply_status' => 2])->select();
$arr = [];
foreach ($room as $key => $value) {
$liushui = Db::name('vs_give_gift')->where(['from_id' => $value['id'],'from' => 2])->sum('total_price');
$usercode = Db::name('user')->where(['id' => $value['user_id']])->value('user_code');
$nickname = Db::name('user')->where(['id' => $value['user_id']])->value('nickname');
$arr[] = [
'room_id' => $value['id'],
'user_id' => $value['user_id'],
'user_code' => $usercode,
'nickname' => $nickname,
'liushui' => $liushui
];
}
//房主的收益
foreach ($arr as $key => $v){
$shouyi = db::name('vs_user_money_log')->where(['user_id' => $v['user_id'],'change_type' => 18,'money_type' =>2,'createtime'=>['<',1759585380]])->sum('change_value');
$arr[$key]['shouyi'] = $shouyi;
$arr[$key]['duibi'] = $shouyi.'-'.$v['liushui']/10/10;
$arr[$key]['chazhi'] = $v['liushui']/10/10 - $shouyi;
}
var_dump($arr);
}
}

View File

@@ -1,12 +0,0 @@
<?php
return [
'host' => '127.0.0.1',
'port' => 6379,
'password' => '',
'select' => 0,
'timeout' => 0,
'expire' => 0,
'persistent' => false,
'prefix' => 'fa_redpacket_',
];

199
extend/Xilaixi/Xilaixi.php Normal file
View File

@@ -0,0 +1,199 @@
<?php
use think\Env;
use think\Log;
class Xilaixi
{
private $pid;
private $key;
private string $sign_type = 'MD5';
// private string $mapi_url = 'https://wxjs.980city.com/mapi.php';
private string $mapi_url = 'https://wxjs.980city.com/submit.php';
private string $api_url = 'https://wxjs.980city.com/api.php';//https://wxjs.980city.com/api.php?
function __construct(){
$this->pid = Env::get('XilaixiPay.pid');//平台分配的APPID
$this->key = Env::get('XilaixiPay.key');//平台分配的APPID
}
/**
* 西来喜支付
*/
public function XilaixiPay($date, $type) {
//6-西来喜微信7-西来喜支付宝8-西来喜QQ钱包9-西来喜云闪付
if($type == 6){
$types = 'wxpay';
}elseif ($type == 7){
$types = 'alipay';
}elseif ($type == 8){
$types = 'qqpay';
}elseif ($type == 9){
$types = 'bank';
}else{
$types = 'wxpay';
}
$ip = $this->get_client_ip();
if ($ip == '::1')
$ip = '1.1.1.1';
//构造要请求的参数数组,无需改动
$parameter = array(
"pid" => $this->pid,
"type" => $types,
"notify_url" => get_system_config_value("web_site")."/api/Payment/XilaixiPayNotify",
"return_url" => get_system_config_value("web_site")."/api/Payment/XilaixiPayNotify",
"out_trade_no" => $date['order_sn'],//商户订单号,
"name" => $date['remarke'],//订单标题(不能有空格),
"money" => $date['money'],
'clientip' => $ip,
);
Log::record("西来喜支付参数:".json_encode($parameter),"info");
$param = $this->buildRequestParam($parameter);
// $response = $this->getHttpResponse($this->mapi_url, http_build_query($param));
return $this->getHttpRequest($this->mapi_url,$param);
// return json_decode($response, true);
}
private function buildRequestParam($param){
$mysign = $this->getSign($param);
$param['sign'] = $mysign;
$param['sign_type'] = $this->sign_type;
return $param;
}
// 计算签名
private function getSign($param){
ksort($param);
reset($param);
$signstr = '';
foreach($param as $k => $v){
if($k != "sign" && $k != "sign_type" && $v!=''){
$signstr .= $k.'='.$v.'&';
}
}
$signstr = substr($signstr,0,-1);
$signstr .= $this->key;
$sign = md5($signstr);
return $sign;
}
// 请求外部资源
private function getHttpResponse($url, $post = false, $timeout = 10){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "Accept: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
// 异步回调验证
public function verifyNotify(){
if(empty($_GET)) return false;
$sign = $this->getSign($_GET);
if($sign === $_GET['sign']){
$signResult = true;
}else{
$signResult = false;
}
return $signResult;
}
// 查询订单支付状态
public function orderStatus($trade_no){
$result = $this->queryOrder($trade_no);
if($result['status']==1){
return true;
}else{
return false;
}
}
// 查询订单
public function queryOrder($trade_no){
$url = $this->api_url.'?act=order&pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no;
$response = $this->getHttpResponse($url);
$arr = json_decode($response, true);
return $arr;
}
// 订单退款
public function refund($trade_no, $money){
$url = $this->api_url.'?act=refund';
$post = 'pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no . '&money=' . $money;
$response = $this->getHttpResponse($url, $post);
$arr = json_decode($response, true);
return $arr;
}
//获取当前服务器的IP
function get_client_ip() {
if ($_SERVER ['REMOTE_ADDR']) {
$cip = $_SERVER ['REMOTE_ADDR'];
} elseif (getenv("REMOTE_ADDR")) {
$cip = getenv("REMOTE_ADDR");
} elseif (getenv("HTTP_CLIENT_IP")) {
$cip = getenv("HTTP_CLIENT_IP");
} else {
$cip = "unknown";
}
return $cip;
}
//拼接参数get请求
private function getHttpRequest($url, $param) {
// 将参数数组转换为查询字符串
$query = http_build_query($param);
// 拼接完整的URL
$fullUrl = $url . '?' . $query;
// // 初始化curl
// $ch = curl_init();
//
// // 设置curl选项
// curl_setopt($ch, CURLOPT_URL, $fullUrl);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($ch, CURLOPT_HEADER, false);
// curl_setopt($ch, CURLOPT_TIMEOUT, 30);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//
// // 设置HTTP头
// $httpheader[] = "Accept: */*";
// $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
// $httpheader[] = "Connection: close";
// curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
//
// // 执行请求
// $response = curl_exec($ch);
//
// // 检查是否有错误
// if (curl_errno($ch)) {
// Log::record("西来喜支付请求错误: " . curl_error($ch), "error");
// }
//
// // 关闭curl
// curl_close($ch);
return $fullUrl;
}
}

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>正在为您跳转到支付页面,请稍候...</title>
<style type="text/css">
body{margin:0;padding:0}
p{position:absolute;left:50%;top:50%;height:35px;margin:-35px 0 0 -160px;padding:20px;font:bold 16px/30px "宋体",Arial;text-indent:40px;border:1px solid #c5d0dc}
#waiting{font-family:Arial}
</style>
</head>
<body>
<?php
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
/**************************请求参数**************************/
$notify_url = "http://127.0.0.1/SDK/notify_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = "http://127.0.0.1/SDK/return_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//商户订单号
$out_trade_no = $_POST['WIDout_trade_no'];
//商户网站订单系统中唯一订单号,必填
//支付方式可传入alipay,wxpay,qqpay,bank,jdpay
$type = $_POST['type'];
//商品名称
$name = $_POST['WIDsubject'];
//付款金额
$money = $_POST['WIDtotal_fee'];
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = array(
"pid" => $epay_config['pid'],
"type" => $type,
"notify_url" => $notify_url,
"return_url" => $return_url,
"out_trade_no" => $out_trade_no,
"name" => $name,
"money" => $money,
);
//建立请求
$epay = new EpayCore($epay_config);
$html_text = $epay->pagePay($parameter);
echo $html_text;
?>
<p>正在为您跳转到支付页面,请稍候...</p>
</body>
</html>

205
extend/Xilaixi/index.php Normal file
View File

@@ -0,0 +1,205 @@
<?php
/* *
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>彩虹易支付接口测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
*{
margin:0;
padding:0;
}
ul,ol{
list-style:none;
}
.title{
color: #ADADAD;
font-size: 14px;
font-weight: bold;
padding: 8px 16px 5px 10px;
}
.hidden{
display:none;
}
.new-btn-login-sp{
border:1px solid #D74C00;
padding:1px;
display:inline-block;
}
.new-btn-login{
background-color: #ff8c00;
color: #FFFFFF;
font-weight: bold;
border: medium none;
width:82px;
height:28px;
}
.new-btn-login:hover{
background-color: #ffa300;
width: 82px;
color: #FFFFFF;
font-weight: bold;
height: 28px;
}
.bank-list{
overflow:hidden;
margin-top:5px;
}
.bank-list li{
float:left;
width:153px;
margin-bottom:5px;
}
#main{
width:750px;
margin:0 auto;
font-size:14px;
font-family:'宋体';
}
#logo{
background-color: transparent;
background-image: url("images/new-btn-fixed.png");
border: medium none;
background-position:0 0;
width:166px;
height:35px;
float:left;
}
.red-star{
color:#f00;
width:10px;
display:inline-block;
}
.null-star{
color:#fff;
}
.content{
margin-top:5px;
}
.content dt{
width:160px;
display:inline-block;
text-align:right;
float:left;
}
.content dd{
margin-left:100px;
margin-bottom:5px;
}
#foot{
margin-top:10px;
}
.foot-ul li {
text-align:center;
}
.note-help {
color: #999999;
font-size: 12px;
line-height: 130%;
padding-left: 3px;
}
.cashier-nav {
font-size: 14px;
margin: 15px 0 10px;
text-align: left;
height:30px;
border-bottom:solid 2px #CFD2D7;
}
.cashier-nav ol li {
float: left;
}
.cashier-nav li.current {
color: #AB4400;
font-weight: bold;
}
.cashier-nav li.last {
clear:right;
}
.alipay_link {
text-align:right;
}
.alipay_link a:link{
text-decoration:none;
color:#8D8D8D;
}
.alipay_link a:visited{
text-decoration:none;
color:#8D8D8D;
}
</style>
</head>
<body text=#000000 bgColor=#ffffff leftMargin=0 topMargin=4>
<div id="main">
<div id="head">
<dl class="alipay_link">
</dl>
<span class="title">彩虹易支付接口测试</span>
</div>
<div class="cashier-nav">
<ol>
<li class="current">1、确认信息 →</li>
<li>2、点击确认 →</li>
<li class="last">3、确认完成</li>
</ol>
</div>
<form name=alipayment action=epayapi.php method=post target="_blank">
<div id="body" style="clear:left">
<dl class="content">
<dt>商户订单号:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDout_trade_no" value="<?php echo date("YmdHis").mt_rand(100,999); ?>"/>
<span>商户网站订单系统中唯一订单号,必填
</span>
</dd>
<dt>商品名称:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDsubject" value="测试商品"/>
<span>必填
</span>
</dd>
<dt>付款金额:</dt>
<dd>
<span class="null-star">*</span>
<input size="30" name="WIDtotal_fee" value="1"/>
<span>必填
</span>
</dd>
<dt>支付方式:</dt>
<dd>
<label><input type="radio" name="type" value="alipay" checked="">支付宝</label>&nbsp; <label><input type="radio" name="type" value="qqpay">QQ钱包</label>&nbsp;<label><input type="radio" name="type" value="wxpay">微信支付</label>&nbsp;<label><input type="radio" name="type" value="bank">云闪付</label>
</dd>
<dt></dt>
<dd>
<span class="new-btn-login-sp">
<button class="new-btn-login" type="submit" style="text-align:center;">确 认</button>
</span>
</dd>
</dl>
</div>
</form>
<div id="foot">
<ul class="foot-ul">
<li><font class="note-help">如果您点击“确认”按钮,即表示您同意该次的执行操作。 </font></li>
<li>
</li>
</ul>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,154 @@
<?php
/* *
* 彩虹易支付SDK服务类
* 说明:
* 包含发起支付、查询订单、回调验证等功能
*/
class EpayCore
{
private $pid;
private $key;
private $submit_url;
private $mapi_url;
private $api_url;
private $sign_type = 'MD5';
function __construct($config){
$this->pid = $config['pid'];
$this->key = $config['key'];
$this->submit_url = $config['apiurl'].'submit.php';
$this->mapi_url = $config['apiurl'].'mapi.php';
$this->api_url = $config['apiurl'].'api.php';
}
// 发起支付(页面跳转)
public function pagePay($param_tmp, $button='正在跳转'){
$param = $this->buildRequestParam($param_tmp);
$html = '<form id="dopay" action="'.$this->submit_url.'" method="post">';
foreach ($param as $k=>$v) {
$html.= '<input type="hidden" name="'.$k.'" value="'.$v.'"/>';
}
$html .= '<input type="submit" value="'.$button.'"></form><script>document.getElementById("dopay").submit();</script>';
return $html;
}
// 发起支付(获取链接)
public function getPayLink($param_tmp){
$param = $this->buildRequestParam($param_tmp);
$url = $this->submit_url.'?'.http_build_query($param);
return $url;
}
// 发起支付API接口
public function apiPay($param_tmp){
$param = $this->buildRequestParam($param_tmp);
$response = $this->getHttpResponse($this->mapi_url, http_build_query($param));
$arr = json_decode($response, true);
return $arr;
}
// 异步回调验证
public function verifyNotify(){
if(empty($_GET)) return false;
$sign = $this->getSign($_GET);
if($sign === $_GET['sign']){
$signResult = true;
}else{
$signResult = false;
}
return $signResult;
}
// 同步回调验证
public function verifyReturn(){
if(empty($_GET)) return false;
$sign = $this->getSign($_GET);
if($sign === $_GET['sign']){
$signResult = true;
}else{
$signResult = false;
}
return $signResult;
}
// 查询订单支付状态
public function orderStatus($trade_no){
$result = $this->queryOrder($trade_no);
if($result['status']==1){
return true;
}else{
return false;
}
}
// 查询订单
public function queryOrder($trade_no){
$url = $this->api_url.'?act=order&pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no;
$response = $this->getHttpResponse($url);
$arr = json_decode($response, true);
return $arr;
}
// 订单退款
public function refund($trade_no, $money){
$url = $this->api_url.'?act=refund';
$post = 'pid=' . $this->pid . '&key=' . $this->key . '&trade_no=' . $trade_no . '&money=' . $money;
$response = $this->getHttpResponse($url, $post);
$arr = json_decode($response, true);
return $arr;
}
private function buildRequestParam($param){
$mysign = $this->getSign($param);
$param['sign'] = $mysign;
$param['sign_type'] = $this->sign_type;
return $param;
}
// 计算签名
private function getSign($param){
ksort($param);
reset($param);
$signstr = '';
foreach($param as $k => $v){
if($k != "sign" && $k != "sign_type" && $v!=''){
$signstr .= $k.'='.$v.'&';
}
}
$signstr = substr($signstr,0,-1);
$signstr .= $this->key;
$sign = md5($signstr);
return $sign;
}
// 请求外部资源
private function getHttpResponse($url, $post = false, $timeout = 10){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$httpheader[] = "Accept: */*";
$httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
$httpheader[] = "Connection: close";
curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
}

View File

@@ -0,0 +1,13 @@
<?php
/* *
* 配置文件
*/
//支付接口地址
$epay_config['apiurl'] = 'http://pay.www.com/';
//商户ID
$epay_config['pid'] = '1000';
//商户密钥
$epay_config['key'] = 'WWc3Z2jkK7jhNGPALcGKjHLPK47wRK85';

View File

@@ -0,0 +1,45 @@
<?php
/* *
* 功能:彩虹易支付异步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verifyNotify();
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//彩虹易支付交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
//支付金额
$money = $_GET['money'];
if ($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
//验证成功返回
echo "success";
}
else {
//验证失败
echo "fail";
}
?>

View File

@@ -0,0 +1,55 @@
<?php
/* *
* 功能:彩虹易支付页面跳转同步通知页面
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once("lib/epay.config.php");
require_once("lib/EpayCore.class.php");
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付返回页面</title>
</head>
<body>
<?php
//计算得出通知验证结果
$epay = new EpayCore($epay_config);
$verify_result = $epay->verifyReturn();
if($verify_result) {//验证成功
//商户订单号
$out_trade_no = $_GET['out_trade_no'];
//支付宝交易号
$trade_no = $_GET['trade_no'];
//交易状态
$trade_status = $_GET['trade_status'];
//支付方式
$type = $_GET['type'];
if($_GET['trade_status'] == 'TRADE_SUCCESS') {
//判断该笔订单是否在商户网站中已经做过处理
//如果没有做过处理根据订单号out_trade_no在商户网站的订单系统中查到该笔订单的详细并执行商户的业务程序
//如果有做过处理,不执行商户的业务程序
}
else {
echo "trade_status=".$_GET['trade_status'];
}
echo "<h3>验证成功</h3><br />";
}
else {
//验证失败
echo "<h3>验证失败</h3>";
}
?>
</body>
</html>

View File

@@ -17,7 +17,7 @@ defined("JSON_UNESCAPED_UNICODE") or define("JSON_UNESCAPED_UNICODE", 256);
class BaseClient
{
const SDK_NAME = "yunzhanghu-sdk-php";
const SDK_VERSION = "2.0.22";
const SDK_VERSION = "2.0.15";
const ENV_PROD = "yzh_env_prod";
const ENV_SANDBOX = "yzh_env_sandbox";
@@ -44,8 +44,6 @@ class BaseClient
'bizlicxjjh5service' => 'https://api-aic.yunzhanghu.com', // 个体工商户注册服务(云账户新经济 H5接口域名
'ins' => 'https://api-ins.yunzhanghu.com', // 保险服务接口域名
'task' => 'https://api-task.yunzhanghu.com', // 任务库服务接口域名
'usercollectservice' => 'https://api-user.yunzhanghu.com', // 用户信息收集接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com', // 连续劳务税费试算接口域名
),
self::ENV_SANDBOX => array( // 沙箱环境
@@ -53,10 +51,8 @@ class BaseClient
'authentication' => 'https://api-service.yunzhanghu.com/sandbox', // 用户信息验证接口域名
'apiusersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // API 签约接口域名
'h5usersignservice' => 'https://api-service.yunzhanghu.com/sandbox', // H5 签约接口域名
'calculatelaborservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'realnameservice' => 'https://api-service.yunzhanghu.com/sandbox', // 连续劳务税费试算接口域名
'ins' => '', // 保险服务接口域名
'aic' => 'https://api-aic.yunzhanghu.com/sandbox', // 个体工商户注册服务接口域名
'aic' => '', // 个体工商户注册服务接口域名
'task' => '', // 任务库服务接口域名
'dataservice' => '', // 数据服务接口域名
),

View File

@@ -1,81 +0,0 @@
<?php
namespace Yzh;
use Yzh\Exception\ConfigException;
use Yzh\Exception\ExceptionCode;
use Yzh\Model\Calculatelabor\LaborCaculatorRequest;
use Yzh\Model\Calculatelabor\LaborCaculatorResponse;
use Yzh\Model\Calculatelabor\CalcTaxRequest;
use Yzh\Model\Calculatelabor\CalcTaxResponse;
use Yzh\Model\Calculatelabor\CalculationYearH5UrlRequest;
use Yzh\Model\Calculatelabor\CalculationYearH5UrlResponse;
use Yzh\Model\Calculatelabor\CalculationH5UrlRequest;
use Yzh\Model\Calculatelabor\CalculationH5UrlResponse;
/**
* 连续劳务税费试算
* Class CalculateLaborServiceClient
*/
class CalculateLaborServiceClient extends BaseClient
{
protected static $service_name = 'calculatelaborservice';
/**
* 连续劳务税费试算(计算器)
* @param LaborCaculatorRequest $request
* @param null $option
* @return LaborCaculatorResponse
*/
public function laborCaculator($request, $option = null)
{
if (!$request instanceof LaborCaculatorRequest) {
throw new ConfigException("Calculatelabor->laborCaculator request 必须是 Yzh\\Model\\Calculatelabor\\LaborCaculatorRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('POST', '/api/tax/v1/labor-caculator', $request, "Yzh\\Model\\Calculatelabor\\LaborCaculatorResponse", $option);
}
/**
* 订单税费试算
* @param CalcTaxRequest $request
* @param null $option
* @return CalcTaxResponse
*/
public function calcTax($request, $option = null)
{
if (!$request instanceof CalcTaxRequest) {
throw new ConfigException("Calculatelabor->calcTax request 必须是 Yzh\\Model\\Calculatelabor\\CalcTaxRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('POST', '/api/payment/v1/calc-tax', $request, "Yzh\\Model\\Calculatelabor\\CalcTaxResponse", $option);
}
/**
* 连续劳务年度税费测算-H5
* @param CalculationYearH5UrlRequest $request
* @param null $option
* @return CalculationYearH5UrlResponse
*/
public function calculationYearH5Url($request, $option = null)
{
if (!$request instanceof CalculationYearH5UrlRequest) {
throw new ConfigException("Calculatelabor->calculationYearH5Url request 必须是 Yzh\\Model\\Calculatelabor\\CalculationYearH5UrlRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('GET', '/api/labor/service/calculation/year/h5url', $request, "Yzh\\Model\\Calculatelabor\\CalculationYearH5UrlResponse", $option);
}
/**
* 连续劳务单笔结算税费测算-H5
* @param CalculationH5UrlRequest $request
* @param null $option
* @return CalculationH5UrlResponse
*/
public function calculationH5Url($request, $option = null)
{
if (!$request instanceof CalculationH5UrlRequest) {
throw new ConfigException("Calculatelabor->calculationH5Url request 必须是 Yzh\\Model\\Calculatelabor\\CalculationH5UrlRequest 实例", ExceptionCode::CONFIG_ERROR_WRONG_PARAM);
}
return $this->send('GET', '/api/labor/service/calculation/h5url', $request, "Yzh\\Model\\Calculatelabor\\CalculationH5UrlResponse", $option);
}
}

View File

@@ -1,40 +0,0 @@
<?php
namespace Yzh;
use Yzh\Utils\Rsa;
use Yzh\Utils\Hmac;
use Yzh\Utils\MessString;
/**
* 专属客服链接
* Class CustomerLinkClient
*/
class CustomerLinkClient extends BaseClient
{
/**
* 获取客服链接
* @return str
*/
public function getCustomerLink($base_url, $member_id)
{
$mess = MessString::rand(16);
$timestamp = time();
$signature = "";
$encodesign = "";
// 签名
$signdata = "data=member_id=".$member_id."&mess=".$mess."&timestamp=".$timestamp."&key=".$this->config->app_key;
if ($this->config->sign_type == Config::SIGN_TYPE_RSA) {
$signature = $this->rsa->sign($signdata);
}else if($this->config->sign_type == Config::SIGN_TYPE_HMAC) {
$signature = $this->hmac->sign($signdata);
}
$encodesign = urlencode($signature);
$url = $base_url."?sign_type=".$this->config->sign_type."&sign=".$encodesign."&member_id=".$member_id."&mess=".$mess."&timestamp=".$timestamp;
return $url;
}
}

View File

@@ -70,11 +70,6 @@ class UserExemptedInfoRequest extends BaseRequest
* @var string
*/
public $ref;
/**
* 证件照片 URL 地址
* @var string[]
*/
public $image_urls;
public function __construct($params = array())
{

View File

@@ -1,335 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 税费明细
* Class CalcTaxDetail
*/
class CalcTaxDetail extends BaseModel
{
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 云账户预扣个税
* @var string
*/
protected $broker_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 云账户预扣增值税
* @var string
*/
protected $broker_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 云账户预扣附加税费
* @var string
*/
protected $broker_additional_tax;
/**
* 预扣个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 预扣个税速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 云账户预扣个税
* @var string $broker_personal_tax
*/
public function setBrokerPersonalTax($broker_personal_tax)
{
$this->broker_personal_tax = $broker_personal_tax;
}
/**
* 云账户预扣个税
* @return string
*/
public function getBrokerPersonalTax()
{
return $this->broker_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 云账户预扣增值税
* @var string $broker_value_added_tax
*/
public function setBrokerValueAddedTax($broker_value_added_tax)
{
$this->broker_value_added_tax = $broker_value_added_tax;
}
/**
* 云账户预扣增值税
* @return string
*/
public function getBrokerValueAddedTax()
{
return $this->broker_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 云账户预扣附加税费
* @var string $broker_additional_tax
*/
public function setBrokerAdditionalTax($broker_additional_tax)
{
$this->broker_additional_tax = $broker_additional_tax;
}
/**
* 云账户预扣附加税费
* @return string
*/
public function getBrokerAdditionalTax()
{
return $this->broker_additional_tax;
}
/**
* 预扣个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 预扣个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 预扣个税速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 预扣个税速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
}

View File

@@ -1,52 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 订单税费试算请求
* Class CalcTaxRequest
*/
class CalcTaxRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 姓名
* @var string
*/
public $real_name;
/**
* 证件号
* @var string
*/
public $id_card;
/**
* 测算金额
* @var string
*/
public $pay;
/**
* 测算类型
* @var string
*/
public $tax_type;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 订单税费试算返回
* Class CalcTaxResponse
*/
class CalcTaxResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalcTaxResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalcTaxResponseData($data);
return $this;
}
}

View File

@@ -1,405 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 订单税费试算返回
* Class CalcTaxResponseData
*/
class CalcTaxResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 测算金额
* @var string
*/
protected $pay;
/**
* 税费总额
* @var string
*/
protected $tax;
/**
* 税后结算金额
* @var string
*/
protected $after_tax_amount;
/**
* 缴税明细
* @var CalcTaxDetail
*/
protected $tax_detail;
/**
* 税前订单金额
* @var string
*/
protected $before_tax_amount;
/**
* 用户税费总额
* @var string
*/
protected $user_tax;
/**
* 平台企业税费总额
* @var string
*/
protected $dealer_tax;
/**
* 云账户税费总额
* @var string
*/
protected $broker_tax;
/**
* 用户服务费
* @var string
*/
protected $user_fee;
/**
* 结果
* @var string
*/
protected $status;
/**
* 结果详细状态码
* @var string
*/
protected $status_detail;
/**
* 结果说明
* @var string
*/
protected $status_message;
/**
* 结果详细状态码描述
* @var string
*/
protected $status_detail_message;
/**
* 用户实收金额(未扣除追缴的增附税)
* @var string
*/
protected $user_real_excluding_vat_amount;
/**
* 用户还未缴清的增附税
* @var string
*/
protected $user_remaining_repayment_amount;
/**
* 已追缴增附税(本笔订单)
* @var string
*/
protected $user_recover_tax_amount;
/**
* 待追缴增附税总金额
* @var string
*/
protected $user_total_recover_tax_amount;
/**
* 测算金额
* @var string $pay
*/
public function setPay($pay)
{
$this->pay = $pay;
}
/**
* 测算金额
* @return string
*/
public function getPay()
{
return $this->pay;
}
/**
* 税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 税后结算金额
* @var string $after_tax_amount
*/
public function setAfterTaxAmount($after_tax_amount)
{
$this->after_tax_amount = $after_tax_amount;
}
/**
* 税后结算金额
* @return string
*/
public function getAfterTaxAmount()
{
return $this->after_tax_amount;
}
/**
* 缴税明细
* @var CalcTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return CalcTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
/**
* 税前订单金额
* @var string $before_tax_amount
*/
public function setBeforeTaxAmount($before_tax_amount)
{
$this->before_tax_amount = $before_tax_amount;
}
/**
* 税前订单金额
* @return string
*/
public function getBeforeTaxAmount()
{
return $this->before_tax_amount;
}
/**
* 用户税费总额
* @var string $user_tax
*/
public function setUserTax($user_tax)
{
$this->user_tax = $user_tax;
}
/**
* 用户税费总额
* @return string
*/
public function getUserTax()
{
return $this->user_tax;
}
/**
* 平台企业税费总额
* @var string $dealer_tax
*/
public function setDealerTax($dealer_tax)
{
$this->dealer_tax = $dealer_tax;
}
/**
* 平台企业税费总额
* @return string
*/
public function getDealerTax()
{
return $this->dealer_tax;
}
/**
* 云账户税费总额
* @var string $broker_tax
*/
public function setBrokerTax($broker_tax)
{
$this->broker_tax = $broker_tax;
}
/**
* 云账户税费总额
* @return string
*/
public function getBrokerTax()
{
return $this->broker_tax;
}
/**
* 用户服务费
* @var string $user_fee
*/
public function setUserFee($user_fee)
{
$this->user_fee = $user_fee;
}
/**
* 用户服务费
* @return string
*/
public function getUserFee()
{
return $this->user_fee;
}
/**
* 结果
* @var string $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* 结果
* @return string
*/
public function getStatus()
{
return $this->status;
}
/**
* 结果详细状态码
* @var string $status_detail
*/
public function setStatusDetail($status_detail)
{
$this->status_detail = $status_detail;
}
/**
* 结果详细状态码
* @return string
*/
public function getStatusDetail()
{
return $this->status_detail;
}
/**
* 结果说明
* @var string $status_message
*/
public function setStatusMessage($status_message)
{
$this->status_message = $status_message;
}
/**
* 结果说明
* @return string
*/
public function getStatusMessage()
{
return $this->status_message;
}
/**
* 结果详细状态码描述
* @var string $status_detail_message
*/
public function setStatusDetailMessage($status_detail_message)
{
$this->status_detail_message = $status_detail_message;
}
/**
* 结果详细状态码描述
* @return string
*/
public function getStatusDetailMessage()
{
return $this->status_detail_message;
}
/**
* 用户实收金额(未扣除追缴的增附税)
* @var string $user_real_excluding_vat_amount
*/
public function setUserRealExcludingVatAmount($user_real_excluding_vat_amount)
{
$this->user_real_excluding_vat_amount = $user_real_excluding_vat_amount;
}
/**
* 用户实收金额(未扣除追缴的增附税)
* @return string
*/
public function getUserRealExcludingVatAmount()
{
return $this->user_real_excluding_vat_amount;
}
/**
* 用户还未缴清的增附税
* @var string $user_remaining_repayment_amount
*/
public function setUserRemainingRepaymentAmount($user_remaining_repayment_amount)
{
$this->user_remaining_repayment_amount = $user_remaining_repayment_amount;
}
/**
* 用户还未缴清的增附税
* @return string
*/
public function getUserRemainingRepaymentAmount()
{
return $this->user_remaining_repayment_amount;
}
/**
* 已追缴增附税(本笔订单)
* @var string $user_recover_tax_amount
*/
public function setUserRecoverTaxAmount($user_recover_tax_amount)
{
$this->user_recover_tax_amount = $user_recover_tax_amount;
}
/**
* 已追缴增附税(本笔订单)
* @return string
*/
public function getUserRecoverTaxAmount()
{
return $this->user_recover_tax_amount;
}
/**
* 待追缴增附税总金额
* @var string $user_total_recover_tax_amount
*/
public function setUserTotalRecoverTaxAmount($user_total_recover_tax_amount)
{
$this->user_total_recover_tax_amount = $user_total_recover_tax_amount;
}
/**
* 待追缴增附税总金额
* @return string
*/
public function getUserTotalRecoverTaxAmount()
{
return $this->user_total_recover_tax_amount;
}
}

View File

@@ -1,47 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务单笔结算税费测算-H5 请求
* Class CalculationH5UrlRequest
*/
class CalculationH5UrlRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 姓名
* @var string
*/
public $real_name;
/**
* 证件号
* @var string
*/
public $id_card;
/**
* 主题颜色
* @var string
*/
public $color;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务单笔结算税费测算-H5 返回
* Class CalculationH5UrlResponse
*/
class CalculationH5UrlResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalculationH5UrlResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalculationH5UrlResponseData($data);
return $this;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务单笔结算税费测算-H5 返回
* Class CalculationH5UrlResponseData
*/
class CalculationH5UrlResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @var string
*/
protected $url;
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @var string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* 连续劳务单笔结算税费测算 H5 页面 URL
* @return string
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务年度税费测算-H5 请求
* Class CalculationYearH5UrlRequest
*/
class CalculationYearH5UrlRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 主题颜色
* @var string
*/
public $color;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务年度税费测算-H5 返回
* Class CalculationYearH5UrlResponse
*/
class CalculationYearH5UrlResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return CalculationYearH5UrlResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new CalculationYearH5UrlResponseData($data);
return $this;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务年度税费测算-H5 返回
* Class CalculationYearH5UrlResponseData
*/
class CalculationYearH5UrlResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 年度劳务测算 H5 页面 URL
* @var string
*/
protected $url;
/**
* 年度劳务测算 H5 页面 URL
* @var string $url
*/
public function setUrl($url)
{
$this->url = $url;
}
/**
* 年度劳务测算 H5 页面 URL
* @return string
*/
public function getUrl()
{
return $this->url;
}
}

View File

@@ -1,37 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseRequest;
/**
* 连续劳务税费试算(计算器)请求
* Class LaborCaculatorRequest
*/
class LaborCaculatorRequest extends BaseRequest
{
/**
* 平台企业 ID
* @var string
*/
public $dealer_id;
/**
* 综合服务主体 ID
* @var string
*/
public $broker_id;
/**
* 月度收入列表
* @var MonthSettlement[]
*/
public $month_settlement_list;
public function __construct($params = array())
{
foreach (array_keys(get_object_vars($this)) as $property) {
if (isset($params[$property])) {
$this->{$property} = $params[$property];
}
}
}
}

View File

@@ -1,33 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseResponse;
use Yzh\Model\ResponseInterface;
/**
* 连续劳务税费试算(计算器)返回
* Class LaborCaculatorResponse
*/
class LaborCaculatorResponse extends BaseResponse implements ResponseInterface
{
/**
* 获取数据对象
* @return LaborCaculatorResponseData
*/
public function getData()
{
return $this->data;
}
/**
* 设置数据对象
* @param array $data
* @return self
*/
public function setData($data)
{
$this->data = new LaborCaculatorResponseData($data);
return $this;
}
}

View File

@@ -1,62 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
use Yzh\Model\ResponseDataInterface;
/**
* 连续劳务税费试算(计算器)返回
* Class LaborCaculatorResponseData
*/
class LaborCaculatorResponseData extends BaseModel implements ResponseDataInterface
{
/**
* 综合所得汇算清缴
* @var YearTaxInfo
*/
protected $year_tax_info;
/**
* 月度税务信息列表
* @var MontTax[]
*/
protected $month_tax_list;
/**
* 综合所得汇算清缴
* @var YearTaxInfo $year_tax_info
*/
public function setYearTaxInfo($year_tax_info)
{
$this->year_tax_info = $year_tax_info;
}
/**
* 综合所得汇算清缴
* @return YearTaxInfo
*/
public function getYearTaxInfo()
{
return $this->year_tax_info;
}
/**
* @var array $items
*/
public function setMonthTaxList($items)
{
$this->month_tax_list = array();
foreach ($items as $k => $v) {
array_push($this->month_tax_list, new MontTax($v));
}
}
/**
* 月度税务信息列表
* @return MontTax[]
*/
public function getMonthTaxList()
{
return $this->month_tax_list;
}
}

View File

@@ -1,243 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 月度税务信息
* Class MontTax
*/
class MontTax extends BaseModel
{
/**
* 月份
* @var int32
*/
protected $month;
/**
* 含增值税收入
* @var string
*/
protected $pre_tax_amount;
/**
* 不含增值税收入
* @var string
*/
protected $excluding_vat_amount;
/**
* 增值税
* @var string
*/
protected $value_added_tax;
/**
* 附加税
* @var string
*/
protected $additional_tax;
/**
* 个税
* @var string
*/
protected $personal_tax;
/**
* 个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 税后金额
* @var string
*/
protected $post_tax_amount;
/**
* 税负率
* @var string
*/
protected $total_tax_rate;
/**
* 月份
* @var int32 $month
*/
public function setMonth($month)
{
$this->month = $month;
}
/**
* 月份
* @return int32
*/
public function getMonth()
{
return $this->month;
}
/**
* 含增值税收入
* @var string $pre_tax_amount
*/
public function setPreTaxAmount($pre_tax_amount)
{
$this->pre_tax_amount = $pre_tax_amount;
}
/**
* 含增值税收入
* @return string
*/
public function getPreTaxAmount()
{
return $this->pre_tax_amount;
}
/**
* 不含增值税收入
* @var string $excluding_vat_amount
*/
public function setExcludingVatAmount($excluding_vat_amount)
{
$this->excluding_vat_amount = $excluding_vat_amount;
}
/**
* 不含增值税收入
* @return string
*/
public function getExcludingVatAmount()
{
return $this->excluding_vat_amount;
}
/**
* 增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 附加税
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 附加税
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
/**
* 税后金额
* @var string $post_tax_amount
*/
public function setPostTaxAmount($post_tax_amount)
{
$this->post_tax_amount = $post_tax_amount;
}
/**
* 税后金额
* @return string
*/
public function getPostTaxAmount()
{
return $this->post_tax_amount;
}
/**
* 税负率
* @var string $total_tax_rate
*/
public function setTotalTaxRate($total_tax_rate)
{
$this->total_tax_rate = $total_tax_rate;
}
/**
* 税负率
* @return string
*/
public function getTotalTaxRate()
{
return $this->total_tax_rate;
}
}

View File

@@ -1,59 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 月度收入
* Class MonthSettlement
*/
class MonthSettlement extends BaseModel
{
/**
* 月份
* @var int32
*/
protected $month;
/**
* 月度收入
* @var string
*/
protected $month_pre_tax_amount;
/**
* 月份
* @var int32 $month
*/
public function setMonth($month)
{
$this->month = $month;
}
/**
* 月份
* @return int32
*/
public function getMonth()
{
return $this->month;
}
/**
* 月度收入
* @var string $month_pre_tax_amount
*/
public function setMonthPreTaxAmount($month_pre_tax_amount)
{
$this->month_pre_tax_amount = $month_pre_tax_amount;
}
/**
* 月度收入
* @return string
*/
public function getMonthPreTaxAmount()
{
return $this->month_pre_tax_amount;
}
}

View File

@@ -1,151 +0,0 @@
<?php
namespace Yzh\Model\Calculatelabor;
use Yzh\Model\BaseModel;
/**
* 综合所得汇算清缴信息
* Class YearTaxInfo
*/
class YearTaxInfo extends BaseModel
{
/**
* 连续劳务年度个税
* @var string
*/
protected $continuous_month_personal_tax;
/**
* 综合所得汇算清缴年度个税
* @var string
*/
protected $personal_tax;
/**
* 年度扣除费用
* @var string
*/
protected $deduct_cost;
/**
* 个税税率
* @var string
*/
protected $personal_tax_rate;
/**
* 速算扣除数
* @var string
*/
protected $deduct_tax;
/**
* 税负率
* @var string
*/
protected $total_tax_rate;
/**
* 连续劳务年度个税
* @var string $continuous_month_personal_tax
*/
public function setContinuousMonthPersonalTax($continuous_month_personal_tax)
{
$this->continuous_month_personal_tax = $continuous_month_personal_tax;
}
/**
* 连续劳务年度个税
* @return string
*/
public function getContinuousMonthPersonalTax()
{
return $this->continuous_month_personal_tax;
}
/**
* 综合所得汇算清缴年度个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 综合所得汇算清缴年度个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 年度扣除费用
* @var string $deduct_cost
*/
public function setDeductCost($deduct_cost)
{
$this->deduct_cost = $deduct_cost;
}
/**
* 年度扣除费用
* @return string
*/
public function getDeductCost()
{
return $this->deduct_cost;
}
/**
* 个税税率
* @var string $personal_tax_rate
*/
public function setPersonalTaxRate($personal_tax_rate)
{
$this->personal_tax_rate = $personal_tax_rate;
}
/**
* 个税税率
* @return string
*/
public function getPersonalTaxRate()
{
return $this->personal_tax_rate;
}
/**
* 速算扣除数
* @var string $deduct_tax
*/
public function setDeductTax($deduct_tax)
{
$this->deduct_tax = $deduct_tax;
}
/**
* 速算扣除数
* @return string
*/
public function getDeductTax()
{
return $this->deduct_tax;
}
/**
* 税负率
* @var string $total_tax_rate
*/
public function setTotalTaxRate($total_tax_rate)
{
$this->total_tax_rate = $total_tax_rate;
}
/**
* 税负率
* @return string
*/
public function getTotalTaxRate()
{
return $this->total_tax_rate;
}
}

View File

@@ -21,145 +21,25 @@ class DailyOrderSummary extends BaseModel
*/
protected $pay;
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @var string
*/
protected $broker_fee;
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @var string
*/
protected $broker_real_fee;
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @var string
*/
protected $broker_rebate_fee;
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @var string
*/
protected $user_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 实收余额账户支出加成服务费金额
* @var string
*/
protected $received_broker_real_fee;
/**
* 实收加成服务费抵扣金额
* @var string
*/
protected $received_broker_deduct_fee;
/**
* 实收用户加成服务费金额
* @var string
*/
protected $received_user_fee;
/**
* 预扣税费总额
* @var string
*/
protected $tax;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/**
* 订单数量
@@ -198,7 +78,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @var string $broker_fee
*/
public function setBrokerFee($broker_fee)
@@ -207,7 +87,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @return string
*/
public function getBrokerFee()
@@ -216,7 +96,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @var string $broker_real_fee
*/
public function setBrokerRealFee($broker_real_fee)
@@ -225,7 +105,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @return string
*/
public function getBrokerRealFee()
@@ -234,7 +114,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @var string $broker_rebate_fee
*/
public function setBrokerRebateFee($broker_rebate_fee)
@@ -243,7 +123,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @return string
*/
public function getBrokerRebateFee()
@@ -252,7 +132,7 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @var string $user_fee
*/
public function setUserFee($user_fee)
@@ -261,443 +141,11 @@ class DailyOrderSummary extends BaseModel
}
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @return string
*/
public function getUserFee()
{
return $this->user_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @var string $received_broker_real_fee
*/
public function setReceivedBrokerRealFee($received_broker_real_fee)
{
$this->received_broker_real_fee = $received_broker_real_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @return string
*/
public function getReceivedBrokerRealFee()
{
return $this->received_broker_real_fee;
}
/**
* 实收加成服务费抵扣金额
* @var string $received_broker_deduct_fee
*/
public function setReceivedBrokerDeductFee($received_broker_deduct_fee)
{
$this->received_broker_deduct_fee = $received_broker_deduct_fee;
}
/**
* 实收加成服务费抵扣金额
* @return string
*/
public function getReceivedBrokerDeductFee()
{
return $this->received_broker_deduct_fee;
}
/**
* 实收用户加成服务费金额
* @var string $received_user_fee
*/
public function setReceivedUserFee($received_user_fee)
{
$this->received_user_fee = $received_user_fee;
}
/**
* 实收用户加成服务费金额
* @return string
*/
public function getReceivedUserFee()
{
return $this->received_user_fee;
}
/**
* 预扣税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 预扣税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
}

View File

@@ -51,15 +51,10 @@ class DealerOrderInfo extends BaseModel
*/
protected $broker_amount;
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @var string
*/
protected $broker_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 支付路径流水号
* @var string
@@ -120,21 +115,6 @@ class DealerOrderInfo extends BaseModel
* @var string
*/
protected $finished_time;
/**
* 预扣税费总额
* @var string
*/
protected $tax_amount;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 缴税明细
* @var OrderTaxDetail
*/
protected $tax_detail;
/**
* 综合服务主体 ID
@@ -281,7 +261,7 @@ class DealerOrderInfo extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @var string $broker_fee
*/
public function setBrokerFee($broker_fee)
@@ -290,7 +270,7 @@ class DealerOrderInfo extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @return string
*/
public function getBrokerFee()
@@ -298,24 +278,6 @@ class DealerOrderInfo extends BaseModel
return $this->broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 支付路径流水号
* @var string $bill
@@ -531,58 +493,4 @@ class DealerOrderInfo extends BaseModel
{
return $this->finished_time;
}
/**
* 预扣税费总额
* @var string $tax_amount
*/
public function setTaxAmount($tax_amount)
{
$this->tax_amount = $tax_amount;
}
/**
* 预扣税费总额
* @return string
*/
public function getTaxAmount()
{
return $this->tax_amount;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 缴税明细
* @var OrderTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return OrderTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
}

View File

@@ -56,15 +56,10 @@ class DealerOrderInfoV2 extends BaseModel
*/
protected $broker_amount;
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @var string
*/
protected $broker_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 支付路径流水号
* @var string
@@ -135,21 +130,6 @@ class DealerOrderInfoV2 extends BaseModel
* @var string
*/
protected $pay_ref;
/**
* 预扣税费总额
* @var string
*/
protected $tax_amount;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 缴税明细
* @var OrderTaxDetail
*/
protected $tax_detail;
/**
* 综合服务主体 ID
@@ -314,7 +294,7 @@ class DealerOrderInfoV2 extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @var string $broker_fee
*/
public function setBrokerFee($broker_fee)
@@ -323,7 +303,7 @@ class DealerOrderInfoV2 extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 综合服务主体加成服务费
* @return string
*/
public function getBrokerFee()
@@ -331,24 +311,6 @@ class DealerOrderInfoV2 extends BaseModel
return $this->broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 支付路径流水号
* @var string $bill
@@ -600,58 +562,4 @@ class DealerOrderInfoV2 extends BaseModel
{
return $this->pay_ref;
}
/**
* 预扣税费总额
* @var string $tax_amount
*/
public function setTaxAmount($tax_amount)
{
$this->tax_amount = $tax_amount;
}
/**
* 预扣税费总额
* @return string
*/
public function getTaxAmount()
{
return $this->tax_amount;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 缴税明细
* @var OrderTaxDetail $tax_detail
*/
public function setTaxDetail($tax_detail)
{
$this->tax_detail = $tax_detail;
}
/**
* 缴税明细
* @return OrderTaxDetail
*/
public function getTaxDetail()
{
return $this->tax_detail;
}
}

View File

@@ -21,145 +21,25 @@ class MonthlyOrderSummary extends BaseModel
*/
protected $pay;
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @var string
*/
protected $broker_fee;
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @var string
*/
protected $broker_real_fee;
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @var string
*/
protected $broker_rebate_fee;
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @var string
*/
protected $user_fee;
/**
* 实收综合服务主体加成服务费金额
* @var string
*/
protected $received_broker_fee;
/**
* 实收余额账户支出加成服务费金额
* @var string
*/
protected $received_broker_real_fee;
/**
* 实收加成服务费抵扣金额
* @var string
*/
protected $received_broker_deduct_fee;
/**
* 实收用户加成服务费金额
* @var string
*/
protected $received_user_fee;
/**
* 预扣税费总额
* @var string
*/
protected $tax;
/**
* 实缴税费总额
* @var string
*/
protected $received_tax_amount;
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/**
* 订单数量
@@ -198,7 +78,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @var string $broker_fee
*/
public function setBrokerFee($broker_fee)
@@ -207,7 +87,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收综合服务主体加成服务费金额
* 加成服务费金额
* @return string
*/
public function getBrokerFee()
@@ -216,7 +96,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @var string $broker_real_fee
*/
public function setBrokerRealFee($broker_real_fee)
@@ -225,7 +105,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收余额账户支出加成服务费金额
* 加成服务费实收金额
* @return string
*/
public function getBrokerRealFee()
@@ -234,7 +114,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @var string $broker_rebate_fee
*/
public function setBrokerRebateFee($broker_rebate_fee)
@@ -243,7 +123,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收加成服务费抵扣金额
* 已抵扣加成服务费金额
* @return string
*/
public function getBrokerRebateFee()
@@ -252,7 +132,7 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @var string $user_fee
*/
public function setUserFee($user_fee)
@@ -261,443 +141,11 @@ class MonthlyOrderSummary extends BaseModel
}
/**
* 应收用户加成服务费金额
* 用户加成服务费金额
* @return string
*/
public function getUserFee()
{
return $this->user_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @var string $received_broker_fee
*/
public function setReceivedBrokerFee($received_broker_fee)
{
$this->received_broker_fee = $received_broker_fee;
}
/**
* 实收综合服务主体加成服务费金额
* @return string
*/
public function getReceivedBrokerFee()
{
return $this->received_broker_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @var string $received_broker_real_fee
*/
public function setReceivedBrokerRealFee($received_broker_real_fee)
{
$this->received_broker_real_fee = $received_broker_real_fee;
}
/**
* 实收余额账户支出加成服务费金额
* @return string
*/
public function getReceivedBrokerRealFee()
{
return $this->received_broker_real_fee;
}
/**
* 实收加成服务费抵扣金额
* @var string $received_broker_deduct_fee
*/
public function setReceivedBrokerDeductFee($received_broker_deduct_fee)
{
$this->received_broker_deduct_fee = $received_broker_deduct_fee;
}
/**
* 实收加成服务费抵扣金额
* @return string
*/
public function getReceivedBrokerDeductFee()
{
return $this->received_broker_deduct_fee;
}
/**
* 实收用户加成服务费金额
* @var string $received_user_fee
*/
public function setReceivedUserFee($received_user_fee)
{
$this->received_user_fee = $received_user_fee;
}
/**
* 实收用户加成服务费金额
* @return string
*/
public function getReceivedUserFee()
{
return $this->received_user_fee;
}
/**
* 预扣税费总额
* @var string $tax
*/
public function setTax($tax)
{
$this->tax = $tax;
}
/**
* 预扣税费总额
* @return string
*/
public function getTax()
{
return $this->tax;
}
/**
* 实缴税费总额
* @var string $received_tax_amount
*/
public function setReceivedTaxAmount($received_tax_amount)
{
$this->received_tax_amount = $received_tax_amount;
}
/**
* 实缴税费总额
* @return string
*/
public function getReceivedTaxAmount()
{
return $this->received_tax_amount;
}
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
}

View File

@@ -1,427 +0,0 @@
<?php
namespace Yzh\Model\Dataservice;
use Yzh\Model\BaseModel;
/**
* 缴税明细
* Class OrderTaxDetail
*/
class OrderTaxDetail extends BaseModel
{
/**
* 预扣个税
* @var string
*/
protected $personal_tax;
/**
* 预扣增值税
* @var string
*/
protected $value_added_tax;
/**
* 预扣附加税费
* @var string
*/
protected $additional_tax;
/**
* 实缴个税
* @var string
*/
protected $received_personal_tax;
/**
* 实缴增值税
* @var string
*/
protected $received_value_added_tax;
/**
* 实缴附加税费
* @var string
*/
protected $received_additional_tax;
/**
* 用户预扣个税
* @var string
*/
protected $user_personal_tax;
/**
* 平台企业预扣个税
* @var string
*/
protected $dealer_personal_tax;
/**
* 用户预扣增值税
* @var string
*/
protected $user_value_added_tax;
/**
* 平台企业预扣增值税
* @var string
*/
protected $dealer_value_added_tax;
/**
* 用户预扣附加税费
* @var string
*/
protected $user_additional_tax;
/**
* 平台企业预扣附加税费
* @var string
*/
protected $dealer_additional_tax;
/**
* 用户实缴个税
* @var string
*/
protected $user_received_personal_tax;
/**
* 平台企业实缴个税
* @var string
*/
protected $dealer_received_personal_tax;
/**
* 用户实缴增值税
* @var string
*/
protected $user_received_value_added_tax;
/**
* 平台企业实缴增值税
* @var string
*/
protected $dealer_received_value_added_tax;
/**
* 用户实缴附加税费
* @var string
*/
protected $user_received_additional_tax;
/**
* 平台企业实缴附加税费
* @var string
*/
protected $dealer_received_additional_tax;
/**
* 预扣个税
* @var string $personal_tax
*/
public function setPersonalTax($personal_tax)
{
$this->personal_tax = $personal_tax;
}
/**
* 预扣个税
* @return string
*/
public function getPersonalTax()
{
return $this->personal_tax;
}
/**
* 预扣增值税
* @var string $value_added_tax
*/
public function setValueAddedTax($value_added_tax)
{
$this->value_added_tax = $value_added_tax;
}
/**
* 预扣增值税
* @return string
*/
public function getValueAddedTax()
{
return $this->value_added_tax;
}
/**
* 预扣附加税费
* @var string $additional_tax
*/
public function setAdditionalTax($additional_tax)
{
$this->additional_tax = $additional_tax;
}
/**
* 预扣附加税费
* @return string
*/
public function getAdditionalTax()
{
return $this->additional_tax;
}
/**
* 实缴个税
* @var string $received_personal_tax
*/
public function setReceivedPersonalTax($received_personal_tax)
{
$this->received_personal_tax = $received_personal_tax;
}
/**
* 实缴个税
* @return string
*/
public function getReceivedPersonalTax()
{
return $this->received_personal_tax;
}
/**
* 实缴增值税
* @var string $received_value_added_tax
*/
public function setReceivedValueAddedTax($received_value_added_tax)
{
$this->received_value_added_tax = $received_value_added_tax;
}
/**
* 实缴增值税
* @return string
*/
public function getReceivedValueAddedTax()
{
return $this->received_value_added_tax;
}
/**
* 实缴附加税费
* @var string $received_additional_tax
*/
public function setReceivedAdditionalTax($received_additional_tax)
{
$this->received_additional_tax = $received_additional_tax;
}
/**
* 实缴附加税费
* @return string
*/
public function getReceivedAdditionalTax()
{
return $this->received_additional_tax;
}
/**
* 用户预扣个税
* @var string $user_personal_tax
*/
public function setUserPersonalTax($user_personal_tax)
{
$this->user_personal_tax = $user_personal_tax;
}
/**
* 用户预扣个税
* @return string
*/
public function getUserPersonalTax()
{
return $this->user_personal_tax;
}
/**
* 平台企业预扣个税
* @var string $dealer_personal_tax
*/
public function setDealerPersonalTax($dealer_personal_tax)
{
$this->dealer_personal_tax = $dealer_personal_tax;
}
/**
* 平台企业预扣个税
* @return string
*/
public function getDealerPersonalTax()
{
return $this->dealer_personal_tax;
}
/**
* 用户预扣增值税
* @var string $user_value_added_tax
*/
public function setUserValueAddedTax($user_value_added_tax)
{
$this->user_value_added_tax = $user_value_added_tax;
}
/**
* 用户预扣增值税
* @return string
*/
public function getUserValueAddedTax()
{
return $this->user_value_added_tax;
}
/**
* 平台企业预扣增值税
* @var string $dealer_value_added_tax
*/
public function setDealerValueAddedTax($dealer_value_added_tax)
{
$this->dealer_value_added_tax = $dealer_value_added_tax;
}
/**
* 平台企业预扣增值税
* @return string
*/
public function getDealerValueAddedTax()
{
return $this->dealer_value_added_tax;
}
/**
* 用户预扣附加税费
* @var string $user_additional_tax
*/
public function setUserAdditionalTax($user_additional_tax)
{
$this->user_additional_tax = $user_additional_tax;
}
/**
* 用户预扣附加税费
* @return string
*/
public function getUserAdditionalTax()
{
return $this->user_additional_tax;
}
/**
* 平台企业预扣附加税费
* @var string $dealer_additional_tax
*/
public function setDealerAdditionalTax($dealer_additional_tax)
{
$this->dealer_additional_tax = $dealer_additional_tax;
}
/**
* 平台企业预扣附加税费
* @return string
*/
public function getDealerAdditionalTax()
{
return $this->dealer_additional_tax;
}
/**
* 用户实缴个税
* @var string $user_received_personal_tax
*/
public function setUserReceivedPersonalTax($user_received_personal_tax)
{
$this->user_received_personal_tax = $user_received_personal_tax;
}
/**
* 用户实缴个税
* @return string
*/
public function getUserReceivedPersonalTax()
{
return $this->user_received_personal_tax;
}
/**
* 平台企业实缴个税
* @var string $dealer_received_personal_tax
*/
public function setDealerReceivedPersonalTax($dealer_received_personal_tax)
{
$this->dealer_received_personal_tax = $dealer_received_personal_tax;
}
/**
* 平台企业实缴个税
* @return string
*/
public function getDealerReceivedPersonalTax()
{
return $this->dealer_received_personal_tax;
}
/**
* 用户实缴增值税
* @var string $user_received_value_added_tax
*/
public function setUserReceivedValueAddedTax($user_received_value_added_tax)
{
$this->user_received_value_added_tax = $user_received_value_added_tax;
}
/**
* 用户实缴增值税
* @return string
*/
public function getUserReceivedValueAddedTax()
{
return $this->user_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @var string $dealer_received_value_added_tax
*/
public function setDealerReceivedValueAddedTax($dealer_received_value_added_tax)
{
$this->dealer_received_value_added_tax = $dealer_received_value_added_tax;
}
/**
* 平台企业实缴增值税
* @return string
*/
public function getDealerReceivedValueAddedTax()
{
return $this->dealer_received_value_added_tax;
}
/**
* 用户实缴附加税费
* @var string $user_received_additional_tax
*/
public function setUserReceivedAdditionalTax($user_received_additional_tax)
{
$this->user_received_additional_tax = $user_received_additional_tax;
}
/**
* 用户实缴附加税费
* @return string
*/
public function getUserReceivedAdditionalTax()
{
return $this->user_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @var string $dealer_received_additional_tax
*/
public function setDealerReceivedAdditionalTax($dealer_received_additional_tax)
{
$this->dealer_received_additional_tax = $dealer_received_additional_tax;
}
/**
* 平台企业实缴附加税费
* @return string
*/
public function getDealerReceivedAdditionalTax()
{
return $this->dealer_received_additional_tax;
}
}

Some files were not shown because too many files have changed in this diff Show More