Compare commits
368 Commits
master-秘地结
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 5754f71023 | |||
| 3d4465a5c6 | |||
| 5e132848bc | |||
| 4dfdcf325d | |||
| e2aea224c9 | |||
| 2814c8a7b7 | |||
| d6eacc53ce | |||
| 678f2f5cea | |||
| ddf8bbf387 | |||
| 81382c1591 | |||
| a832c1024b | |||
| 0f7cf82276 | |||
| 5b03fec4f6 | |||
| 47e02d8796 | |||
| 50ed633439 | |||
| 752fbece93 | |||
| 54efad0668 | |||
| bbb3f85fee | |||
| 590f5cb092 | |||
| 172beb8d34 | |||
| 3d7beb38fc | |||
| b2320cf92d | |||
| bd4b016586 | |||
| 4f917863e6 | |||
| 60b517312c | |||
| 60e2cde5e7 | |||
| 1bd790071c | |||
| f54302f22e | |||
| 7937998240 | |||
| 93e60d695b | |||
| 943921a352 | |||
| fc48e1f261 | |||
| 4effce28ef | |||
| 08bb57e5a3 | |||
| c4cfcb393f | |||
| 5b2c655be8 | |||
| 910717464f | |||
| bad85524ef | |||
| 8ad606a8dd | |||
| b7302fa213 | |||
| b4827f823b | |||
| 7e9c2b5138 | |||
| e7a17bb34e | |||
| 3b22f8d134 | |||
| de5ae479c9 | |||
| 8315eeae2d | |||
| 46d12d99b1 | |||
| 817da774ef | |||
| 0d734d092b | |||
| a6ae1d8c01 | |||
| 6ef84a2690 | |||
| 29ec30fd65 | |||
| c49abb572f | |||
| 24bb57f516 | |||
| 5ebcdb2a7e | |||
| 0451444b85 | |||
| 391a2481e9 | |||
| 0353bae8db | |||
| df976eebfe | |||
| 2a085baaa5 | |||
| 9038538ee8 | |||
| 8bba9f61ec | |||
| 59ba40a66a | |||
| dc3f0983da | |||
| 7ea48b8c9f | |||
| dbd4a43a15 | |||
| ca79d16c95 | |||
| c7a1864c65 | |||
| 396dfeaa07 | |||
| 6cca013d61 | |||
| c96d8750b6 | |||
| 287523fc88 | |||
| c46038cf5b | |||
| 747c2747b1 | |||
| eee56fc7eb | |||
| ee25111a0a | |||
| 20a8c4e8bf | |||
| d6c92bc150 | |||
| ea9fa85d46 | |||
| 7a703e3cfd | |||
| 4edc124d15 | |||
| 92831bcd13 | |||
| 8a62c2f1eb | |||
| 854c87cc46 | |||
| aa9bf9232e | |||
| 21890b3fcd | |||
| dbe7a83aef | |||
| 39018da4e3 | |||
| 85d4174798 | |||
| 656f0692cf | |||
| 20ad1818e0 | |||
| 9ffb61ada9 | |||
| 8269218c7d | |||
| d284ee8346 | |||
| db7a9c460c | |||
| 8ab582956e | |||
| 9f4b3a512c | |||
| 74c0e85178 | |||
| 1e4729fbb7 | |||
| 3abe055f1c | |||
| 36850d6087 | |||
| cf0d665f42 | |||
| 2525487051 | |||
| fd535f969b | |||
| 2308ea8b64 | |||
| 774107e28f | |||
| beb87cf3fd | |||
| 754bc120ca | |||
| ed5488699f | |||
| 6c89b1b992 | |||
| ec7aa532d8 | |||
| 6bf05fd52d | |||
| 195f6f9fad | |||
| 85bc9a30db | |||
| a72b3bc410 | |||
| 18944ddcbc | |||
| d6bbdefb0a | |||
| 46dd1af437 | |||
| 5ff8dc4acf | |||
| ba835772b2 | |||
| b5422fbc35 | |||
| 4a08d656f0 | |||
| 5e80ea66f1 | |||
| 09b4ebb5b8 | |||
| a04a75d7d9 | |||
| aa972a9669 | |||
| faba9d6d2b | |||
| 213294ac64 | |||
| 09a02c1d14 | |||
| ee8b00e840 | |||
| 9fe6beb9f3 | |||
| 05acefde88 | |||
| c3bddf960a | |||
| a1866ff95f | |||
| 0140dad0d1 | |||
| 62a00d51d6 | |||
| 4aac4e9109 | |||
| 7a57493a19 | |||
| 4a6cb606a7 | |||
| b168178112 | |||
| c8efd7c4cc | |||
| aff5a7ae17 | |||
| ee98bd051b | |||
| 1878361188 | |||
| 14f30dd692 | |||
| 4440aee163 | |||
| d5332dadfd | |||
| d7c0170743 | |||
| a3a8d582e5 | |||
| 2eaa7360e9 | |||
| 51b78a0be3 | |||
| 7062cd12ce | |||
| 5b26b8c57f | |||
| 2db084b7bd | |||
| 4651940f46 | |||
| 6308a03610 | |||
| ec0607e1d6 | |||
| 222493831b | |||
| 5523125c65 | |||
| 40a297dc94 | |||
| a0801a7e58 | |||
| 2ebc3bdd5a | |||
| 4d22b53936 | |||
| b42d87294d | |||
| 9c957165ff | |||
| 7516ee5289 | |||
| 8a3bb401cf | |||
| aa8f10e4f6 | |||
| 69e5922901 | |||
| 769710c2dc | |||
| 9ff949db23 | |||
| 24beb48c17 | |||
| c82bf56b88 | |||
| 43f9a619b4 | |||
| aaa3bdb5dd | |||
| e76e4a8e49 | |||
| 4628896157 | |||
| aadaee553a | |||
| a17bcb1daf | |||
| e0265dd287 | |||
| 98771969fc | |||
| f31fdc635f | |||
| 58d7411243 | |||
| e83173bd9c | |||
| 25fe6150ad | |||
| 7385361521 | |||
| f50609fffe | |||
| f187eb9abc | |||
| b42927191a | |||
| 3ea90b555c | |||
| e1c0f3c803 | |||
| 4dcccc2896 | |||
| 72f56a4fb4 | |||
| ee65ea17d3 | |||
| 76a782be82 | |||
| fcbe37f846 | |||
| 84695ac8a1 | |||
| 98417ecf7f | |||
| 7efdf519ce | |||
| e60975581d | |||
| a720c696c6 | |||
| 9c0cd48425 | |||
| 212c4faaf3 | |||
| 645de3ecb7 | |||
| 1cb3a00718 | |||
| 8891e14154 | |||
| cb05d174c0 | |||
| 173a003dd7 | |||
| e98b932eb3 | |||
| 23acefb6b1 | |||
| 4eae7d8375 | |||
| 274750dc1d | |||
| b0b3bb07a7 | |||
| 977cb910df | |||
| a17365bbe4 | |||
| 77623330b3 | |||
| 2ffda46f91 | |||
| ef90015195 | |||
| a504005c8f | |||
| ffdf765ef0 | |||
| dea9e225f2 | |||
| be57b42260 | |||
| 07f6e148ed | |||
| 9cdf269f22 | |||
| fcf912ac90 | |||
| d7c48a5ae0 | |||
| 65bb1b0c53 | |||
| d995df1b66 | |||
| 60283af40f | |||
| ec2110c07d | |||
| 05f61dfe11 | |||
| 4846be3538 | |||
| f5c2391032 | |||
| 27ad16bb52 | |||
| 4fe5b7e1f0 | |||
| 757c36c830 | |||
| e76bf26819 | |||
| 8556184c1a | |||
| 641368f78e | |||
| 204c19ff6d | |||
| 7415193bba | |||
| ac9182c566 | |||
| 7a18e94faf | |||
| c606916057 | |||
| af6403d6aa | |||
| 323272b89b | |||
| 06a9fac6a9 | |||
| 8c2d43dfb1 | |||
| 36ce1a8c17 | |||
| d3e89e9af8 | |||
| 059bf0095a | |||
| d186cdf7b7 | |||
| dd316482e7 | |||
| 7b93166495 | |||
| 255841e3dc | |||
| f1e0d9b220 | |||
| 4ef4486ffa | |||
| db3dcaaef7 | |||
| 9549b5adbc | |||
| 35953326c6 | |||
| b448d77d05 | |||
| 80fe3afca6 | |||
| 38d81d3f47 | |||
| 2bc5edbab9 | |||
| 8d014150a2 | |||
| e0004eb216 | |||
| 40f5222762 | |||
| f571330267 | |||
| 404f195d57 | |||
| cf2a49d020 | |||
| 5a54381854 | |||
| 2a9639e45c | |||
| 989985afe6 | |||
| 89f6d32bd2 | |||
| 2a508ce4d4 | |||
| ddb22e9556 | |||
| b3f5a5d62d | |||
| 4faaea51b8 | |||
| 38d3600ced | |||
| f48d6ff512 | |||
| 9772866432 | |||
| 32dfeb8f9b | |||
| f21032aa56 | |||
| 6e86199ea5 | |||
| edf7adfdab | |||
| fbe69d1fee | |||
| bb1d02a0df | |||
| 1d28dc041c | |||
| 4006b9f83c | |||
| eeae4df530 | |||
| ab278d25bb | |||
| 3d63949019 | |||
| 4ecd68f985 | |||
| b64e001e3f | |||
| fb86fac9de | |||
| 0a2f05a928 | |||
| 5279199cec | |||
| 76b01f975c | |||
| ba9e883e0c | |||
| a19338ab17 | |||
| c8551384e3 | |||
| 8fca63d910 | |||
| 80a6cc4459 | |||
| 5ac02eabb6 | |||
| 6e3eabbc8f | |||
| 550058ec45 | |||
| 469063984e | |||
| 36fc715dd7 | |||
| 86acddf2aa | |||
| 3c9c22a2dc | |||
| c08578072d | |||
| 5e5185a92a | |||
| bd3af537cc | |||
| 2fb4b136ed | |||
| a8eddc74eb | |||
| 90a0862e8c | |||
| f5416d6b9b | |||
| 0fa41cfd7b | |||
| b2c229ace8 | |||
| c9264b6b93 | |||
| fb70b146d2 | |||
| 2355ba0c26 | |||
| d8de39462e | |||
| 46b7afda8a | |||
| 61a9478bf3 | |||
| 89206ee3e6 | |||
| 542cd9b3c2 | |||
| c425b3c8c3 | |||
| 84239c5653 | |||
| 56c919cb90 | |||
| d9daa2410f | |||
| 5972dc04cc | |||
| 4dac5497f8 | |||
| 770c9a0fb8 | |||
| 3d66a47226 | |||
| 4e2b101c33 | |||
| ea11467cc0 | |||
| 39e3436c69 | |||
| feadb42002 | |||
| 37020e8b53 | |||
| 10c8066469 | |||
| 9fdcf751ea | |||
| e373fe3706 | |||
| 147f5fc32e | |||
| 981f3ce605 | |||
| 8b9ccfab14 | |||
| 734182151f | |||
| c0a1f3ea33 | |||
| 7cc5ebd582 | |||
| 7cf865a39f | |||
| d012b82fce | |||
| 3ad690fae4 | |||
| eccb8c3cb3 | |||
| aacd3e7f51 | |||
| 121f22b608 | |||
| 367222cda0 | |||
| 4c7ff4a469 | |||
| d68e7fc955 | |||
| a09b6af359 | |||
| b3a1df9088 | |||
| f0ef5b39a6 | |||
| bfbc9daa33 | |||
| 040aa38659 | |||
| 826392fbda | |||
| 90a34cc958 | |||
| 47457337da | |||
| 3698e92545 | |||
| 77b123d955 |
10
.env
10
.env
@@ -10,13 +10,21 @@ trace = false
|
||||
; hostport = 3306
|
||||
; prefix = fa_
|
||||
|
||||
|
||||
hostname = 1.13.181.248
|
||||
database = midi
|
||||
username = midi
|
||||
password = YWbCxwkZKJ36nnDx
|
||||
password = 5B2zwShhTi5L7t2w
|
||||
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
|
||||
|
||||
@@ -40,8 +40,9 @@ 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'] = 1;
|
||||
$where['activities_id'] = $activities_id;
|
||||
$where['delete_time'] = 0;
|
||||
$count = db($this->table)->where($where)->count();
|
||||
$lists = db($this->table)->where($where)->page($page, $page_limit)->select();
|
||||
@@ -76,11 +77,12 @@ 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' => 1,
|
||||
'activities_id' => $activities_id,
|
||||
];
|
||||
$ext = [
|
||||
'title1' => $title1,
|
||||
@@ -167,11 +169,12 @@ 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'=>1,'delete_time'=>0])->select();
|
||||
$gift_bag = db('vs_gift_bag')->where(['activities_id'=>$activities_id,'delete_time'=>0])->select();
|
||||
|
||||
if($gift_bag_id){
|
||||
$where['gift_bag_id'] = $gift_bag_id;
|
||||
@@ -360,6 +363,7 @@ 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();
|
||||
@@ -373,6 +377,7 @@ class Activities extends adminApi
|
||||
'foreign_id' => $gift_id,
|
||||
'name' => $gift['title'],
|
||||
'days' => $decorate_price['day'],
|
||||
'gold' => $decorate_price['price'],
|
||||
];
|
||||
} elseif($type == 4){
|
||||
$data = [
|
||||
@@ -419,6 +424,7 @@ class Activities extends adminApi
|
||||
'money' => $ext['money'],
|
||||
'money_str' => $ext['money_str'],
|
||||
'diamond' => $ext['diamond'],
|
||||
'activity_end_time' => $ext['activity_end_time'],
|
||||
];
|
||||
return V(1,"成功",$data);
|
||||
}
|
||||
@@ -433,17 +439,20 @@ 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
|
||||
'status' => $status,
|
||||
'money' => $money,
|
||||
];
|
||||
$ext = [
|
||||
'counter' => $counter,
|
||||
'money_str' => $money_str,
|
||||
'diamond' => $diamond,
|
||||
'money' => $money
|
||||
'money' => $money,
|
||||
'activity_end_time' => $activity_end_time
|
||||
];
|
||||
$data['ext'] = json_encode($ext);
|
||||
$res = db::name($this->table)->where(['id'=>$id])->update($data);
|
||||
|
||||
@@ -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,10 +196,9 @@ 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) {
|
||||
@@ -211,6 +210,7 @@ class Admin extends adminApi
|
||||
$dataset[] = ['uid' => $params['id'], 'group_id' => $value];
|
||||
}
|
||||
model('admin/AuthGroupAccess')->saveAll($dataset);
|
||||
}
|
||||
Db::commit();
|
||||
return V(1,"成功", []);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@@ -52,10 +52,10 @@ class Adminlog extends adminApi
|
||||
$where['createtime'] = ['>=', strtotime($search_stime)];
|
||||
}
|
||||
if ($search_etime) {
|
||||
$where['createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($search_etime)];
|
||||
}
|
||||
if(!empty($search_stime) && !empty($search_etime)){
|
||||
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||
}
|
||||
|
||||
$list_data = $this->model->where($where)->where('admin_id', 'in', $this->childrenAdminIds)->order('createtime', 'desc')->paginate($page_limit, false, ['page' => $page]);
|
||||
|
||||
@@ -9,6 +9,7 @@ use think\Db;
|
||||
use think\Hook;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
use think\Cache;
|
||||
|
||||
/**
|
||||
* 盲盒
|
||||
@@ -61,17 +62,14 @@ class BlindBox extends adminApi
|
||||
$lists[$key]['gift_id'] = $value['foreign_id'];
|
||||
$lists[$key]['gift_name'] = $value['name'];
|
||||
$gift_data = db::name('vs_gift')->where(['gid'=>$value['foreign_id']])->find();
|
||||
if(empty($gift_data)){
|
||||
continue;
|
||||
}
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'];
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'];
|
||||
$lists[$key]['quantity'] = $value['quantity'];
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'];
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'];
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'];
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'];
|
||||
$lists[$key]['weight'] = $value['weight'];
|
||||
$lists[$key]['base_image'] = $gift_data['base_image'] ?? "";
|
||||
$lists[$key]['gift_price'] = $gift_data['gift_price'] ?? 0;
|
||||
$lists[$key]['quantity'] = $value['quantity'] ?? 0;
|
||||
$lists[$key]['remaining_number'] = $value['remaining_number'] ?? 0;
|
||||
$lists[$key]['is_public_screen'] = $gift_data['is_public_screen'] ?? 0;
|
||||
$lists[$key]['is_public_server'] = $gift_data['is_public_server'] ?? 0;
|
||||
$lists[$key]['is_world_show'] = $value['is_world_show'] ?? 0;
|
||||
$lists[$key]['weight'] = $value['weight'] ?? 0;
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
|
||||
}
|
||||
@@ -260,99 +258,107 @@ 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']]);
|
||||
}
|
||||
// 清除缓存
|
||||
Cache::rm("pan_gift_bag".$gift_bag_id);
|
||||
Cache::rm("pan_gift_bag_detail".$gift_bag_id);
|
||||
Cache::rm("pan_total_quantity".$gift_bag_id);
|
||||
Cache::rm("pan_total_remaining".$gift_bag_id);
|
||||
Cache::rm("pan_total_draw".$gift_bag_id);
|
||||
Cache::rm("pan_gift_info_map".$gift_bag_id);
|
||||
|
||||
return V(1,"成功");
|
||||
}
|
||||
|
||||
@@ -594,6 +600,9 @@ 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,"失败");
|
||||
@@ -726,7 +735,9 @@ 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;
|
||||
}
|
||||
@@ -751,8 +762,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_log')->where($where)->count();
|
||||
$lists_data = db::name('vs_gift_bag_receive_log')->where($where)->page($page, $page_limit)->order("id desc")->select();
|
||||
$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();
|
||||
$lists = [];
|
||||
foreach ($lists_data as $key => $value) {
|
||||
$lists[$key]['id'] = $value['id'];
|
||||
@@ -783,7 +794,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_log')->where($where)->order("id desc")->select();
|
||||
$all_lists_data = db::name('vs_gift_bag_receive_pan_log')->where($where)->order("id desc")->select();
|
||||
$total =0;
|
||||
$total_gift_money = 0;
|
||||
$total_money = 0;
|
||||
@@ -798,13 +809,18 @@ 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;
|
||||
$platform_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,
|
||||
@@ -818,6 +834,8 @@ 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);
|
||||
@@ -834,7 +852,9 @@ 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;
|
||||
}
|
||||
@@ -872,6 +892,11 @@ 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'));
|
||||
|
||||
@@ -327,6 +327,7 @@ 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!=""){
|
||||
@@ -340,7 +341,8 @@ class Decorate extends adminApi
|
||||
$return_list = [];
|
||||
foreach ($lists as $k=>$v){
|
||||
$return_list[$k]['id'] = $v['udid'];
|
||||
$return_list[$k]['user_name'] = $v['user_id']."-".db::name('user')->where(['id'=>$v['user_id']])->value('nickname');
|
||||
$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]['type'] = model('api/Decorate')->TypeArray[$v['type']];
|
||||
if($v['type'] >= 6){
|
||||
$return_list[$k]['name'] = $v['special_num'];
|
||||
|
||||
@@ -31,36 +31,46 @@ class GiveGift extends adminApi
|
||||
$end_time = input('end_time', '');
|
||||
|
||||
$where=[];
|
||||
$gwhere = [];
|
||||
if($send_user != ''){
|
||||
$user_id = db::name('user')->where('user_code', $send_user)->value('id');
|
||||
$where['user_id'] = $user_id;
|
||||
$gwhere['gg.user_id'] = $user_id;
|
||||
}
|
||||
if($gift_user != ''){
|
||||
$gift_user_id = db::name('user')->where('user_code', $gift_user)->value('id');
|
||||
$where['gift_user'] = $gift_user_id;
|
||||
$gwhere['gg.gift_user'] = $gift_user_id;
|
||||
}
|
||||
if($from_id != ''){
|
||||
$room_id = db::name('vs_room')->where('room_number', $from_id)->value('id');
|
||||
if($room_id){
|
||||
$where['from_id'] = $room_id;
|
||||
$gwhere['gg.from_id'] = $room_id;
|
||||
}else{
|
||||
$where['from_id'] = $from_id;
|
||||
$gwhere['gg.from_id'] = $from_id;
|
||||
}
|
||||
}
|
||||
if($gift_id != ''){
|
||||
$where['gift_id'] = $gift_id;
|
||||
$gwhere['gg.gift_id'] = $gift_id;
|
||||
}
|
||||
if($from != ''){
|
||||
$where['from'] = $from;
|
||||
$gwhere['gg.from'] = $from;
|
||||
}
|
||||
// 时间筛选优化
|
||||
if (!empty($start_time) || !empty($end_time)) {
|
||||
if (!empty($start_time) && !empty($end_time)) {
|
||||
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
|
||||
$where['createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
$gwhere['gg.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
} elseif (!empty($start_time)) {
|
||||
$where['createtime'] = ['>=', strtotime($start_time)];
|
||||
$gwhere['gg.createtime'] = ['>=', strtotime($start_time)];
|
||||
} elseif (!empty($end_time)) {
|
||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
$gwhere['gg.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
}
|
||||
//礼物总数
|
||||
@@ -79,15 +89,12 @@ class GiveGift extends adminApi
|
||||
$count = db::name('vs_give_gift')->where($where)->count();
|
||||
$earning_list = [];
|
||||
if(!empty($where)){
|
||||
$gift_ids = db::name('vs_give_gift')->where($where)->column('id');
|
||||
if (!empty($gift_ids)) {
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
->field('app_earning,gift_user_earning,room_owner_earning')
|
||||
->where('give_gift_id', 'in', $gift_ids)
|
||||
->order('id', 'desc')
|
||||
->alias('egl')
|
||||
->join('vs_give_gift gg', 'egl.give_gift_id = gg.id')
|
||||
->where($gwhere) // 替换为实际的筛选条件
|
||||
->field('egl.app_earning,egl.gift_user_earning,egl.room_owner_earning')
|
||||
->select();
|
||||
}
|
||||
}else{
|
||||
// 批量获取所有收益记录
|
||||
$earning_list = db::name('vs_give_gift_ratio_log')
|
||||
@@ -199,6 +206,8 @@ class GiveGift extends adminApi
|
||||
$value['gift_user_earning'] = $earning_info ? $earning_info['gift_user_earning'] : 0;
|
||||
$value['room_owner_earning'] = $earning_info ? $earning_info['room_owner_earning'] : 0;
|
||||
}
|
||||
//比例
|
||||
$config = get_system_config();
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
@@ -209,7 +218,10 @@ class GiveGift extends adminApi
|
||||
'total_price' => $total_price,
|
||||
'app_earning' => round($app_earning,2) ,
|
||||
'receive_earning' => round($receive_earning,2),
|
||||
'room_owner_earning' => round($room_owner_earning,2)
|
||||
'room_owner_earning' => round($room_owner_earning,2),
|
||||
'app_earning_ratio' => 100 - $config['room_gift_ratio'] - $config['room_author_ratio'],
|
||||
'receive_earning_ratio' => $config['room_gift_ratio'] ?? 0,
|
||||
'room_owner_earning_ratio' => $config['room_author_ratio'] ?? 0,
|
||||
]
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
|
||||
@@ -84,11 +84,12 @@ class Guild extends adminApi
|
||||
//当日流水
|
||||
$list[$k]['today_money'] = model('Guild')->getTodayMoney($v['id'],$search_stime,$search_etime);
|
||||
$list[$k]['is_show'] = $v['is_show'];
|
||||
$list[$k]['is_show_str'] = $v['is_show'] == 1 ? '显示' : '隐藏';
|
||||
$list[$k]['status'] = $v['status'];
|
||||
$list[$k]['status_str'] = $v['status'] == 1 ? '正常' : '解散';
|
||||
$list[$k]['createtime'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$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 排序
|
||||
@@ -102,6 +103,21 @@ class Guild extends adminApi
|
||||
$reslut['list'] = $list;
|
||||
return V(1,"成功", $reslut);
|
||||
}
|
||||
/*
|
||||
* 工会显示状态修改
|
||||
*/
|
||||
public function guild_show_status_edit(){
|
||||
$id = input('id',0);
|
||||
$guild = model('Guild')->getOne(['id'=>$id]);
|
||||
if (!$guild) {
|
||||
return V(0, "数据不存在");
|
||||
}
|
||||
if ($guild) {
|
||||
$status = $guild['is_show'] == 1 ? 0 : 1;
|
||||
}
|
||||
$res = db::name('vs_guild')->where('id',$id)->update(['is_show'=>$status]);;
|
||||
return V(1,"成功", $res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工会添加
|
||||
@@ -342,9 +358,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'];
|
||||
$rum_lists[$k]['wealth_level']=$user_info['wealth_level'];
|
||||
$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;
|
||||
//用户流水
|
||||
$consumption_sql = db::name('vs_user_money_log')
|
||||
->whereIn('change_type',$coin_consumption_type_array)
|
||||
@@ -379,8 +395,8 @@ class Guild extends adminApi
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$guild_id = input('guild_id', 0);
|
||||
$search_stime = input('search_stime','');
|
||||
$search_etime = input('search_etime','');
|
||||
$search_stime_str = input('search_stime','');
|
||||
$search_etime_str = input('search_etime','');
|
||||
$room_id = input('room_id', 0);
|
||||
$where=['a.status'=>1];
|
||||
$where=['a.room_id'=>['>',0]];
|
||||
@@ -396,15 +412,44 @@ class Guild extends adminApi
|
||||
}
|
||||
$count = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->count();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)->count();
|
||||
$list = db::name($this->table_guild_user)->alias('a')
|
||||
->join('vs_room b', 'a.room_id = b.id', 'left')
|
||||
->where(['a.guild_id'=>$guild_id,'a.quit_type'=>['in',[0,3]]])->where($where)->page($page, $page_limit)->select();
|
||||
->where(['a.guild_id'=>$guild_id])->where($where)
|
||||
// ->page($page, $page_limit)
|
||||
->select();
|
||||
if(!$list){
|
||||
return V(0,"暂无数据");
|
||||
}
|
||||
$rum_lists = [];
|
||||
//总流水
|
||||
$total_consumption = 0;
|
||||
foreach ($list as $k=>$v){
|
||||
$search_stime = $search_stime_str;
|
||||
$search_etime = $search_etime_str;
|
||||
if($search_stime!=""){
|
||||
if($search_stime!="" && $v['createtime'] < strtotime($search_stime)){
|
||||
$search_stime = $search_stime;
|
||||
}else{
|
||||
$search_stime = date('Y-m-d H:i:s',$v['createtime']) ;
|
||||
}
|
||||
}else{
|
||||
$search_stime = $search_stime;
|
||||
}
|
||||
if($search_etime!=""){
|
||||
if($v['quit_time']){
|
||||
if($search_etime!="" && $v['quit_time'] > strtotime($search_etime)){
|
||||
$search_etime = $search_etime;
|
||||
}else{
|
||||
$search_etime = date('Y-m-d H:i:s',$v['quit_time']);
|
||||
}
|
||||
}else{
|
||||
$search_etime = $search_etime;
|
||||
}
|
||||
}else{
|
||||
$search_etime = $search_etime;
|
||||
}
|
||||
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id']])->find();
|
||||
$rum_lists[$k]['id']=$v['id'];
|
||||
$rum_lists[$k]['room_id']=$v['room_id'];
|
||||
@@ -414,10 +459,18 @@ class Guild extends adminApi
|
||||
//房间流水
|
||||
$rum_lists[$k]['consumption']= model('Room')->getRoomFlow($v['room_id'],$search_stime,$search_etime);
|
||||
$rum_lists[$k]['add_time'] = date('Y-m-d H:i:s',$v['createtime']);
|
||||
$total_consumption += $rum_lists[$k]['consumption'];
|
||||
}
|
||||
usort($rum_lists, function($a, $b) {
|
||||
return $b['consumption'] - $a['consumption'];
|
||||
});
|
||||
//分页
|
||||
$rum_lists = array_slice($rum_lists, ($page-1)*$page_limit, $page_limit);
|
||||
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'total_consumption' => $total_consumption,
|
||||
'count' => $count,
|
||||
'lists' => $rum_lists
|
||||
];
|
||||
@@ -623,12 +676,14 @@ 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 = ['b.delete_time'=>0];
|
||||
$where = [];
|
||||
if($search_user_id){
|
||||
$where['b.user_id'] = $search_user_id;
|
||||
}
|
||||
if($search_guild_id){
|
||||
$where['a.guild_id'] = $search_guild_id;
|
||||
//$where['a.guild_id'] = $search_guild_id;
|
||||
$where['b.guild_special_id'] = $search_guild_id;
|
||||
}
|
||||
if($search_status_time){
|
||||
$where['a.start_time'] = ['>=', $search_status_time];
|
||||
@@ -646,7 +701,7 @@ class Guild extends adminApi
|
||||
$lists_data = db::name($this->table_guild_subsidy)->alias('a')
|
||||
->join('vs_guild b','a.guild_id = b.id')
|
||||
->where($where)
|
||||
->order('a.id desc')
|
||||
->order('a.total_transaction desc')
|
||||
->field('a.*,b.guild_name,b.user_id,b.guild_special_id')
|
||||
->page($page,$page_limit)
|
||||
->select();
|
||||
|
||||
@@ -54,6 +54,15 @@ 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();
|
||||
|
||||
@@ -425,6 +425,12 @@ class Room extends adminApi
|
||||
$search_room_id = input('search_room_id', '');
|
||||
$search_user_id = input('search_user_id', '');
|
||||
$search_status = input('search_status', '');
|
||||
$type_id = input('type_id', '');
|
||||
$label_id = input('label_id', '');
|
||||
$is_hot = input('is_hot', '');
|
||||
$is_top = input('is_top', '');
|
||||
$is_recommend = input('is_recommend', '');
|
||||
|
||||
$where=[];
|
||||
//房间号
|
||||
if($search_room_id!==''){
|
||||
@@ -437,9 +443,25 @@ class Room extends adminApi
|
||||
if($search_status!==''){
|
||||
$where['room_status'] = $search_status;
|
||||
}
|
||||
if($type_id!==''){
|
||||
$where['type_id'] = $type_id;
|
||||
}else{
|
||||
$where['type_id'] = ['<>',6];
|
||||
}
|
||||
if($label_id!==''){
|
||||
$where['label_id'] = $label_id;
|
||||
}
|
||||
if($is_hot!==''){
|
||||
$where['is_hot'] = $is_hot;
|
||||
}
|
||||
if($is_top!==''){
|
||||
$where['is_top'] = $is_top;
|
||||
}
|
||||
if($is_recommend!==''){
|
||||
$where['is_recommend'] = $is_recommend;
|
||||
}
|
||||
//房间列表只展示 审核通过的房间
|
||||
$where['apply_status'] = 2;//1待审核 2审核通过 3审核失败
|
||||
$where['type_id'] = ['<>',6];
|
||||
$count = db::name($this->table)->where($where)->count();
|
||||
$room_lists = db::name($this->table)->where($where)->page($page, $page_limit)->select();
|
||||
$lists = [];
|
||||
@@ -656,8 +678,8 @@ class Room extends adminApi
|
||||
}
|
||||
elseif ($type == 3){
|
||||
//周流水
|
||||
//周一
|
||||
$begin_time = strtotime(date('Y-m-d 24:00:00',strtotime('-'.date('w').'days')));
|
||||
//本周一
|
||||
$begin_time = strtotime(date('Y-m-d 00:00:00', strtotime('this week')));
|
||||
$end_time = time();
|
||||
$where['a.createtime'] = ['between', [$begin_time, $end_time]];
|
||||
}
|
||||
@@ -992,6 +1014,10 @@ 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;
|
||||
@@ -1002,12 +1028,36 @@ 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']);
|
||||
@@ -1018,7 +1068,27 @@ 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,
|
||||
@@ -1028,6 +1098,7 @@ class Room extends adminApi
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
|
||||
//Cp电影房封禁
|
||||
public function cp_movie_room_forbid()
|
||||
{
|
||||
@@ -1465,10 +1536,10 @@ class Room extends adminApi
|
||||
$where['createtime'] = ['>=',strtotime($stime)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
|
||||
$where['createtime'] = ['<=',strtotime($etime)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
}
|
||||
$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();
|
||||
@@ -1636,4 +1707,183 @@ 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表的ID,user_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);
|
||||
}
|
||||
|
||||
}
|
||||
227
application/adminapi/controller/RoomEmoji.php
Normal file
227
application/adminapi/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
|
||||
namespace app\adminapi\controller;
|
||||
|
||||
use app\admin\model\AdminLog;
|
||||
use app\common\controller\adminApi;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Hook;
|
||||
use think\Model;
|
||||
use think\Session;
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 房间
|
||||
* @internal
|
||||
*/
|
||||
class RoomEmoji extends adminApi
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['emoji_list','add_emoji','edit_emoji','del_emoji','emoji_detail','emoji_type_list'];
|
||||
|
||||
protected $table = 'vs_room_emoji';
|
||||
protected $table_type = 'vs_room_emoji_type';
|
||||
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
|
||||
}
|
||||
//房间表情列表
|
||||
function emoji_list(){
|
||||
$id = input('id', '', 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$page = input('page', 1);
|
||||
$page_limit = input('page_limit', 30);
|
||||
$where = [];
|
||||
if ($id) {
|
||||
$where['id'] = $id;
|
||||
}
|
||||
if ($name) {
|
||||
$where['name'] = ['like', '%' . $name . '%'];
|
||||
}
|
||||
$total = Db::name($this->table)
|
||||
->where($where)
|
||||
->count();
|
||||
$list = Db::name($this->table)
|
||||
->where($where)
|
||||
->where(['deletetime' => 0])
|
||||
->order('sort desc,id desc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
foreach ($list as &$item) {
|
||||
$item['type_str'] = Db::name($this->table_type)->where('id', $item['type_id'])->value('type_name');
|
||||
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
|
||||
$item['status_str'] = $item['status'] == 1 ? '显示' : '隐藏';
|
||||
}
|
||||
$return_data = [
|
||||
'page' =>$page,
|
||||
'page_limit' => $page_limit,
|
||||
'count' => $total,
|
||||
'list' => $list
|
||||
];
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
//添加房间表情
|
||||
function add_emoji(){
|
||||
$pid = input('pid', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$name) {
|
||||
return V(0, '请输入表情名称');
|
||||
}
|
||||
if (!$img) {
|
||||
return V(0, '请上传表情图片');
|
||||
}
|
||||
if (!$type_id) {
|
||||
return V(0, '请选择表情类型');
|
||||
}
|
||||
$data = [
|
||||
'pid' => $pid,
|
||||
'name' => $name,
|
||||
'image' => $img,
|
||||
'animate_image' => $animate_image,
|
||||
'sort' => $sort,
|
||||
'type_id' => $type_id,
|
||||
'status' => $status,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//房间表情修改
|
||||
function edit_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$name = input('name', '', 'trim');
|
||||
$img = input('image', '', 'trim');
|
||||
$animate_image = input('animate_image', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$type_id = input('type_id', 0);
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情');
|
||||
}
|
||||
if($name){
|
||||
$data['name'] = $name;
|
||||
}
|
||||
if($img){
|
||||
$data['image'] = $img;
|
||||
}
|
||||
if($animate_image){
|
||||
$data['animate_image'] = $animate_image;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($type_id){
|
||||
$data['type_id'] = $type_id;
|
||||
}
|
||||
$data['status'] = $status;
|
||||
$res = Db::name($this->table)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
}
|
||||
//房间表情删除
|
||||
function del_emoji(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情');
|
||||
}
|
||||
$res = Db::name($this->table)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
}
|
||||
//表情详情
|
||||
function emoji_detail(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要查看的表情');
|
||||
}
|
||||
$detail = Db::name($this->table)->where('id',$id)->find();
|
||||
if (!$detail) {
|
||||
return V(0, '表情不存在');
|
||||
}
|
||||
return V(1,"成功", $detail);
|
||||
}
|
||||
|
||||
//表情类型列表
|
||||
function emoji_type_list(){
|
||||
$emoji_type = Db::name($this->table_type)
|
||||
->field('id,type_name')
|
||||
->where(['deletetime'=>0,'status'=>1])
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
return V(1,"成功", $emoji_type);
|
||||
}
|
||||
|
||||
//表情类型添加
|
||||
function add_emoji_type(){
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
if (!$type_name) {
|
||||
return V(0, '请输入表情类型名称');
|
||||
}
|
||||
$data = [
|
||||
'type_name' => $type_name,
|
||||
'sort' => 0,
|
||||
'status' => 1,
|
||||
'createtime' => time(),
|
||||
];
|
||||
$res = Db::name($this->table_type)->insert($data);
|
||||
if ($res) {
|
||||
return V(1, '添加成功');
|
||||
}
|
||||
}
|
||||
//表情类型修改
|
||||
function edit_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
$type_name = input('type_name', '', 'trim');
|
||||
$sort = input('sort', 0, 'intval');
|
||||
$status = input('status', 1, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要修改的表情类型');
|
||||
}
|
||||
if($type_name){
|
||||
$data['type_name'] = $type_name;
|
||||
}
|
||||
if($sort){
|
||||
$data['sort'] = $sort;
|
||||
}
|
||||
if($status){
|
||||
$data['status'] = $status;
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update($data);
|
||||
if ($res) {
|
||||
return V(1, '修改成功');
|
||||
}
|
||||
return V(0, '修改失败');
|
||||
}
|
||||
//表情类型删除
|
||||
function del_emoji_type(){
|
||||
$id = input('id', 0, 'intval');
|
||||
if (!$id) {
|
||||
return V(0, '请选择要删除的表情类型');
|
||||
}
|
||||
$res = Db::name($this->table_type)->where('id',$id)->update(
|
||||
['deletetime' => time()]
|
||||
);
|
||||
if ($res) {
|
||||
return V(1, '删除成功');
|
||||
}
|
||||
return V(0, '删除失败');
|
||||
}
|
||||
}
|
||||
371
application/adminapi/controller/RoomHourRanking.php
Normal file
371
application/adminapi/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,371 @@
|
||||
<?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);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ class Statistical extends adminApi
|
||||
$where['createtime'] = ['>=', strtotime($begin_time)];
|
||||
}
|
||||
if($end_time !== ''){
|
||||
$where['createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
|
||||
$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.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
$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.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
// 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.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if(!empty($begin_time) && !empty($end_time)){
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($begin_time),strtotime($end_time)]];
|
||||
}
|
||||
//不为空
|
||||
$where['from'] = 2;
|
||||
@@ -259,9 +259,14 @@ class Statistical extends adminApi
|
||||
->select();
|
||||
foreach ($lists as $key => $value) {
|
||||
$room = db::name('vs_room')->where('id', $value['from_id'])->find();
|
||||
$lists[$key]['createtime'] = date('Y-m-d H:i:s', $value['createtime']);
|
||||
if($room){
|
||||
$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');
|
||||
@@ -302,10 +307,10 @@ class Statistical extends adminApi
|
||||
$where['createtime'] = ['>=', strtotime($pay_stime)];
|
||||
}
|
||||
if($pay_etime !== ''){
|
||||
$where['createtime'] = ['<=', strtotime($pay_etime.' 23:59:59')];
|
||||
$where['createtime'] = ['<=', strtotime($pay_etime)];
|
||||
}
|
||||
if(!empty($pay_stime) && !empty($pay_etime)){
|
||||
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($pay_stime),strtotime($pay_etime)]];
|
||||
}
|
||||
if($pay_status !== ''){
|
||||
$where['pay_status'] = $pay_status;
|
||||
@@ -346,19 +351,21 @@ class Statistical extends adminApi
|
||||
];
|
||||
//总收入
|
||||
$wherew=[];
|
||||
$return_data['total_money'] = db::name('vs_user_recharge')->sum('money');
|
||||
unset($where['pay_status']);
|
||||
unset($where['pay_type']);
|
||||
$return_data['total_money'] = db::name('vs_user_recharge')->where($where)->sum('money');
|
||||
//未支付
|
||||
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where('pay_status',1)->sum('money');
|
||||
$return_data['unpaid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',1)->sum('money');
|
||||
//已支付
|
||||
$return_data['paid_money'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('money');
|
||||
$return_data['paid_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('money');
|
||||
//微信支付
|
||||
$wherew['pay_type'] = ['in', [1,4]];
|
||||
$return_data['wx_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherew)->sum('money');
|
||||
$return_data['wx_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherew)->sum('money');
|
||||
//支付宝支付
|
||||
$wherez['pay_type'] = ['in', [2,3]];
|
||||
$return_data['ali_money'] = db::name('vs_user_recharge')->where('pay_status',2)->where($wherez)->sum('money');
|
||||
$return_data['ali_money'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->where($wherez)->sum('money');
|
||||
//金币数量
|
||||
$return_data['gold_num'] = db::name('vs_user_recharge')->where('pay_status',2)->sum('coin');
|
||||
$return_data['gold_num'] = db::name('vs_user_recharge')->where($where)->where('pay_status',2)->sum('coin');
|
||||
return V(1,"成功", $return_data);
|
||||
}
|
||||
|
||||
@@ -383,10 +390,10 @@ class Statistical extends adminApi
|
||||
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
||||
}
|
||||
if($end_time !== ''){
|
||||
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
||||
$where['a.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if($start_time !== '' && $end_time !== ''){
|
||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
|
||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
}
|
||||
|
||||
$count = db::name('user_exchange')->where($where)->alias('a')->join('user b', 'a.user_id = b.id')->count();
|
||||
@@ -429,10 +436,10 @@ class Statistical extends adminApi
|
||||
$where['a.createtime'] = ['>=', strtotime($start_time)];
|
||||
}
|
||||
if($end_time !== ''){
|
||||
$where['a.createtime'] = ['<=', strtotime($end_time.' 23:59:59')];
|
||||
$where['a.createtime'] = ['<=', strtotime($end_time)];
|
||||
}
|
||||
if($start_time !== '' && $end_time !== ''){
|
||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time.' 23:59:59')]];
|
||||
$where['a.createtime'] = ['between', [strtotime($start_time), strtotime($end_time)]];
|
||||
}
|
||||
$count = db::name('vs_admin_recharge_log')
|
||||
->alias('a')->join('user b', 'a.user_id = b.id')
|
||||
|
||||
@@ -33,6 +33,10 @@ class SysSet extends adminApi
|
||||
'8' => '房间配置',
|
||||
'9' => '弹窗内容设置',
|
||||
'10' => '邀请奖励',
|
||||
'11' => '二级密码',
|
||||
];
|
||||
public $noAdminConfigType = [
|
||||
'1' => '基础设置',
|
||||
];
|
||||
|
||||
public function _initialize()
|
||||
@@ -44,7 +48,11 @@ class SysSet extends adminApi
|
||||
* 类型列表
|
||||
*/
|
||||
public function type_list(){
|
||||
if($this->auth->isSuperAdmin()){
|
||||
$configType = $this->configType;
|
||||
}else{
|
||||
$configType = $this->noAdminConfigType;
|
||||
}
|
||||
$list = [];
|
||||
$i=0;
|
||||
foreach ($configType as $k=>$v){
|
||||
|
||||
@@ -72,10 +72,12 @@ class User extends adminApi
|
||||
if($v=='coin1'){
|
||||
$where['c.coin'] = ['>=',$input_data];
|
||||
}elseif($v=='coin2'){
|
||||
if($input_data){
|
||||
$where['c.coin'] = ['<=',$input_data];
|
||||
}
|
||||
}elseif($v=='createtime'){
|
||||
$where['a.createtime'] = ['>=',strtotime($input_data.' 00:00:00')];
|
||||
$where['a.createtime'] = ['<=',strtotime($input_data.' 23:59:59')];
|
||||
$where['a.createtime'] = ['>=',strtotime($input_data)];
|
||||
$where['a.createtime'] = ['<=',strtotime($input_data)];
|
||||
}else{
|
||||
$where['a.'.$v] = $input_data;
|
||||
}
|
||||
@@ -231,7 +233,8 @@ class User extends adminApi
|
||||
'type' => $type,
|
||||
'type_text' => $type_text,
|
||||
];
|
||||
$res = Db::name('block')->where($map)->delete();
|
||||
Db::name('block')->where($map)->delete();
|
||||
Db::name('sms_error')->where(['mobile' => $user_info['mobile']])->delete();
|
||||
}
|
||||
return V(1,"成功", null);
|
||||
}
|
||||
@@ -435,7 +438,15 @@ class User extends adminApi
|
||||
$page = input('page',1);
|
||||
$page_limit = input('page_limit',10);
|
||||
$type = input('type','');
|
||||
$return = model('UserWallet')->money_change_log($user_id,$type,$page,$page_limit);
|
||||
$stime = input('stime','');
|
||||
$etime = input('etime','');
|
||||
$change_type = input('change_type','');
|
||||
$seach = [
|
||||
'stime' => $stime,
|
||||
'etime' => $etime,
|
||||
'change_type' => $change_type
|
||||
];
|
||||
$return = model('UserWallet')->money_change_log($user_id,$seach,$type,$page,$page_limit);
|
||||
$list = [];
|
||||
foreach($return['list'] as $k=>$v){
|
||||
$list[$k] = [
|
||||
@@ -455,6 +466,14 @@ class User extends adminApi
|
||||
return V(1,"操作成功", $return_data);
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取用户资金类型
|
||||
*/
|
||||
public function get_money_type(){
|
||||
$reslut = model('UserWallet')->getChangeTypeLableList();
|
||||
return V(1,"操作成功", $reslut);
|
||||
}
|
||||
|
||||
/*
|
||||
* 相册列表
|
||||
*/
|
||||
@@ -735,7 +754,12 @@ class User extends adminApi
|
||||
* 用户列表
|
||||
*/
|
||||
public function get_user_list(){
|
||||
$user = db::name('user')->field('id,nickname,avatar')->where(['status'=>1,'is_robot'=>0,'delete_time'=>0])->select();
|
||||
$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();
|
||||
return V(1,"操作成功", $user);
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Version extends adminApi
|
||||
$version = input('version', '');
|
||||
$type = input('type', '');
|
||||
$downloadurl = input('downloadurl', '');
|
||||
$content = input('content', '');
|
||||
$content = $_POST['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 = input('content', '');
|
||||
$content = $_POST['content'] ?? '';
|
||||
$enforce = input('enforce', '');
|
||||
$version_code = input('version_code', '');
|
||||
$status = input('status', 1);
|
||||
|
||||
@@ -60,10 +60,10 @@ class Withdrawal extends adminApi
|
||||
$where['a.createtime'] = ['>=', strtotime($search_stime)];
|
||||
}
|
||||
if($search_etime !== ''){
|
||||
$where['a.createtime'] = ['<=', strtotime($search_etime.' 23:59:59')];
|
||||
$where['a.createtime'] = ['<=', strtotime($search_etime)];
|
||||
}
|
||||
if(!empty($search_stime) && !empty($search_etime)){
|
||||
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
||||
$where['a.createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||
}
|
||||
$count = db::name('vs_user_withdrawal')->alias('a')
|
||||
->join('user b', 'a.user_id = b.id', 'left')
|
||||
@@ -75,6 +75,7 @@ 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) {
|
||||
@@ -255,19 +256,23 @@ 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']) >= 98000){
|
||||
if(($had_money+$withdraw_info['general_money']) >= $max_month_money){
|
||||
return ['code' => 0, 'msg' => '单人单月云账户提现金额最大为98000元!', 'data' => null];
|
||||
}
|
||||
//查询该用户信息
|
||||
$user_info = model('api/user')->get_user_info($withdraw_info['user_id']);
|
||||
$user_info = model('api/user')->get_user_info($withdraw_info['user_id'], ['user','user_auth']);
|
||||
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];
|
||||
}
|
||||
@@ -281,7 +286,11 @@ 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);
|
||||
$result = $yun_pay->alipay();
|
||||
$user_data = [
|
||||
'nickname' => $user_info['nickname'],
|
||||
'user_id' => $withdraw_info['user_id'],
|
||||
];
|
||||
$result = $yun_pay->alipay($user_data);
|
||||
} elseif ($withdraw_info['type'] == 3) {
|
||||
if(empty($user_info['bank_card_number'])){
|
||||
return ['code' => 0, 'msg' => '请先绑定银行卡号', 'data' => null];
|
||||
|
||||
@@ -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])
|
||||
->where(['g.user_id' => $user_id,'g.status' => 1,'g.delete_time' => 0])
|
||||
->find();
|
||||
return $guild;
|
||||
}
|
||||
@@ -95,31 +95,29 @@ class Guild extends Model
|
||||
*工会当日流水
|
||||
*/
|
||||
public function getTodayMoney($guild_id,$stoday="",$etoday=""){
|
||||
$where = [];
|
||||
if(empty($stoday) && empty($etoday)){
|
||||
$stoday = strtotime(date('Y-m-d 00:00:00'));
|
||||
$etoday = strtotime(date('Y-m-d 23:59:59'));
|
||||
$where['createtime'] = ['between', [$stoday, $etoday]];
|
||||
}else{
|
||||
if(!empty($stoday)){
|
||||
$where['createtime'] = ['>=', strtotime($stoday."00:00:00")];
|
||||
}
|
||||
if(!empty($etoday)){
|
||||
$where['createtime'] = ['<=', strtotime($etoday." 23:59:59")];
|
||||
}
|
||||
if(!empty($stoday) && !empty($etoday)){
|
||||
$where['createtime'] = ['between', [strtotime($stoday." 00:00:00"), strtotime($etoday." 23:59:59")]];
|
||||
}
|
||||
}
|
||||
|
||||
//获取所有工会房间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)
|
||||
$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) {
|
||||
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()));
|
||||
}else{
|
||||
$stoday_seach = strtotime($stoday);
|
||||
$etoday_seach = strtotime($etoday);
|
||||
}
|
||||
if($v['createtime'] && $stoday_seach < $v['createtime']){
|
||||
$stoday_seach = $v['createtime'];
|
||||
}
|
||||
if($v['quit_time'] && ($etoday > $v['quit_time'])){
|
||||
$etoday_seach = $v['quit_time'];
|
||||
}
|
||||
$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]]])
|
||||
->sum('total_price');
|
||||
$transaction += $transaction_one;
|
||||
}
|
||||
return $transaction;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.' 00:00:00')];
|
||||
$give_where['createtime'] = ['>=',strtotime($stime)];
|
||||
}
|
||||
if(!empty($etime)){
|
||||
$give_where['createtime'] = ['<=',strtotime($etime.' 23:59:59')];
|
||||
$give_where['createtime'] = ['<=',strtotime($etime)];
|
||||
}
|
||||
if(!empty($stime) && !empty($etime)){
|
||||
$give_where['createtime'] = ['between',[strtotime($stime.' 00:00:00'),strtotime($etime.' 23:59:59')]];
|
||||
$give_where['createtime'] = ['between',[strtotime($stime),strtotime($etime)]];
|
||||
}
|
||||
$total_price = db::name('vs_give_gift')->where($give_where)
|
||||
->sum('total_price');
|
||||
@@ -92,18 +92,18 @@ class Room extends Model
|
||||
* 房间绑定盘
|
||||
*/
|
||||
public function bindPan($room_id){
|
||||
db::name('vs_room_pan')->where(['room_id'=>$room_id])->delete();
|
||||
$gift_bag = db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>['in',[10,11,12,13]]])->select();
|
||||
foreach ($gift_bag as $k=>$v){
|
||||
$data = [
|
||||
'room_id'=>$room_id,
|
||||
'gift_bag_id'=>$v['gift_bag_id'],
|
||||
'gift_bag_detail_id'=>$v['id'],
|
||||
'remaining_number'=>$v['quantity'],
|
||||
'createtime'=>time()
|
||||
];
|
||||
db::name('vs_room_pan')->insert($data);
|
||||
}
|
||||
// db::name('vs_room_pan')->where(['room_id'=>$room_id])->delete();
|
||||
// $gift_bag = db::name('vs_gift_bag_detail')->where(['gift_bag_id'=>['in',[10,11,12,13]]])->select();
|
||||
// foreach ($gift_bag as $k=>$v){
|
||||
// $data = [
|
||||
// 'room_id'=>$room_id,
|
||||
// 'gift_bag_id'=>$v['gift_bag_id'],
|
||||
// 'gift_bag_detail_id'=>$v['id'],
|
||||
// 'remaining_number'=>$v['quantity'],
|
||||
// 'createtime'=>time()
|
||||
// ];
|
||||
// db::name('vs_room_pan')->insert($data);
|
||||
// }
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => null];
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ 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']??"";
|
||||
@@ -87,8 +88,8 @@ class Activities extends BaseCom
|
||||
$uid = input('uid',$this->uid);
|
||||
$permission_status = 1;
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->find();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$uid)->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
$system = request()->header('system');
|
||||
$app_version = request()->header('App-Version');
|
||||
if(!$app_version){
|
||||
@@ -129,46 +130,51 @@ 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'] = $ext['money'];
|
||||
$data['counter']['counter'] = $ext['counter'];
|
||||
$data['counter']['money'] = $ext['money_str'];
|
||||
$data['counter']['diamond'] = $ext['diamond'];
|
||||
$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);
|
||||
}
|
||||
$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]['name'] = "金币";
|
||||
$list[$k]['gift_name'] = "金币";
|
||||
$list[$k]['num'] = $v['gold'];
|
||||
$list[$k]['gold'] = $v['gold'];
|
||||
$list[$k]['gift_price'] = $v['gold'];
|
||||
$list[$k]['type'] = 1;
|
||||
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||
$list[$k]['base_image'] = 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]['name'] = $gift['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift['gift_name'];
|
||||
$list[$k]['num'] = $v['quantity'];
|
||||
$list[$k]['gold'] = $gift['gift_price'];
|
||||
$list[$k]['gift_price'] = $gift['gift_price'];
|
||||
$list[$k]['type'] =2;
|
||||
$list[$k]['icon'] = $gift['play_image'];
|
||||
$list[$k]['base_image'] = $gift['base_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]['name'] = $gift['title']; //装扮名称
|
||||
$list[$k]['gift_name'] = $gift['title']; //装扮名称
|
||||
$list[$k]['num'] = $decorate_price['day']; //天数
|
||||
$list[$k]['gold'] = $decorate_price['price']; //价格
|
||||
$list[$k]['gift_price'] = $decorate_price['price']; //价格
|
||||
$list[$k]['type'] =3;
|
||||
$list[$k]['icon'] = $gift['base_image'];
|
||||
$list[$k]['base_image'] = $gift['base_image'];
|
||||
}elseif($v['type'] == 4) {
|
||||
$list[$k]['name'] = "钻石";
|
||||
$list[$k]['gift_name'] = "钻石";
|
||||
$list[$k]['num'] = $v['quantity'];
|
||||
$list[$k]['gold'] = $v['gold'];
|
||||
$list[$k]['gift_price'] = $v['gold'];
|
||||
$list[$k]['type'] = 4;
|
||||
$list[$k]['icon'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||
$list[$k]['base_image'] = localpath_to_netpath("static/image/icon/gold.png");
|
||||
}
|
||||
}
|
||||
$data['gift_list'] = $list;
|
||||
@@ -179,20 +185,183 @@ class Activities extends BaseCom
|
||||
{
|
||||
$activities_id = 3;//天降好礼
|
||||
$uid = input('uid',$this->uid);
|
||||
$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]);
|
||||
//礼包
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
return V(1,'操作成功', ['permission'=>$permission]);
|
||||
}
|
||||
//天降好礼发放
|
||||
public function drop_gift_send()
|
||||
{
|
||||
$uid = input('uid',$this->uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid);
|
||||
$reslut = model('Activities')->drop_gift_send($uid,16);
|
||||
return V($reslut['code'],$reslut['msg'], $reslut['data']);
|
||||
}
|
||||
|
||||
//新人好礼
|
||||
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)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
$permission = DB::name('vs_activities_receive')->where(['activities_id'=>$activities_id,'user_id'=>$uid])->where(['createtime'=>['>=',"1760666400"]])->find();
|
||||
if($is_first_charge > 0){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
if($permission){
|
||||
$first_charge_permission = 0;
|
||||
}
|
||||
|
||||
//天降好礼
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>3,'status'=>1])->find();
|
||||
$day_drop_permission = 0;
|
||||
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();
|
||||
if($activities){
|
||||
$effective_time = $activities['effective_time'];
|
||||
}else{
|
||||
$effective_time = 0;
|
||||
}
|
||||
$bag_data = DB::name('vs_gift_bag')->where(['activities_id'=>7,'status'=>1,'delete_time'=>0])->select();
|
||||
$bag_receive_log = DB::name('vs_gift_bag_receive_log')->where(['gift_bag_id'=>['in',array_column($bag_data,'id')],'user_id'=>$uid])->select();
|
||||
$new_permission = 0;
|
||||
$user_info = DB::name('user')->where(['id'=>$uid])->find();
|
||||
if($user_info['createtime']<"1760666400"){
|
||||
$user_info['createtime'] = 1760666400;
|
||||
}
|
||||
if($user_info['createtime'] + $effective_time >= time()){
|
||||
$new_permission = 1;
|
||||
}
|
||||
$gift_bag_log_ids = array_column($bag_receive_log,'gift_bag_id');
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ class BlindBoxTurntable extends BaseCom
|
||||
$gift_user_ids = input('gift_user_ids',0);
|
||||
$num = input('num',1);
|
||||
$heart_id = input('heart_id',0);
|
||||
$reslut = model('BlindBoxTurntableGiftDraw')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id);
|
||||
$auction_id = input('auction_id',0);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->draw_gift($gift_bag_id, $user_id, $gift_user_ids,$num,$room_id,$heart_id,$auction_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -92,7 +93,7 @@ class BlindBoxTurntable extends BaseCom
|
||||
$user_id = $this->uid;
|
||||
$room_id = input('room_id',0);
|
||||
$num = input('num',1);
|
||||
$reslut = model('BlindBoxTurntableGiftDraw')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
$reslut = model('BlindBoxTurntableGiftDrawWorldNew')->xlh_draw_gift($user_id,$num,$room_id);
|
||||
return v($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
/*
|
||||
@@ -116,4 +117,15 @@ 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']);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ use think\Controller;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
|
||||
class Ceshi extends Controller
|
||||
class Ceshi extends Controllers
|
||||
{
|
||||
//设置白名单ip访问本类接口
|
||||
protected $allowIp = [
|
||||
@@ -211,17 +211,17 @@ class Ceshi extends Controller
|
||||
|
||||
|
||||
$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 Controller
|
||||
|
||||
//删除腾讯房间
|
||||
$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++ ;
|
||||
|
||||
@@ -43,4 +43,10 @@ class Cron
|
||||
$cron = new \app\cron\controller\FriendEnd();
|
||||
$cron->index();
|
||||
}
|
||||
|
||||
//房间小时榜发礼物(每小时执行一次)
|
||||
public function RoomHourRanking(){
|
||||
$cron = new \app\cron\controller\RoomHourRanking();
|
||||
$cron->index();
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@ 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);
|
||||
|
||||
@@ -26,6 +26,9 @@ class Payment extends Controller
|
||||
$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');
|
||||
}
|
||||
@@ -60,7 +63,9 @@ class Payment extends Controller
|
||||
$data['user_id'] = $user_id;
|
||||
$data['pay_type'] = $type;
|
||||
$data['createtime'] = time();
|
||||
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";;
|
||||
$data['remarke'] = '充值到app用户'.($user_code ?? "") ."余额!";
|
||||
$data['type_params'] = $type_params;
|
||||
$data['type_id'] = $type_id;
|
||||
|
||||
$re = db::name('vs_user_recharge')->insert($data);
|
||||
if (!$re) {
|
||||
@@ -105,6 +110,7 @@ class Payment extends Controller
|
||||
$where['order_sn']=$out_trade_no;
|
||||
$where['order_type']=1;
|
||||
$where['pay_type']=2;
|
||||
$where['pay_status']=1;
|
||||
|
||||
$data=[
|
||||
'trade_no'=>$trade_no
|
||||
@@ -149,6 +155,7 @@ class Payment extends Controller
|
||||
$where['order_sn']=$out_trade_no;
|
||||
$where['order_type']=1;//1 充值
|
||||
$where['pay_type']=1;//1微信2支付宝 3通联支付宝 4通联微信
|
||||
$where['pay_status']=1;
|
||||
|
||||
$data=[
|
||||
'trade_no'=>$transaction_id
|
||||
@@ -204,6 +211,7 @@ class Payment extends Controller
|
||||
$where['order_sn']=$out_trade_no;
|
||||
$where['order_type']=1;//1 充值
|
||||
$where['pay_type']=$pay_type;//1微信2支付宝 3通联支付宝 4通联微信
|
||||
$where['pay_status']=1;
|
||||
|
||||
$data=[
|
||||
'trade_no'=>$trade_no
|
||||
@@ -225,11 +233,16 @@ class Payment extends Controller
|
||||
* 云账户回调(提现)
|
||||
*/
|
||||
public function yun_callback(){
|
||||
$data = input("data", "");
|
||||
$mess = input("mess", "");
|
||||
$timestamp = input("timestamp", "");
|
||||
$sign = input("sign", "");
|
||||
Log::record("云账户回调信息".json_encode($_POST),"info");
|
||||
// $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);
|
||||
$yun_pay = new YunPay();
|
||||
$result = $yun_pay->yun_callback($data,$mess,$timestamp,$sign);
|
||||
if($result['code']==1){
|
||||
|
||||
119
application/api/controller/Redpacket.php
Normal file
119
application/api/controller/Redpacket.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -451,4 +451,13 @@ 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']);
|
||||
}
|
||||
}
|
||||
22
application/api/controller/RoomEmoji.php
Normal file
22
application/api/controller/RoomEmoji.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseCom;
|
||||
use think\Db;
|
||||
|
||||
class RoomEmoji extends BaseCom
|
||||
{
|
||||
//表情类型列表
|
||||
public function type_list(){
|
||||
$reslut = model('RoomEmoji')->getRoomEmojiType();
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
//表情列表
|
||||
public function emoji_list(){
|
||||
$type_id = input('type_id', "");
|
||||
$pid = input('pid', "");
|
||||
$reslut = model('RoomEmoji')->getRoomEmoji($type_id,$pid,true);
|
||||
return V($reslut['code'], $reslut['msg'], $reslut['data']);
|
||||
}
|
||||
}
|
||||
34
application/api/controller/RoomHourRanking.php
Normal file
34
application/api/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?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']);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ 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){
|
||||
@@ -19,27 +21,19 @@ 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);
|
||||
|
||||
|
||||
@@ -100,4 +100,59 @@ 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]);
|
||||
}
|
||||
}
|
||||
@@ -234,6 +234,15 @@ 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()
|
||||
{
|
||||
|
||||
39
application/api/controller/Xintiao.php
Normal file
39
application/api/controller/Xintiao.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
434
application/api/controller/Xxiaoshi.php
Normal file
434
application/api/controller/Xxiaoshi.php
Normal file
@@ -0,0 +1,434 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -25,7 +25,8 @@ class Activities extends Model
|
||||
public static function first_charge_gift_send($user_id,$money=0)
|
||||
{
|
||||
//礼包
|
||||
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'money'=>$money])->value('id');
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>1,'status'=>1,'delete_time'=>0,'money'=>['<=',$money]])->order('money desc')->find();
|
||||
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||
if (!$gift_bag_id) {
|
||||
return ['code' => 0, 'msg' => '礼包不存在','data' => null];
|
||||
}
|
||||
@@ -98,14 +99,19 @@ class Activities extends Model
|
||||
/*
|
||||
* 天降好礼发放
|
||||
*/
|
||||
public static function drop_gift_send($user_id)
|
||||
public static function drop_gift_send($user_id,$money=0)
|
||||
{
|
||||
$activities_id = 3;
|
||||
//礼包
|
||||
$gift_bag_id = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->value('id');
|
||||
$gift_bag = DB::name('vs_gift_bag')->where(['activities_id'=>$activities_id,'status'=>1])->find();
|
||||
$gift_bag_id = $gift_bag['id'] ?? 0;
|
||||
|
||||
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];
|
||||
@@ -136,15 +142,20 @@ 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,
|
||||
@@ -160,4 +171,85 @@ 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
@@ -7,16 +7,34 @@ 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)
|
||||
public function draw_gift($gift_bag_id, $user_id, $gift_user_ids, $num = 1, $room_id = 0, $heart_id = 0, $auction_id = 0)
|
||||
{
|
||||
try {
|
||||
// 1. 验证参数并提前处理错误
|
||||
@@ -26,7 +44,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
}
|
||||
|
||||
// 2. 预加载必要数据
|
||||
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id);
|
||||
$loadResult = $this->loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids);
|
||||
if ($loadResult['code'] !== 1) {
|
||||
return $loadResult;
|
||||
}
|
||||
@@ -47,7 +65,12 @@ 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,
|
||||
@@ -55,7 +78,10 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
$room_id,
|
||||
$num,
|
||||
$precomputedResults,
|
||||
$availableGiftss
|
||||
$availableGiftss,
|
||||
$gift_user_ids,
|
||||
$heart_id,
|
||||
$auction_id
|
||||
);
|
||||
if ($transactionResult['code'] !== 1) {
|
||||
return $transactionResult;
|
||||
@@ -79,7 +105,9 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
return $this->buildDrawResult($boxTurntableLog, $giftCounts);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return ['code' => 0, 'msg' => "网络请求错误,请重试!", 'data' => null];
|
||||
$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];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,7 +142,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
/**
|
||||
* 预加载必要数据
|
||||
*/
|
||||
private function loadDrawData($gift_bag_id, $user_id, $room_id)
|
||||
private function loadDrawData($gift_bag_id, $user_id, $room_id,$num,$gift_user_ids)
|
||||
{
|
||||
// 1. 合并查询盲盒配置和礼物信息
|
||||
$bag_data = db::name("vs_gift_bag")
|
||||
@@ -150,7 +178,9 @@ 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();
|
||||
|
||||
@@ -191,7 +221,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
if (empty($availableGifts)) {
|
||||
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
|
||||
if (empty($availableGifts)) {
|
||||
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null];
|
||||
throw new \Exception('重置奖池后仍无可用礼物');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +235,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
$remaining_available_gifts = $availableGifts;
|
||||
$availableGifts = $this->resetPoolAndReload($bag_data['id'], $room_id, $periods + 1, 0);
|
||||
if (empty($availableGifts)) {
|
||||
return ['code' => 0, 'msg' => '重置奖池后仍无可用礼物', 'data' => null];
|
||||
throw new \Exception('重置奖池后仍无可用礼物');
|
||||
}
|
||||
$totalDrawTimes = 0;
|
||||
$num = abs($totalRemaining - $num);
|
||||
@@ -226,7 +256,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
$remaining_available_gifts
|
||||
);
|
||||
if (empty($precomputedResults['precomputedResults'])) {
|
||||
return ['code' => 0, 'msg' => '预计算抽奖结果失败', 'data' => null];
|
||||
throw new \Exception('预计算抽奖结果失败');
|
||||
}
|
||||
|
||||
return [
|
||||
@@ -257,6 +287,15 @@ 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 = [];
|
||||
@@ -285,13 +324,10 @@ 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) {
|
||||
@@ -340,7 +376,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
}
|
||||
}
|
||||
|
||||
return ['precomputedResults' => $precomputedResults,'precomputedResultss' => $precomputedResultss];
|
||||
return ['precomputedResults' => $precomputedResults, 'precomputedResultss' => $precomputedResultss];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -439,9 +475,10 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
/**
|
||||
* 执行抽奖事务(核心操作)
|
||||
*/
|
||||
private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss)
|
||||
private function executeDrawTransaction($bag_data, $user_id, $room_id, $num, $precomputedResults,$availableGiftss,$gift_user_ids,$heart_id,$auction_id)
|
||||
{
|
||||
$bagGiftPrice = $bag_data['gift_price'] * $num;
|
||||
$gift_user_num = count(explode(',', $gift_user_ids)); //人数
|
||||
$bagGiftPrice = $bag_data['gift_price'] * $num * $gift_user_num;
|
||||
|
||||
db::startTrans();
|
||||
try {
|
||||
@@ -468,6 +505,12 @@ 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. 统计礼物数量
|
||||
@@ -511,7 +554,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
|
||||
if (!$ret) {
|
||||
Log::record('巡乐会更新礼物剩余数量: ' . $room_id."【数据】".var_export($precomputedResults, true),"info");
|
||||
// throw new \Exception('更新礼物剩余数量失败');
|
||||
throw new \Exception('更新礼物剩余数量失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -591,8 +634,8 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
// 1. 批量插入盲盒转盘结果记录
|
||||
$this->batchInsertBlindBoxResults($precomputedResults, $boxTurntableLog, $room_id);
|
||||
|
||||
// 2. 发送礼物给接收者
|
||||
$this->sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id);
|
||||
// 2. 发送礼物给接收者 (已前置)
|
||||
// $this->sendGiftsToRecipients($precomputedResults, $room_id,$user_id);
|
||||
|
||||
// 3. 处理巡乐会相关操作
|
||||
if (!empty($xlh_ext) && $xlh_ext['inlet_bag_id'] == $precomputedResults[0]['gift_bag_detail']['gift_bag_id']) {
|
||||
@@ -643,7 +686,7 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
/**
|
||||
* 发送礼物给接收者
|
||||
*/
|
||||
private function sendGiftsToRecipients($precomputedResults, $boxTurntableLog, $room_id,$user_id)
|
||||
private function sendGiftsToRecipients($precomputedResults, $room_id,$user_id,$heart_id,$auction_id)
|
||||
{
|
||||
// 统计每个用户每个礼物的数量
|
||||
$giftUserCounts = [];
|
||||
@@ -662,6 +705,9 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
|
||||
// 批量发送礼物
|
||||
foreach ($giftUserCounts as $userGift) {
|
||||
if($userGift['count'] > 9){ //防止礼物超发,礼物超10个则不发送
|
||||
continue;
|
||||
}
|
||||
$giveGiftExt = [
|
||||
'gift_id' => $userGift['gift_id'],
|
||||
'count' => $userGift['count'],
|
||||
@@ -669,7 +715,9 @@ 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'],
|
||||
@@ -678,16 +726,17 @@ class BlindBoxTurntableGiftDraw extends Model
|
||||
1,
|
||||
$room_id,
|
||||
0,
|
||||
0,
|
||||
$heart_id,
|
||||
$giveGiftExt
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($res) && $res['code'] != 1) {
|
||||
Log::record('发送礼物失败: ' . $res['msg'].$userGift['gift_user_id'],"info");
|
||||
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];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1299,7 +1348,10 @@ 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;
|
||||
@@ -1514,5 +1566,38 @@ 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1728
application/api/model/BlindBoxTurntableGiftDrawWorld.php
Normal file
1728
application/api/model/BlindBoxTurntableGiftDrawWorld.php
Normal file
File diff suppressed because it is too large
Load Diff
1391
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
1391
application/api/model/BlindBoxTurntableGiftDrawWorldNew.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -119,6 +119,10 @@ class Chat extends Model
|
||||
|
||||
//清空个人魅力
|
||||
// ClearUserCharm = 1059,
|
||||
//发红包
|
||||
// RedPacket = 1060,
|
||||
//红包领完推送
|
||||
// RedPacketComplete = 1061,
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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=>'财富等级特权赠送'];
|
||||
public $TypeArray = [1=>'头像框',2=>'坐骑',3=>'麦圈',6=>'个人靓号',7=>'房间靓号',8=>'公会靓号',9=>'聊天气泡'];
|
||||
protected $FromType = [1=>'购买',2=>'后台赠送',3=>'礼盒开奖',4=>'好友赠送',5=>'首充赠送',6=>'天降好礼获得',7=>'财富等级特权赠送',8=>'新人充值好礼'];
|
||||
public function __construct($data = [])
|
||||
{
|
||||
parent::__construct($data);
|
||||
@@ -206,6 +206,9 @@ class Decorate extends Model
|
||||
if($decorate_price_info['price']<=0 && $user_decorate_data['end_time'] > $now_time + $change_time){
|
||||
return ['code' => 0, 'msg' => '您已购买过此装扮,请勿重复购买', 'data' => null];
|
||||
}
|
||||
if($user_decorate_data['end_time'] < $now_time){
|
||||
$user_decorate_data['end_time'] = 0;
|
||||
}
|
||||
$change_time = $day * 24 * 3600;
|
||||
$update['is_using'] = 2;
|
||||
$update['end_time'] = $user_decorate_data['end_time'] + $change_time;
|
||||
@@ -408,10 +411,14 @@ class Decorate extends Model
|
||||
$did = db::name('vs_user_decorate')->where($map)->where('end_time',['>=',time()],'or')->value('did');
|
||||
if(empty($did)){
|
||||
$reslut = '';//返回数据
|
||||
}else{
|
||||
if($type == 9){
|
||||
$reslut = db::name('vs_decorate')->where('did', $did)->value('base_image');
|
||||
}else{
|
||||
$reslut = db::name('vs_decorate')->where('did', $did)->value('play_image');
|
||||
}
|
||||
}
|
||||
}
|
||||
return $reslut;
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ class GiveGift extends Model
|
||||
*/
|
||||
public function give_gift($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
||||
{
|
||||
if(isset($ext['is_draw_gift']) && $ext['is_draw_gift'] == 1) {
|
||||
$return_pan = $this->give_gift_to_pan($uid, $to_uid, $gid, $num, $from_type, $type, $from_id, $pit_number, $change_type, $ext);
|
||||
return $return_pan;
|
||||
}
|
||||
//送的礼物信息
|
||||
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
||||
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
||||
@@ -68,6 +72,7 @@ class GiveGift extends Model
|
||||
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($uid,9);//聊天气泡
|
||||
|
||||
//送给一人礼物的总价格(扣除用户的数额)
|
||||
$gift_price = $gift_info['gift_price'] * $num;
|
||||
@@ -262,11 +267,14 @@ class GiveGift extends Model
|
||||
}
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earningss = $room_owner_earnings - $host_earnings;
|
||||
if($room_owner_earningss > 0){
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
@@ -275,6 +283,13 @@ class GiveGift extends Model
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,7 +318,9 @@ class GiveGift extends Model
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
||||
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||
if (!$gift_rate) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||
@@ -433,7 +450,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_inf,
|
||||
'GiftNum' => $count,
|
||||
'gift_num' => $count,
|
||||
'text' => null
|
||||
];
|
||||
|
||||
@@ -487,7 +504,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_info,
|
||||
'GiftNum' => $num,
|
||||
'gift_num' => $num,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
@@ -557,6 +574,309 @@ class GiveGift extends Model
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
||||
}
|
||||
|
||||
/*
|
||||
* 送礼物-盲盒转盘专用
|
||||
* @param int $uid 用户id
|
||||
* @param int $from_id 来源id
|
||||
* @param str $to_uid 接收礼物用户id字符串逗号分隔
|
||||
* @param int $gid 礼物id
|
||||
* @param int $num 礼物数量
|
||||
* @param int $from_type 来源 1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||
* @param int $type 金币购买 1金币购买 2送背包礼物
|
||||
* @param int $pit_number 坑位编号
|
||||
* @return array
|
||||
* 用户,在房间中,给谁,送了什么礼物,多少个,来源
|
||||
*/
|
||||
public function give_gift_to_pan($uid,$to_uid,$gid,$num,$from_type,$type,$from_id = 0,$pit_number = 0,$change_type = 0,$ext = [])
|
||||
{
|
||||
//送的礼物信息
|
||||
$gift_info = Db::name('vs_gift')->where(['gid'=>$gid])
|
||||
->field('gid as gift_id,gift_name,gift_price,file_type,base_image,play_image,gift_type,label,is_public_server')->find();
|
||||
if(empty($gift_info)){
|
||||
return ['code' => 0, 'msg' => '礼物不存在', 'data' => null];
|
||||
}
|
||||
if(!$to_uid){
|
||||
return ['code' => 0, 'msg' => '请选择收礼人', 'data' => null];
|
||||
}
|
||||
$toarray = explode(',',$to_uid);
|
||||
if(in_array($uid,$toarray)){
|
||||
return ['code' => 0, 'msg' => '收礼人不能包含自己', 'data' => null];
|
||||
}
|
||||
if (ceil($num) != $num) {
|
||||
return ['code' => 0, 'msg' => '打赏礼物数量必须为整数', 'data' => null];
|
||||
}
|
||||
if ($num < 1) {
|
||||
return ['code' => 0, 'msg' => '打赏礼物数量必须大于零', 'data' => null];
|
||||
}
|
||||
$user_info = Db::name('user')->where(['id'=>$uid,'status'=>1])->find();
|
||||
if(empty($user_info)){
|
||||
return ['code' => 301, 'msg' => '当前用户登录失效', 'data' => null];
|
||||
}
|
||||
|
||||
//获取送礼用户昵称
|
||||
$FromUserInfo = db::name('user')->where('id',$uid)->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$FromUserInfo['icon'][0] = model('UserData')->user_wealth_icon($uid);//财富图标
|
||||
$FromUserInfo['icon'][1] = model('UserData')->user_charm_icon($uid);//魅力图标
|
||||
$FromUserInfo['chat_bubble'] = model('Decorate')->user_decorate_detail($uid,9);//聊天气泡
|
||||
|
||||
//送给一人礼物的总价格(扣除用户的数额)
|
||||
$gift_price = $gift_info['gift_price'] * $num;
|
||||
|
||||
$roomId = 0;
|
||||
if($from_type == 2 || $from_type == 3 || $from_type == 6){
|
||||
$roomId = $from_id;
|
||||
}
|
||||
|
||||
//循环送礼
|
||||
$gift_total = 0;
|
||||
$give_gift = 0;
|
||||
$gift_user_data = [];
|
||||
foreach ($toarray as $k => $to_id){
|
||||
$gift_user_data[]['user_id'] = $to_id;
|
||||
$gift_box1 = [];
|
||||
$gift_box = [];
|
||||
$gift_total += $gift_price;
|
||||
//收礼记录行为日志
|
||||
$give_gift = $this -> change_user_give_gift_log($uid,$gid,$gift_price,$num,$to_id,$from_type,$type,$from_id,$pit_number);
|
||||
if(!$give_gift){
|
||||
return ['code' => 0, 'msg' => '送礼失败', 'data' => null];
|
||||
}
|
||||
$gift_user_data[$k]['gift_price'] = $gift_price;
|
||||
|
||||
//计算收礼人得益
|
||||
$receiver_earnings = $this -> receiver_earnings($to_id,$gift_price,$from_type);
|
||||
if($receiver_earnings <= 0){
|
||||
return ['code' => 0, 'msg' => '收礼人收益配置有误', 'data' => null];
|
||||
}
|
||||
//1聊天送礼物 2房间语聊送礼 3直播送礼 4动态打赏 5系统任务 6-cp房间送礼
|
||||
if($from_type == 1 || $from_type == 2 || $from_type == 3 ||$from_type == 4 || $from_type == 6){
|
||||
//增加收益并记录日志
|
||||
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,2,11,'收礼增加收益');
|
||||
}elseif($from_type == 5){
|
||||
//增加收益并记录日志
|
||||
$receiver = $this -> change_user_cion_or_earnings_log($to_id,$receiver_earnings,$from_id,1,$change_type,'活动增加金币');
|
||||
}else{
|
||||
$receiver = false;
|
||||
}
|
||||
if(!$receiver){
|
||||
return ['code' => 0, 'msg' => '收礼人收益失败', 'data' => null];
|
||||
}
|
||||
//用户魅力等级更新
|
||||
$user_level = model('Level')->user_level_data_update($to_id,$gift_price,2,$roomId);
|
||||
if(!$user_level){
|
||||
return ['code' => 0, 'msg' => '用户等级更新失败', 'data' => null];
|
||||
}
|
||||
|
||||
$room_owner_earnings = 0;//房主收益
|
||||
$room_owner_earningsg = 0;//公会会长收益
|
||||
//是否在房间
|
||||
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
|
||||
if($from_type == 6){ //cp电影房
|
||||
//房主有收益
|
||||
if(get_system_config_value('room_cp_room_user_ratio') > 0){
|
||||
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
||||
//计算房主收益//room_author_ratio
|
||||
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,699);
|
||||
if($room_owner_earnings > 0){
|
||||
//增加收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
//公会长收益
|
||||
if(get_system_config_value('room_cp_guild_user_ratio') > 0){
|
||||
$guild_id = Db::name('vs_guild_user')->where(['user_id'=>$to_uid,'status'=>1])->value('guild_id');
|
||||
if($guild_id){
|
||||
$room_guild = Db::name('vs_guild')->where(['id'=>$guild_id])->value('user_id');
|
||||
//计算会长收益
|
||||
$room_owner_earningsg = $this -> receiver_earnings($room_guild,$gift_price,698);
|
||||
//增加收益并记录日志
|
||||
$room_owner_earningg = $this -> change_user_cion_or_earnings_log($room_guild,$room_owner_earningsg,$from_id,2,21,'工会长收益');
|
||||
if(!$room_owner_earningg){
|
||||
return ['code' => 0, 'msg' => '工会长收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
$room_owner = Db::name('vs_room')->where(['id'=>$from_id,'apply_status'=>2])->value('user_id');
|
||||
//计算房主收益//room_author_ratio
|
||||
$room_owner_earnings = $this -> receiver_earnings($room_owner,$gift_price,99);//结果是钻石
|
||||
if($room_owner_earnings > 0){
|
||||
//主持人收益
|
||||
//在主持位的主持人
|
||||
$host_id = Db::name('vs_room_pit')->where(['room_id'=>$from_id,'pit_number'=>9])->value('user_id');
|
||||
if($host_id){
|
||||
//计算主持人收益
|
||||
$host_earnings = $this -> receiver_earnings($host_id,$room_owner_earnings*get_system_config_value('rmb_coin_ratio'),98,$from_id);
|
||||
if($host_earnings > 0){
|
||||
//增加主持人收益并记录日志
|
||||
$host_earnings_earning = $this -> change_user_cion_or_earnings_log($host_id,$host_earnings,$from_id,2,19,'主持人收益');
|
||||
if(!$host_earnings_earning){
|
||||
return ['code' => 0, 'msg' => '主持人收益失败', 'data' => null];
|
||||
}
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earningss = $room_owner_earnings - $host_earnings;
|
||||
if($room_owner_earningss > 0){
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earningss,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//增加房主收益并记录日志
|
||||
$room_owner_earning = $this -> change_user_cion_or_earnings_log($room_owner,$room_owner_earnings,$from_id,2,18,'房主收益');
|
||||
if(!$room_owner_earning){
|
||||
return ['code' => 0, 'msg' => '房主收益失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($gift_info['label'] == 2){
|
||||
foreach ($gift_box as $gv) {
|
||||
//记录送礼利率和各方收益
|
||||
//收礼人是否加入公会
|
||||
$configs = get_system_config();
|
||||
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
|
||||
//收益增加 加入工会的收益
|
||||
if ($is_join_guild) {
|
||||
$ratiog = $configs['room_gift_guild_ratio'];
|
||||
} else {
|
||||
$ratiog = 0;
|
||||
}
|
||||
//未加入工会的收益
|
||||
$ratiogr = $configs['room_gift_ratio'];
|
||||
//收礼人最终的收益比例
|
||||
$ratio = $ratiogr + $ratiog;
|
||||
//房主收益大于0 就代表有收益 且在房间
|
||||
if ($room_owner_earningsg > 0) {
|
||||
$guid_ratio = $configs['room_cp_guild_user_ratio'];
|
||||
} else {
|
||||
$guid_ratio = 0;
|
||||
}
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||
$app_earning = coin_earning($gv['gift_price'], $app_ratio);
|
||||
$receiver_earningss = $this -> receiver_earnings($to_id,$gv['gift_price'],$from_type);
|
||||
$room_owner_earningss = $this -> receiver_earnings($room_owner,$gv['gift_price'],99);//结果是钻石
|
||||
$gift_rate = $this->change_give_gift_profit($gv['give_gift_id'], $ratio, $receiver_earningss, $configs['room_author_ratio'], $room_owner_earningss, $app_ratio, $app_earning);
|
||||
if (!$gift_rate) {
|
||||
Db::rollback();
|
||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
//记录送礼利率和各方收益
|
||||
//收礼人是否加入公会
|
||||
$configs = get_system_config();
|
||||
$is_join_guild = Db::name('vs_guild_user')->where(['user_id' => $to_uid, 'status' => 1, 'quit_time' => 0])->field('guild_id')->find();
|
||||
//收益增加 加入工会的收益
|
||||
if ($is_join_guild) {
|
||||
$ratiog = $configs['room_gift_guild_ratio'];
|
||||
} else {
|
||||
$ratiog = 0;
|
||||
}
|
||||
//未加入工会的收益
|
||||
$ratiogr = $configs['room_gift_ratio'];
|
||||
//收礼人最终的收益比例
|
||||
$ratio = $ratiogr + $ratiog;
|
||||
//房主收益大于0 就代表有收益 且在房间
|
||||
if ($room_owner_earningsg > 0) {
|
||||
$guid_ratio = $configs['room_cp_guild_user_ratio'];
|
||||
} else {
|
||||
$guid_ratio = 0;
|
||||
}
|
||||
//平台收益 = 总金额 - 收礼人收益 - 房主收益 - 工会长收益
|
||||
$app_ratio = 100 - $ratio - $configs['room_author_ratio'] - $guid_ratio;
|
||||
$app_earning = coin_earning($gift_price, $app_ratio);
|
||||
$gift_rate = $this->change_give_gift_profit($give_gift, $ratio, $receiver_earnings, $configs['room_author_ratio'], $room_owner_earnings, $app_ratio, $app_earning);
|
||||
if (!$gift_rate) {
|
||||
return ['code' => 0, 'msg' => '礼物记录失败', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ToUserInfo = Db::name('user')->where(['id' => $to_id])->field('id as user_id,nickname,avatar,sex')->find();
|
||||
$ToUserInfo['icon'][0] = model('UserData')->user_wealth_icon($to_id);//财富图标
|
||||
$ToUserInfo['icon'][1] = model('UserData')->user_charm_icon($to_id);//魅力图标
|
||||
$ToUserInfo['charm'] = db::name('vs_room_user_charm')->where(['user_id' => $to_id,'room_id' => $from_id])->value('charm');//魅力
|
||||
|
||||
if(isset($from_id) && ($from_type == 2 || $from_type == 6)){
|
||||
//查询房间是否在PK中 是fa_vs_room_pk 表中的 room_id_a,还是room_id_b
|
||||
$room_pk = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_a' => $from_id])->field('pk_id')->find();
|
||||
if (!empty($room_pk)) {
|
||||
// 当前 room_id 是 room_id_a 修改create_value_a
|
||||
$rooma = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->setInc('create_value_a', $gift_price * 10);
|
||||
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk['pk_id'])->find();
|
||||
//推送变化
|
||||
$text = [
|
||||
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
|
||||
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
|
||||
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
|
||||
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
|
||||
'text' => ''
|
||||
];
|
||||
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
|
||||
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
|
||||
} else {
|
||||
// 当前 room_id 不是 room_id_a,可能是 room_id_b 或者不存在
|
||||
$room_pk_b = Db::name('vs_room_pk')->where(['status' => 3, 'room_id_b' => $from_id])->field('pk_id')->find();
|
||||
if (!empty($room_pk_b)) {
|
||||
// 当前 room_id 是 room_id_b
|
||||
$roomb = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->setInc('receive_value_b', $gift_price * 10);
|
||||
$roomPKinfo = Db::name('vs_room_pk')->where('pk_id', $room_pk_b['pk_id'])->find();
|
||||
//推送变化
|
||||
$text = [
|
||||
'room_id_a' => $roomPKinfo['room_id_a'],//发起者房间id
|
||||
'create_value_a' => $roomPKinfo['create_value_a'],//发起者房间值
|
||||
'room_id_b' => $roomPKinfo['room_id_b'],//接受者房间id
|
||||
'receive_value_b' => $roomPKinfo['receive_value_b'],//接受者房间值
|
||||
'text' => ''
|
||||
];
|
||||
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_a'],$text);
|
||||
model('Chat')->sendMsg(1015,$roomPKinfo['room_id_b'],$text);
|
||||
}
|
||||
}
|
||||
//直播间送礼物 每日任务
|
||||
model('DailyTasks')->tasks_complete($uid,3);
|
||||
}
|
||||
}
|
||||
|
||||
//增加房间火热值hot_value
|
||||
$gift_totalaa = $gift_total * get_system_config_value('coin_charm_exp');
|
||||
db::name('vs_room')->where(['id' => $from_id])->inc('hot_value', $gift_totalaa)->inc('today_hot_value', $gift_totalaa)->update();
|
||||
|
||||
$roomtype = Db::name('vs_room')->where(['id' => $from_id])->value('type_id');
|
||||
if($roomtype == 6){
|
||||
//推送消息 交友房创建的私密房 倒计时增加
|
||||
$value = db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
|
||||
->value('time_day');
|
||||
if($value){
|
||||
db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)
|
||||
->setInc('time_day', $gift_total);
|
||||
$text111 = [
|
||||
'room_id' => $from_id,
|
||||
'time_day' => db::name('vs_room_cp_movie')->where('room_id', $from_id)->where('type',1)->value('time_day'),
|
||||
'text' => '房间结束时间变化'
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
model('Chat')->sendMsg(1052,$from_id,$text111);
|
||||
}
|
||||
}
|
||||
|
||||
return ['code' => 1, 'msg' => '送礼成功', 'data' => ['gift_total' => $gift_total,'gift_user_data' =>$gift_user_data]];
|
||||
}
|
||||
|
||||
//送礼特效
|
||||
public function give_gift_effect($to_id,$FromUserInfo,$gift_info,$num,$from_id)
|
||||
{
|
||||
@@ -569,7 +889,7 @@ class GiveGift extends Model
|
||||
'FromUserInfo' => $FromUserInfo,
|
||||
'ToUserInfo' => $ToUserInfo,
|
||||
'GiftInfo' => $gift_info,
|
||||
'GiftNum' => $num,
|
||||
'gift_num' => $num,
|
||||
'text' => $text
|
||||
];
|
||||
//聊天室推送系统消息
|
||||
|
||||
@@ -17,9 +17,9 @@ class Guild extends Model
|
||||
* @param $page
|
||||
* @param $limit
|
||||
*/
|
||||
public function get_guild_list($page,$limit=10,$search='',$user_id=0)
|
||||
public function get_guild_list($page,$page_limit,$search='',$user_id=0)
|
||||
{
|
||||
$where ="1=1";
|
||||
$where =[];
|
||||
if ($search) {
|
||||
$where = ['guild_special_id'=>['like',$search.'%']]; //通过工会ID搜索
|
||||
}
|
||||
@@ -28,8 +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)
|
||||
->order('income desc')
|
||||
->page($page,$limit)
|
||||
->page($page, $page_limit)
|
||||
->order('num desc')
|
||||
->select();
|
||||
$count = Db::name('vs_guild')
|
||||
->where(['is_show'=>1,'delete_time'=>0])
|
||||
@@ -62,7 +62,7 @@ class Guild extends Model
|
||||
}
|
||||
$data =[
|
||||
'page' => $page,
|
||||
'limit' => $limit,
|
||||
'limit' => $page_limit,
|
||||
'count' => $count,
|
||||
'list' => $list
|
||||
];
|
||||
@@ -610,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', strtotime('last monday'));
|
||||
$week_end = date('Y-m-d', strtotime('last monday +6 days'));
|
||||
$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'));
|
||||
$guild_subsidy = db::name('vs_guild_subsidy')
|
||||
->where(["guild_id"=>$guild_id,'start_time' => $week_start, 'end_time' => $week_end])
|
||||
->find();
|
||||
@@ -622,18 +622,38 @@ class Guild extends Model
|
||||
$data['list'][0]['status_str'] = isset( $guild_subsidy['status'])&& $guild_subsidy['status']==1 ? "已发放" : "未发放";
|
||||
//本周流水
|
||||
//本周的第一天
|
||||
$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()]]])
|
||||
$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]]])
|
||||
->sum('total_price');
|
||||
$transaction += $transaction_one;
|
||||
|
||||
}
|
||||
$total_transaction = $transaction;
|
||||
$ss = 0;
|
||||
if($total_transaction){
|
||||
//根据工会流水 获取补贴比例 单位%
|
||||
$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);
|
||||
//获取补贴配置
|
||||
$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; // 找到匹配项后提前退出循环
|
||||
}
|
||||
}
|
||||
}
|
||||
//待开发
|
||||
$data['list'][1]['name'] = "本周流水";
|
||||
@@ -738,7 +758,7 @@ class Guild extends Model
|
||||
* 工会流水查询
|
||||
* @return array
|
||||
*/
|
||||
public function get_guild_transaction($guild_id,$start_time=0,$end_time=0,$page=1,$page_limit=20){
|
||||
public function get_guild_transaction($guild_id,$seach_start_time,$seach_end_time,$page,$page_limit){
|
||||
$guild_info = db::name('vs_guild')->where(['id'=>$guild_id,'delete_time'=>0])->find();
|
||||
if(empty($guild_info)){
|
||||
return ['code' => 0, 'msg' => '公会不存在!', 'data' => null];
|
||||
@@ -747,6 +767,8 @@ class Guild extends Model
|
||||
$all_guild_room = db::name('vs_guild_user')->where(['guild_id' => $guild_id,'status'=>1,"delete_time"=>0])->select();
|
||||
$total_transaction = 0;
|
||||
foreach ($all_guild_room as $key => $value) {
|
||||
$start_time = $seach_start_time;
|
||||
$end_time = $seach_end_time;
|
||||
if(!$start_time){
|
||||
$start_time_all = $value['createtime'];
|
||||
$end_time_all = time();
|
||||
@@ -754,15 +776,21 @@ 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'=>2,'createtime' => ['between', [$start_time_all, $end_time_all]]])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_all, $end_time_all]]])
|
||||
->sum('total_price');
|
||||
$total_transaction = $total_transaction+$transaction;
|
||||
}
|
||||
//查询工会所有房间流水
|
||||
$list = db::name('vs_guild_user')->where(['guild_id'=>$guild_id,'delete_time'=>0,'status'=>1,'room_id'=>['<>',0]])
|
||||
->order('coin desc')
|
||||
->order('id asc')
|
||||
->page($page, $page_limit)
|
||||
->select();
|
||||
|
||||
@@ -770,12 +798,20 @@ class Guild extends Model
|
||||
$room_data = [];
|
||||
$i=0;
|
||||
foreach ($list as $k=>$v){
|
||||
$start_time = $seach_start_time;
|
||||
$end_time = $seach_end_time;
|
||||
if(!$start_time){
|
||||
$start_time = $v['createtime'];
|
||||
$end_time = time();
|
||||
$start_time_seach = $value['createtime'];
|
||||
$end_time_seach = time();
|
||||
}else{
|
||||
$start_time = strtotime($start_time." 00:00:00");
|
||||
$end_time = strtotime($end_time." 23:59:59");
|
||||
$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'];
|
||||
}
|
||||
$room_info = db::name('vs_room')->where(['id'=>$v['room_id'],'room_status'=>1,'delete_time'=>0])->find();
|
||||
if($room_info){
|
||||
@@ -785,7 +821,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'=>2,'createtime' => ['between', [$start_time, $end_time]]])
|
||||
->where(['from'=>['in',[2,3,6]],'createtime' => ['between', [$start_time_seach, $end_time_seach]]])
|
||||
->sum('total_price');
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,10 @@ 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];
|
||||
@@ -198,6 +202,7 @@ class Login extends Model
|
||||
$return_res[0]['mobile'] = $user_info['mobile'];
|
||||
$return_res[0]['icon'][0] = model('UserData')->user_wealth_icon($user_info['id']);//财富图标
|
||||
$return_res[0]['icon'][1] = model('UserData')->user_charm_icon($user_info['id']);//魅力图标
|
||||
$return_res[0]['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
|
||||
$isAuth = 0;
|
||||
if($user_info['mobile']){
|
||||
@@ -293,24 +298,48 @@ 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 (md5($password) != $user_info['password']) {
|
||||
return ['code' => 0, 'msg' => '密码错误', 'data' => null];
|
||||
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];
|
||||
}
|
||||
// $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']];
|
||||
}
|
||||
|
||||
@@ -336,21 +365,21 @@ class Login extends Model
|
||||
$openid = $userinfo['openid'];
|
||||
$user_info_data = model('UserData')->where(['wx_openid' => $openid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ali'){
|
||||
$ali_userid = $userinfo['open_id'];
|
||||
$user_info_data = model('UserData')->where(['ali_userid' => $ali_userid,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}elseif ($type == 'ios'){
|
||||
$apple_id = $userinfo;
|
||||
$user_info_data = model('UserData')->where(['apple_id' => $userinfo,'deletetime'=>0])->find();
|
||||
$config_time = get_system_config_value('cancel_to_reset_reg');
|
||||
if($user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
if(isset($user_info_data) && $user_info_data['deletetime'] != 0 && time() - $user_info_data['deletetime'] < 86400 * $config_time){
|
||||
return ['code' => 0, 'msg' => '注销后需等待'.$config_time.'天才能重新注册', 'data' => null];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
@@ -849,8 +849,17 @@ class Room extends Model
|
||||
$friend = null;
|
||||
}
|
||||
|
||||
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
|
||||
$xlh_info['xlh_info'] = model('api/BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$open_time = db::name('vs_hour_ranking_config')->where('id', 1)->value('open_time');
|
||||
if($open_time > 0){
|
||||
if($open_time <= time()){
|
||||
$hour_open = 1;//开启
|
||||
}else{
|
||||
$hour_open = 0;//关闭
|
||||
}
|
||||
}else{
|
||||
$hour_open = 0;//关闭
|
||||
}
|
||||
return ['code' => 1,
|
||||
'msg' => '成功',
|
||||
'data' => ['room_info' => $room_info,
|
||||
@@ -864,6 +873,7 @@ class Room extends Model
|
||||
'song_pit_list' => $song_pit_list,
|
||||
'friend_info' => $friend,
|
||||
'gift_cycle' => $xlh_info,
|
||||
'hour_ranking_open' => $hour_open
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -1147,7 +1157,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()+300,'createtime' => time()]);
|
||||
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()]);
|
||||
//发送消息
|
||||
|
||||
$text['text'] = '用户 ' . $nickname . ' 被 '. $room_typer .' 踢出房间';
|
||||
@@ -1292,10 +1302,18 @@ 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(Db::name('user')->where('id', $vv['user_id'])->value('is_online') == 0){
|
||||
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){
|
||||
model('Room')->quit_room($vv['user_id'], $room_id,$vv['user_id'],2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$list = db::name('vs_room_visitor')->alias('a')
|
||||
@@ -1596,6 +1614,9 @@ 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){
|
||||
@@ -1794,7 +1815,7 @@ class Room extends Model
|
||||
$user_in_room = db::name('vs_room_visitor')->where(['room_id' => $room_id,'user_id' => $user_id])->find();
|
||||
if(!$user_in_room){
|
||||
// return ['code' => 0, 'msg' => '您已不在此房间', 'data' => null];
|
||||
return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
// return ['code' => 0, 'msg' => '', 'data' => null];
|
||||
}
|
||||
$room = db::name('vs_room')->where(['id' => $room_id])->find();
|
||||
$song_list = null;
|
||||
@@ -2002,7 +2023,17 @@ class Room extends Model
|
||||
$friend = null;
|
||||
}
|
||||
|
||||
$xlh_info['xlh_info'] = model('BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$xlh_info['xlh_info'] = model('api/BlindBoxTurntableGift')->get_user_xlh_info($room_id);
|
||||
$open_time = db::name('vs_hour_ranking_config')->order('id', 'desc')->value('open_time');
|
||||
if($open_time > 0){
|
||||
if($open_time <= time()){
|
||||
$hour_open = 1;//开启
|
||||
}else{
|
||||
$hour_open = 0;//关闭
|
||||
}
|
||||
}else{
|
||||
$hour_open = 0;//关闭
|
||||
}
|
||||
|
||||
return ['code' => 1,
|
||||
'msg' => '成功',
|
||||
@@ -2017,6 +2048,7 @@ class Room extends Model
|
||||
'song_pit_list'=>$song_pit_list,
|
||||
'friend_info' => $friend,
|
||||
'gift_cycle' => $xlh_info,
|
||||
'hour_ranking_open' => $hour_open
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -2222,7 +2254,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,'d.id' => ['>',0]])
|
||||
->where(['a.user_id1' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
|
||||
->order('a.updatetime desc')
|
||||
->select();
|
||||
$room_auction2 = db::name('vs_room_auction_relation')->alias('a')
|
||||
@@ -2230,7 +2262,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])
|
||||
->where(['a.user_id2' => $user_id,'a.end_time' =>['>',time()],'a.delete_time' => 0,'a.relation_id' => ['>',0]])
|
||||
->order('a.updatetime desc')
|
||||
->select();
|
||||
|
||||
@@ -2523,15 +2555,80 @@ class Room extends Model
|
||||
public function user_reconnect($user_id,$room_id)
|
||||
{
|
||||
if(!$room_id){
|
||||
$room_id = Db::name('vs_room_visitor')->where('user_id', $user_id)->order('id desc')->value('room_id');
|
||||
// $room_id = Db::name('user_data')->where('user_id', $user_id)->value('room_id');
|
||||
}
|
||||
$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_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' =>'断线后重连']);
|
||||
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];
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ class RoomAuction extends Model
|
||||
|
||||
|
||||
//参与竞拍
|
||||
public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type)
|
||||
public function room_auction_join($auction_id,$user_id,$gift_id,$num,$type,$ext=[])
|
||||
{
|
||||
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);
|
||||
$ree = model('GiveGift')->give_gift($user_id,$auction['user_id'],$gift_id,$num,2,$type,$auction['room_id'],0,0,$ext);
|
||||
if($ree['code'] != 1){
|
||||
return ['code' => $ree['code'], 'msg' => $ree['msg'],'data' => null];
|
||||
}
|
||||
|
||||
67
application/api/model/RoomEmoji.php
Normal file
67
application/api/model/RoomEmoji.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\model;
|
||||
|
||||
use app\common\controller\Push;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
use think\Model;
|
||||
|
||||
class RoomEmoji extends Model
|
||||
{
|
||||
protected $table = 'vs_room_emoji';
|
||||
protected $table_type = 'vs_room_emoji_type';
|
||||
private $redis;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->redis = \think\Cache::store('redis')->handler();
|
||||
}
|
||||
//获取房间表情包类型
|
||||
public function getRoomEmojiType(){
|
||||
$list = db($this->table_type)->field('id,type_name')->where(['status'=>1,'deletetime'=>0])->select();
|
||||
return ['code' => 1, 'msg' => '创建成功', 'data' => $list];
|
||||
}
|
||||
|
||||
//获取房间表情包
|
||||
public function getRoomEmoji($type_id=0,$pid=0, $isTree = false){
|
||||
$where = [];
|
||||
if($type_id){
|
||||
$where['type_id'] = $type_id;
|
||||
}
|
||||
if($pid!=""){
|
||||
$where['pid'] = $pid;
|
||||
}
|
||||
$list = db($this->table)
|
||||
->field('id,pid,type_id,name,image,animate_image')
|
||||
->where(['status'=>1,'deletetime'=>0])
|
||||
->where($where)
|
||||
->order('sort desc,id desc')
|
||||
->select();
|
||||
if ($isTree && !empty($list) && empty($pid)) {
|
||||
$list = $this->buildTree($list);
|
||||
}
|
||||
return ['code' => 1, 'msg' => '成功', 'data' => $list];
|
||||
}
|
||||
|
||||
/**
|
||||
* 将扁平数据转换为树状结构
|
||||
* @param array $data 数据列表
|
||||
* @param int $pid 父级ID
|
||||
* @return array
|
||||
*/
|
||||
private function buildTree($data, $pid = 0)
|
||||
{
|
||||
$tree = [];
|
||||
foreach ($data as $item) {
|
||||
if ($item['pid'] == $pid) {
|
||||
$children = $this->buildTree($data, $item['id']);
|
||||
if (!empty($children)) {
|
||||
$item['children'] = $children;
|
||||
}
|
||||
$tree[] = $item;
|
||||
}
|
||||
}
|
||||
return $tree;
|
||||
}
|
||||
}
|
||||
73
application/api/model/RoomHourRanking.php
Normal file
73
application/api/model/RoomHourRanking.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?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('api/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]];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,24 +192,30 @@ 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];
|
||||
}
|
||||
@@ -228,15 +234,6 @@ 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]);
|
||||
@@ -248,13 +245,9 @@ 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){
|
||||
@@ -278,50 +271,51 @@ 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(($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];
|
||||
if ($host_pit > 0) {
|
||||
if ($host_pit == $user_id) {
|
||||
return ['code' => 0, 'msg' => '您已在主持麦位', 'data' => null];
|
||||
} else {
|
||||
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,9);//用户上了这个房间的几号麦位
|
||||
$ont = $this->OnPit($user_id,$room_id,$pit_number);//用户上了这个房间的几号麦位
|
||||
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){
|
||||
@@ -353,6 +347,7 @@ class RoomPit extends Model
|
||||
return ['code' => 1, 'msg' => '申请成功,请等待房主审核', 'data' => null];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//申请上麦列表
|
||||
public function apply_pit_list($userId,$room_id)
|
||||
@@ -366,15 +361,6 @@ 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();
|
||||
|
||||
@@ -287,7 +287,7 @@ class RoomPk extends Model
|
||||
'a.is_show_room' => 1,
|
||||
'b.pit_number' => 9,
|
||||
'b.user_id' => ['<>',0],
|
||||
'a.type_id' => ['in',[1,3,4]],
|
||||
'a.type_id' => ['in',[1,3,4,8]],
|
||||
'a.label_id' => 1,
|
||||
];
|
||||
|
||||
|
||||
@@ -20,6 +20,28 @@ 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) {
|
||||
//验证码正确
|
||||
@@ -34,9 +56,19 @@ 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 {
|
||||
return ['code' => 0, 'msg' => '验证码错误','data' =>null];
|
||||
//验证码错误次数
|
||||
$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];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -915,27 +915,42 @@ class Tencent extends Model
|
||||
}
|
||||
|
||||
//腾讯IM监控在线状态更新
|
||||
public function tencent_member_status_change($info){
|
||||
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){
|
||||
$room_type = db::name('vs_room')->where(['id' => $v['room_id'],'room_status' => 1])->field('step,type_id')->find();
|
||||
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{
|
||||
}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()]);
|
||||
@@ -946,12 +961,117 @@ 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);
|
||||
}
|
||||
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()]);
|
||||
$room = Db::name('vs_room_visitor')->where('user_id', $uid)->order('id desc')->value('room_id');
|
||||
$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);
|
||||
// }
|
||||
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()]);
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ class User extends Model
|
||||
}
|
||||
//头像装扮
|
||||
$user_info['dress'] = model('Decorate')->user_decorate_detail($user_info['user_id'],1);
|
||||
$user_info['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
$user_info['auth'] = db::name('user_auth')->where(['mobile' => $user_info['mobile'],'is_real' => 1])->find() ? 1 : 0;
|
||||
|
||||
//是否可以发布动态
|
||||
@@ -326,6 +327,8 @@ class User extends Model
|
||||
$user_info['age'] = getAge($user_info['birthday']);
|
||||
//头像装扮
|
||||
$user_info['dress'] = model('Decorate')->user_decorate_detail($user_info['user_id'],1);
|
||||
//聊天泡
|
||||
$user_info['chat_bubble'] = model('Decorate')->user_decorate_detail($user_info['user_id'],9);//聊天气泡
|
||||
|
||||
//记录用户访问记录
|
||||
if($from_uid != $uid){
|
||||
@@ -841,6 +844,35 @@ 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是否是汉字
|
||||
|
||||
@@ -594,6 +594,16 @@ 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];
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,10 @@ 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()
|
||||
{
|
||||
@@ -51,7 +55,9 @@ class UserGiftPack extends Model
|
||||
self::GIFT_USE => '礼物使用',
|
||||
self::FIRST_CHARGE => '首充获得',
|
||||
self::DRAW_GIFT => '天降好礼获得',
|
||||
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得'
|
||||
self::XLH_DRAW_GIFT_GET => '巡乐会抽奖所得',
|
||||
self::HOUR_RANK_GET => '小时榜获得',
|
||||
self::NEW_CHARGE_GIFT => '新人充值好礼'
|
||||
];
|
||||
}
|
||||
|
||||
@@ -100,6 +106,8 @@ class UserGiftPack extends Model
|
||||
self::FIRST_CHARGE,
|
||||
self::DRAW_GIFT,
|
||||
self::XLH_DRAW_GIFT_GET
|
||||
,self::HOUR_RANK_GET
|
||||
,self::NEW_CHARGE_GIFT
|
||||
];
|
||||
//获取背包日志列表
|
||||
$log_model = Db::name('vs_user_gift_pack_log')->where(['user_id'=>$uid])->whereIn('type', $type)
|
||||
@@ -114,7 +122,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "X".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." X ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
@@ -141,7 +149,7 @@ class UserGiftPack extends Model
|
||||
$gift_info = db::name('vs_gift')->where(['gid'=>$v['gid']])->find();
|
||||
$list[$k]['remarks'] = $v['remarks'];
|
||||
$list[$k]['gift_num'] = $v['change_num'];
|
||||
$list[$k]['gift_name'] = "-".$v['change_num'].$gift_info['gift_name'];
|
||||
$list[$k]['gift_name'] = $gift_info['gift_name']." - ".$v['change_num'];
|
||||
$list[$k]['gift_image'] = $gift_info['play_image'];
|
||||
$list[$k]['time'] = date('Y-m-d H:i:s', $v['createtime']);
|
||||
}
|
||||
|
||||
@@ -50,17 +50,18 @@ 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];
|
||||
$in_out_types = [2,5,6,8,13,14,15,16,22,23,26,27,30,28,33];
|
||||
}elseif($in_out_type == 2){//2支出
|
||||
$in_out_types = [4,7,10,17,20,24,25];
|
||||
$in_out_types = [4,7,10,17,20,24,25,32];
|
||||
}
|
||||
}elseif($gift_type == 2){ //1金币,2收益(钻石)
|
||||
if($in_out_type == 1){//1收入
|
||||
$in_out_types = [6,9,11,12,18,19,21];
|
||||
$in_out_types = [6,9,11,12,18,19,21,22,31,28,34];
|
||||
}elseif($in_out_type == 2){//2支出
|
||||
$in_out_types = [3,14];
|
||||
$in_out_types = [3,14,29];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,13 @@ 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']);
|
||||
@@ -192,14 +199,15 @@ class UserWithdrawal extends Model
|
||||
$where['createtime'] = ['>=',strtotime($search_stime)];
|
||||
}
|
||||
if($search_etime){
|
||||
$where['createtime'] = ['<=',strtotime($search_etime.' 23:59:59')];
|
||||
$where['createtime'] = ['<=',strtotime($search_etime)];
|
||||
}
|
||||
if(!empty($search_stime) && !empty($search_etime)){
|
||||
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime.' 23:59:59')]];
|
||||
$where['createtime'] = ['between',[strtotime($search_stime),strtotime($search_etime)]];
|
||||
}
|
||||
$withdraw_list = db::name('vs_user_withdrawal')
|
||||
->where($where)
|
||||
->page($page,$page_limit)
|
||||
->order('createtime desc')
|
||||
->select();
|
||||
$return_data = [];
|
||||
foreach ($withdraw_list as $key=>$value){
|
||||
@@ -207,6 +215,26 @@ 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];
|
||||
|
||||
@@ -880,7 +880,7 @@ function generateRandom($num = 0)
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
function generateRandoms($length = 4)
|
||||
function generateRandoms($length = 6)
|
||||
{
|
||||
$min = pow(10, $length - 1);
|
||||
$max = pow(10, $length) - 1;
|
||||
@@ -1170,7 +1170,7 @@ function handelCharge($where,$data){
|
||||
return 0;
|
||||
}
|
||||
//查询是否首充
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->count();
|
||||
$is_first_charge = db::name('vs_user_money_log')->where('user_id',$orderModel['user_id'])->where('change_type',2)->where('money_type',1)->where(['createtime'=>['>=',"1760666400"]])->count();
|
||||
//添加充值记录
|
||||
$res2 = db::name('vs_user_money_log')->insert([
|
||||
'user_id' => $orderModel['user_id'],
|
||||
@@ -1185,14 +1185,6 @@ 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;
|
||||
// }
|
||||
}
|
||||
|
||||
//给上级返佣
|
||||
//获取上级
|
||||
@@ -1204,9 +1196,29 @@ function handelCharge($where,$data){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
db::commit();
|
||||
|
||||
//活动
|
||||
//首充
|
||||
if($is_first_charge == 0){
|
||||
model('Activities')->first_charge_gift_send($orderModel['user_id'],$orderModel['money']);
|
||||
}
|
||||
//活动
|
||||
if($orderModel['type_id'] == 6){
|
||||
$orderModel['type_params'] = 2;
|
||||
}elseif(in_array($orderModel['type_id'],[14,15,16])){
|
||||
$orderModel['type_params'] = 3;
|
||||
}
|
||||
switch ($orderModel['type_params']){
|
||||
case 2:
|
||||
//天降好礼
|
||||
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();
|
||||
@@ -1281,6 +1293,22 @@ 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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class BaseCom extends Controller
|
||||
//检测系统是否维护中
|
||||
$is_maintenance = get_system_config_value('is_maintenance');
|
||||
if($is_maintenance == 2){
|
||||
return V(203, '系统维护中');
|
||||
return V(0, '系统维护中');
|
||||
}
|
||||
//检测是什么系统
|
||||
$system = input('system','');
|
||||
|
||||
@@ -73,6 +73,10 @@ 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;
|
||||
|
||||
@@ -299,6 +303,17 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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', []));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
114
application/common/library/RedpacketLua.php
Normal file
114
application/common/library/RedpacketLua.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
171
application/common/model/Redpacket.php
Normal file
171
application/common/model/Redpacket.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
12
application/common/model/RedpacketRecord.php
Normal file
12
application/common/model/RedpacketRecord.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class RedpacketRecord extends Model
|
||||
{
|
||||
protected $autoWriteTimestamp = true;
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
}
|
||||
@@ -73,7 +73,23 @@ 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 = [
|
||||
@@ -82,12 +98,14 @@ class UserWallet extends Model
|
||||
self::OPERATION_GIFT,
|
||||
self::GUILD_EXIT,
|
||||
self::HEADLINE_REWARD,
|
||||
self::TRANSFER_COIN
|
||||
self::TRANSFER_COIN,
|
||||
self::RED_PACKET_COIN,
|
||||
];
|
||||
//钻石支出类型数组
|
||||
public $diamond_consumption_type_array = [
|
||||
self::OPERATION_WITHDRAW,
|
||||
self::MONEY_CONVERSION
|
||||
self::MONEY_CONVERSION,
|
||||
self::RED_PACKET_DIAMOND
|
||||
];
|
||||
|
||||
|
||||
@@ -107,7 +125,7 @@ class UserWallet extends Model
|
||||
return isset($status[$value]) ? $status[$value] : '';
|
||||
|
||||
}
|
||||
public static function ChangeTypeLable($type)
|
||||
public static function ChangeTypeLable($type="")
|
||||
{
|
||||
$status = [
|
||||
self::OPERATION_SYSTEM => '系统调节',
|
||||
@@ -135,9 +153,22 @@ class UserWallet extends Model
|
||||
self::FINANCE_LEVEL_REWARD => '财富等级奖励金币领取',
|
||||
self::DELETE_RELATION_COIN => '删除关系扣金币',
|
||||
self::TRANSFER_COIN => '赠送好友金币',
|
||||
self::RECEIVE_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 => '红包剩余退回(钻石)',
|
||||
];
|
||||
if($type){
|
||||
return $status[$type] ?? '';
|
||||
}else{
|
||||
return $status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,10 +274,19 @@ class UserWallet extends Model
|
||||
/*
|
||||
* 用户资金变动日志
|
||||
*/
|
||||
public function money_change_log($user_id, $money_type=0, $page=0,$page_limit=30){
|
||||
public function money_change_log($user_id,$seach, $money_type=0, $page=0,$page_limit=30){
|
||||
if($money_type){
|
||||
$where['money_type'] =$money_type;
|
||||
}
|
||||
if($seach['stime']){
|
||||
$where['createtime'] = ['>=',strtotime($seach['stime'])];
|
||||
}
|
||||
if($seach['etime']){
|
||||
$where['createtime'] = ['<=',strtotime($seach['etime'])];
|
||||
}
|
||||
if($seach['change_type']){
|
||||
$where['change_type'] =$seach['change_type'];
|
||||
}
|
||||
$log['count'] = Db::name('vs_user_money_log')->where($where)->where('user_id',$user_id)->count();
|
||||
$log_select = Db::name('vs_user_money_log')
|
||||
->where($where)
|
||||
@@ -280,4 +320,11 @@ class UserWallet extends Model
|
||||
}
|
||||
return $log;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取用户资金类型
|
||||
*/
|
||||
public function getChangeTypeLableList(){
|
||||
return $this->ChangeTypeLable();
|
||||
}
|
||||
}
|
||||
707
application/common/service/RedpacketService.php
Normal file
707
application/common/service/RedpacketService.php
Normal file
@@ -0,0 +1,707 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace app\cron\controller;
|
||||
|
||||
use app\common\model\Redpacket;
|
||||
use app\common\model\UserWallet;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
use Yzh\YunPay;
|
||||
|
||||
@@ -30,9 +33,15 @@ 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";
|
||||
}
|
||||
|
||||
|
||||
@@ -136,6 +145,9 @@ class PerformPerSecond
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(in_array($value['yun_order_status'],[261,5077])){
|
||||
continue;
|
||||
}
|
||||
echo "提现订单查询:".$value['order_sn']."\n";
|
||||
$yun_pay = new YunPay($value['order_sn'], "", "", "", "","");
|
||||
$result = $yun_pay->queryOrder($value['type']);
|
||||
@@ -145,15 +157,32 @@ class PerformPerSecond
|
||||
'status' => 6,
|
||||
'pay_time' => time(),
|
||||
'pay_message' => $result['data']['msg'],
|
||||
'updatetime' => time()
|
||||
'updatetime' => time(),
|
||||
'yun_order_status' => $result['data']['code'],
|
||||
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
|
||||
'received_tax_amount' => $result['data']['received_tax_amount'] ?? 0,
|
||||
]);
|
||||
}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()
|
||||
'updatetime' => time(),
|
||||
'yun_order_status' => $result['data']['code'],
|
||||
// 'personal_tax_rate' => $result['personal_tax_rate'] ?? 0,
|
||||
'received_tax_amount' => $result['data']['received_tax_amount'] ?? 0,
|
||||
]);
|
||||
if(in_array($result['data']['code'],[5077,261]) && $value['yun_order_status'] == null){
|
||||
// if($result['data']['code']==5077 && $value['yun_order_status'] == null){
|
||||
//该支付宝账户不存在或未开通手机号转账功能。如有疑问,请收款用户联系支付宝客服咨询。
|
||||
//退还金币
|
||||
$res = model('api/UserWithdrawal')->withdrawal_fail($value['order_sn']);
|
||||
if($res){
|
||||
echo "提现订单失败,退回金币成功\n";
|
||||
}else{
|
||||
echo "提现订单失败,退回金币失败:".$res['msg']."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "提现订单查询成功:".$result['msg']."\n";
|
||||
@@ -205,4 +234,97 @@ 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";
|
||||
}
|
||||
|
||||
}
|
||||
405
application/cron/controller/RoomHourRanking.php
Normal file
405
application/cron/controller/RoomHourRanking.php
Normal file
@@ -0,0 +1,405 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace app\cron\controller;
|
||||
|
||||
use app\common\controller\Push;
|
||||
use think\Cache;
|
||||
use think\Db;
|
||||
|
||||
|
||||
@@ -43,6 +44,7 @@ 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'];
|
||||
@@ -125,16 +127,17 @@ 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
|
||||
]);
|
||||
// db::name("vs_room")->where('id',$value['room_id'])->update([
|
||||
// 'xlh_periods_num' => 0
|
||||
// ]);
|
||||
Cache::set("xlh_periods_num", 0, 0);
|
||||
//推送礼物横幅
|
||||
$text = "本轮巡乐会已结束,请大家重新开始下一轮巡乐会";
|
||||
$push = new Push(0, $value['room_id']);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'room_id' => $value['room_id'],
|
||||
'from_type' => 3
|
||||
'from_type' => 104
|
||||
];
|
||||
$push->xunlehui($text_list_new);
|
||||
continue;
|
||||
@@ -171,20 +174,17 @@ class RoomPan
|
||||
echo "处理发放记录失败 \n";
|
||||
continue;
|
||||
}
|
||||
db::name("vs_room")->where('id',$value['room_id'])->update([
|
||||
'xlh_periods_num' => 0
|
||||
]);
|
||||
Cache::set("xlh_periods_num", 0, 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'] . ' 用户在 ' . $room_name.' 房间巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
|
||||
$text = $FromUserInfo['nickname'] . ' 用户在巡乐会中 ' .$gift_name.'礼物 x ' .$value['num']." 已收入背包";
|
||||
//推送礼物横幅
|
||||
$push = new Push(0, $value['room_id']);
|
||||
$text_list_new = [
|
||||
'text' => $text,
|
||||
'room_id' => $value['room_id'],
|
||||
'from_type' => 3
|
||||
'from_type' => 104
|
||||
];
|
||||
$push->xunlehui($text_list_new);
|
||||
}catch (\Exception $e){
|
||||
|
||||
@@ -30,10 +30,10 @@ class Subsidy
|
||||
*/
|
||||
public function createGuildSubsidyData(){
|
||||
//获取上周第一天时间
|
||||
$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');
|
||||
$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');
|
||||
|
||||
//获取上周时间
|
||||
$time_value = date('o-W', $week_start_time);
|
||||
@@ -43,12 +43,24 @@ class Subsidy
|
||||
$data_count = 0;
|
||||
foreach ($guild_list as $key => $value) {
|
||||
//获取所有工会房间ID
|
||||
$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]]])
|
||||
$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]]])
|
||||
->sum('total_price');
|
||||
$transaction += $transaction_one;
|
||||
}
|
||||
|
||||
if($transaction > 0){
|
||||
//判断是否已经生成过
|
||||
if (db::name('vs_guild_subsidy')->where(['guild_id'=>$value['id'],'week'=>$time_value])->find()) {
|
||||
@@ -65,7 +77,7 @@ class Subsidy
|
||||
foreach ($config as $k => $v) {
|
||||
if ($transaction >= $v['end_amount']) {
|
||||
$subsidy_ratio = $v['subsidy_ratio'];
|
||||
$subsidy_amount = $transaction * ($subsidy_ratio / 100);
|
||||
$subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石
|
||||
break; // 找到匹配项后提前退出循环
|
||||
}
|
||||
}
|
||||
@@ -81,6 +93,7 @@ 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";
|
||||
@@ -130,7 +143,7 @@ class Subsidy
|
||||
foreach ($config as $k => $v) {
|
||||
if ($transaction >= $v['end_amount']) {
|
||||
$subsidy_ratio = $v['subsidy_ratio'];
|
||||
$subsidy_amount = $transaction * ($subsidy_ratio / 100);
|
||||
$subsidy_amount = ($transaction * ($subsidy_ratio / 100)) / get_system_config_value('rmb_coin_ratio');//转为钻石;
|
||||
break; // 找到匹配项后提前退出循环
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,14 @@ 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();
|
||||
@@ -40,17 +45,6 @@ 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++;
|
||||
}
|
||||
}
|
||||
@@ -58,4 +52,18 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
158
application/cron/controller/Test.php
Normal file
158
application/cron/controller/Test.php
Normal file
@@ -0,0 +1,158 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
||||
12
application/extra/redis.php
Normal file
12
application/extra/redis.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'password' => '',
|
||||
'select' => 0,
|
||||
'timeout' => 0,
|
||||
'expire' => 0,
|
||||
'persistent' => false,
|
||||
'prefix' => 'fa_redpacket_',
|
||||
];
|
||||
@@ -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.15";
|
||||
const SDK_VERSION = "2.0.22";
|
||||
const ENV_PROD = "yzh_env_prod";
|
||||
const ENV_SANDBOX = "yzh_env_sandbox";
|
||||
|
||||
@@ -44,6 +44,8 @@ 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( // 沙箱环境
|
||||
@@ -51,8 +53,10 @@ 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' => '', // 个体工商户注册服务接口域名
|
||||
'aic' => 'https://api-aic.yunzhanghu.com/sandbox', // 个体工商户注册服务接口域名
|
||||
'task' => '', // 任务库服务接口域名
|
||||
'dataservice' => '', // 数据服务接口域名
|
||||
),
|
||||
|
||||
81
extend/Yzh/CalculateLaborServiceClient.php
Normal file
81
extend/Yzh/CalculateLaborServiceClient.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
40
extend/Yzh/CustomerLinkClient.php
Normal file
40
extend/Yzh/CustomerLinkClient.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?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."×tamp=".$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."×tamp=".$timestamp;
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,11 @@ class UserExemptedInfoRequest extends BaseRequest
|
||||
* @var string
|
||||
*/
|
||||
public $ref;
|
||||
/**
|
||||
* 证件照片 URL 地址
|
||||
* @var string[]
|
||||
*/
|
||||
public $image_urls;
|
||||
|
||||
public function __construct($params = array())
|
||||
{
|
||||
|
||||
335
extend/Yzh/Model/Calculatelabor/CalcTaxDetail.php
Normal file
335
extend/Yzh/Model/Calculatelabor/CalcTaxDetail.php
Normal file
@@ -0,0 +1,335 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
52
extend/Yzh/Model/Calculatelabor/CalcTaxRequest.php
Normal file
52
extend/Yzh/Model/Calculatelabor/CalcTaxRequest.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
extend/Yzh/Model/Calculatelabor/CalcTaxResponse.php
Normal file
33
extend/Yzh/Model/Calculatelabor/CalcTaxResponse.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
405
extend/Yzh/Model/Calculatelabor/CalcTaxResponseData.php
Normal file
405
extend/Yzh/Model/Calculatelabor/CalcTaxResponseData.php
Normal file
@@ -0,0 +1,405 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
47
extend/Yzh/Model/Calculatelabor/CalculationH5UrlRequest.php
Normal file
47
extend/Yzh/Model/Calculatelabor/CalculationH5UrlRequest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
extend/Yzh/Model/Calculatelabor/CalculationH5UrlResponse.php
Normal file
33
extend/Yzh/Model/Calculatelabor/CalculationH5UrlResponse.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
37
extend/Yzh/Model/Calculatelabor/LaborCaculatorRequest.php
Normal file
37
extend/Yzh/Model/Calculatelabor/LaborCaculatorRequest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
extend/Yzh/Model/Calculatelabor/LaborCaculatorResponse.php
Normal file
33
extend/Yzh/Model/Calculatelabor/LaborCaculatorResponse.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
243
extend/Yzh/Model/Calculatelabor/MontTax.php
Normal file
243
extend/Yzh/Model/Calculatelabor/MontTax.php
Normal file
@@ -0,0 +1,243 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
59
extend/Yzh/Model/Calculatelabor/MonthSettlement.php
Normal file
59
extend/Yzh/Model/Calculatelabor/MonthSettlement.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
151
extend/Yzh/Model/Calculatelabor/YearTaxInfo.php
Normal file
151
extend/Yzh/Model/Calculatelabor/YearTaxInfo.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -21,25 +21,145 @@ 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;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
@@ -78,7 +198,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string $broker_fee
|
||||
*/
|
||||
public function setBrokerFee($broker_fee)
|
||||
@@ -87,7 +207,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerFee()
|
||||
@@ -96,7 +216,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费实收金额
|
||||
* 应收余额账户支出加成服务费金额
|
||||
* @var string $broker_real_fee
|
||||
*/
|
||||
public function setBrokerRealFee($broker_real_fee)
|
||||
@@ -105,7 +225,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费实收金额
|
||||
* 应收余额账户支出加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerRealFee()
|
||||
@@ -114,7 +234,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 已抵扣加成服务费金额
|
||||
* 应收加成服务费抵扣金额
|
||||
* @var string $broker_rebate_fee
|
||||
*/
|
||||
public function setBrokerRebateFee($broker_rebate_fee)
|
||||
@@ -123,7 +243,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 已抵扣加成服务费金额
|
||||
* 应收加成服务费抵扣金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerRebateFee()
|
||||
@@ -132,7 +252,7 @@ class DailyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户加成服务费金额
|
||||
* 应收用户加成服务费金额
|
||||
* @var string $user_fee
|
||||
*/
|
||||
public function setUserFee($user_fee)
|
||||
@@ -141,11 +261,443 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,10 +51,15 @@ class DealerOrderInfo extends BaseModel
|
||||
*/
|
||||
protected $broker_amount;
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $broker_fee;
|
||||
/**
|
||||
* 实收综合服务主体加成服务费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $received_broker_fee;
|
||||
/**
|
||||
* 支付路径流水号
|
||||
* @var string
|
||||
@@ -115,6 +120,21 @@ 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
|
||||
@@ -261,7 +281,7 @@ class DealerOrderInfo extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string $broker_fee
|
||||
*/
|
||||
public function setBrokerFee($broker_fee)
|
||||
@@ -270,7 +290,7 @@ class DealerOrderInfo extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerFee()
|
||||
@@ -278,6 +298,24 @@ 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
|
||||
@@ -493,4 +531,58 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,15 @@ class DealerOrderInfoV2 extends BaseModel
|
||||
*/
|
||||
protected $broker_amount;
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $broker_fee;
|
||||
/**
|
||||
* 实收综合服务主体加成服务费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $received_broker_fee;
|
||||
/**
|
||||
* 支付路径流水号
|
||||
* @var string
|
||||
@@ -130,6 +135,21 @@ 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
|
||||
@@ -294,7 +314,7 @@ class DealerOrderInfoV2 extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string $broker_fee
|
||||
*/
|
||||
public function setBrokerFee($broker_fee)
|
||||
@@ -303,7 +323,7 @@ class DealerOrderInfoV2 extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合服务主体加成服务费
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerFee()
|
||||
@@ -311,6 +331,24 @@ 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
|
||||
@@ -562,4 +600,58 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,25 +21,145 @@ 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;
|
||||
|
||||
/**
|
||||
* 订单数量
|
||||
@@ -78,7 +198,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @var string $broker_fee
|
||||
*/
|
||||
public function setBrokerFee($broker_fee)
|
||||
@@ -87,7 +207,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 应收综合服务主体加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerFee()
|
||||
@@ -96,7 +216,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费实收金额
|
||||
* 应收余额账户支出加成服务费金额
|
||||
* @var string $broker_real_fee
|
||||
*/
|
||||
public function setBrokerRealFee($broker_real_fee)
|
||||
@@ -105,7 +225,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费实收金额
|
||||
* 应收余额账户支出加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerRealFee()
|
||||
@@ -114,7 +234,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 已抵扣加成服务费金额
|
||||
* 应收加成服务费抵扣金额
|
||||
* @var string $broker_rebate_fee
|
||||
*/
|
||||
public function setBrokerRebateFee($broker_rebate_fee)
|
||||
@@ -123,7 +243,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 已抵扣加成服务费金额
|
||||
* 应收加成服务费抵扣金额
|
||||
* @return string
|
||||
*/
|
||||
public function getBrokerRebateFee()
|
||||
@@ -132,7 +252,7 @@ class MonthlyOrderSummary extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户加成服务费金额
|
||||
* 应收用户加成服务费金额
|
||||
* @var string $user_fee
|
||||
*/
|
||||
public function setUserFee($user_fee)
|
||||
@@ -141,11 +261,443 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
427
extend/Yzh/Model/Dataservice/OrderTaxDetail.php
Normal file
427
extend/Yzh/Model/Dataservice/OrderTaxDetail.php
Normal file
@@ -0,0 +1,427 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
@@ -61,12 +61,12 @@ class StatementDetail extends BaseModel
|
||||
*/
|
||||
protected $reex_amount;
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 实收综合服务主体加成服务费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $fee_amount;
|
||||
/**
|
||||
* 加成服务费抵扣金额
|
||||
* 实收加成服务费抵扣金额
|
||||
* @var string
|
||||
*/
|
||||
protected $deduct_rebate_fee_amount;
|
||||
@@ -95,6 +95,11 @@ class StatementDetail extends BaseModel
|
||||
* @var string
|
||||
*/
|
||||
protected $project_name;
|
||||
/**
|
||||
* 实纳税费金额
|
||||
* @var string
|
||||
*/
|
||||
protected $received_tax_amount;
|
||||
|
||||
/**
|
||||
* 账单 ID
|
||||
@@ -277,7 +282,7 @@ class StatementDetail extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 实收综合服务主体加成服务费金额
|
||||
* @var string $fee_amount
|
||||
*/
|
||||
public function setFeeAmount($fee_amount)
|
||||
@@ -286,7 +291,7 @@ class StatementDetail extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费金额
|
||||
* 实收综合服务主体加成服务费金额
|
||||
* @return string
|
||||
*/
|
||||
public function getFeeAmount()
|
||||
@@ -295,7 +300,7 @@ class StatementDetail extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费抵扣金额
|
||||
* 实收加成服务费抵扣金额
|
||||
* @var string $deduct_rebate_fee_amount
|
||||
*/
|
||||
public function setDeductRebateFeeAmount($deduct_rebate_fee_amount)
|
||||
@@ -304,7 +309,7 @@ class StatementDetail extends BaseModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 加成服务费抵扣金额
|
||||
* 实收加成服务费抵扣金额
|
||||
* @return string
|
||||
*/
|
||||
public function getDeductRebateFeeAmount()
|
||||
@@ -401,4 +406,22 @@ class StatementDetail extends BaseModel
|
||||
{
|
||||
return $this->project_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实纳税费金额
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,11 @@ class H5UserPresignRequest extends BaseRequest
|
||||
* @var int32
|
||||
*/
|
||||
public $certificate_type;
|
||||
/**
|
||||
* 是否收集手机号码 0:不收集(默认) 1:收集手机号码
|
||||
* @var int32
|
||||
*/
|
||||
public $collect_phone_no;
|
||||
|
||||
public function __construct($params = array())
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user